1
This commit is contained in:
parent
760aad52de
commit
ccc09fee69
@ -96,73 +96,9 @@ func (this *Game2005) DailyMailGo() {
|
|||||||
err)
|
err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var lastIdx int64
|
if !this.DailyMailOneDB(conf, conn) {
|
||||||
for true {
|
f5.SysLog().Warning("DailyMailOneDB error")
|
||||||
rows, err := conn.Query("SELECT idx, accountid, vip_lv, privi_lv, createtime, modifytime, " +
|
return
|
||||||
" privi_daily_mail_lasttime, vip_weekly_mail_lasttime " +
|
|
||||||
"FROM `vip_user` " +
|
|
||||||
"WHERE idx > ? LIMIT 0, 1000;",
|
|
||||||
lastIdx)
|
|
||||||
if err != nil {
|
|
||||||
f5.SysLog().Warning(
|
|
||||||
"DailyMailGo queryError %s error:%s",
|
|
||||||
conn,
|
|
||||||
err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
defer rows.Close()
|
|
||||||
hasData := false
|
|
||||||
for rows.Next() {
|
|
||||||
var idx int64
|
|
||||||
var accountId string
|
|
||||||
var vipLv int32
|
|
||||||
var priviLv int32
|
|
||||||
var createTime int32
|
|
||||||
var modifyTime int32
|
|
||||||
var priviDailyMailLastTime int64
|
|
||||||
var vipWeeklyMailLastTime int64
|
|
||||||
nowTime := f5.App.NowUnix()
|
|
||||||
rows.Scan(&idx,
|
|
||||||
&accountId,
|
|
||||||
&vipLv,
|
|
||||||
&priviLv,
|
|
||||||
&createTime,
|
|
||||||
&modifyTime,
|
|
||||||
&priviDailyMailLastTime,
|
|
||||||
&vipWeeklyMailLastTime)
|
|
||||||
if priviDailyMailLastTime <= 0 ||
|
|
||||||
q5.GetDaySeconds(nowTime) > q5.GetDaySeconds(nowTime) {
|
|
||||||
if priviLv > 0 {
|
|
||||||
this.SendPriviDailyMail(accountId, priviLv)
|
|
||||||
if _, err :=conn.Exec("UPDATE `vip_user` SET privi_daily_mail_lasttime = ? WHERE idx = ?;",
|
|
||||||
nowTime,
|
|
||||||
idx); err != nil {
|
|
||||||
return
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
if vipWeeklyMailLastTime <= 0 ||
|
|
||||||
q5.GetDaySeconds(nowTime) > q5.GetDaySeconds(nowTime) {
|
|
||||||
if vipLv > 0 {
|
|
||||||
this.SendVipWeeklyMail(accountId, vipLv)
|
|
||||||
if _, err :=conn.Exec("UPDATE `vip_user` SET vip_weekly_mail_lasttime = ? WHERE idx = ?;",
|
|
||||||
nowTime,
|
|
||||||
idx); err != nil {
|
|
||||||
return
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if idx > lastIdx {
|
|
||||||
lastIdx = idx
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if !hasData {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -256,3 +192,96 @@ func (this *Game2005) FetchEventOneDB(conf *MtwGame2005MysqlConf, conn *q5.Mysql
|
|||||||
this.SetDBIdx(conf.GetInstanceId(), lastIdx)
|
this.SetDBIdx(conf.GetInstanceId(), lastIdx)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *Game2005) DailyMailOneDB(conf *MtwGame2005MysqlConf, conn *q5.Mysql) bool {
|
||||||
|
procPriviDailyMail := func(accountId string,
|
||||||
|
priviLv int32,
|
||||||
|
nowTime int64,
|
||||||
|
priviDailyMailLastTime int64,
|
||||||
|
idx int64) bool {
|
||||||
|
if priviDailyMailLastTime <= 0 ||
|
||||||
|
q5.GetDaySeconds(nowTime) > q5.GetDaySeconds(nowTime) {
|
||||||
|
if priviLv > 0 {
|
||||||
|
this.SendPriviDailyMail(accountId, priviLv)
|
||||||
|
if _, err := conn.Exec("UPDATE `vip_user` SET privi_daily_mail_lasttime = ? WHERE idx = ?;",
|
||||||
|
nowTime,
|
||||||
|
idx); err != nil {
|
||||||
|
return false
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
procVipWeeklyMail := func(accountId string,
|
||||||
|
vipLv int32,
|
||||||
|
nowTime int64,
|
||||||
|
vipWeeklyMailLastTime int64,
|
||||||
|
idx int64) bool {
|
||||||
|
if vipWeeklyMailLastTime <= 0 ||
|
||||||
|
q5.GetDaySeconds(nowTime) > q5.GetDaySeconds(nowTime) {
|
||||||
|
if vipLv > 0 {
|
||||||
|
this.SendVipWeeklyMail(accountId, vipLv)
|
||||||
|
if _, err := conn.Exec("UPDATE `vip_user` SET vip_weekly_mail_lasttime = ? WHERE idx = ?;",
|
||||||
|
nowTime,
|
||||||
|
idx); err != nil {
|
||||||
|
return false
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
var lastIdx int64
|
||||||
|
for true {
|
||||||
|
rows, err := conn.Query("SELECT idx, accountid, vip_lv, privi_lv, createtime, modifytime, " +
|
||||||
|
" privi_daily_mail_lasttime, vip_weekly_mail_lasttime " +
|
||||||
|
"FROM `vip_user` " +
|
||||||
|
"WHERE idx > ? LIMIT 0, 1000;",
|
||||||
|
lastIdx)
|
||||||
|
if err != nil {
|
||||||
|
f5.SysLog().Warning(
|
||||||
|
"DailyMailOneDB queryError %s error:%s",
|
||||||
|
conn,
|
||||||
|
err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
defer rows.Close()
|
||||||
|
hasData := false
|
||||||
|
for rows.Next() {
|
||||||
|
var idx int64
|
||||||
|
var accountId string
|
||||||
|
var vipLv int32
|
||||||
|
var priviLv int32
|
||||||
|
var createTime int32
|
||||||
|
var modifyTime int32
|
||||||
|
var priviDailyMailLastTime int64
|
||||||
|
var vipWeeklyMailLastTime int64
|
||||||
|
nowTime := f5.App.NowUnix()
|
||||||
|
rows.Scan(&idx,
|
||||||
|
&accountId,
|
||||||
|
&vipLv,
|
||||||
|
&priviLv,
|
||||||
|
&createTime,
|
||||||
|
&modifyTime,
|
||||||
|
&priviDailyMailLastTime,
|
||||||
|
&vipWeeklyMailLastTime)
|
||||||
|
if !procPriviDailyMail(accountId, priviLv, nowTime, priviDailyMailLastTime, idx) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if !procVipWeeklyMail(accountId, vipLv, nowTime, vipWeeklyMailLastTime, idx) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if idx > lastIdx {
|
||||||
|
lastIdx = idx
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !hasData {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user