package empower import ( "key_performance_indicators/models/modelssystempermission" "key_performance_indicators/overall/publicmethod" "strings" "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 } 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 } publicmethod.Result(0, pointId, c) }