印度包网
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

84 lines
2.8 KiB

package call
import (
"fmt"
"server/common"
"server/db"
"time"
"github.com/liangdas/mqant/log"
"gorm.io/gorm"
)
var (
SystemTitle = "System Notice"
EmailWithdrawPass = "Your order %v, amount: $%v is in the payment status, please be patient."
EmailWithdrawSuccess = "Your order %v, amount: $%v has been credited, please check. If you have any questions, you can contact customer service."
EmailWithdrawFail = "Your order %v, Amount: $%v\nYour withdrawal failed due to incorrect information. Please verify or change your withdrawal details and resubmit"
EmailDiscount = "Congratulations, you have received a $%v coupon for a top-up of $%v or more."
)
func checkMail(uid int, red *common.PlayerRed) {
data := &common.PlayerData{UID: uid}
db.Mysql().Get(data)
t := data.LastSysEmailDraw
all := []common.Mail{}
// mailCount := db.Mysql().QueryNewMailCount(uid)
mailCount := 0
db.Mysql().QueryAll(fmt.Sprintf("receiver = %v and time > %v", 0, t), "", &common.Mail{}, &all)
if len(all) > 0 {
now := time.Now().Unix()
u, err := db.Mysql().UpdateRes(&common.PlayerData{UID: uid, LastSysEmailDraw: data.LastSysEmailDraw}, &common.PlayerData{LastSysEmailDraw: now})
if err != nil || u == 0 {
log.Error("err:%v", err)
return
}
for _, v := range all {
one := v
one.ID = 0
one.Receiver = uid
db.Mysql().Create(&one)
mailCount++
}
if red.ID == 0 {
red.Mail = mailCount
db.Mysql().Create(red)
} else {
db.Mysql().Update(red, map[string]interface{}{"mail": gorm.Expr("mail + ?", mailCount)})
}
}
red.Mail += mailCount
}
const (
MailWithdrawType2 = "Your withdrawal order is already in payment. We've paid cash to bank, the final time is determined by the bank, please be patient!\nIf cash has not yet arrived, please click online customer service on the upper right corner or WhatsApp us at %v."
MailWithdrawType3 = "1.Please check your bank/UPI information and try to withdraw again: Bank IFSC Code is formatted as 'AAAA0XXXXXX'; there shouldn't be space in UPI account;\n2.If withdrawal still fails, please click online customer service on the upper right corner or WhatsApp us at %v."
)
func SendWithdrawMail(uid int, contentType string) {
one := &common.Mail{
Sender: "System",
Receiver: uid,
Title: "Withdraw Notice",
Content: fmt.Sprintf(contentType, GetConfigPlatform().Whatsapp),
Time: time.Now().Unix(),
}
db.Mysql().Create(one)
UpsertRedPointAndNotify(uid, 1, ModuleMail)
}
func SendMailWithContent(uid int, title, content string) {
one := &common.Mail{
Sender: "System",
Receiver: uid,
Title: title,
Content: content,
Time: time.Now().Unix(),
}
db.Mysql().Create(one)
UpsertRedPointAndNotify(uid, 1, ModuleMail)
}
func SendMail(mail *common.Mail) {
db.Mysql().Create(mail)
UpsertRedPointAndNotify(mail.Receiver, 1, ModuleMail)
}