作者 yangfu

Merge branch 'dev' of http://gitlab.fjmaimaimai.com/mmm-go/opp into dev

@@ -176,7 +176,7 @@ func CheckToken(ctx *context.Context) (result bool) { @@ -176,7 +176,7 @@ func CheckToken(ctx *context.Context) (result bool) {
176 ) 176 )
177 token := ctx.Input.Header("x-mmm-accesstoken") 177 token := ctx.Input.Header("x-mmm-accesstoken")
178 if token == "" { 178 if token == "" {
179 - if strings.HasSuffix(ctx.Request.RequestURI, "login") || 179 + if strings.HasSuffix(ctx.Request.RequestURI, "loginModule") ||
180 strings.HasSuffix(ctx.Request.RequestURI, "accessToken") || 180 strings.HasSuffix(ctx.Request.RequestURI, "accessToken") ||
181 strings.HasSuffix(ctx.Request.RequestURI, "refreshToken") { 181 strings.HasSuffix(ctx.Request.RequestURI, "refreshToken") {
182 return true 182 return true
@@ -19,7 +19,7 @@ type AuthController struct { @@ -19,7 +19,7 @@ type AuthController struct {
19 } 19 }
20 20
21 // Login 21 // Login
22 -// @router /login [post] 22 +// @router /loginModule [post]
23 func (this *AuthController) Login() { 23 func (this *AuthController) Login() {
24 var msg *protocol.ResponseMessage 24 var msg *protocol.ResponseMessage
25 defer func() { 25 defer func() {
@@ -31,7 +31,7 @@ type RequestHeader struct { @@ -31,7 +31,7 @@ type RequestHeader struct {
31 31
32 /*Login */ 32 /*Login */
33 type LoginRequest struct { 33 type LoginRequest struct {
34 - Uid int64 `json:"cuid" valid:"Required;"` 34 + Uid string `json:"cuid" valid:"Required;"`
35 Token string `json:"credentials" valid:"Required;"` 35 Token string `json:"credentials" valid:"Required;"`
36 ClientId string `json:"clientId"` 36 ClientId string `json:"clientId"`
37 } 37 }
@@ -18,7 +18,7 @@ func init() { @@ -18,7 +18,7 @@ func init() {
18 beego.GlobalControllerRouter["opp/controllers/v1:AuthController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:AuthController"], 18 beego.GlobalControllerRouter["opp/controllers/v1:AuthController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:AuthController"],
19 beego.ControllerComments{ 19 beego.ControllerComments{
20 Method: "Login", 20 Method: "Login",
21 - Router: `/login`, 21 + Router: `/loginModule`,
22 AllowHTTPMethods: []string{"post"}, 22 AllowHTTPMethods: []string{"post"},
23 MethodParams: param.Make(), 23 MethodParams: param.Make(),
24 Params: nil}) 24 Params: nil})
@@ -9,6 +9,7 @@ import ( @@ -9,6 +9,7 @@ import (
9 "net/http" 9 "net/http"
10 "opp/internal/utils" 10 "opp/internal/utils"
11 "opp/services/agg" 11 "opp/services/agg"
  12 + "strconv"
12 "time" 13 "time"
13 14
14 "gitlab.fjmaimaimai.com/mmm-go/gocomm/identity/uid" 15 "gitlab.fjmaimaimai.com/mmm-go/gocomm/identity/uid"
@@ -35,8 +36,9 @@ func Login(header *protocol.RequestHeader, request *protocol.LoginRequest) (rsp @@ -35,8 +36,9 @@ func Login(header *protocol.RequestHeader, request *protocol.LoginRequest) (rsp
35 var ( 36 var (
36 user *models.User 37 user *models.User
37 userAuth *models.UserAuth 38 userAuth *models.UserAuth
  39 + id, _ = strconv.ParseInt(request.Uid, 10, 64)
38 getUserRequest *protocol.UCenterServerLoginRequest = &protocol.UCenterServerLoginRequest{ 40 getUserRequest *protocol.UCenterServerLoginRequest = &protocol.UCenterServerLoginRequest{
39 - Uid: request.Uid, 41 + Uid: id,
40 Token: request.Token, 42 Token: request.Token,
41 Type: 2, 43 Type: 2,
42 } 44 }
@@ -44,7 +46,7 @@ func Login(header *protocol.RequestHeader, request *protocol.LoginRequest) (rsp @@ -44,7 +46,7 @@ func Login(header *protocol.RequestHeader, request *protocol.LoginRequest) (rsp
44 message *protocol.Message 46 message *protocol.Message
45 company *models.Company 47 company *models.Company
46 ) 48 )
47 - user, err = models.GetUserByUcenterId(request.Uid) 49 + user, err = models.GetUserByUcenterId(id)
48 if err != nil { 50 if err != nil {
49 log.Error(err) 51 log.Error(err)
50 err = protocol.NewErrWithMessage(2002, err) //账号不存在 52 err = protocol.NewErrWithMessage(2002, err) //账号不存在