作者 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) {
)
token := ctx.Input.Header("x-mmm-accesstoken")
if token == "" {
if strings.HasSuffix(ctx.Request.RequestURI, "login") ||
if strings.HasSuffix(ctx.Request.RequestURI, "loginModule") ||
strings.HasSuffix(ctx.Request.RequestURI, "accessToken") ||
strings.HasSuffix(ctx.Request.RequestURI, "refreshToken") {
return true
... ...
... ... @@ -19,7 +19,7 @@ type AuthController struct {
}
// Login
// @router /login [post]
// @router /loginModule [post]
func (this *AuthController) Login() {
var msg *protocol.ResponseMessage
defer func() {
... ...
... ... @@ -31,7 +31,7 @@ type RequestHeader struct {
/*Login */
type LoginRequest struct {
Uid int64 `json:"cuid" valid:"Required;"`
Uid string `json:"cuid" valid:"Required;"`
Token string `json:"credentials" valid:"Required;"`
ClientId string `json:"clientId"`
}
... ...
... ... @@ -18,7 +18,7 @@ func init() {
beego.GlobalControllerRouter["opp/controllers/v1:AuthController"] = append(beego.GlobalControllerRouter["opp/controllers/v1:AuthController"],
beego.ControllerComments{
Method: "Login",
Router: `/login`,
Router: `/loginModule`,
AllowHTTPMethods: []string{"post"},
MethodParams: param.Make(),
Params: nil})
... ...
... ... @@ -9,6 +9,7 @@ import (
"net/http"
"opp/internal/utils"
"opp/services/agg"
"strconv"
"time"
"gitlab.fjmaimaimai.com/mmm-go/gocomm/identity/uid"
... ... @@ -35,8 +36,9 @@ func Login(header *protocol.RequestHeader, request *protocol.LoginRequest) (rsp
var (
user *models.User
userAuth *models.UserAuth
id, _ = strconv.ParseInt(request.Uid, 10, 64)
getUserRequest *protocol.UCenterServerLoginRequest = &protocol.UCenterServerLoginRequest{
Uid: request.Uid,
Uid: id,
Token: request.Token,
Type: 2,
}
... ... @@ -44,7 +46,7 @@ func Login(header *protocol.RequestHeader, request *protocol.LoginRequest) (rsp
message *protocol.Message
company *models.Company
)
user, err = models.GetUserByUcenterId(request.Uid)
user, err = models.GetUserByUcenterId(id)
if err != nil {
log.Error(err)
err = protocol.NewErrWithMessage(2002, err) //账号不存在
... ...