作者 yangfu

build

@@ -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"
@@ -36,8 +37,9 @@ func Login(header *protocol.RequestHeader, request *protocol.LoginRequest) (rsp @@ -36,8 +37,9 @@ func Login(header *protocol.RequestHeader, request *protocol.LoginRequest) (rsp
36 var ( 37 var (
37 user *models.User 38 user *models.User
38 userAuth *models.UserAuth 39 userAuth *models.UserAuth
  40 + id, _ = strconv.ParseInt(request.Uid, 10, 64)
39 getUserRequest *protocol.UCenterServerLoginRequest = &protocol.UCenterServerLoginRequest{ 41 getUserRequest *protocol.UCenterServerLoginRequest = &protocol.UCenterServerLoginRequest{
40 - Uid: request.Uid, 42 + Uid: id,
41 Token: request.Token, 43 Token: request.Token,
42 Type: 2, 44 Type: 2,
43 } 45 }
@@ -45,7 +47,7 @@ func Login(header *protocol.RequestHeader, request *protocol.LoginRequest) (rsp @@ -45,7 +47,7 @@ func Login(header *protocol.RequestHeader, request *protocol.LoginRequest) (rsp
45 message *protocol.Message 47 message *protocol.Message
46 company *models.Company 48 company *models.Company
47 ) 49 )
48 - user, err = models.GetUserByUcenterId(request.Uid) 50 + user, err = models.GetUserByUcenterId(id)
49 if err != nil { 51 if err != nil {
50 log.Error(err) 52 log.Error(err)
51 err = protocol.NewErrWithMessage(2002, err) //账号不存在 53 err = protocol.NewErrWithMessage(2002, err) //账号不存在