From 583bfc0a6098269d6c7ac1bef9fec1c4e464f5f7 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Fri, 19 Jan 2024 16:14:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hdl/hdl_upgrade.go | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/hdl/hdl_upgrade.go b/hdl/hdl_upgrade.go index 0789af3..f5adc36 100644 --- a/hdl/hdl_upgrade.go +++ b/hdl/hdl_upgrade.go @@ -12,7 +12,7 @@ import ( "xorm.io/xorm" ) -func CommUpdate(blockStarChain string, eg *xorm.Engine, dbName string, user *model.User, DataDetail md.DataDetail) (error, bool, int) { +func CommUpdate(params map[string]string, blockStarChain string, eg *xorm.Engine, dbName string, user *model.User, DataDetail md.DataDetail) (error, bool, int) { uid := DataDetail.Uid //判断有没有审核通过或审核中的记录 has, err := db.UserLevelAuditingFindByUid(eg, zhios_condition_statistics_utils.StrToInt(uid)) @@ -27,18 +27,18 @@ func CommUpdate(blockStarChain string, eg *xorm.Engine, dbName string, user *mod return errors.New(msg), false, 0 } lv := user.Level - result, AutoAudit := CommUplv(blockStarChain, eg, dbName, user, lv, DataDetail) + result, AutoAudit := CommUplv(params, blockStarChain, eg, dbName, user, lv, DataDetail) if result == false { return errors.New("升级失败,请查看任务是否完成"), false, AutoAudit } return nil, result, AutoAudit } -func CommUplv(blockStarChain string, eg *xorm.Engine, dbName string, user *model.User, lv int, DataDetail md.DataDetail) (bool, int) { +func CommUplv(params map[string]string, blockStarChain string, eg *xorm.Engine, dbName string, user *model.User, lv int, DataDetail md.DataDetail) (bool, int) { levelExpireAt := user.LevelExpireAt levelArriveAt := user.LevelArriveAt oldLevel := user.Level uid := zhios_condition_statistics_utils.IntToStr(user.Uid) - result, _, payOrdId := IsCompleteSchemeTask(blockStarChain, eg, user, DataDetail.AgentType, DataDetail.IsChangeTime, dbName) + result, _, payOrdId := IsCompleteSchemeTask(params, blockStarChain, eg, user, DataDetail.AgentType, DataDetail.IsChangeTime, dbName) AutoAudit := 0 if result { level, err := db.UserLevelByID(eg, zhios_condition_statistics_utils.StrToInt(DataDetail.AgentType)) @@ -145,7 +145,7 @@ func CommUplv(blockStarChain string, eg *xorm.Engine, dbName string, user *model } // IsCompleteSchemeTask 根据传入的 level 判断是否可以升级 -func IsCompleteSchemeTask(blockStarChain string, engine *xorm.Engine, user *model.User, level, IsChangeTime, dbName string) (bool, bool, int64) { +func IsCompleteSchemeTask(params map[string]string, blockStarChain string, engine *xorm.Engine, user *model.User, level, IsChangeTime, dbName string) (bool, bool, int64) { uid := zhios_condition_statistics_utils.IntToStr(user.Uid) userLevel, err := db.UserLevelByID(engine, user.Level) if err != nil { @@ -174,10 +174,10 @@ func IsCompleteSchemeTask(blockStarChain string, engine *xorm.Engine, user *mode return false, false, 0 } - return CheckSchemeTasksComplete(blockStarChain, engine, schemeTasks, uid, becomeLevel, level, "", dbName) + return CheckSchemeTasksComplete(params, blockStarChain, engine, schemeTasks, uid, becomeLevel, level, "", dbName) } -func CheckSchemeTasksComplete(blockStarChain string, engine *xorm.Engine, tasks *[]model.UserLevelUpgradeTask, uid interface{}, scheme *model.UserLevel, level string, regionalId, dbName string) (bool, bool, int64) { +func CheckSchemeTasksComplete(params map[string]string, blockStarChain string, engine *xorm.Engine, tasks *[]model.UserLevelUpgradeTask, uid interface{}, scheme *model.UserLevel, level string, regionalId, dbName string) (bool, bool, int64) { //分离出 必做/选做 途径(任务组) && 分离出 必做/选做 var tasksGroup []map[string]interface{} mustTasks := make(map[string][]interface{}) @@ -211,7 +211,7 @@ func CheckSchemeTasksComplete(blockStarChain string, engine *xorm.Engine, tasks name := GetTaskName(item.TaskType) - finish, hasPay, payOrdId := GetFinishCount(blockStarChain, engine, uid, &item, level, regionalId, allLvMap, dbName) + finish, hasPay, payOrdId := GetFinishCount(params, blockStarChain, engine, uid, &item, level, regionalId, allLvMap, dbName) total := "" // 总共需完成的数 if item.TaskType == 6 { // 当是付费条件是否,total的指标只能是1 @@ -349,7 +349,7 @@ func GetTaskName(id int) string { // // GetFinishCount is 计算规定时间内完成的指标的数量 -func GetFinishCount(blockStarChain string, engine *xorm.Engine, uid interface{}, task *model.UserLevelUpgradeTask, level string, regionalId string, allLvMap map[int]*model.UserLevel, dbName string) (string, bool, int64) { +func GetFinishCount(params map[string]string, blockStarChain string, engine *xorm.Engine, uid interface{}, task *model.UserLevelUpgradeTask, level string, regionalId string, allLvMap map[int]*model.UserLevel, dbName string) (string, bool, int64) { t := time.Now() hasPay := false var payOrdId int64 @@ -378,6 +378,9 @@ func GetFinishCount(blockStarChain string, engine *xorm.Engine, uid interface{}, stime = lvTime.Date.Format("2006-01-02") } etime := t.Format("2006-01-02") + if params["is_view"] == "1" { + etime = time.Date(t.Year(), t.Month(), t.Day()+1, 0, 0, 0, 0, t.Location()).Format("2006-01-02") + } _, days, activity := one_circles.CalcUserContinuousDailyActivityDays(engine, dbName, int(zhios_condition_statistics_utils.AnyToInt64(uid)), stime, etime) if activity == false { days = 0