1
This commit is contained in:
parent
75819b839f
commit
b854b9fd80
@ -142,34 +142,55 @@ func (this *Game2005) SetDBIdx(instanceId int32, idx int64) {
|
|||||||
this.dbIdxHash.Store(instanceId, idx)
|
this.dbIdxHash.Store(instanceId, idx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Game2005) SendVipLvUpMail(accountId string, oldLv int32, newLv int32, upTime int32) bool {
|
func (this *Game2005) internalSendMail(to string,
|
||||||
|
mailSubType int32,
|
||||||
|
content string,
|
||||||
|
subject string,
|
||||||
|
sendTime int32,
|
||||||
|
expireTime int32,
|
||||||
|
attachments string) bool {
|
||||||
gameMailApiUrl := "https://gamemail.kingsome.cn/webapp/index.php"
|
gameMailApiUrl := "https://gamemail.kingsome.cn/webapp/index.php"
|
||||||
if !f5.IsOnlineEnv() {
|
if !f5.IsOnlineEnv() {
|
||||||
gameMailApiUrl = "https://gamemail-test.kingsome.cn/webapp/index.php"
|
gameMailApiUrl = "https://gamemail-test.kingsome.cn/webapp/index.php"
|
||||||
}
|
}
|
||||||
|
params := q5.NewMxoObject()
|
||||||
|
params.SetXValue("c", q5.NewXString("MailMgr"))
|
||||||
|
params.SetXValue("a", q5.NewXString("sendMail"))
|
||||||
|
params.SetXValue("gameid", q5.NewXInt32(this.GetGameId()))
|
||||||
|
params.SetXValue("to", q5.NewXString(to))
|
||||||
|
params.SetXValue("mailtype", q5.NewXInt32(1))
|
||||||
|
params.SetXValue("mailsubtype", q5.NewXInt32(mailSubType))
|
||||||
|
params.SetXValue("usertype", q5.NewXInt32(2))
|
||||||
|
params.SetXValue("content", q5.NewXString(content))
|
||||||
|
params.SetXValue("subject", q5.NewXString(subject))
|
||||||
|
params.SetXValue("sendtime", q5.NewXInt32(sendTime))
|
||||||
|
params.SetXValue("expiretime", q5.NewXInt32(expireTime))
|
||||||
|
params.SetXValue("attachments", q5.NewXString(attachments))
|
||||||
|
respObj, respStr, err := q5.HttpGetAsJson(gameMailApiUrl, params.AsXObject())
|
||||||
|
if err != nil {
|
||||||
|
f5.SysLog().Warning("url:%s resp:%s", gameMailApiUrl, respStr)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if !(respObj.GetSimpleStr("errcode", "") == "0" &&
|
||||||
|
respObj.GetSimpleStr("errcode", "") == "1008") {
|
||||||
|
f5.SysLog().Warning("url:%s resp:%s", gameMailApiUrl, respStr)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *Game2005) SendVipLvUpMail(accountId string, oldLv int32, newLv int32, upTime int32) bool {
|
||||||
mailMeta := this.vipLvUpMailMeta
|
mailMeta := this.vipLvUpMailMeta
|
||||||
for vipLv := oldLv + 1; vipLv <= newLv; vipLv++ {
|
for vipLv := oldLv + 1; vipLv <= newLv; vipLv++ {
|
||||||
params := q5.NewMxoObject()
|
ok := this.internalSendMail(
|
||||||
params.SetXValue("c", q5.NewXString("MailMgr"))
|
accountId,
|
||||||
params.SetXValue("a", q5.NewXString("sendMail"))
|
-2,
|
||||||
params.SetXValue("gameid", q5.NewXInt32(this.GetGameId()))
|
mailMeta.GetContent(),
|
||||||
params.SetXValue("to", q5.NewXString(accountId))
|
mailMeta.GetSubject(),
|
||||||
params.SetXValue("mailtype", q5.NewXInt32(1))
|
upTime,
|
||||||
params.SetXValue("mailsubtype", q5.NewXInt32(-2))
|
upTime + 3600 * 24 * 30,
|
||||||
params.SetXValue("usertype", q5.NewXInt32(2))
|
mailMeta.GetAttachmentsByLv(vipLv))
|
||||||
params.SetXValue("content", q5.NewXString(mailMeta.GetContent()))
|
if !ok {
|
||||||
params.SetXValue("subject", q5.NewXString(mailMeta.GetSubject()))
|
|
||||||
params.SetXValue("sendtime", q5.NewXInt32(upTime))
|
|
||||||
params.SetXValue("expiretime", q5.NewXInt32(upTime + 3600 * 24 * 30))
|
|
||||||
params.SetXValue("attachments", q5.NewXString(mailMeta.GetAttachmentsByLv(vipLv)))
|
|
||||||
respObj, respStr, err := q5.HttpGetAsJson(gameMailApiUrl, params.AsXObject())
|
|
||||||
if err != nil {
|
|
||||||
f5.SysLog().Warning("url:%s resp:%s", gameMailApiUrl, respStr)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if !(respObj.GetSimpleStr("errcode", "") == "0" &&
|
|
||||||
respObj.GetSimpleStr("errcode", "") == "1008") {
|
|
||||||
f5.SysLog().Warning("url:%s resp:%s", gameMailApiUrl, respStr)
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -177,67 +198,29 @@ func (this *Game2005) SendVipLvUpMail(accountId string, oldLv int32, newLv int32
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *Game2005) SendPriviDailyMail(accountId string, priviLv int32, sendTime int32) bool {
|
func (this *Game2005) SendPriviDailyMail(accountId string, priviLv int32, sendTime int32) bool {
|
||||||
gameMailApiUrl := "https://gamemail.kingsome.cn/webapp/index.php"
|
|
||||||
if !f5.IsOnlineEnv() {
|
|
||||||
gameMailApiUrl = "https://gamemail-test.kingsome.cn/webapp/index.php"
|
|
||||||
}
|
|
||||||
mailMeta := this.priviDailyMailMeta
|
mailMeta := this.priviDailyMailMeta
|
||||||
params := q5.NewMxoObject()
|
ok := this.internalSendMail(
|
||||||
params.SetXValue("c", q5.NewXString("MailMgr"))
|
accountId,
|
||||||
params.SetXValue("a", q5.NewXString("sendMail"))
|
-3,
|
||||||
params.SetXValue("gameid", q5.NewXInt32(this.GetGameId()))
|
mailMeta.GetContent(),
|
||||||
params.SetXValue("to", q5.NewXString(accountId))
|
mailMeta.GetSubject(),
|
||||||
params.SetXValue("mailtype", q5.NewXInt32(1))
|
sendTime,
|
||||||
params.SetXValue("mailsubtype", q5.NewXInt32(-2))
|
sendTime + 3600 * 24 * 30,
|
||||||
params.SetXValue("usertype", q5.NewXInt32(2))
|
mailMeta.GetAttachmentsByLv(priviLv))
|
||||||
params.SetXValue("content", q5.NewXString(mailMeta.GetContent()))
|
return ok
|
||||||
params.SetXValue("subject", q5.NewXString(mailMeta.GetSubject()))
|
|
||||||
params.SetXValue("sendtime", q5.NewXInt32(sendTime))
|
|
||||||
params.SetXValue("expiretime", q5.NewXInt32(sendTime + 3600 * 24 * 30))
|
|
||||||
params.SetXValue("attachments", q5.NewXString(mailMeta.GetAttachmentsByLv(priviLv)))
|
|
||||||
respObj, respStr, err := q5.HttpGetAsJson(gameMailApiUrl, params.AsXObject())
|
|
||||||
if err != nil {
|
|
||||||
f5.SysLog().Warning("url:%s resp:%s", gameMailApiUrl, respStr)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if !(respObj.GetSimpleStr("errcode", "") == "0" &&
|
|
||||||
respObj.GetSimpleStr("errcode", "") == "1008") {
|
|
||||||
f5.SysLog().Warning("url:%s resp:%s", gameMailApiUrl, respStr)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Game2005) SendVipWeeklyMail(accountId string, vipLv int32, sendTime int32) bool {
|
func (this *Game2005) SendVipWeeklyMail(accountId string, vipLv int32, sendTime int32) bool {
|
||||||
gameMailApiUrl := "https://gamemail.kingsome.cn/webapp/index.php"
|
|
||||||
if !f5.IsOnlineEnv() {
|
|
||||||
gameMailApiUrl = "https://gamemail-test.kingsome.cn/webapp/index.php"
|
|
||||||
}
|
|
||||||
mailMeta := this.vipWeeklyMailMeta
|
mailMeta := this.vipWeeklyMailMeta
|
||||||
params := q5.NewMxoObject()
|
ok := this.internalSendMail(
|
||||||
params.SetXValue("c", q5.NewXString("MailMgr"))
|
accountId,
|
||||||
params.SetXValue("a", q5.NewXString("sendMail"))
|
-4,
|
||||||
params.SetXValue("gameid", q5.NewXInt32(this.GetGameId()))
|
mailMeta.GetContent(),
|
||||||
params.SetXValue("to", q5.NewXString(accountId))
|
mailMeta.GetSubject(),
|
||||||
params.SetXValue("mailtype", q5.NewXInt32(1))
|
sendTime,
|
||||||
params.SetXValue("mailsubtype", q5.NewXInt32(-2))
|
sendTime + 3600 * 24 * 30,
|
||||||
params.SetXValue("usertype", q5.NewXInt32(2))
|
mailMeta.GetAttachmentsByLv(vipLv))
|
||||||
params.SetXValue("content", q5.NewXString(mailMeta.GetContent()))
|
return ok
|
||||||
params.SetXValue("subject", q5.NewXString(mailMeta.GetSubject()))
|
|
||||||
params.SetXValue("sendtime", q5.NewXInt32(sendTime))
|
|
||||||
params.SetXValue("expiretime", q5.NewXInt32(sendTime + 3600 * 24 * 30))
|
|
||||||
params.SetXValue("attachments", q5.NewXString(mailMeta.GetAttachmentsByLv(vipLv)))
|
|
||||||
respObj, respStr, err := q5.HttpGetAsJson(gameMailApiUrl, params.AsXObject())
|
|
||||||
if err != nil {
|
|
||||||
f5.SysLog().Warning("url:%s resp:%s", gameMailApiUrl, respStr)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if !(respObj.GetSimpleStr("errcode", "") == "0" &&
|
|
||||||
respObj.GetSimpleStr("errcode", "") == "1008") {
|
|
||||||
f5.SysLog().Warning("url:%s resp:%s", gameMailApiUrl, respStr)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Game2005) FetchEventOneDB(conf *MtwGame2005MysqlConf, conn *q5.Mysql, sendTime int32) bool {
|
func (this *Game2005) FetchEventOneDB(conf *MtwGame2005MysqlConf, conn *q5.Mysql, sendTime int32) bool {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user