Browse Source

升级

master
huangjiajun 2 weeks ago
parent
commit
cf4d8099e4
1 changed files with 14 additions and 1 deletions
  1. +14
    -1
      rule/user_upgrade.go

+ 14
- 1
rule/user_upgrade.go View File

@@ -11,9 +11,22 @@ import (
"xorm.io/xorm"
)

func UserUpgradeInsert(eg *xorm.Engine, uid, level int) error {
func UserUpgradeInsert(eg *xorm.Engine, uid int) error {
userDb := implement.NewUserDb(eg)
user, _ := userDb.GetUser(int64(uid))
level := user.Level
isNext := 0
levelDb := implement.NewUserLevelDb(db.Db)
levels, _ := levelDb.UserLevelAllByAsc()
for _, v1 := range levels {
if isNext == 1 {
level = v1.Id
isNext = 0
}
if v1.Id == level {
isNext = 1
}
}
if level == user.Level {
return errors.New("等级相同")
}


Loading…
Cancel
Save