| | |
| | | if flag { |
| | | authDriver := auth.GenerateAuthDriver() |
| | | tokenStr := (*authDriver).Login(c.Request, c.Writer, util.Struct2Map(userInfo)) |
| | | util.ResponseFormat(c,code.LoginSuccess,map[string]interface{}{ |
| | | "userInfo":userInfo, |
| | | c.JSON(200,map[string]interface{}{ |
| | | "userInfo":userInfo.(map[string]interface{})["data"], |
| | | "access_token":tokenStr, |
| | | "refresh_token":tokenStr, |
| | | "scope":"app", |
| | |
| | | "expires_in":time.Now().Add(time.Hour * 8).Unix(), |
| | | }) |
| | | } else { |
| | | util.ResponseFormat(c,code.SigninInfoError,"用户名或密码错误") |
| | | c.JSON(500,"用户名或密码错误") |
| | | } |
| | | } |
| | | |