Merge remote-tracking branch 'origin/dev' into test
正在显示
9 个修改的文件
包含
75 行增加
和
27 行删除
@@ -81,6 +81,18 @@ spec: | @@ -81,6 +81,18 @@ spec: | ||
81 | configMapKeyRef: | 81 | configMapKeyRef: |
82 | name: suplus-config | 82 | name: suplus-config |
83 | key: service.businessadmin | 83 | key: service.businessadmin |
84 | + - name: REDIS_HOST | ||
85 | + valueFrom: | ||
86 | + configMapKeyRef: | ||
87 | + name: suplus-config | ||
88 | + key: redis.ip | ||
89 | + - name: REDIS_PORT | ||
90 | + valueFrom: | ||
91 | + configMapKeyRef: | ||
92 | + name: suplus-config | ||
93 | + key: redis.port | ||
94 | + - name: REDIS_AUTH | ||
95 | + value: "" | ||
84 | volumes: | 96 | volumes: |
85 | - name: accesslogs | 97 | - name: accesslogs |
86 | emptyDir: {} | 98 | emptyDir: {} |
@@ -81,6 +81,18 @@ spec: | @@ -81,6 +81,18 @@ spec: | ||
81 | configMapKeyRef: | 81 | configMapKeyRef: |
82 | name: suplus-config | 82 | name: suplus-config |
83 | key: service.businessadmin | 83 | key: service.businessadmin |
84 | + - name: REDIS_HOST | ||
85 | + valueFrom: | ||
86 | + configMapKeyRef: | ||
87 | + name: suplus-config | ||
88 | + key: redis.ip | ||
89 | + - name: REDIS_PORT | ||
90 | + valueFrom: | ||
91 | + configMapKeyRef: | ||
92 | + name: suplus-config | ||
93 | + key: redis.port | ||
94 | + - name: REDIS_AUTH | ||
95 | + value: "" | ||
84 | volumes: | 96 | volumes: |
85 | - name: accesslogs | 97 | - name: accesslogs |
86 | emptyDir: {} | 98 | emptyDir: {} |
@@ -81,6 +81,18 @@ spec: | @@ -81,6 +81,18 @@ spec: | ||
81 | configMapKeyRef: | 81 | configMapKeyRef: |
82 | name: suplus-config | 82 | name: suplus-config |
83 | key: service.businessadmin | 83 | key: service.businessadmin |
84 | + - name: REDIS_HOST | ||
85 | + valueFrom: | ||
86 | + configMapKeyRef: | ||
87 | + name: suplus-config | ||
88 | + key: redis.ip | ||
89 | + - name: REDIS_PORT | ||
90 | + valueFrom: | ||
91 | + configMapKeyRef: | ||
92 | + name: suplus-config | ||
93 | + key: redis.port | ||
94 | + - name: REDIS_AUTH | ||
95 | + value: "" | ||
84 | volumes: | 96 | volumes: |
85 | - name: accesslogs | 97 | - name: accesslogs |
86 | emptyDir: {} | 98 | emptyDir: {} |
@@ -6,7 +6,6 @@ require ( | @@ -6,7 +6,6 @@ require ( | ||
6 | github.com/astaxie/beego v1.12.1 | 6 | github.com/astaxie/beego v1.12.1 |
7 | github.com/dgrijalva/jwt-go v3.2.0+incompatible | 7 | github.com/dgrijalva/jwt-go v3.2.0+incompatible |
8 | github.com/gin-gonic/gin v1.5.0 | 8 | github.com/gin-gonic/gin v1.5.0 |
9 | - github.com/go-pg/pg v8.0.6+incompatible | ||
10 | github.com/go-pg/pg/v10 v10.0.0-beta.2 | 9 | github.com/go-pg/pg/v10 v10.0.0-beta.2 |
11 | github.com/linmadan/egglib-go v0.0.0-20191217144343-ca4539f95bf9 | 10 | github.com/linmadan/egglib-go v0.0.0-20191217144343-ca4539f95bf9 |
12 | github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 // indirect | 11 | github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 // indirect |
@@ -301,6 +301,11 @@ func CenterCompanys(header *protocol.RequestHeader, request *protocolx.CenterCom | @@ -301,6 +301,11 @@ func CenterCompanys(header *protocol.RequestHeader, request *protocolx.CenterCom | ||
301 | return | 301 | return |
302 | } | 302 | } |
303 | break | 303 | break |
304 | + case protocol.LoginByCredentials: | ||
305 | + if _, err = utils.ParseJWTToken(request.Credentials); err != nil { | ||
306 | + err = protocol.NewErrWithMessage(4140, err) | ||
307 | + return | ||
308 | + } | ||
304 | default: | 309 | default: |
305 | err = protocol.NewCustomMessage(1, "登录方式不支持!") | 310 | err = protocol.NewCustomMessage(1, "登录方式不支持!") |
306 | break | 311 | break |
@@ -330,6 +335,7 @@ func CenterCompanys(header *protocol.RequestHeader, request *protocolx.CenterCom | @@ -330,6 +335,7 @@ func CenterCompanys(header *protocol.RequestHeader, request *protocolx.CenterCom | ||
330 | rsp.CsAccountID = fmt.Sprintf("%v", imInfo.CustomerImId) | 335 | rsp.CsAccountID = fmt.Sprintf("%v", imInfo.CustomerImId) |
331 | rsp.ImToken = imInfo.ImToken | 336 | rsp.ImToken = imInfo.ImToken |
332 | rsp.Accid, _ = strconv.Atoi(imInfo.ImId) | 337 | rsp.Accid, _ = strconv.Atoi(imInfo.ImId) |
338 | + rsp.Phone = request.Phone | ||
333 | rsp.Credentials, _ = utils.GenerateToken(int64(phoneId), request.Phone, protocol.RefreshTokenExipre*time.Second) | 339 | rsp.Credentials, _ = utils.GenerateToken(int64(phoneId), request.Phone, protocol.RefreshTokenExipre*time.Second) |
334 | 340 | ||
335 | err = transactionContext.CommitTransaction() | 341 | err = transactionContext.CommitTransaction() |
@@ -352,7 +358,7 @@ func Companys(header *protocol.RequestHeader, request *protocolx.CompanysRequest | @@ -352,7 +358,7 @@ func Companys(header *protocol.RequestHeader, request *protocolx.CompanysRequest | ||
352 | transactionContext.RollbackTransaction() | 358 | transactionContext.RollbackTransaction() |
353 | }() | 359 | }() |
354 | if claim, err = utils.ParseJWTToken(request.Credentials); err != nil { | 360 | if claim, err = utils.ParseJWTToken(request.Credentials); err != nil { |
355 | - err = protocol.NewErrWithMessage(4139, err) | 361 | + err = protocol.NewErrWithMessage(4140, err) |
356 | return | 362 | return |
357 | } | 363 | } |
358 | loginSvr.Init(claim.Phone) | 364 | loginSvr.Init(claim.Phone) |
@@ -9,6 +9,7 @@ var REDIS_AUTH = "123456" | @@ -9,6 +9,7 @@ var REDIS_AUTH = "123456" | ||
9 | func init() { | 9 | func init() { |
10 | if os.Getenv("REDIS_HOST") != "" { | 10 | if os.Getenv("REDIS_HOST") != "" { |
11 | REDIS_HOST = os.Getenv("REDIS_HOST") | 11 | REDIS_HOST = os.Getenv("REDIS_HOST") |
12 | + REDIS_AUTH = os.Getenv("REDIS_AUTH") | ||
12 | } | 13 | } |
13 | if os.Getenv("REDIS_PORT") != "" { | 14 | if os.Getenv("REDIS_PORT") != "" { |
14 | REDIS_PORT = os.Getenv("REDIS_PORT") | 15 | REDIS_PORT = os.Getenv("REDIS_PORT") |
@@ -2,6 +2,7 @@ package domain_service | @@ -2,6 +2,7 @@ package domain_service | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "github.com/tiptok/gocomm/xa/eda" | 4 | "github.com/tiptok/gocomm/xa/eda" |
5 | + "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant" | ||
5 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain" | 6 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain" |
6 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/dao" | 7 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/dao" |
7 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg/transaction" | 8 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg/transaction" |
@@ -154,8 +155,8 @@ func (svr *PgLoginService) ManagerStaticInfo() (interface{}, error) { | @@ -154,8 +155,8 @@ func (svr *PgLoginService) ManagerStaticInfo() (interface{}, error) { | ||
154 | return response, nil | 155 | return response, nil |
155 | } | 156 | } |
156 | var ( | 157 | var ( |
157 | - companyList []*domain.Company | ||
158 | - //adminApiGateway = http_gateway.NewHttplibBusinessAdminApiServiceGateway() | 158 | + companyList []*domain.Company |
159 | + adminApiGateway = http_gateway.NewHttplibBusinessAdminApiServiceGateway() | ||
159 | ) | 160 | ) |
160 | doGetCompanyIds := func() []int64 { | 161 | doGetCompanyIds := func() []int64 { |
161 | var companies []int64 | 162 | var companies []int64 |
@@ -169,22 +170,24 @@ func (svr *PgLoginService) ManagerStaticInfo() (interface{}, error) { | @@ -169,22 +170,24 @@ func (svr *PgLoginService) ManagerStaticInfo() (interface{}, error) { | ||
169 | for i := range companyList { | 170 | for i := range companyList { |
170 | c := companyList[i] | 171 | c := companyList[i] |
171 | 172 | ||
172 | - //通过企业平台 校验模块权限 | ||
173 | - //var user *domain.Users | ||
174 | - //for j := range svr.Users { | ||
175 | - // if svr.Users[j].CompanyId == c.Id { | ||
176 | - // user = svr.Users[j] | ||
177 | - // break | ||
178 | - // } | ||
179 | - //} | ||
180 | - //if user != nil { | ||
181 | - // if code, e := adminApiGateway.UserAuth(user.Id, constant.BUSINESS_ADMIN_PLATFORM_ID); e != nil || code != 0 { | ||
182 | - // log.Debug("【检查权限】", svr.Phone, "【公司】", c.Id, user.Id, code, e.Error()) | ||
183 | - // continue | ||
184 | - // } else { | ||
185 | - // log.Debug("【检查权限】", svr.Phone, "【公司】", c.Id, user.Id, code, e) | ||
186 | - // } | ||
187 | - //} | 173 | + if constant.POSTGRESQL_DB_NAME != "partner_dev" { |
174 | + //通过企业平台 校验模块权限 | ||
175 | + var user *domain.Users | ||
176 | + for j := range svr.Users { | ||
177 | + if svr.Users[j].CompanyId == c.Id { | ||
178 | + user = svr.Users[j] | ||
179 | + break | ||
180 | + } | ||
181 | + } | ||
182 | + if user != nil { | ||
183 | + if code, e := adminApiGateway.UserAuth(user.Id, constant.BUSINESS_ADMIN_PLATFORM_ID); e != nil || code != 0 { | ||
184 | + log.Debug("【检查权限】", svr.Phone, "【公司】", c.Id, user.Id, code, e.Error()) | ||
185 | + continue | ||
186 | + } else { | ||
187 | + log.Debug("【检查权限】", svr.Phone, "【公司】", c.Id, user.Id, code, e) | ||
188 | + } | ||
189 | + } | ||
190 | + } | ||
188 | item := newCompanyBase(c) | 191 | item := newCompanyBase(c) |
189 | companys = append(companys, item) | 192 | companys = append(companys, item) |
190 | } | 193 | } |
1 | package protocol | 1 | package protocol |
2 | 2 | ||
3 | const ( | 3 | const ( |
4 | - LoginByPassword = "signInPassword" | ||
5 | - LoginBySmsCode = "signInCaptcha" | 4 | + LoginByPassword = "signInPassword" |
5 | + LoginBySmsCode = "signInCaptcha" | ||
6 | + LoginByCredentials = "signInCredentials" | ||
6 | ) | 7 | ) |
7 | 8 | ||
8 | const AuthCodeExpire = 60 * 15 //15分钟过期 | 9 | const AuthCodeExpire = 60 * 15 //15分钟过期 |
@@ -15,11 +16,12 @@ const RefreshTokenExipre = 3600 * 24 * 30 * 1 //刷新token 一个月过期 | @@ -15,11 +16,12 @@ const RefreshTokenExipre = 3600 * 24 * 30 * 1 //刷新token 一个月过期 | ||
15 | 16 | ||
16 | /*Login */ | 17 | /*Login */ |
17 | type LoginRequest struct { | 18 | type LoginRequest struct { |
18 | - Phone string `json:"phone" valid:"Required;"` | ||
19 | - Password string `json:"password"` | ||
20 | - Captcha string `json:"captcha"` | ||
21 | - GrantType string `json:"grantType"` // 登录类型 1:密码 2:验证码 | ||
22 | - ClientId string `json:"clientId"` | 19 | + Phone string `json:"phone" valid:"Required;"` |
20 | + Password string `json:"password"` | ||
21 | + Captcha string `json:"captcha"` | ||
22 | + GrantType string `json:"grantType"` // 登录类型 1:密码 2:验证码 | ||
23 | + ClientId string `json:"clientId"` | ||
24 | + Credentials string `json:"credentials"` //凭证登录 | ||
23 | } | 25 | } |
24 | type LoginResponse struct { | 26 | type LoginResponse struct { |
25 | AuthCode string `json:"authCode"` | 27 | AuthCode string `json:"authCode"` |
@@ -5,6 +5,7 @@ type CenterCompanysResponse struct { | @@ -5,6 +5,7 @@ type CenterCompanysResponse struct { | ||
5 | ImToken string `json:"imToken"` //网易云信Token | 5 | ImToken string `json:"imToken"` //网易云信Token |
6 | CsAccountID string `json:"csAccountID"` //系统分配客服ID | 6 | CsAccountID string `json:"csAccountID"` //系统分配客服ID |
7 | Credentials string `json:"credentials"` //登录凭证 | 7 | Credentials string `json:"credentials"` //登录凭证 |
8 | + Phone string `json:"phone"` //登录手机号 | ||
8 | Partner interface{} `json:"partner"` //合伙人对象 | 9 | Partner interface{} `json:"partner"` //合伙人对象 |
9 | Manager interface{} `json:"manager"` //高管对象 | 10 | Manager interface{} `json:"manager"` //高管对象 |
10 | } | 11 | } |
-
请 注册 或 登录 后发表评论