123456789101112131415161718192021222324252627282930313233 |
- package admin_api_controllers
-
- import (
- "XT_Admin_Api/enums"
- "XT_Admin_Api/service"
- )
-
- type LoginAPIController struct {
- AdminBaseAPIController
- }
-
- // /admin/api/login/pwd [post] LoginByPwd
- // @param account:string
- // @param password:string
- func (this *LoginAPIController) LoginByPwd() {
- account := this.GetString("account")
- password := this.GetString("password")
-
- admin, getAdminErr := service.GetAdminAccount(account, password)
- if getAdminErr != nil {
- this.ErrorLog("获取管理员信息失败:%v", getAdminErr)
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
- return
- } else if admin == nil {
- this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAccountOrPasswordWrong)
- return
- }
-
- this.ServeSuccessJSON(map[string]interface{}{
- "admin": admin,
- })
- }
|