定时任务,每天23:50,每个服插入一条数据为0的第二天的充值数据

master
czx 2023-04-21 23:53:12 +08:00
parent d195a300ea
commit 513c2696d4
1 changed files with 44 additions and 17 deletions

View File

@ -48,6 +48,7 @@ func init() {
30
*/
// 统计充值人数、充值总额(刷新统计值)
gcron.AddSingleton("0 50 23 * * ?", initServerPayInfo)
gcron.AddSingleton("0 0,30 * * * ?", StatisticalRecharge)
gcron.AddSingleton("0 0,30 * * * ?", StatisticalRecharge_Server)
@ -641,7 +642,7 @@ func logCharge() {
}
// 拼接内容
bugType := ""
if (gconv.Int(pay.PayItem) >= 1 && gconv.Int(pay.PayItem) <= 6) {
if gconv.Int(pay.PayItem) >= 1 && gconv.Int(pay.PayItem) <= 6 {
bugType = "1"
} else {
bugType = "2"
@ -886,7 +887,6 @@ func goodsInfo() {
fmt.Println("goodsInfo end")
}
// 用户账号与角色对应关系表: log_role_{游戏名}.txt (按照月度级别)
func logRole() {
// 取配置中的游戏名
@ -943,3 +943,30 @@ func logRole() {
}
fmt.Println("logRole end")
}
func initServerPayInfo() {
bs := bson.D{}
serverInfoList := gameinfo.ModelServer.FindServerInfoList(bs)
for serverInfoList.Next(context.TODO()) {
var serverInfo gameinfo.ServerInfo
err := serverInfoList.Decode(&serverInfo)
if err != nil {
//log.Fatal(err)
log.Println(err)
continue
}
statisticalRecharge := gameinfo.StatisticalRecharge{}
tomorrow := time.Now().AddDate(0, 0, 1).Format("2006-01-02")
statisticalRecharge.CreatDay = tomorrow
//统计新增充值(当日注册且付费的人数和金额、付费次数)
statisticalRecharge.NewRechargeNum = gconv.Int(0)
statisticalRecharge.NewRechargeAmount = gconv.Float64(0)
statisticalRecharge.NewRechargeCount = gconv.Int(0)
//统计充值总数(人数和金额、付费次数)
statisticalRecharge.RechargeNum = gconv.Int(0)
statisticalRecharge.RechargeAmount = gconv.Float64(0)
statisticalRecharge.RechargeCount = gconv.Int(0)
gameinfo.ModelStatisticalRecharge.InsertAndUpdateStatisticalRecharge(statisticalRecharge.Id, statisticalRecharge, serverInfo.ServerId)
}
}