parent
de4371e81c
commit
9a1cd35812
34 changed files with 541 additions and 139 deletions
@ -1,10 +1,18 @@ |
|||||||
[Backend] |
[Backend] |
||||||
Addr=":7616" |
Addr=":7616" |
||||||
Release=false |
Release=false |
||||||
DB="root:d47a98e748ccaf1f@tcp(172.105.117.6:3306)/backend" |
DB="root:123456@tcp(192.168.10.101:3306)/backend" |
||||||
[Web.ZYPay] |
[Web.ZYPay] |
||||||
ZYPayURL="https://in.zyhws.com/tablegames/singleton/orderPay" |
ZYPayURL="https://in.zyhws.com/tablegames/singleton/orderPay" |
||||||
ZYWithdrawURL="https://in.zyhws.com/tablegames/singleton/orderdraw" |
ZYWithdrawURL="https://in.zyhws.com/tablegames/singleton/orderdraw" |
||||||
PayNotifyURL="http://192.168.1.141:7615/balance/recharge/ZYPayCallback" |
PayNotifyURL="http://192.168.1.141:7615/balance/recharge/ZYPayCallback" |
||||||
WithdrawNotifyURL="http://192.168.1.141:7615/balance/withdraw/ZYWithdrawCallback" |
WithdrawNotifyURL="http://192.168.1.141:7615/balance/withdraw/ZYWithdrawCallback" |
||||||
WhiteIPs = ["47.241.254.165","8.214.46.27"] |
WhiteIPs = ["47.241.254.165","8.214.46.27"] |
||||||
|
[Backend.Oss] |
||||||
|
Endpoint="oss-ap-south-1.aliyuncs.com" |
||||||
|
AccessKeyId="LTAI5tLaYWuRVz7BiQ7m666Z" |
||||||
|
AccessKeySecret="6s7mMexYbVmZSLXEv3kdJwxXThMN4T" |
||||||
|
BucketName="xpggame" |
||||||
|
ObjectName="res/" |
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,45 @@ |
|||||||
|
package call |
||||||
|
|
||||||
|
import ( |
||||||
|
"server/common" |
||||||
|
"server/db" |
||||||
|
"time" |
||||||
|
|
||||||
|
"github.com/liangdas/mqant/log" |
||||||
|
"gorm.io/gorm" |
||||||
|
) |
||||||
|
|
||||||
|
type Task struct { |
||||||
|
Uid int // uid
|
||||||
|
Types []common.TaskType // 任务类型
|
||||||
|
Value int64 // 进度值
|
||||||
|
} |
||||||
|
|
||||||
|
func CheckTask(task Task) { |
||||||
|
log.Info("checkTask task:%v", task) |
||||||
|
now := time.Now().Unix() |
||||||
|
con := GetConfigTask() |
||||||
|
uid := task.Uid |
||||||
|
for _, v := range con { |
||||||
|
for _, t := range task.Types { |
||||||
|
if (t == common.TaskTypeOnceRecharge || t == common.TaskTypeInvite || t == common.TaskTypePlayGame) && v.Type == t { // 单次充值任务 || 首次充值任务 || v.Type == common.TaskTypeFirstRecharge)
|
||||||
|
data := GetUserTaskDataByTaskID(task.Uid, v.TaskID) |
||||||
|
if data.ID == 0 { |
||||||
|
db.Mysql().Create(&common.TaskData{UID: uid, TaskID: v.TaskID, Time: now, Progress: v.Target}) |
||||||
|
} else if data.Progress == 0 { |
||||||
|
db.Mysql().Update(&common.TaskData{UID: uid, TaskID: v.TaskID}, map[string]interface{}{"progress": v.Target, "time": now}) |
||||||
|
} |
||||||
|
break |
||||||
|
} else if (t == common.TaskTypeBet1000 || t == common.TaskTypeBet10000) && v.Type == t { |
||||||
|
data := GetUserTaskDataByTaskID(task.Uid, v.TaskID) |
||||||
|
if data.ID == 0 { |
||||||
|
db.Mysql().Create(&common.TaskData{UID: uid, TaskID: v.TaskID, Time: now, Progress: task.Value}) |
||||||
|
} else { |
||||||
|
db.Mysql().Update(&common.TaskData{UID: uid, TaskID: v.TaskID}, map[string]interface{}{"progress": gorm.Expr("progress + ?", task.Value), "time": now}) |
||||||
|
} |
||||||
|
break |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue