|
@@ -31,16 +31,7 @@ type auth struct {
|
|
|
TypeIn int `json:"typein"`
|
|
|
}
|
|
|
|
|
|
-// @Summary 获取登录token 信息
|
|
|
-// @Tags auth
|
|
|
-// @Accept json
|
|
|
-// @Produce json
|
|
|
-// @Param username formData string true "admin"
|
|
|
-// @Param password formData string true "123456"
|
|
|
-// @Success 200 {string} json "{ "code": 200e, "data": { "token": "xxx" }, "msg": "ok" }"
|
|
|
-// @Failure 400 {string} json "{"code":400, "data":null,"msg":"请求参数错误"}"
|
|
|
-// @Failure 404 {string} json "{ "code": 404, "data":null,"msg":"请求参数错误"}"
|
|
|
-// @Router /auth [POST]
|
|
|
+// Auth 获取登录token 信息
|
|
|
func Auth(c *gin.Context) {
|
|
|
appG := app.Gin{C: c}
|
|
|
var reqInfo auth
|
|
@@ -51,7 +42,7 @@ func Auth(c *gin.Context) {
|
|
|
valid.MaxSize(reqInfo.Password, 100, "password").Message("最长为100字符")
|
|
|
valid.MinSize(reqInfo.Password, 1, "password").Message("不能为空")
|
|
|
valid.MinSize(reqInfo.Password, 1, "password").Message("不能为空")
|
|
|
- fmt.Println("==========reqInfo===========", reqInfo)
|
|
|
+
|
|
|
if valid.HasErrors() {
|
|
|
app.MarkErrors(valid.Errors)
|
|
|
appG.Response(http.StatusInternalServerError, e.ERROR_ADD_FAIL, valid.Errors)
|
|
@@ -60,7 +51,6 @@ func Auth(c *gin.Context) {
|
|
|
|
|
|
authService := user_service.User{Username: reqInfo.Username, Password: reqInfo.Password}
|
|
|
isExist, err := authService.Check()
|
|
|
- fmt.Println("==========Check===========", isExist, err)
|
|
|
if err != nil {
|
|
|
appG.Response(http.StatusInternalServerError, e.ERROR_AUTH_CHECK_TOKEN_FAIL, err)
|
|
|
return
|