作者 yangfu

修改:登录验证修改

@@ -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: {}
@@ -336,7 +336,7 @@ func CenterCompanys(header *protocol.RequestHeader, request *protocolx.CenterCom @@ -336,7 +336,7 @@ func CenterCompanys(header *protocol.RequestHeader, request *protocolx.CenterCom
336 rsp.ImToken = imInfo.ImToken 336 rsp.ImToken = imInfo.ImToken
337 rsp.Accid, _ = strconv.Atoi(imInfo.ImId) 337 rsp.Accid, _ = strconv.Atoi(imInfo.ImId)
338 rsp.Phone = request.Phone 338 rsp.Phone = request.Phone
339 - rsp.Credentials, _ = utils.GenerateToken(int64(phoneId), request.Phone, 60*time.Second) 339 + rsp.Credentials, _ = utils.GenerateToken(int64(phoneId), request.Phone, protocol.RefreshTokenExipre*time.Second)
340 340
341 err = transactionContext.CommitTransaction() 341 err = transactionContext.CommitTransaction()
342 v = map[string]interface{}{"center": rsp} 342 v = map[string]interface{}{"center": rsp}
@@ -358,7 +358,7 @@ func Companys(header *protocol.RequestHeader, request *protocolx.CompanysRequest @@ -358,7 +358,7 @@ func Companys(header *protocol.RequestHeader, request *protocolx.CompanysRequest
358 transactionContext.RollbackTransaction() 358 transactionContext.RollbackTransaction()
359 }() 359 }()
360 if claim, err = utils.ParseJWTToken(request.Credentials); err != nil { 360 if claim, err = utils.ParseJWTToken(request.Credentials); err != nil {
361 - err = protocol.NewErrWithMessage(4139, err) 361 + err = protocol.NewErrWithMessage(4140, err)
362 return 362 return
363 } 363 }
364 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")