作者 tangxvhui

bug 修复

... ... @@ -521,7 +521,7 @@ func SmsCodeCheck(phone string, code string) error {
}
//InitPermission 登录时权限初始化
func InitPermission(usercompanyid int64, usercompamyid int64) (map[string]serverbac.PermissionOptionObject, error) {
func InitPermission(usercompanyid int64, userid int64) (map[string]serverbac.PermissionOptionObject, error) {
var (
err error
permissionMap = make(map[string]serverbac.PermissionOptionObject)
... ... @@ -532,7 +532,7 @@ func InitPermission(usercompanyid int64, usercompamyid int64) (map[string]server
return permissionMap, err
}
err = redisdata.SetUserPermission(permissionMap, usercompamyid)
err = redisdata.SetUserPermission(permissionMap, userid)
if err != nil {
log.Error("缓存用户权限失败:%s", err)
}
... ... @@ -577,7 +577,7 @@ func LoginAuthBySecretKey(secretKey string) (protocol.LoginAuthToken, error) {
var (
err error
logintoken protocol.LoginAuthToken
usercompanyid int64
// usercompanyid int64
userdata *models.User
companyData *models.Company
)
... ... @@ -628,6 +628,6 @@ func LoginAuthBySecretKey(secretKey string) (protocol.LoginAuthToken, error) {
if err != nil {
log.Error("更新用户user_company数据失败:%s", err)
}
InitPermission(usercompanyid, userdata.Id)
InitPermission(ucompany.Id, userdata.Id)
return logintoken, err
}
... ...
... ... @@ -8,6 +8,7 @@ import (
"oppmg/protocol"
"oppmg/services/rbac"
"strings"
"time"
)
func SetLoginToken(param protocol.LoginAuthToken, userid int64, companyid int64) error {
... ... @@ -116,7 +117,7 @@ func SetUserPermission(objMap map[string]rbac.PermissionOptionObject, userid int
log.Error("设置权限缓存失败:%s", err)
}
}
// client.Expire(key, 60*60*6*time.Second)
client.Expire(key, 60*60*6*time.Second)
return nil
}
... ...