KPI绩效考核系统
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.

51 lines
1.7 KiB

3 years ago
package empower
import (
"key_performance_indicators/overall/publicmethod"
"strings"
3 years ago
"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
}
// jsonStr, _ := json.Marshal(receivedValue)
// fmt.Printf("jsonStr------>%v\n", string(jsonStr))
// menuIdAry, menuUrl, err := publicmethod.GetPostPower(context.AdminOrg, context.Position, receivedValue.System)
_, pointId, operation, _ := publicmethod.GetNewAccredit(receivedValue.System, context.Role, context.Key, context.AdminOrg, context.Position)
// var systemPermission modelssystempermission.Empower
// err = systemPermission.GetCont(map[string]interface{}{"`state`": 1, "`ordid`": context.AdminOrg, "`post_id`": context.Position, "`system`": receivedValue.System}, "`point_id`")
3 years ago
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"] = strings.Split(pointId, ",")
sendData["poweroperationid"] = strings.Split(operation, ",")
sendData["powerurl"] = []string{}
publicmethod.Result(0, sendData, c)
3 years ago
}