|
|
@@ -45,8 +45,13 @@ func Login(c *gin.Context) { |
|
|
|
} |
|
|
|
key := fmt.Sprintf("%s:token:%s", c.GetString("mid"), user.Username) |
|
|
|
cache.SetEx(key, token, 39528000) // 半年 |
|
|
|
res := map[string]string{ |
|
|
|
role := []string{"comm"} |
|
|
|
if user.Level == 3 { |
|
|
|
role = append(role, "operator") |
|
|
|
} |
|
|
|
res := map[string]interface{}{ |
|
|
|
"token": token, |
|
|
|
"role": role, |
|
|
|
} |
|
|
|
e.OutSuc(c, res, nil) |
|
|
|
return |
|
|
|