|
|
@ -161,7 +161,7 @@ func (t *UserCtl) WxLogin() { |
|
|
|
} |
|
|
|
|
|
|
|
func (t *UserCtl) Login() { |
|
|
|
activityId := t.MustGetInt("activity_id") |
|
|
|
//activityId := t.MustGetInt("activity_id")
|
|
|
|
wxcode := t.MustGet("code") |
|
|
|
admin := t.DefaultInt("admin", 0) |
|
|
|
|
|
|
@ -177,24 +177,24 @@ func (t *UserCtl) Login() { |
|
|
|
} |
|
|
|
|
|
|
|
area := &models.AreaStore{} |
|
|
|
if admin == 1 { |
|
|
|
username := t.MustGet("username") |
|
|
|
password := t.MustGet("password") |
|
|
|
exist, err := area.Login(activityId, username, password) |
|
|
|
t.CheckErr(err) |
|
|
|
t.Assert(exist, code.MSG_ERR_Authority, "不存在地区管理员") |
|
|
|
if area.UserId != user.Id { |
|
|
|
area.UserId = user.Id |
|
|
|
_, err = models.Update(area.Id, area, "user_id") |
|
|
|
t.CheckErr(err) |
|
|
|
} |
|
|
|
} else { |
|
|
|
exist, err := area.GetByUserId(activityId, user.Id) |
|
|
|
t.CheckErr(err) |
|
|
|
if exist { // 管理员
|
|
|
|
admin = 1 |
|
|
|
} |
|
|
|
} |
|
|
|
//if admin == 1 {
|
|
|
|
// username := t.MustGet("username")
|
|
|
|
// password := t.MustGet("password")
|
|
|
|
// exist, err := area.Login(activityId, username, password)
|
|
|
|
// t.CheckErr(err)
|
|
|
|
// t.Assert(exist, code.MSG_ERR_Authority, "不存在地区管理员")
|
|
|
|
// if area.UserId != user.Id {
|
|
|
|
// area.UserId = user.Id
|
|
|
|
// _, err = models.Update(area.Id, area, "user_id")
|
|
|
|
// t.CheckErr(err)
|
|
|
|
// }
|
|
|
|
//} else {
|
|
|
|
// exist, err := area.GetByUserId(activityId, user.Id)
|
|
|
|
// t.CheckErr(err)
|
|
|
|
// if exist { // 管理员
|
|
|
|
// admin = 1
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
|
|
|
|
jwtToken, err := jwt.GenJwtToken(define.TYPE_H5USER, user.Id, 0, 0, 0, 0) |
|
|
|
t.CheckErr(err) |
|
|
|