Browse Source

Merge remote-tracking branch 'origin/eta/2.3' into debug

Roc 3 months ago
parent
commit
4a3479a627

+ 22 - 2
controllers/data_manage/public_chart.go

@@ -172,7 +172,14 @@ func (c *ChartPublicController) Cancel() {
 		return
 	}
 
-	chartInfoId, _ := c.GetInt("ChartInfoId")
+	var req request.CancelChartPublicReq
+	err := json.Unmarshal(c.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	chartInfoId := req.ChartInfoId
 	if chartInfoId <= 0 {
 		br.Msg = "参数错误"
 		br.ErrMsg = "参数错误"
@@ -214,8 +221,21 @@ func (c *ChartPublicController) Cancel() {
 			return
 		}
 	}
-
 	checkUserIdList := []int{sysUser.AdminId}
+	// 已经分享的用户
+	{
+		obj := data_manage.ChartInfoShare{}
+		userIdList, err := obj.GetAllUserIdListByChartInfoId(chartInfo.ChartInfoId)
+		if err != nil {
+			br.Msg = "设置失败!"
+			br.ErrMsg = "设置失败,Err:" + err.Error()
+			return
+		}
+		if len(userIdList) > 0 {
+			checkUserIdList = append(checkUserIdList, userIdList...)
+		}
+	}
+
 	noReferenced, otherUserIdList, err, tips := data.CheckChartReferencedByOthers([]int{chartInfo.ChartInfoId}, []string{chartInfo.UniqueCode}, checkUserIdList)
 	if err != nil {
 		br.Msg = "保存失败"

+ 23 - 1
controllers/data_manage/public_edb.go

@@ -171,7 +171,14 @@ func (c *EdbPublicController) Cancel() {
 		return
 	}
 
-	edbInfoId, _ := c.GetInt("EdbInfoId")
+	var req request.CancelEdbPublicReq
+	err := json.Unmarshal(c.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	edbInfoId := req.EdbInfoId
 	if edbInfoId <= 0 {
 		br.Msg = "参数错误"
 		br.ErrMsg = "参数错误"
@@ -215,6 +222,21 @@ func (c *EdbPublicController) Cancel() {
 	}
 
 	checkUserIdList := []int{sysUser.AdminId}
+
+	// 已经分享的用户
+	{
+		obj := data_manage.EdbInfoShare{}
+		userIdList, err := obj.GetAllUserIdListByEdbInfoId(edbInfo.EdbInfoId)
+		if err != nil {
+			br.Msg = "设置失败!"
+			br.ErrMsg = "设置失败,Err:" + err.Error()
+			return
+		}
+		if len(userIdList) > 0 {
+			checkUserIdList = append(checkUserIdList, userIdList...)
+		}
+	}
+
 	noReferenced, otherUserIdList, err, tips := data.CheckEdbReferencedByOthers(edbInfo.EdbInfoType, []int{edbInfo.EdbInfoId}, checkUserIdList)
 	if err != nil {
 		br.Msg = "保存失败"

+ 1 - 2
models/bi_dashboard/bi_dashboard_detail.go

@@ -79,7 +79,6 @@ func DeleteBiDashboardDetailByDetailId(id int) (err error) {
 // @return total int
 // @return err error
 func GetUserIdListRelationBiDashboardDetailByCondition(condition string, pars []interface{}) (userIdList []int, err error) {
-	o := global.DmSQL["data"]
 	sql := ` SELECT b.sys_admin_id FROM bi_dashboard_detail AS a 
 	JOIN bi_dashboard AS b on a.bi_dashboard_id = b.bi_dashboard_id WHERE 1=1 `
 	if condition != "" {
@@ -87,7 +86,7 @@ func GetUserIdListRelationBiDashboardDetailByCondition(condition string, pars []
 	}
 	sql += ` GROUP BY b.sys_admin_id `
 
-	err = o.Raw(sql, pars...).Scan(&userIdList).Error
+	err = global.DEFAULT_DmSQL.Raw(sql, pars...).Scan(&userIdList).Error
 
 	return
 }