瀏覽代碼

no message

xingzai 1 年之前
父節點
當前提交
070aa42cd4
共有 1 個文件被更改,包括 16 次插入11 次删除
  1. 16 11
      services/chart.go

+ 16 - 11
services/chart.go

@@ -419,7 +419,7 @@ func GetChartDetailByChartId(cont context.Context) (err error) {
 }
 
 //func init() {
-//	GetChartDetailByChartId()
+//	GetChartDetailByApi(6159)
 //}
 
 // 同步图表详情
@@ -485,17 +485,17 @@ func GetChartDetailByApi(chartId int) (err error) {
 	}
 
 	//如果没有就新增 有就更新
-	if mapChartid[v.ChartId] == 0 {
+	if mapChartid[chartId] == 0 {
 		_, err := models.AddCygxChart(item)
 		if item.PublishStatus == 1 && v.IsActive {
-			go UpdateResourceData(item.ChartId, "newchart", "add", time.Now().Format(utils.FormatDateTime))
+			//go UpdateResourceData(chartId, "newchart", "add", time.Now().Format(utils.FormatDateTime))
 		}
 		if err != nil {
 			return err
 		}
 	} else {
 		if item.PublishStatus == 0 {
-			chartIdsDelete = append(chartIdsDelete, item.ChartId)
+			chartIdsDelete = append(chartIdsDelete, chartId)
 		}
 		updateParams := make(map[string]interface{})
 		updateParams["Title"] = v.Title
@@ -512,20 +512,20 @@ func GetChartDetailByApi(chartId int) (err error) {
 		updateParams["CtagIdTwo"] = v.CtagTwo.Id
 		updateParams["Cover"] = v.Cover
 		updateParams["Iframe"] = v.Iframe
-		whereParam := map[string]interface{}{"chart_id": v.ChartId}
+		whereParam := map[string]interface{}{"chart_id": chartId}
 		err = models.UpdateByExpr(models.CygxChart{}, whereParam, updateParams)
 		if err != nil {
 			return err
 		}
 		if item.PublishStatus == 0 {
-			go UpdateResourceData(item.ChartId, "newchart", "delete", time.Now().Format(utils.FormatDateTime))
+			//go UpdateResourceData(chartId, "newchart", "delete", time.Now().Format(utils.FormatDateTime))
 		}
 	}
 	//}
 	fmt.Println("删除的", chartIdsDelete)
-	if len(chartIdsDelete) > 0 {
-		go Deletenewchart(chartIdsDelete)
-	}
+	//if len(chartIdsDelete) > 0 {
+	//	go Deletenewchart(chartIdsDelete)
+	//}
 
 	//策略平台图表,记录所有,的显示用户收藏使用
 	{
@@ -548,8 +548,13 @@ func GetChartDetailByApi(chartId int) (err error) {
 		item.Cover = v.Cover
 		item.Iframe = v.Iframe
 
+		//如果是软删除就做取消发布处理
+		if !v.IsActive {
+			item.PublishStatus = 0
+		}
+
 		//如果没有就新增 有就更新
-		if mapAllChartid[v.ChartId] == 0 {
+		if mapAllChartid[chartId] == 0 {
 			_, err := models.AddCygxChartAll(item)
 			if err != nil {
 				return err
@@ -570,7 +575,7 @@ func GetChartDetailByApi(chartId int) (err error) {
 			updateParams["CtagIdTwo"] = v.CtagTwo.Id
 			updateParams["Cover"] = v.Cover
 			updateParams["Iframe"] = v.Iframe
-			whereParam := map[string]interface{}{"chart_id": v.ChartId}
+			whereParam := map[string]interface{}{"chart_id": chartId}
 			err = models.UpdateByExpr(models.CygxChartAll{}, whereParam, updateParams)
 			if err != nil {
 				return err