作者 tangxvhui

bug 修复

@@ -521,7 +521,7 @@ func SmsCodeCheck(phone string, code string) error { @@ -521,7 +521,7 @@ func SmsCodeCheck(phone string, code string) error {
521 } 521 }
522 522
523 //InitPermission 登录时权限初始化 523 //InitPermission 登录时权限初始化
524 -func InitPermission(usercompanyid int64, usercompamyid int64) (map[string]serverbac.PermissionOptionObject, error) { 524 +func InitPermission(usercompanyid int64, userid int64) (map[string]serverbac.PermissionOptionObject, error) {
525 var ( 525 var (
526 err error 526 err error
527 permissionMap = make(map[string]serverbac.PermissionOptionObject) 527 permissionMap = make(map[string]serverbac.PermissionOptionObject)
@@ -532,7 +532,7 @@ func InitPermission(usercompanyid int64, usercompamyid int64) (map[string]server @@ -532,7 +532,7 @@ func InitPermission(usercompanyid int64, usercompamyid int64) (map[string]server
532 return permissionMap, err 532 return permissionMap, err
533 } 533 }
534 534
535 - err = redisdata.SetUserPermission(permissionMap, usercompamyid) 535 + err = redisdata.SetUserPermission(permissionMap, userid)
536 if err != nil { 536 if err != nil {
537 log.Error("缓存用户权限失败:%s", err) 537 log.Error("缓存用户权限失败:%s", err)
538 } 538 }
@@ -577,7 +577,7 @@ func LoginAuthBySecretKey(secretKey string) (protocol.LoginAuthToken, error) { @@ -577,7 +577,7 @@ func LoginAuthBySecretKey(secretKey string) (protocol.LoginAuthToken, error) {
577 var ( 577 var (
578 err error 578 err error
579 logintoken protocol.LoginAuthToken 579 logintoken protocol.LoginAuthToken
580 - usercompanyid int64 580 + // usercompanyid int64
581 userdata *models.User 581 userdata *models.User
582 companyData *models.Company 582 companyData *models.Company
583 ) 583 )
@@ -628,6 +628,6 @@ func LoginAuthBySecretKey(secretKey string) (protocol.LoginAuthToken, error) { @@ -628,6 +628,6 @@ func LoginAuthBySecretKey(secretKey string) (protocol.LoginAuthToken, error) {
628 if err != nil { 628 if err != nil {
629 log.Error("更新用户user_company数据失败:%s", err) 629 log.Error("更新用户user_company数据失败:%s", err)
630 } 630 }
631 - InitPermission(usercompanyid, userdata.Id) 631 + InitPermission(ucompany.Id, userdata.Id)
632 return logintoken, err 632 return logintoken, err
633 } 633 }
@@ -8,6 +8,7 @@ import ( @@ -8,6 +8,7 @@ import (
8 "oppmg/protocol" 8 "oppmg/protocol"
9 "oppmg/services/rbac" 9 "oppmg/services/rbac"
10 "strings" 10 "strings"
  11 + "time"
11 ) 12 )
12 13
13 func SetLoginToken(param protocol.LoginAuthToken, userid int64, companyid int64) error { 14 func SetLoginToken(param protocol.LoginAuthToken, userid int64, companyid int64) error {
@@ -116,7 +117,7 @@ func SetUserPermission(objMap map[string]rbac.PermissionOptionObject, userid int @@ -116,7 +117,7 @@ func SetUserPermission(objMap map[string]rbac.PermissionOptionObject, userid int
116 log.Error("设置权限缓存失败:%s", err) 117 log.Error("设置权限缓存失败:%s", err)
117 } 118 }
118 } 119 }
119 - // client.Expire(key, 60*60*6*time.Second) 120 + client.Expire(key, 60*60*6*time.Second)
120 return nil 121 return nil
121 } 122 }
122 123