@ -6,11 +6,13 @@ import (
"key_performance_indicators/middleware/grocerystore"
"key_performance_indicators/middleware/grocerystore"
"key_performance_indicators/middleware/wechatapp/wechatstatice"
"key_performance_indicators/middleware/wechatapp/wechatstatice"
"key_performance_indicators/models/modelshr"
"key_performance_indicators/models/modelshr"
"key_performance_indicators/models/modelssystempermission"
"key_performance_indicators/overall"
"key_performance_indicators/overall"
"key_performance_indicators/overall/publicmethod"
"key_performance_indicators/overall/publicmethod"
"net/http"
"net/http"
"net/url"
"net/url"
"strconv"
"strconv"
"strings"
"time"
"time"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
@ -299,7 +301,11 @@ func SetUpUserLogin(openId string) (userCont modelshr.ManCont, sendMap map[strin
sha1Str := userKeyCode + userCont . Number + userCont . Password + md5Token
sha1Str := userKeyCode + userCont . Number + userCont . Password + md5Token
sha1Token := publicmethod . Sha1Encryption ( sha1Str )
sha1Token := publicmethod . Sha1Encryption ( sha1Str )
//身份识别数据
//身份识别数据
menuoper , jurisdiction := getRoleSeat ( userCont . Role )
// menuoper, jurisdiction := getRoleSeat(userCont.Role)
//获取身份权限
menuoper , jurisdiction := GetRoleAndPostPower ( "kpi" , userCont . Role , userCont . AdminOrg , userCont . Position )
writeRedisData := map [ string ] interface { } {
writeRedisData := map [ string ] interface { } {
"userkey" : userKeyCode ,
"userkey" : userKeyCode ,
"key" : userCont . Key ,
"key" : userCont . Key ,
@ -569,3 +575,96 @@ func (a *ApiMethod) ScanQrCodeCallBackAuthUser(c *gin.Context) {
// publicmethod.Result(1, callBackLoginUrl, c, "未能查询到您的信息!企业微信授权失败!5")
// publicmethod.Result(1, callBackLoginUrl, c, "未能查询到您的信息!企业微信授权失败!5")
c . Redirect ( http . StatusMovedPermanently , callBackLoginUrl )
c . Redirect ( http . StatusMovedPermanently , callBackLoginUrl )
}
}
/ *
*
@ 作者 : 秦东
@ 时间 : 2022 - 11 - 23 15 : 02 : 11
@ 功能 : 获取新权限
@ 参数
# systemName 系统
# roleId 角色Id
# orgId 行政组织ID
# postId 岗位ID
@ 返回值
# menuPower 菜单权限
# operationPower 操作权限
@ 方法原型
# GetRoleAndPostPower ( systemName , roleId string , orgId , postId int64 ) ( menuPower , operationPower string )
* /
func GetRoleAndPostPower ( systemName , roleId string , orgId , postId int64 ) ( menuPower , operationPower string ) {
var menuAry [ ] string
var operationAry [ ] string
if roleId != "" {
roleIdAry := strings . Split ( roleId , "," )
if len ( roleIdAry ) > 0 {
var roleContList [ ] modelssystempermission . RoleEmpower
// err := roleCont.GetCont(map[string]interface{}{"`system`": systemName, "`role_id`": roleId}, "`point_id`", "`operation`")
err := overall . CONSTANT_DB_System_Permission . Model ( & modelssystempermission . RoleEmpower { } ) . Select ( "`point_id`,`operation`,`level`" ) . Where ( "`system` = ? AND `role_id` IN ?" , systemName , roleIdAry ) . Find ( & roleContList ) . Error
if err == nil && len ( roleContList ) > 0 {
for _ , rev := range roleContList {
menuList := strings . Split ( rev . PointId , "," )
for _ , mv := range menuList { //菜单权限
if publicmethod . IsInTrue [ string ] ( mv , menuAry ) == false {
menuAry = append ( menuAry , mv )
}
}
operList := strings . Split ( rev . Operation , "," )
for _ , ov := range operList { //操作权限
if publicmethod . IsInTrue [ string ] ( ov , operationAry ) == false {
operationAry = append ( operationAry , ov )
}
}
}
}
}
}
if orgId != 0 && postId != 0 {
var postCont modelssystempermission . Empower
err := postCont . GetCont ( map [ string ] interface { } { "`system`" : systemName , "`organization`" : orgId , "`post_id`" : postId } , "`point_id`" , "`operation`" )
if err == nil {
if postCont . PointId != "" {
if len ( menuAry ) < 1 {
menuAry = strings . Split ( postCont . PointId , "," )
} else {
guoduPostAry := strings . Split ( postCont . PointId , "," )
for _ , v := range guoduPostAry {
if publicmethod . IsInTrue [ string ] ( v , menuAry ) == false {
menuAry = append ( menuAry , v )
}
}
}
}
if postCont . Operation != "" {
if len ( operationAry ) < 1 {
operationAry = strings . Split ( postCont . Operation , "," )
} else {
guoduPostAryOp := strings . Split ( postCont . Operation , "," )
for _ , v := range guoduPostAryOp {
if publicmethod . IsInTrue [ string ] ( v , operationAry ) == false {
operationAry = append ( operationAry , v )
}
}
}
}
}
}
if len ( menuAry ) > 1 {
menuPower = strings . Join ( menuAry , "," )
}
if len ( operationAry ) > 1 {
operationPower = strings . Join ( operationAry , "," )
}
return
}