Merge branch 'dev' of http://gitlab.fjmaimaimai.com/mmm-go/oppmg into dev
# Conflicts: # models/user_company.go # services/auth/auth.go
正在显示
19 个修改的文件
包含
261 行增加
和
48 行删除
| @@ -2,10 +2,10 @@ | @@ -2,10 +2,10 @@ | ||
| 2 | 2 | ||
| 3 | | 功能 | 完成状态 | 时间 | 接口路径 | 请求方式 | | 3 | | 功能 | 完成状态 | 时间 | 接口路径 | 请求方式 | |
| 4 | | -------------- | ------------------ | --------------- | --------------------------------- | -------- | | 4 | | -------------- | ------------------ | --------------- | --------------------------------- | -------- | |
| 5 | -| 登录获取 token | 进行中 | | /auth/login | post | | 5 | +| 登录获取 token | 完成 | 2018/12/11 | /auth/login | post | |
| 6 | | 短信验证码 | 未开始 | | | | 6 | | 短信验证码 | 未开始 | | | |
| 7 | -| 刷新 token | 未开始 | | /v1/auth/refresh_token | post | | ||
| 8 | -| 切换公司 | 未开始 | | /v1/auth/change_company | | 7 | +| 刷新 token | 完成 | 2018/12/11 | /v1/auth/refresh_token | get | |
| 8 | +| 切换公司 | 完成 | 2018/12/11 | /v1/auth/change_company | post | | ||
| 9 | | 获取角色列表 | 完成 | | /v1/rbac/:companyid/role | get | | 9 | | 获取角色列表 | 完成 | | /v1/rbac/:companyid/role | get | |
| 10 | | 添加角色 | 完成 | 2019.11.26 | /v1/rbac/role | post | | 10 | | 添加角色 | 完成 | 2019.11.26 | /v1/rbac/role | post | |
| 11 | | 编辑角色 | 完成 | 2019.11.26 | /v1/rbac/role | put | | 11 | | 编辑角色 | 完成 | 2019.11.26 | /v1/rbac/role | put | |
| @@ -27,9 +27,9 @@ log_level = "${LOG_LEVEL||error}" | @@ -27,9 +27,9 @@ log_level = "${LOG_LEVEL||error}" | ||
| 27 | 27 | ||
| 28 | ##统一用户中心相关配置 | 28 | ##统一用户中心相关配置 |
| 29 | ucenter_check_alt = "rsF0pL!6DwjBO735" | 29 | ucenter_check_alt = "rsF0pL!6DwjBO735" |
| 30 | -ucenter_base_url = "suplus-ucenter-dev.fjmaimaimai.com" | ||
| 31 | -ucenter_secret = "12412213" | ||
| 32 | -ucenter_app_key = "111222" | 30 | +ucenter_base_url = "http://suplus-ucenter-dev.fjmaimaimai.com" |
| 31 | +ucenter_app_key = "39aefef9e22744a3b2d2d3791824ae7b" | ||
| 32 | +ucenter_secret = "39aefef9e22744a3b2d2d3791824ae7b" | ||
| 33 | # 审批流程修改 消息发布 | 33 | # 审批流程修改 消息发布 |
| 34 | message_publish = "audit_change" | 34 | message_publish = "audit_change" |
| 35 | #---自定义配置 结束---- | 35 | #---自定义配置 结束---- |
| @@ -20,14 +20,19 @@ func (c *AuthController) URLMapping() { | @@ -20,14 +20,19 @@ func (c *AuthController) URLMapping() { | ||
| 20 | // RefreshToken .... | 20 | // RefreshToken .... |
| 21 | // @router /refresh_token [get] | 21 | // @router /refresh_token [get] |
| 22 | func (c *AuthController) RefreshToken() { | 22 | func (c *AuthController) RefreshToken() { |
| 23 | - log.Debug("运行cotrollers") | ||
| 24 | var msg *protocol.ResponseMessage | 23 | var msg *protocol.ResponseMessage |
| 25 | defer func() { | 24 | defer func() { |
| 26 | c.ResposeJson(msg) | 25 | c.ResposeJson(msg) |
| 27 | }() | 26 | }() |
| 28 | - | ||
| 29 | - // data, commErr := auth.GetAccessToken(param) | ||
| 30 | - // msg = protocol.NewReturnResponse(data, commErr) | 27 | + companyid := c.GetCompanyId() |
| 28 | + userid := c.GetUserId() | ||
| 29 | + logintoken, err := serveauth.ChangeLoginToken(userid, companyid) | ||
| 30 | + if err != nil { | ||
| 31 | + msg = protocol.NewReturnResponse(nil, err) | ||
| 32 | + return | ||
| 33 | + } | ||
| 34 | + err = serveauth.ResetLoginTokenRedis(logintoken) | ||
| 35 | + msg = protocol.NewReturnResponse(logintoken, err) | ||
| 31 | return | 36 | return |
| 32 | } | 37 | } |
| 33 | 38 | ||
| @@ -49,12 +54,18 @@ func (c *AuthController) Login() { | @@ -49,12 +54,18 @@ func (c *AuthController) Login() { | ||
| 49 | msg = protocol.BadRequestParam("10021") | 54 | msg = protocol.BadRequestParam("10021") |
| 50 | return | 55 | return |
| 51 | } | 56 | } |
| 52 | - logintoken, err := serveauth.LoginAuthByPassword(param.Account, param.Password) | 57 | + // logintoken, err := serveauth.LoginAuthByPassword(param.Account, param.Password) |
| 58 | + // if err != nil { | ||
| 59 | + // msg = protocol.NewReturnResponse(nil, err) | ||
| 60 | + // return | ||
| 61 | + // } | ||
| 62 | + // err = serveauth.ResetLoginToken(logintoken) | ||
| 63 | + logintoken, err := serveauth.LoginAuthByUCenter(param.Account, param.Password) | ||
| 53 | if err != nil { | 64 | if err != nil { |
| 54 | msg = protocol.NewReturnResponse(nil, err) | 65 | msg = protocol.NewReturnResponse(nil, err) |
| 55 | return | 66 | return |
| 56 | } | 67 | } |
| 57 | - err = serveauth.ResetLoginToken(logintoken) | 68 | + err = serveauth.ResetLoginTokenRedis(logintoken) |
| 58 | msg = protocol.NewReturnResponse(logintoken, err) | 69 | msg = protocol.NewReturnResponse(logintoken, err) |
| 59 | return | 70 | return |
| 60 | } | 71 | } |
| @@ -78,13 +89,12 @@ func (c *AuthController) ChangeCompany() { | @@ -78,13 +89,12 @@ func (c *AuthController) ChangeCompany() { | ||
| 78 | msg = protocol.BadRequestParam("1") | 89 | msg = protocol.BadRequestParam("1") |
| 79 | return | 90 | return |
| 80 | } | 91 | } |
| 81 | - | ||
| 82 | logintoken, err := serveauth.ChangeLoginToken(userid, param.CompanyId) | 92 | logintoken, err := serveauth.ChangeLoginToken(userid, param.CompanyId) |
| 83 | if err != nil { | 93 | if err != nil { |
| 84 | msg = protocol.NewReturnResponse(nil, err) | 94 | msg = protocol.NewReturnResponse(nil, err) |
| 85 | return | 95 | return |
| 86 | } | 96 | } |
| 87 | - err = redisdata.SetLoginToken(logintoken, userid) | 97 | + err = redisdata.SetLoginToken(logintoken, userid, param.CompanyId) |
| 88 | if err != nil { | 98 | if err != nil { |
| 89 | log.Error("redisdata.SetLoginToken err:%s", err) | 99 | log.Error("redisdata.SetLoginToken err:%s", err) |
| 90 | } | 100 | } |
| @@ -86,6 +86,7 @@ func (c *RbacController) RoleDelete() { | @@ -86,6 +86,7 @@ func (c *RbacController) RoleDelete() { | ||
| 86 | } | 86 | } |
| 87 | 87 | ||
| 88 | err := serverbac.RoleDelete(param) | 88 | err := serverbac.RoleDelete(param) |
| 89 | + | ||
| 89 | msg = protocol.NewReturnResponse(nil, err) | 90 | msg = protocol.NewReturnResponse(nil, err) |
| 90 | return | 91 | return |
| 91 | } | 92 | } |
| @@ -158,6 +159,7 @@ func (c *RbacController) RoleGroupDelete() { | @@ -158,6 +159,7 @@ func (c *RbacController) RoleGroupDelete() { | ||
| 158 | msg = protocol.BadRequestParam("1") | 159 | msg = protocol.BadRequestParam("1") |
| 159 | return | 160 | return |
| 160 | } | 161 | } |
| 162 | + | ||
| 161 | err := serverbac.RoleGroupDelete(param) | 163 | err := serverbac.RoleGroupDelete(param) |
| 162 | msg = protocol.NewReturnResponse(nil, err) | 164 | msg = protocol.NewReturnResponse(nil, err) |
| 163 | return | 165 | return |
| @@ -6,7 +6,6 @@ import ( | @@ -6,7 +6,6 @@ import ( | ||
| 6 | 6 | ||
| 7 | "oppmg/common/config" | 7 | "oppmg/common/config" |
| 8 | "oppmg/common/log" | 8 | "oppmg/common/log" |
| 9 | - "oppmg/middleware" | ||
| 10 | 9 | ||
| 11 | "github.com/astaxie/beego" | 10 | "github.com/astaxie/beego" |
| 12 | "github.com/astaxie/beego/orm" | 11 | "github.com/astaxie/beego/orm" |
| @@ -22,7 +21,6 @@ func main() { | @@ -22,7 +21,6 @@ func main() { | ||
| 22 | // beego.BConfig.WebConfig.DirectoryIndex = true | 21 | // beego.BConfig.WebConfig.DirectoryIndex = true |
| 23 | // beego.BConfig.WebConfig.StaticDir["/swagger"] = "swagger" | 22 | // beego.BConfig.WebConfig.StaticDir["/swagger"] = "swagger" |
| 24 | // } | 23 | // } |
| 25 | - beego.InsertFilter("*", beego.BeforeExec, middleware.LogRouter) | ||
| 26 | log.Debug("应用启动") | 24 | log.Debug("应用启动") |
| 27 | beego.Run() | 25 | beego.Run() |
| 28 | } | 26 | } |
| @@ -15,10 +15,14 @@ import ( | @@ -15,10 +15,14 @@ import ( | ||
| 15 | //LogRequestData Before Router | 15 | //LogRequestData Before Router |
| 16 | var LogRequestData = func(ctx *context.Context) { | 16 | var LogRequestData = func(ctx *context.Context) { |
| 17 | log.Info("====>Recv Request:%s", ctx.Input.URI()) | 17 | log.Info("====>Recv Request:%s", ctx.Input.URI()) |
| 18 | + hmap := map[string]string{ | ||
| 19 | + protocol.HeaderAccessToken: ctx.Input.Header(protocol.HeaderAccessToken), | ||
| 20 | + protocol.HeaderRefreshToken: ctx.Input.Header(protocol.HeaderRefreshToken), | ||
| 21 | + } | ||
| 18 | if ctx.Input.RequestBody != nil { | 22 | if ctx.Input.RequestBody != nil { |
| 19 | - log.Info("====>Recv data from client:\nHeadData: %s \nBodyData: %s", ctx.Request.Header, string(ctx.Input.RequestBody)) | 23 | + log.Info("====>Recv data from client:\nHeadData: %v \nBodyData: %s", hmap, string(ctx.Input.RequestBody)) |
| 20 | } else { | 24 | } else { |
| 21 | - log.Info("====>Recv data from client:\nHeadData: %s ", ctx.Request.Header) | 25 | + log.Info("====>Recv data from client:\nHeadData: %v ", hmap) |
| 22 | } | 26 | } |
| 23 | } | 27 | } |
| 24 | 28 | ||
| @@ -50,7 +54,7 @@ var LogRequestData = func(ctx *context.Context) { | @@ -50,7 +54,7 @@ var LogRequestData = func(ctx *context.Context) { | ||
| 50 | var AuthToken = func(ctx *context.Context) { | 54 | var AuthToken = func(ctx *context.Context) { |
| 51 | log.Debug("执行中间件AuthToken") | 55 | log.Debug("执行中间件AuthToken") |
| 52 | var ( | 56 | var ( |
| 53 | - storetoken protocol.LoginAuthToken | 57 | + storetoken redisdata.RedisLoginToken |
| 54 | msg *protocol.ResponseMessage | 58 | msg *protocol.ResponseMessage |
| 55 | err error | 59 | err error |
| 56 | mtoken *serveauth.MyToken | 60 | mtoken *serveauth.MyToken |
| @@ -61,7 +65,7 @@ var AuthToken = func(ctx *context.Context) { | @@ -61,7 +65,7 @@ var AuthToken = func(ctx *context.Context) { | ||
| 61 | if err == nil { | 65 | if err == nil { |
| 62 | storetoken, err = redisdata.GetLoginToken(mtoken.UID) | 66 | storetoken, err = redisdata.GetLoginToken(mtoken.UID) |
| 63 | if err != nil { | 67 | if err != nil { |
| 64 | - log.Error("err:%s", err) | 68 | + log.Error("redisdata.GetLoginToken err:%s", err) |
| 65 | msg = protocol.NewMesage("10024") | 69 | msg = protocol.NewMesage("10024") |
| 66 | ctx.Output.JSON(msg, false, false) | 70 | ctx.Output.JSON(msg, false, false) |
| 67 | return | 71 | return |
| @@ -110,3 +114,5 @@ var LogRouter = func(ctx *context.Context) { | @@ -110,3 +114,5 @@ var LogRouter = func(ctx *context.Context) { | ||
| 110 | fmt.Println("====>r:", p) | 114 | fmt.Println("====>r:", p) |
| 111 | return | 115 | return |
| 112 | } | 116 | } |
| 117 | + | ||
| 118 | +//登录失效 |
| @@ -10,7 +10,7 @@ import ( | @@ -10,7 +10,7 @@ import ( | ||
| 10 | type Company struct { | 10 | type Company struct { |
| 11 | Id int64 `orm:"column(id);auto"` | 11 | Id int64 `orm:"column(id);auto"` |
| 12 | Name string `orm:"column(name);size(40)"` | 12 | Name string `orm:"column(name);size(40)"` |
| 13 | - UserId int64 `orm:"column(user_id)"` | 13 | + Admin_id int64 `orm:"column(admin_id)"` |
| 14 | CreateAt time.Time `orm:"column(create_at);type(timestamp);auto_now"` | 14 | CreateAt time.Time `orm:"column(create_at);type(timestamp);auto_now"` |
| 15 | UpdateAt time.Time `orm:"column(update_at);type(timestamp)"` | 15 | UpdateAt time.Time `orm:"column(update_at);type(timestamp)"` |
| 16 | DeleteAt time.Time `orm:"column(delete_at);type(timestamp)"` | 16 | DeleteAt time.Time `orm:"column(delete_at);type(timestamp)"` |
| 1 | package models | 1 | package models |
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | + "errors" | ||
| 4 | "fmt" | 5 | "fmt" |
| 5 | "time" | 6 | "time" |
| 6 | 7 | ||
| @@ -92,6 +93,9 @@ func GetUserByPhone(phone string) (v *User, err error) { | @@ -92,6 +93,9 @@ func GetUserByPhone(phone string) (v *User, err error) { | ||
| 92 | if err = o.Read(v, "Phone"); err == nil { | 93 | if err = o.Read(v, "Phone"); err == nil { |
| 93 | return v, nil | 94 | return v, nil |
| 94 | } | 95 | } |
| 96 | + if v.DeleteAt.Unix() > 0 { | ||
| 97 | + return nil, errors.New("user is deleted") | ||
| 98 | + } | ||
| 95 | return nil, err | 99 | return nil, err |
| 96 | } | 100 | } |
| 97 | 101 |
| @@ -67,7 +67,7 @@ func UpdateUserAuthById(m *UserAuth, col []string) (err error) { | @@ -67,7 +67,7 @@ func UpdateUserAuthById(m *UserAuth, col []string) (err error) { | ||
| 67 | // ascertain id exists in the database | 67 | // ascertain id exists in the database |
| 68 | var num int64 | 68 | var num int64 |
| 69 | if num, err = o.Update(m, col...); err == nil { | 69 | if num, err = o.Update(m, col...); err == nil { |
| 70 | - log.Info("Number of records updated in database:", num) | 70 | + log.Info("Number of records updated in database:%d", num) |
| 71 | } | 71 | } |
| 72 | return | 72 | return |
| 73 | } | 73 | } |
| @@ -2,6 +2,7 @@ package models | @@ -2,6 +2,7 @@ package models | ||
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "fmt" | 4 | "fmt" |
| 5 | + "oppmg/common/log" | ||
| 5 | "time" | 6 | "time" |
| 6 | 7 | ||
| 7 | "github.com/astaxie/beego/orm" | 8 | "github.com/astaxie/beego/orm" |
| @@ -40,6 +41,7 @@ func (t *UserCompany) IsEnable() bool { | @@ -40,6 +41,7 @@ func (t *UserCompany) IsEnable() bool { | ||
| 40 | } | 41 | } |
| 41 | 42 | ||
| 42 | func (t *UserCompany) IsDelete() bool { | 43 | func (t *UserCompany) IsDelete() bool { |
| 44 | + log.Debug("deleteTime:%d", t.DeleteAt.Unix()) | ||
| 43 | if t.DeleteAt.Unix() > 0 { | 45 | if t.DeleteAt.Unix() > 0 { |
| 44 | return true | 46 | return true |
| 45 | } | 47 | } |
| @@ -85,8 +87,11 @@ func GetUserCompanyBy(userid int64, companyId int64) (*UserCompany, error) { | @@ -85,8 +87,11 @@ func GetUserCompanyBy(userid int64, companyId int64) (*UserCompany, error) { | ||
| 85 | } | 87 | } |
| 86 | return v, nil | 88 | return v, nil |
| 87 | } | 89 | } |
| 90 | +<<<<<<< HEAD | ||
| 88 | 91 | ||
| 89 | func GetUserCompanyByUser(userid int64) ([]UserCompany, error) { | 92 | func GetUserCompanyByUser(userid int64) ([]UserCompany, error) { |
| 90 | //datasql := `` | 93 | //datasql := `` |
| 91 | return nil, nil | 94 | return nil, nil |
| 92 | } | 95 | } |
| 96 | +======= | ||
| 97 | +>>>>>>> 626a6b6d8e73bd83579be13a797ab6c1fce8d3d8 |
| @@ -12,6 +12,7 @@ func init() { | @@ -12,6 +12,7 @@ func init() { | ||
| 12 | nsV1 := beego.NewNamespace("v1", | 12 | nsV1 := beego.NewNamespace("v1", |
| 13 | beego.NSBefore(middleware.AllowOption), | 13 | beego.NSBefore(middleware.AllowOption), |
| 14 | beego.NSBefore(middleware.LogRequestData), | 14 | beego.NSBefore(middleware.LogRequestData), |
| 15 | + beego.NSBefore(middleware.AuthToken), | ||
| 15 | beego.NSNamespace("/company", | 16 | beego.NSNamespace("/company", |
| 16 | beego.NSRouter("/:companyid([0-9]+)/department", &controllers.CompanyController{}, "get:DepartmentList"), | 17 | beego.NSRouter("/:companyid([0-9]+)/department", &controllers.CompanyController{}, "get:DepartmentList"), |
| 17 | beego.NSRouter("/department/:id([0-9]+)", &controllers.CompanyController{}, "get:DepartmentOne"), | 18 | beego.NSRouter("/department/:id([0-9]+)", &controllers.CompanyController{}, "get:DepartmentOne"), |
| @@ -34,7 +35,7 @@ func init() { | @@ -34,7 +35,7 @@ func init() { | ||
| 34 | ), | 35 | ), |
| 35 | beego.NSNamespace("/auth", | 36 | beego.NSNamespace("/auth", |
| 36 | beego.NSRouter("/change_company", &controllers.AuthController{}, "post:ChangeCompany"), | 37 | beego.NSRouter("/change_company", &controllers.AuthController{}, "post:ChangeCompany"), |
| 37 | - beego.NSRouter("/refresh_token", &controllers.AuthController{}, "post:RefreshToken"), | 38 | + beego.NSRouter("/refresh_token", &controllers.AuthController{}, "get:RefreshToken"), |
| 38 | ), | 39 | ), |
| 39 | beego.NSNamespace("/bulletin", | 40 | beego.NSNamespace("/bulletin", |
| 40 | beego.NSRouter("/release", &controllers.BulletinController{}, "post:BulletinRelease"), | 41 | beego.NSRouter("/release", &controllers.BulletinController{}, "post:BulletinRelease"), |
| @@ -12,6 +12,7 @@ import ( | @@ -12,6 +12,7 @@ import ( | ||
| 12 | "oppmg/protocol" | 12 | "oppmg/protocol" |
| 13 | "oppmg/services/ucenter" | 13 | "oppmg/services/ucenter" |
| 14 | "oppmg/storage/redisdata" | 14 | "oppmg/storage/redisdata" |
| 15 | + "oppmg/utils" | ||
| 15 | "strings" | 16 | "strings" |
| 16 | "time" | 17 | "time" |
| 17 | 18 | ||
| @@ -41,6 +42,7 @@ func validatePassword(from, to string) bool { | @@ -41,6 +42,7 @@ func validatePassword(from, to string) bool { | ||
| 41 | } | 42 | } |
| 42 | 43 | ||
| 43 | //LoginAuth 登录认证 | 44 | //LoginAuth 登录认证 |
| 45 | +//TODO 登录校验逻辑修改 | ||
| 44 | func LoginAuthByPassword(account, password string) (protocol.LoginAuthToken, error) { | 46 | func LoginAuthByPassword(account, password string) (protocol.LoginAuthToken, error) { |
| 45 | var ( | 47 | var ( |
| 46 | user *models.User | 48 | user *models.User |
| @@ -139,7 +141,7 @@ func ResetLoginToken(loginToken protocol.LoginAuthToken) error { | @@ -139,7 +141,7 @@ func ResetLoginToken(loginToken protocol.LoginAuthToken) error { | ||
| 139 | return nil | 141 | return nil |
| 140 | } | 142 | } |
| 141 | 143 | ||
| 142 | -// token 存redis | 144 | +//ResetLoginTokenRedis token存redis |
| 143 | func ResetLoginTokenRedis(loginToken protocol.LoginAuthToken) error { | 145 | func ResetLoginTokenRedis(loginToken protocol.LoginAuthToken) error { |
| 144 | var ( | 146 | var ( |
| 145 | mtoken *MyToken | 147 | mtoken *MyToken |
| @@ -150,7 +152,7 @@ func ResetLoginTokenRedis(loginToken protocol.LoginAuthToken) error { | @@ -150,7 +152,7 @@ func ResetLoginTokenRedis(loginToken protocol.LoginAuthToken) error { | ||
| 150 | log.Error("jwt err:%s", err) | 152 | log.Error("jwt err:%s", err) |
| 151 | return protocol.NewErrWithMessage("1") | 153 | return protocol.NewErrWithMessage("1") |
| 152 | } | 154 | } |
| 153 | - err = redisdata.SetLoginToken(loginToken, mtoken.UID) | 155 | + err = redisdata.SetLoginToken(loginToken, mtoken.UID, mtoken.CompanyID) |
| 154 | if err != nil { | 156 | if err != nil { |
| 155 | log.Error(" redisdata.SetLoginToken err:%s", err) | 157 | log.Error(" redisdata.SetLoginToken err:%s", err) |
| 156 | } | 158 | } |
| @@ -168,14 +170,14 @@ func ChangeLoginToken(userid, companyid int64) (protocol.LoginAuthToken, error) | @@ -168,14 +170,14 @@ func ChangeLoginToken(userid, companyid int64) (protocol.LoginAuthToken, error) | ||
| 168 | 170 | ||
| 169 | usercompany, err = models.GetUserCompanyBy(userid, companyid) | 171 | usercompany, err = models.GetUserCompanyBy(userid, companyid) |
| 170 | if err != nil { | 172 | if err != nil { |
| 171 | - log.Error("GetUserCompanyBy(userid, companyid) err:%s", err) | 173 | + log.Error("GetUserCompanyBy(userid, companyid)[%d,%d] err:%s", userid, companyid, err) |
| 172 | return logintoken, protocol.NewErrWithMessage("1") | 174 | return logintoken, protocol.NewErrWithMessage("1") |
| 173 | } | 175 | } |
| 174 | if ok := usercompany.IsEnable(); !ok { | 176 | if ok := usercompany.IsEnable(); !ok { |
| 175 | log.Debug("公司禁用此用户") | 177 | log.Debug("公司禁用此用户") |
| 176 | return logintoken, protocol.NewErrWithMessage("10027") | 178 | return logintoken, protocol.NewErrWithMessage("10027") |
| 177 | } | 179 | } |
| 178 | - if ok := usercompany.IsDelete(); !ok { | 180 | + if ok := usercompany.IsDelete(); ok { |
| 179 | log.Debug("公司删除此用户") | 181 | log.Debug("公司删除此用户") |
| 180 | return logintoken, protocol.NewErrWithMessage("10027") | 182 | return logintoken, protocol.NewErrWithMessage("10027") |
| 181 | } | 183 | } |
| @@ -201,7 +203,7 @@ func RefreshLoginToken(refreshtoken string) (protocol.LoginAuthToken, error) { | @@ -201,7 +203,7 @@ func RefreshLoginToken(refreshtoken string) (protocol.LoginAuthToken, error) { | ||
| 201 | logintoken protocol.LoginAuthToken | 203 | logintoken protocol.LoginAuthToken |
| 202 | mtoken *MyToken | 204 | mtoken *MyToken |
| 203 | err error | 205 | err error |
| 204 | - storetoken protocol.LoginAuthToken | 206 | + storetoken redisdata.RedisLoginToken |
| 205 | ) | 207 | ) |
| 206 | mtoken, err = ValidJWTToken(refreshtoken) | 208 | mtoken, err = ValidJWTToken(refreshtoken) |
| 207 | if err != nil { | 209 | if err != nil { |
| @@ -217,7 +219,6 @@ func RefreshLoginToken(refreshtoken string) (protocol.LoginAuthToken, error) { | @@ -217,7 +219,6 @@ func RefreshLoginToken(refreshtoken string) (protocol.LoginAuthToken, error) { | ||
| 217 | return logintoken, protocol.NewErrWithMessage("10024") | 219 | return logintoken, protocol.NewErrWithMessage("10024") |
| 218 | } | 220 | } |
| 219 | logintoken, _ = GenerateAuthToken(mtoken.UID, mtoken.CompanyID) | 221 | logintoken, _ = GenerateAuthToken(mtoken.UID, mtoken.CompanyID) |
| 220 | - ResetLoginTokenRedis(logintoken) | ||
| 221 | return logintoken, nil | 222 | return logintoken, nil |
| 222 | } | 223 | } |
| 223 | 224 | ||
| @@ -226,14 +227,33 @@ func LoginAuthByUCenter(account, password string) (protocol.LoginAuthToken, erro | @@ -226,14 +227,33 @@ func LoginAuthByUCenter(account, password string) (protocol.LoginAuthToken, erro | ||
| 226 | err error | 227 | err error |
| 227 | logintoken protocol.LoginAuthToken | 228 | logintoken protocol.LoginAuthToken |
| 228 | uclientReturn ucenter.ResponseLogin | 229 | uclientReturn ucenter.ResponseLogin |
| 230 | + companyids []int64 | ||
| 231 | + companyid int64 | ||
| 232 | + userdata *models.User | ||
| 229 | ) | 233 | ) |
| 234 | +<<<<<<< HEAD | ||
| 230 | 235 | ||
| 231 | _, err = models.GetUserByPhone(account) | 236 | _, err = models.GetUserByPhone(account) |
| 237 | +======= | ||
| 238 | + userdata, err = models.GetUserByPhone(account) | ||
| 239 | +>>>>>>> 626a6b6d8e73bd83579be13a797ab6c1fce8d3d8 | ||
| 232 | if err != nil { | 240 | if err != nil { |
| 233 | log.Debug("GetUserByPhone(%s) err:%s", account, err) | 241 | log.Debug("GetUserByPhone(%s) err:%s", account, err) |
| 234 | return logintoken, protocol.NewErrWithMessage("10021") | 242 | return logintoken, protocol.NewErrWithMessage("10021") |
| 235 | } | 243 | } |
| 236 | - | 244 | + if ok := userdata.IsEnable(); !ok { |
| 245 | + log.Debug("userdata.IsEnable()==false") | ||
| 246 | + return logintoken, protocol.NewErrWithMessage("10021") | ||
| 247 | + } | ||
| 248 | + if companyids, err = getUserCompanyReal(userdata.Id); err != nil { | ||
| 249 | + log.Error("getUserCompanyReal err:%s", err) | ||
| 250 | + return logintoken, protocol.NewErrWithMessage("10021") | ||
| 251 | + } | ||
| 252 | + if len(companyids) == 0 { | ||
| 253 | + log.Debug("no company") | ||
| 254 | + return logintoken, protocol.NewErrWithMessage("10021") | ||
| 255 | + } | ||
| 256 | + companyid = companyids[0] | ||
| 237 | param := ucenter.RequesLogin{ | 257 | param := ucenter.RequesLogin{ |
| 238 | Phone: account, | 258 | Phone: account, |
| 239 | Password: password, | 259 | Password: password, |
| @@ -253,6 +273,34 @@ func LoginAuthByUCenter(account, password string) (protocol.LoginAuthToken, erro | @@ -253,6 +273,34 @@ func LoginAuthByUCenter(account, password string) (protocol.LoginAuthToken, erro | ||
| 253 | uclientReturn.Msg == ucenter.ResponseMsgOk) { | 273 | uclientReturn.Msg == ucenter.ResponseMsgOk) { |
| 254 | return logintoken, protocol.NewErrWithMessage("10021") | 274 | return logintoken, protocol.NewErrWithMessage("10021") |
| 255 | } | 275 | } |
| 256 | - | 276 | + logintoken, _ = GenerateAuthToken(userdata.Id, companyid) |
| 257 | return logintoken, err | 277 | return logintoken, err |
| 258 | } | 278 | } |
| 279 | + | ||
| 280 | +//getUserCompanyReal 获取用户有效的公司id | ||
| 281 | +func getUserCompanyReal(userid int64) (companyids []int64, err error) { | ||
| 282 | + const ( | ||
| 283 | + datasql0 string = `SELECT b.company_id FROM user_company AS b | ||
| 284 | + WHERE b.delete_at=0 AND b.enable = 1 AND b.user_id=?` | ||
| 285 | + datasql2 string = `SELECT b.id FROM company AS b | ||
| 286 | + WHERE b.delete_at=0 AND b.enable = 1 AND b.id in (%s) ` | ||
| 287 | + ) | ||
| 288 | + var ( | ||
| 289 | + ids []string | ||
| 290 | + ) | ||
| 291 | + err = utils.ExecuteQueryAll(&ids, datasql0, userid) | ||
| 292 | + if err != nil { | ||
| 293 | + log.Error("EXECUTE SQL err:%s", err) | ||
| 294 | + return nil, err | ||
| 295 | + } | ||
| 296 | + if len(ids) == 0 { | ||
| 297 | + return nil, nil | ||
| 298 | + } | ||
| 299 | + datasql3 := fmt.Sprintf(datasql2, strings.Join(ids, ",")) | ||
| 300 | + err = utils.ExecuteQueryAll(&companyids, datasql3) | ||
| 301 | + if err != nil { | ||
| 302 | + log.Error("EXECUTE SQL err:%s", err) | ||
| 303 | + return nil, err | ||
| 304 | + } | ||
| 305 | + return companyids, nil | ||
| 306 | +} |
| @@ -74,11 +74,11 @@ func GenerateAuthToken(uid int64, companyid int64) (protocol.LoginAuthToken, err | @@ -74,11 +74,11 @@ func GenerateAuthToken(uid int64, companyid int64) (protocol.LoginAuthToken, err | ||
| 74 | err error | 74 | err error |
| 75 | nowtime = time.Now() | 75 | nowtime = time.Now() |
| 76 | ) | 76 | ) |
| 77 | - accesstoken, err = CreateJWTToken(uid, companyid, expiresIn+2) | 77 | + accesstoken, err = CreateJWTToken(uid, companyid, nowtime.Unix()+expiresIn+2) |
| 78 | if err != nil { | 78 | if err != nil { |
| 79 | return authToken, err | 79 | return authToken, err |
| 80 | } | 80 | } |
| 81 | - refreshtoken, err = CreateJWTToken(uid, companyid, refreshExpires+2) | 81 | + refreshtoken, err = CreateJWTToken(uid, companyid, nowtime.Unix()+refreshExpires+2) |
| 82 | if err != nil { | 82 | if err != nil { |
| 83 | return authToken, err | 83 | return authToken, err |
| 84 | } | 84 | } |
| @@ -33,7 +33,7 @@ func DepartmentAdd(param protocol.RequestDepartmentAdd) error { | @@ -33,7 +33,7 @@ func DepartmentAdd(param protocol.RequestDepartmentAdd) error { | ||
| 33 | for _, v := range param.Managers { | 33 | for _, v := range param.Managers { |
| 34 | _, err = models.GetUserCompanyBy(v, param.CompanyID) | 34 | _, err = models.GetUserCompanyBy(v, param.CompanyID) |
| 35 | if err != nil { | 35 | if err != nil { |
| 36 | - e := fmt.Errorf("GetUserCompanyBy(%d, %d)", v, param.CompanyID) | 36 | + e := fmt.Errorf("GetUserCompanyBy(userid,companyid)[%d, %d] err:%s", v, param.CompanyID, err) |
| 37 | log.Error(e.Error()) | 37 | log.Error(e.Error()) |
| 38 | return protocol.NewErrWithMessage("1", e) | 38 | return protocol.NewErrWithMessage("1", e) |
| 39 | } | 39 | } |
| @@ -101,7 +101,7 @@ func DepartmentEdit(param protocol.RequestDepartmentEdit) error { | @@ -101,7 +101,7 @@ func DepartmentEdit(param protocol.RequestDepartmentEdit) error { | ||
| 101 | for i := range diffmanage { | 101 | for i := range diffmanage { |
| 102 | _, err = models.GetUserCompanyBy(diffmanage[i], param.CompanyID) | 102 | _, err = models.GetUserCompanyBy(diffmanage[i], param.CompanyID) |
| 103 | if err != nil { | 103 | if err != nil { |
| 104 | - e := fmt.Errorf("GetUserCompanyBy(%d,%d) err:%s", diffmanage[i], param.CompanyID, err) | 104 | + e := fmt.Errorf("GetUserCompanyBy(userid,companyid)[%d,%d] err:%s", diffmanage[i], param.CompanyID, err) |
| 105 | log.Error(e.Error()) | 105 | log.Error(e.Error()) |
| 106 | return protocol.NewErrWithMessage("1", e) | 106 | return protocol.NewErrWithMessage("1", e) |
| 107 | } | 107 | } |
| @@ -64,6 +64,7 @@ func (client UCenterClient) httpDo(path string, mathod string, posts []byte) ([] | @@ -64,6 +64,7 @@ func (client UCenterClient) httpDo(path string, mathod string, posts []byte) ([] | ||
| 64 | } | 64 | } |
| 65 | req.Header = client.buildHeader() | 65 | req.Header = client.buildHeader() |
| 66 | resp, err := httpclient.Do(req) | 66 | resp, err := httpclient.Do(req) |
| 67 | + log.Info("====>Send To UCenter:%s", string(posts)) | ||
| 67 | if err != nil { | 68 | if err != nil { |
| 68 | return nil, err | 69 | return nil, err |
| 69 | } | 70 | } |
| @@ -72,7 +73,7 @@ func (client UCenterClient) httpDo(path string, mathod string, posts []byte) ([] | @@ -72,7 +73,7 @@ func (client UCenterClient) httpDo(path string, mathod string, posts []byte) ([] | ||
| 72 | if err != nil { | 73 | if err != nil { |
| 73 | return nil, err | 74 | return nil, err |
| 74 | } | 75 | } |
| 75 | - log.Info("====>Send To UCenter:%s", string(posts)) | 76 | + |
| 76 | log.Info("<====UCenter Return:%s", string(body)) | 77 | log.Info("<====UCenter Return:%s", string(body)) |
| 77 | return body, nil | 78 | return body, nil |
| 78 | } | 79 | } |
| 1 | package redisdata | 1 | package redisdata |
| 2 | 2 | ||
| 3 | const ( | 3 | const ( |
| 4 | - KEY_PREFIX string = "oppmg_" | ||
| 5 | - KEY_USER_TOKEN string = "token" | 4 | + KEY_PREFIX string = "oppmg_" //统一前缀 |
| 5 | + KEY_USER_TOKEN string = "token" //登录token存储 | ||
| 6 | ) | 6 | ) |
| 7 | + | ||
| 8 | +type RedisLoginToken struct { | ||
| 9 | + AccessToken string `json:"access_token"` | ||
| 10 | + RefreshToken string `json:"refresh_token"` | ||
| 11 | + CurrentCompany int64 `json:"current_company"` | ||
| 12 | + IsOk bool `json:"-"` | ||
| 13 | +} |
| @@ -2,15 +2,15 @@ package redisdata | @@ -2,15 +2,15 @@ package redisdata | ||
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "encoding/json" | 4 | "encoding/json" |
| 5 | - "errors" | ||
| 6 | "fmt" | 5 | "fmt" |
| 7 | "oppmg/common/log" | 6 | "oppmg/common/log" |
| 8 | "oppmg/common/redis" | 7 | "oppmg/common/redis" |
| 9 | "oppmg/protocol" | 8 | "oppmg/protocol" |
| 9 | + "strings" | ||
| 10 | "time" | 10 | "time" |
| 11 | ) | 11 | ) |
| 12 | 12 | ||
| 13 | -func SetLoginToken(param protocol.LoginAuthToken, userid int64) error { | 13 | +func SetLoginToken(param protocol.LoginAuthToken, userid int64, companyid int64) error { |
| 14 | client := redis.GetRedis() | 14 | client := redis.GetRedis() |
| 15 | var ( | 15 | var ( |
| 16 | key string | 16 | key string |
| @@ -19,26 +19,33 @@ func SetLoginToken(param protocol.LoginAuthToken, userid int64) error { | @@ -19,26 +19,33 @@ func SetLoginToken(param protocol.LoginAuthToken, userid int64) error { | ||
| 19 | exp int64 | 19 | exp int64 |
| 20 | nowTime = time.Now().Unix() | 20 | nowTime = time.Now().Unix() |
| 21 | ) | 21 | ) |
| 22 | + data := RedisLoginToken{ | ||
| 23 | + AccessToken: param.AccessToken, | ||
| 24 | + RefreshToken: param.RefreshToken, | ||
| 25 | + CurrentCompany: companyid, | ||
| 26 | + IsOk: true, | ||
| 27 | + } | ||
| 28 | + value, _ = json.Marshal(data) | ||
| 22 | exp = param.RefreshExpires - nowTime | 29 | exp = param.RefreshExpires - nowTime |
| 23 | key = fmt.Sprintf("%s%s:%d", KEY_PREFIX, KEY_USER_TOKEN, userid) | 30 | key = fmt.Sprintf("%s%s:%d", KEY_PREFIX, KEY_USER_TOKEN, userid) |
| 24 | - value, _ = json.Marshal(param) | ||
| 25 | err = client.Set(key, string(value), time.Duration(exp)*time.Second).Err() | 31 | err = client.Set(key, string(value), time.Duration(exp)*time.Second).Err() |
| 26 | return err | 32 | return err |
| 27 | } | 33 | } |
| 28 | 34 | ||
| 29 | -func GetLoginToken(userid int64) (protocol.LoginAuthToken, error) { | 35 | +func GetLoginToken(userid int64) (RedisLoginToken, error) { |
| 30 | client := redis.GetRedis() | 36 | client := redis.GetRedis() |
| 31 | var ( | 37 | var ( |
| 32 | key string | 38 | key string |
| 33 | value string | 39 | value string |
| 34 | err error | 40 | err error |
| 35 | - result protocol.LoginAuthToken | 41 | + result RedisLoginToken |
| 36 | ) | 42 | ) |
| 37 | key = fmt.Sprintf("%s%s:%d", KEY_PREFIX, KEY_USER_TOKEN, userid) | 43 | key = fmt.Sprintf("%s%s:%d", KEY_PREFIX, KEY_USER_TOKEN, userid) |
| 38 | - value = client.Get(key).String() | ||
| 39 | - if len(value) == 0 { | ||
| 40 | - return result, errors.New("Token not found") | 44 | + value, err = client.Get(key).Result() |
| 45 | + if err != nil { | ||
| 46 | + return result, err | ||
| 41 | } | 47 | } |
| 48 | + value = strings.TrimSpace(value) | ||
| 42 | err = json.Unmarshal([]byte(value), &result) | 49 | err = json.Unmarshal([]byte(value), &result) |
| 43 | if err != nil { | 50 | if err != nil { |
| 44 | log.Error("Unmarshal redis value:%s err:%s", value, err) | 51 | log.Error("Unmarshal redis value:%s err:%s", value, err) |
| @@ -22,7 +22,7 @@ func PrintLogSql(sql string, param ...interface{}) { | @@ -22,7 +22,7 @@ func PrintLogSql(sql string, param ...interface{}) { | ||
| 22 | 22 | ||
| 23 | //ExecuteQueryOne 执行原生sql查询单条记录;结果用结构体接收 | 23 | //ExecuteQueryOne 执行原生sql查询单条记录;结果用结构体接收 |
| 24 | func ExecuteQueryOne(result interface{}, sqlstr string, param ...interface{}) error { | 24 | func ExecuteQueryOne(result interface{}, sqlstr string, param ...interface{}) error { |
| 25 | - PrintLogSql(sqlstr, param...) | 25 | + |
| 26 | var err error | 26 | var err error |
| 27 | o := orm.NewOrm() | 27 | o := orm.NewOrm() |
| 28 | err = ExecuteQueryOneWithOrmer(o, result, sqlstr, param) | 28 | err = ExecuteQueryOneWithOrmer(o, result, sqlstr, param) |
| @@ -42,7 +42,7 @@ func ExecuteQueryOneWithOrmer(o orm.Ormer, result interface{}, sqlstr string, pa | @@ -42,7 +42,7 @@ func ExecuteQueryOneWithOrmer(o orm.Ormer, result interface{}, sqlstr string, pa | ||
| 42 | 42 | ||
| 43 | //ExecuteQuerySql 执行原生sql查询多条记录 | 43 | //ExecuteQuerySql 执行原生sql查询多条记录 |
| 44 | func ExecuteQueryAll(result interface{}, sqlstr string, param ...interface{}) error { | 44 | func ExecuteQueryAll(result interface{}, sqlstr string, param ...interface{}) error { |
| 45 | - PrintLogSql(sqlstr, param...) | 45 | + |
| 46 | var err error | 46 | var err error |
| 47 | o := orm.NewOrm() | 47 | o := orm.NewOrm() |
| 48 | err = ExecuteQueryAllWithOrmer(o, result, sqlstr, param) | 48 | err = ExecuteQueryAllWithOrmer(o, result, sqlstr, param) |
接口模型.md
0 → 100644
| 1 | +# 机会导向管理后台接口 | ||
| 2 | + | ||
| 3 | +## 全局统一设定 | ||
| 4 | + | ||
| 5 | +### 请求头指定要求的字段 | ||
| 6 | + | ||
| 7 | +| 字段 | 说明 | | ||
| 8 | +| ------------------ | ---------------------------- | | ||
| 9 | +| x-mmm-accesstoken | 发起请求时使用时校验用 token | | ||
| 10 | +| x-mmm-refreshtoken | 刷新 token 时使用的 token | | ||
| 11 | + | ||
| 12 | +- 备注 :token 使用 jwt 进行处理.其中包含有 user_id、company_id 的数据,登录时获取 | ||
| 13 | + | ||
| 14 | +--- | ||
| 15 | + | ||
| 16 | +### 通用响应结构 | ||
| 17 | + | ||
| 18 | +```json | ||
| 19 | +{ | ||
| 20 | + "code": "错误码字符串", | ||
| 21 | + "msg": "错误描述字符串", | ||
| 22 | + "data": { | ||
| 23 | + "xxx": "any" | ||
| 24 | + } | ||
| 25 | +} | ||
| 26 | +``` | ||
| 27 | + | ||
| 28 | +- 备注:data 中的内容根据各接口实际情况确定 | ||
| 29 | + | ||
| 30 | +--- | ||
| 31 | + | ||
| 32 | +## 认证相关 | ||
| 33 | + | ||
| 34 | +### 登录 | ||
| 35 | + | ||
| 36 | +- 请求路径 :/auth/login | ||
| 37 | +- 请求方式 :POST | ||
| 38 | +- 请求 json: | ||
| 39 | + | ||
| 40 | +```json | ||
| 41 | +{ | ||
| 42 | + "account": "账号", | ||
| 43 | + "password": "密码" | ||
| 44 | +} | ||
| 45 | +``` | ||
| 46 | + | ||
| 47 | +- 响应 json | ||
| 48 | + | ||
| 49 | +```json | ||
| 50 | +{ | ||
| 51 | + "code": "00000", | ||
| 52 | + "msg": "成功", | ||
| 53 | + "data": { | ||
| 54 | + "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzYwNTM2OTAsImlhdCI6MTU3NjA1MTg4OCwiaXNzIjoibW1tX29wcG1nIiwibmJmIjoxNTc2MDUxODg4LCJ1aWQiOjEwLCJjb21wYW55X2lkIjoyfQ.R056B306_vO4UKfMRalncFULE5Z0phN4WOhS9PMwydc", | ||
| 55 | + "expires_in": 1576053688, | ||
| 56 | + "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzYwNTU0OTAsImlhdCI6MTU3NjA1MTg4OCwiaXNzIjoibW1tX29wcG1nIiwibmJmIjoxNTc2MDUxODg4LCJ1aWQiOjEwLCJjb21wYW55X2lkIjoyfQ.OY54QdDwAq2B1NPnAmHkSxy_KvhktmZA2boSlcSSfoU", | ||
| 57 | + "refresh_expires": 1576055488 | ||
| 58 | + } | ||
| 59 | +} | ||
| 60 | +``` | ||
| 61 | + | ||
| 62 | +- 备注:该请求无需指定请求头 | ||
| 63 | + | ||
| 64 | +--- | ||
| 65 | + | ||
| 66 | +### 刷新 token | ||
| 67 | + | ||
| 68 | +- 请求路径 :/v1/auth/refresh_token | ||
| 69 | +- 请求方式 :get | ||
| 70 | +- 请求 json: | ||
| 71 | + | ||
| 72 | +```json | ||
| 73 | + | ||
| 74 | +``` | ||
| 75 | + | ||
| 76 | +- 响应 json | ||
| 77 | + | ||
| 78 | +```json | ||
| 79 | +{ | ||
| 80 | + "code": "00000", | ||
| 81 | + "msg": "成功", | ||
| 82 | + "data": { | ||
| 83 | + "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzYwNTM2OTAsImlhdCI6MTU3NjA1MTg4OCwiaXNzIjoibW1tX29wcG1nIiwibmJmIjoxNTc2MDUxODg4LCJ1aWQiOjEwLCJjb21wYW55X2lkIjoyfQ.R056B306_vO4UKfMRalncFULE5Z0phN4WOhS9PMwydc", | ||
| 84 | + "expires_in": 1576053688, | ||
| 85 | + "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzYwNTU0OTAsImlhdCI6MTU3NjA1MTg4OCwiaXNzIjoibW1tX29wcG1nIiwibmJmIjoxNTc2MDUxODg4LCJ1aWQiOjEwLCJjb21wYW55X2lkIjoyfQ.OY54QdDwAq2B1NPnAmHkSxy_KvhktmZA2boSlcSSfoU", | ||
| 86 | + "refresh_expires": 1576055488 | ||
| 87 | + } | ||
| 88 | +} | ||
| 89 | +``` | ||
| 90 | + | ||
| 91 | +- 备注:无 | ||
| 92 | + | ||
| 93 | +--- | ||
| 94 | + | ||
| 95 | +### 切换公司 | ||
| 96 | + | ||
| 97 | +- 请求路径 :/v1/auth/change_company | ||
| 98 | +- 请求方式 :post | ||
| 99 | +- 请求 json: | ||
| 100 | + | ||
| 101 | +```json | ||
| 102 | +{ | ||
| 103 | + "company_id": 2 | ||
| 104 | +} | ||
| 105 | +``` | ||
| 106 | + | ||
| 107 | +- 响应 json | ||
| 108 | + | ||
| 109 | +```json | ||
| 110 | +{ | ||
| 111 | + "code": "00000", | ||
| 112 | + "msg": "成功", | ||
| 113 | + "data": { | ||
| 114 | + "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzYwNTM2OTAsImlhdCI6MTU3NjA1MTg4OCwiaXNzIjoibW1tX29wcG1nIiwibmJmIjoxNTc2MDUxODg4LCJ1aWQiOjEwLCJjb21wYW55X2lkIjoyfQ.R056B306_vO4UKfMRalncFULE5Z0phN4WOhS9PMwydc", | ||
| 115 | + "expires_in": 1576053688, | ||
| 116 | + "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NzYwNTU0OTAsImlhdCI6MTU3NjA1MTg4OCwiaXNzIjoibW1tX29wcG1nIiwibmJmIjoxNTc2MDUxODg4LCJ1aWQiOjEwLCJjb21wYW55X2lkIjoyfQ.OY54QdDwAq2B1NPnAmHkSxy_KvhktmZA2boSlcSSfoU", | ||
| 117 | + "refresh_expires": 1576055488 | ||
| 118 | + } | ||
| 119 | +} | ||
| 120 | +``` | ||
| 121 | + | ||
| 122 | +- 备注:切换公司实际是变更 token 信息 | ||
| 123 | + | ||
| 124 | +--- |
-
请 注册 或 登录 后发表评论