This commit is contained in:
aozhiwei 2024-08-23 19:17:19 +08:00
parent 0775bfd7a7
commit 040e527704

View File

@ -1,6 +1,12 @@
package task
import (
"q5"
"f5"
"main/constant"
"encoding/json"
"fmt"
"jccommon"
)
type oldUser struct {
@ -8,7 +14,80 @@ type oldUser struct {
}
func (this *oldUser) init() {
oldUsers := []struct {
Idx int32 `json:"idx"`
AccountId string `json:"account_id"`
Diamond int32 `json:"diamond"`
}{}
{
if jsonStr, err := f5.ReadJsonFile("/home/kingsome/pub/game2006web3/server/web3tools/1.json"); err == nil {
if err := json.Unmarshal([]byte(jsonStr), &oldUsers); err != nil {
panic(fmt.Sprintf("load oldUser json decode error %s %s", "nets.json", err))
}
} else {
panic(fmt.Sprintf("load oldUser error %s %s", "nets.json", err))
}
}
type AttachmentDto struct {
ItemId int32 `json:"itemid"`
ItemNum int32 `json:"itemnum"`
}
//fmt.Println("%s", oldUsers)
for _, user := range oldUsers {
if user.Idx <= 0 {
panic("")
}
if user.AccountId == "" {
panic("")
}
if user.Diamond <= 0 {
panic("")
}
mailId := q5.ToString(f5.GetApp().NewLockNodeUuid())
unikey := "oldUser.return.20240823:" + user.AccountId
subject := "Claim Your Diamonds"
content := "Thanks for participating in P2E S1! The gold you earned in Gold Mode has been converted to diamonds at a 1:1 ratio. Click “Claim” to receive your rewards now."
nowTime := f5.GetApp().GetRealSeconds()
sendTime := f5.GetApp().GetRealSeconds()
expireTime := nowTime + 3600 * 24 * 15
userRegEndTime := nowTime + 3600 * 24 * 365
f5.GetGoStyleDb().Upsert(
constant.BCNFT_DB,
"t_mail",
[][]string{
{"unikey", unikey},
},
[][]string{
},
[][]string{
{"mail_id", mailId},
{"mail_type", q5.ToString(jccommon.MAIL_TYPE_GROUP)},
{"unikey", unikey},
{"subject", subject},
{"content", content},
{"recipients", q5.EncodeJson([]string{
user.AccountId,
})},
{"attachments", q5.EncodeJson([]AttachmentDto{
AttachmentDto{
ItemId : 10014,
ItemNum : user.Diamond},
})},
{"sendtime", q5.ToString(sendTime)},
{"user_reg_start_time", q5.ToString(0)},
{"user_reg_end_time", q5.ToString(userRegEndTime)},
{"tag1", q5.ToString(jccommon.MAIL_TAG1_OLD_USER)},
{"tag2", q5.ToString(jccommon.MAIL_TAG2_OLD_USER)},
{"expiretime", q5.ToString(expireTime)},
{"createtime", q5.ToString(nowTime)},
{"modifytime", q5.ToString(nowTime)},
},
func (err error, lastInsertId int64, rowsAffected int64) {
if err != nil {
panic("")
}
})
}
}
func (this *oldUser) unInit() {