|
@@ -145,3 +145,63 @@ func (this *ChartPermissionNoAuthController) ClassifyTree() {
|
|
|
br.Success = true
|
|
|
br.Ret = 200
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+func (this *ChartPermissionNoAuthController) List() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+ id, _ := this.GetInt("chartPermissonId", 0)
|
|
|
+
|
|
|
+ var resp *models.ChartPermissionResp[[]*models.ChartPermission]
|
|
|
+ var err error
|
|
|
+ if id == 0 {
|
|
|
+ resp, err = services.GetChartPermissionList()
|
|
|
+ } else if id > 0 {
|
|
|
+ resp, err = services.GetChartPermissionSecondList(id)
|
|
|
+ }
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "权限列表获取失败"
|
|
|
+ br.ErrMsg = "权限列表获取失败,系统错误,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if resp.Ret != 200 {
|
|
|
+ br.Msg = resp.Msg
|
|
|
+ br.ErrMsg = resp.ErrMsg
|
|
|
+ return
|
|
|
+ }
|
|
|
+ chartPermissionList := make([]*models.ChartPermissionView, 0)
|
|
|
+ for _, item := range resp.Data {
|
|
|
+ chartPermissionList = append(chartPermissionList, &models.ChartPermissionView{
|
|
|
+ ChartPermissionId: item.ChartPermissionId,
|
|
|
+ PermissionName: item.PermissionName,
|
|
|
+ Remark: item.Remark,
|
|
|
+ ImageUrl: item.ImageUrl,
|
|
|
+ ChartPermissionType: utils.PermissionTypeEta,
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if id != 0 {
|
|
|
+ chartPermissionList = append(chartPermissionList, &models.ChartPermissionView{
|
|
|
+ ChartPermissionId: -1,
|
|
|
+ PermissionName: utils.MINI_CUSTOM_PERMISSION_NAME,
|
|
|
+ Remark: "",
|
|
|
+ ImageUrl: "",
|
|
|
+ ChartPermissionType: utils.PermissionTypeMini,
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ br.Ret = 200
|
|
|
+ br.Data = chartPermissionList
|
|
|
+ br.Msg = "列表获取成功"
|
|
|
+ br.Success = true
|
|
|
+}
|