Browse Source

更新

master
huangjiajun 10 months ago
parent
commit
583bfc0a60
1 changed files with 12 additions and 9 deletions
  1. +12
    -9
      hdl/hdl_upgrade.go

+ 12
- 9
hdl/hdl_upgrade.go View File

@@ -12,7 +12,7 @@ import (
"xorm.io/xorm" "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 uid := DataDetail.Uid
//判断有没有审核通过或审核中的记录 //判断有没有审核通过或审核中的记录
has, err := db.UserLevelAuditingFindByUid(eg, zhios_condition_statistics_utils.StrToInt(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 return errors.New(msg), false, 0
} }
lv := user.Level 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 { if result == false {
return errors.New("升级失败,请查看任务是否完成"), false, AutoAudit return errors.New("升级失败,请查看任务是否完成"), false, AutoAudit
} }
return nil, result, 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 levelExpireAt := user.LevelExpireAt
levelArriveAt := user.LevelArriveAt levelArriveAt := user.LevelArriveAt
oldLevel := user.Level oldLevel := user.Level
uid := zhios_condition_statistics_utils.IntToStr(user.Uid) 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 AutoAudit := 0
if result { if result {
level, err := db.UserLevelByID(eg, zhios_condition_statistics_utils.StrToInt(DataDetail.AgentType)) 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 判断是否可以升级 // 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) uid := zhios_condition_statistics_utils.IntToStr(user.Uid)
userLevel, err := db.UserLevelByID(engine, user.Level) userLevel, err := db.UserLevelByID(engine, user.Level)
if err != nil { if err != nil {
@@ -174,10 +174,10 @@ func IsCompleteSchemeTask(blockStarChain string, engine *xorm.Engine, user *mode
return false, false, 0 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{} var tasksGroup []map[string]interface{}
mustTasks := make(map[string][]interface{}) mustTasks := make(map[string][]interface{})
@@ -211,7 +211,7 @@ func CheckSchemeTasksComplete(blockStarChain string, engine *xorm.Engine, tasks


name := GetTaskName(item.TaskType) 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 := "" // 总共需完成的数 total := "" // 总共需完成的数
if item.TaskType == 6 { if item.TaskType == 6 {
// 当是付费条件是否,total的指标只能是1 // 当是付费条件是否,total的指标只能是1
@@ -349,7 +349,7 @@ func GetTaskName(id int) string {
// //


// GetFinishCount is 计算规定时间内完成的指标的数量 // 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() t := time.Now()
hasPay := false hasPay := false
var payOrdId int64 var payOrdId int64
@@ -378,6 +378,9 @@ func GetFinishCount(blockStarChain string, engine *xorm.Engine, uid interface{},
stime = lvTime.Date.Format("2006-01-02") stime = lvTime.Date.Format("2006-01-02")
} }
etime := t.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) _, days, activity := one_circles.CalcUserContinuousDailyActivityDays(engine, dbName, int(zhios_condition_statistics_utils.AnyToInt64(uid)), stime, etime)
if activity == false { if activity == false {
days = 0 days = 0


Loading…
Cancel
Save