This commit is contained in:
suyl
2021-07-19 18:44:29 +08:00
parent c31499ddb7
commit 7c952f112f
4 changed files with 20 additions and 13 deletions

View File

@@ -26,9 +26,9 @@ func GetApps(c *gin.Context) {
}
type AddAppParam struct {
Code string `json:"code" form:"code"` //手机验证码
Mobile string `json:"mobile" form:"mobile"` //手机号
Name string `json:"name" form:"name"` //应用名称
Code string `json:"code" form:"code" binding:"required"` //手机验证码
Mobile string `json:"mobile" form:"mobile" binding:"required"` //手机号
Name string `json:"name" form:"name" binding:"required"` //应用名称
}
//新建app POST

View File

@@ -33,6 +33,7 @@ func checkToken(c *gin.Context) (tokenInfo *model.TokenInfo) {
//验证token
//v2下的接口需要验证v1不需要
if !strings.Contains(c.Request.URL.String(), "v1") {
globals.SugarLogger.Debugf("checkToken cookie: %v", utils.Format4Output(c.Request.Cookies(), true))
if cookie, err = c.Request.Cookie("token"); err != nil {
c.JSON(http.StatusOK, &CallBack{
Desc: err.Error(),

View File

@@ -55,12 +55,8 @@ func RegisterUser(c *gin.Context) {
//登录 POST
func Login(c *gin.Context) {
var (
err error
user = &UserParam{}
UserServiceHandler = &services.UserService{
DB: globals.GetDB(),
C: c,
}
err error
user = &UserParam{}
)
if err = c.ShouldBind(&user); err != nil {
c.JSON(http.StatusOK, &CallBack{
@@ -79,7 +75,7 @@ func Login(c *gin.Context) {
return
}
if !callFunc(c, func() (retVal interface{}, errCode string, err error) {
retVal, err = UserServiceHandler.Login(user.Name, user.Password)
retVal, err = services.Login(c, user.Name, user.Password)
return retVal, "", err
}) {
return