This commit is contained in:
aozhiwei 2020-12-04 16:49:01 +08:00
parent b854b9fd80
commit 3f61a38840
2 changed files with 14 additions and 5 deletions

View File

@ -3,6 +3,7 @@ package main
import (
"sync"
"sync/atomic"
"fmt"
"q5"
"f5"
)
@ -148,7 +149,8 @@ func (this *Game2005) internalSendMail(to string,
subject string,
sendTime int32,
expireTime int32,
attachments string) bool {
attachments string,
uniqueKey string) bool {
gameMailApiUrl := "https://gamemail.kingsome.cn/webapp/index.php"
if !f5.IsOnlineEnv() {
gameMailApiUrl = "https://gamemail-test.kingsome.cn/webapp/index.php"
@ -166,6 +168,7 @@ func (this *Game2005) internalSendMail(to string,
params.SetXValue("sendtime", q5.NewXInt32(sendTime))
params.SetXValue("expiretime", q5.NewXInt32(expireTime))
params.SetXValue("attachments", q5.NewXString(attachments))
params.SetXValue("unique_key", q5.NewXString(uniqueKey))
respObj, respStr, err := q5.HttpGetAsJson(gameMailApiUrl, params.AsXObject())
if err != nil {
f5.SysLog().Warning("url:%s resp:%s", gameMailApiUrl, respStr)
@ -182,6 +185,7 @@ func (this *Game2005) internalSendMail(to string,
func (this *Game2005) SendVipLvUpMail(accountId string, oldLv int32, newLv int32, upTime int32) bool {
mailMeta := this.vipLvUpMailMeta
for vipLv := oldLv + 1; vipLv <= newLv; vipLv++ {
uniqueKey := fmt.Sprintf("vipLvUp_%d_%s", vipLv, accountId)
ok := this.internalSendMail(
accountId,
-2,
@ -189,7 +193,8 @@ func (this *Game2005) SendVipLvUpMail(accountId string, oldLv int32, newLv int32
mailMeta.GetSubject(),
upTime,
upTime + 3600 * 24 * 30,
mailMeta.GetAttachmentsByLv(vipLv))
mailMeta.GetAttachmentsByLv(vipLv),
uniqueKey)
if !ok {
return false
}
@ -199,6 +204,7 @@ func (this *Game2005) SendVipLvUpMail(accountId string, oldLv int32, newLv int32
func (this *Game2005) SendPriviDailyMail(accountId string, priviLv int32, sendTime int32) bool {
mailMeta := this.priviDailyMailMeta
uniqueKey := fmt.Sprintf("priviDaily_%s_%s", q5.FormatUnixDateEx(int64(sendTime)), accountId)
ok := this.internalSendMail(
accountId,
-3,
@ -206,12 +212,14 @@ func (this *Game2005) SendPriviDailyMail(accountId string, priviLv int32, sendTi
mailMeta.GetSubject(),
sendTime,
sendTime + 3600 * 24 * 30,
mailMeta.GetAttachmentsByLv(priviLv))
mailMeta.GetAttachmentsByLv(priviLv),
uniqueKey)
return ok
}
func (this *Game2005) SendVipWeeklyMail(accountId string, vipLv int32, sendTime int32) bool {
mailMeta := this.vipWeeklyMailMeta
uniqueKey := fmt.Sprintf("vipWeekly_%s_%s", q5.FormatUnixDateEx(int64(sendTime)), accountId)
ok := this.internalSendMail(
accountId,
-4,
@ -219,7 +227,8 @@ func (this *Game2005) SendVipWeeklyMail(accountId string, vipLv int32, sendTime
mailMeta.GetSubject(),
sendTime,
sendTime + 3600 * 24 * 30,
mailMeta.GetAttachmentsByLv(vipLv))
mailMeta.GetAttachmentsByLv(vipLv),
uniqueKey)
return ok
}

2
third_party/q5 vendored

@ -1 +1 @@
Subproject commit 70271a1b60abea42e643a8b54ca73a4d1e4a044b
Subproject commit a7c34b44d7244328b94beae4a3379ee4cdcc4def