瀏覽代碼

Merge branch 'ETA_2.2.2' into debug

xiziwen 5 月之前
父節點
當前提交
6e755d0279
共有 2 個文件被更改,包括 5 次插入11 次删除
  1. 2 8
      controllers/bi_dashboard.go
  2. 3 3
      models/bi_dashboard/bi_dashboard.go

+ 2 - 8
controllers/bi_dashboard.go

@@ -69,7 +69,7 @@ func (this *BIDaShboardController) AddDashboard() {
 		br.Msg = "名称不能为空"
 		return
 	}
-	nameItem, err := bi_dashboard.GetDashboardByName(req.BiDashboardName)
+	nameItem, err := bi_dashboard.GetDashboardByName(req.BiDashboardName, this.SysUser.AdminId)
 	if err != nil && err.Error() != utils.ErrNoRow() {
 		br.Msg = "查询失败"
 		br.ErrMsg = "查询失败,Err:" + err.Error()
@@ -151,13 +151,7 @@ func (this *BIDaShboardController) EditDashboard() {
 		br.ErrMsg = "获取数据异常,Err:" + err.Error()
 		return
 	}
-
-	// 判断权限
-	if item.SysAdminId != this.SysUser.AdminId {
-		br.Msg = `无权编辑`
-		return
-	}
-
+	
 	// 修改
 	item.BiDashboardName = req.BiDashboardName
 	item.ModifyTime = time.Now()

+ 3 - 3
models/bi_dashboard/bi_dashboard.go

@@ -161,9 +161,9 @@ WHERE a.sys_admin_id = ? GROUP BY a.bi_dashboard_id   `
 }
 
 // getByName
-func GetDashboardByName(name string) (item *BiDashboard, err error) {
-	sql := `SELECT * FROM bi_dashboard WHERE bi_dashboard_name = ? limit 1`
+func GetDashboardByName(name string,adminId int) (item *BiDashboard, err error) {
+	sql := `SELECT * FROM bi_dashboard WHERE bi_dashboard_name = ? and sys_admin_id =? limit 1`
 	o := orm.NewOrm()
-	err = o.Raw(sql, name).QueryRow(&item)
+	err = o.Raw(sql, name, adminId).QueryRow(&item)
 	return
 }