...
|
...
|
@@ -10,7 +10,6 @@ import ( |
|
|
"github.com/astaxie/beego/logs"
|
|
|
userCmd "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/users/command"
|
|
|
userService "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/users/service"
|
|
|
"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/lib"
|
|
|
)
|
|
|
|
|
|
type AdminLoginController struct {
|
...
|
...
|
@@ -24,7 +23,6 @@ func (c *AdminLoginController) Prepare() { |
|
|
urlIn := map[string]int{
|
|
|
"/v1/auth/captcha-init": 1,
|
|
|
"/v1/auth/login": 1,
|
|
|
"/v1/auth/login2": 1,
|
|
|
}
|
|
|
|
|
|
nowUrl := c.Ctx.Input.URL()
|
...
|
...
|
@@ -37,53 +35,6 @@ func (c *AdminLoginController) Prepare() { |
|
|
}
|
|
|
}
|
|
|
|
|
|
//Login 用户登录
|
|
|
// func (c *AdminLoginController) Login() {
|
|
|
// type Paramter struct {
|
|
|
// Username string `json:"username"`
|
|
|
// Password string `json:"password"`
|
|
|
// }
|
|
|
// var (
|
|
|
// param Paramter
|
|
|
// err error
|
|
|
// )
|
|
|
// if err = c.BindJsonData(¶m); err != nil {
|
|
|
// c.ResponseError(fmt.Errorf("json解析失败:%s", err))
|
|
|
// return
|
|
|
// }
|
|
|
// newAdminuserquery := adminuserquery.GetAdminUserQuery{AdminAccount: param.Username}
|
|
|
// newAdminUserService := adminuserservice.NewAdminUserService(nil)
|
|
|
// adminuser, err := newAdminUserService.GetAdminUser(&newAdminuserquery)
|
|
|
// if err != nil {
|
|
|
// logs.Error("获取用户数据失败:%s", err)
|
|
|
// c.ResponseError(errors.New("用户不存在"))
|
|
|
// return
|
|
|
// }
|
|
|
// if adminuser.Password != param.Password {
|
|
|
// c.ResponseError(errors.New("账号或密码错误"))
|
|
|
// return
|
|
|
// }
|
|
|
// if !adminuser.IsUsable {
|
|
|
// c.ResponseError(errors.New("用户被禁用"))
|
|
|
// }
|
|
|
// //TODO
|
|
|
// newJwt := lib.NewMyToken(adminuser.Id, 0)
|
|
|
// newToken, err := newJwt.CreateJWTToken()
|
|
|
// if err != nil {
|
|
|
// logs.Error("生成jwt数据失败:%s", err)
|
|
|
// c.ResponseError(errors.New("服务异常"))
|
|
|
// return
|
|
|
// }
|
|
|
// rspdata := map[string]interface{}{
|
|
|
// "access": map[string]interface{}{
|
|
|
// "accessToken": newToken,
|
|
|
// "expiresIn": lib.JWtExpiresSecond,
|
|
|
// },
|
|
|
// }
|
|
|
// c.ResponseData(rspdata)
|
|
|
// return
|
|
|
// }
|
|
|
|
|
|
func (c *AdminLoginController) Login() {
|
|
|
var (
|
|
|
param userCmd.LoginBySecretKeyCommand
|
...
|
...
|
@@ -102,19 +53,6 @@ func (c *AdminLoginController) Login() { |
|
|
return
|
|
|
}
|
|
|
|
|
|
//Login2 开发临时使用
|
|
|
func (c *AdminLoginController) Login2() {
|
|
|
newToken := `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2MDAwOTg5NzMsImlhdCI6MTYwMDA1NTc3MywiaXNzIjoibW1tX3BhcnRuZXJtZyIsIm5iZiI6MTYwMDA1NTc3MywidWlkIjozMjU0ODUxNzgyMTYzMjAwLCJjb21wYW55SWQiOjF9.UaV6XrZLH_XNB6L-Z8ueidCoGN1dou_kYcFAcK5r2-g`
|
|
|
returnData := map[string]interface{}{
|
|
|
"access": map[string]interface{}{
|
|
|
"accessToken": newToken,
|
|
|
"expiresIn": lib.JWtExpiresSecond,
|
|
|
},
|
|
|
}
|
|
|
c.ResponseData(returnData)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
//CaptchaInit 极验初始化
|
|
|
func (c *AdminLoginController) CaptchaInit() {
|
|
|
const (
|
...
|
...
|
@@ -151,32 +89,3 @@ func (c *AdminLoginController) AdminpPofile() { |
|
|
c.ResponseData(respData)
|
|
|
return
|
|
|
} |
|
|
|
|
|
// func (c *AdminLoginController) PwdUpdate() {
|
|
|
// //用与适配前端定义的数据结构
|
|
|
// type Paramater struct {
|
|
|
// Pwd string `json:"pwd"`
|
|
|
// }
|
|
|
// var (
|
|
|
// param Paramater
|
|
|
// err error
|
|
|
// )
|
|
|
// if err = c.BindJsonData(¶m); err != nil {
|
|
|
// logs.Error(err)
|
|
|
// c.ResponseError(errors.New("json数据解析失败"))
|
|
|
// return
|
|
|
// }
|
|
|
// uid := c.GetUserId()
|
|
|
// newAdminUserService := adminuserservice.NewAdminUserService(nil)
|
|
|
// cmd := adminuserCmd.UpdateAdminUserPwdCommand{
|
|
|
// Id: uid,
|
|
|
// Password: param.Pwd,
|
|
|
// }
|
|
|
// err = newAdminUserService.UpdateAdminPassword(cmd)
|
|
|
// if err != nil {
|
|
|
// c.ResponseError(err)
|
|
|
// return
|
|
|
// }
|
|
|
// c.ResponseData(nil)
|
|
|
// return
|
|
|
// } |
...
|
...
|
|