From 96f2e40e754afe15dba4a9831ae349426173d4da Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 5 Feb 2024 16:56:41 +0800 Subject: [PATCH] update --- ...ircles_public_platoon_give_activty_coin.go | 2 +- ...latoon_double_network_relate_commission.go | 32 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/rule/one_circles/one_circles_public_platoon_give_activty_coin.go b/rule/one_circles/one_circles_public_platoon_give_activty_coin.go index 344e421..5da6ef2 100644 --- a/rule/one_circles/one_circles_public_platoon_give_activty_coin.go +++ b/rule/one_circles/one_circles_public_platoon_give_activty_coin.go @@ -92,7 +92,7 @@ func SettlementPublicGiveActivityCoin(engine *xorm.Engine, masterId string, uid } //判断是否活跃 var m model.OneCirclesGreenEnergySignIn - has, err3 := engine.Where("uid =?", fatherUid).And("end_time <=?", time.Now().Format("2006-01-02 15:04:05")).Get(&m) + has, err3 := engine.Where("uid =?", fatherUid).And("end_time >=?", time.Now().Format("2006-01-02 15:04:05")).Get(&m) if err != nil { return err3 } diff --git a/rule/public_platoon_double_network_relate_commission.go b/rule/public_platoon_double_network_relate_commission.go index 4a0243c..391e6cc 100644 --- a/rule/public_platoon_double_network_relate_commission.go +++ b/rule/public_platoon_double_network_relate_commission.go @@ -426,3 +426,35 @@ func GetUserRankAmount(engine *xorm.Engine, rank string) (amount string, err err } return } + +func ResetPublicPlatoonDoubleNetwork(engine *xorm.Engine, dbName string) (err error) { + //1、查找 `user_public_platoon_setting` 基础设置 + now := time.Now() + userPublicPlatoonDoubleNetworkSetting, err := db.UserPublicPlatoonDoubleNetworkSettingGetOneByParams(engine, map[string]interface{}{ + "key": "is_open", + "value": 1, + }) + if err != nil { + return err + } + if userPublicPlatoonDoubleNetworkSetting.IsOpen != 1 { + return errors.New("未开启公排双网!") + } + if userPublicPlatoonDoubleNetworkSetting.SettlementDate != now.Format("2006-01-02") { + return errors.New("非重置日期!") + } + + //2、计算排名数据 + //sql := "SELECT id, uid, amount, @rank := @rank + 1 AS rank FROM `user_public_platoon_double_network_user_coin_record`, (SELECT @rank:=0) r ORDER BY amount DESC;" + //nativeString, _ := db.QueryNativeString(engine, sql) + //if len(nativeString) <= 0 { + // return errors.New("当前无排名数据") + //} + //for _, v := range nativeString { + // if rank == v["rank"] { + // amount = v["amount"] + // break + // } + //} + return +}