|
|
@@ -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("等级相同") |
|
|
|
} |
|
|
|