You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.4 KiB
46 lines
1.4 KiB
package empower
|
|
|
|
import (
|
|
"key_performance_indicators/overall/publicmethod"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// 系统授权
|
|
func (a *ApiMethod) ObtainAuthorization(c *gin.Context) {
|
|
var receivedValue getSystemEmpower
|
|
err := c.ShouldBindJSON(&receivedValue)
|
|
if err != nil {
|
|
publicmethod.Result(100, err, c)
|
|
return
|
|
}
|
|
if receivedValue.System == "" {
|
|
publicmethod.Result(1, err, c, "未知系统!不可授权!")
|
|
return
|
|
}
|
|
//获取登录人信息
|
|
context, err := publicmethod.LoginMyCont(c)
|
|
if err != nil {
|
|
publicmethod.Result(1, err, c, "未知身份!不可授权!")
|
|
return
|
|
}
|
|
|
|
menuIdAry, menuUrl, err := publicmethod.GetPostPower(context.AdminOrg, context.Position, receivedValue.System)
|
|
|
|
// var systemPermission modelssystempermission.Empower
|
|
// err = systemPermission.GetCont(map[string]interface{}{"`state`": 1, "`ordid`": context.AdminOrg, "`post_id`": context.Position, "`system`": receivedValue.System}, "`point_id`")
|
|
if err != nil {
|
|
publicmethod.Result(1, err, c, "没有可使用的授权信息!")
|
|
return
|
|
}
|
|
// // var pointId []string
|
|
// pointId := strings.Split(systemPermission.PointId, ",")
|
|
// if len(pointId) < 1 {
|
|
// publicmethod.Result(1, err, c, "没有可使用的授23权信息!")
|
|
// return
|
|
// }
|
|
sendData := publicmethod.MapOut[string]()
|
|
sendData["powerid"] = menuIdAry
|
|
sendData["powerurl"] = menuUrl
|
|
publicmethod.Result(0, sendData, c)
|
|
}
|
|
|