xingzai 1 anno fa
parent
commit
891eeb85d1

+ 3 - 3
controllers/yanxuan_special.go

@@ -335,7 +335,7 @@ func (this *YanxuanSpecialController) Save() {
 	if req.DoType == 2 {
 		go services.SendReviewTemplateMsgAdmin(specialId)
 		go services.UpdateYanxuanSpecialResourceData(specialId) //  写入首页最新  cygx_resource_data 表
-		go services.AddYanxuanSpecial(specialId)                //  写入es 综合搜索
+		go services.EsAddYanxuanSpecial(specialId)              //  写入es 综合搜索
 	}
 
 	br.Ret = 200
@@ -429,7 +429,7 @@ func (this *YanxuanSpecialController) Enable() {
 	}
 	go services.SendWxMsgSpecialAuthor(req.Id, status)
 	go services.UpdateYanxuanSpecialResourceData(req.Id) //  写入首页最新  cygx_resource_data 表
-	go services.AddYanxuanSpecial(req.Id)                //  写入es 综合搜索
+	go services.EsAddYanxuanSpecial(req.Id)              //  写入es 综合搜索
 	br.Msg = "审批成功"
 	br.Ret = 200
 	br.Success = true
@@ -822,7 +822,7 @@ func (this *YanxuanSpecialController) Cancel() {
 		return
 	}
 	go services.UpdateYanxuanSpecialResourceData(req.Id) //  写入首页最新  cygx_resource_data 表
-	go services.AddYanxuanSpecial(req.Id)                //  写入es 综合搜索
+	go services.EsAddYanxuanSpecial(req.Id)              //  写入es 综合搜索
 	br.Msg = "取消发布成功"
 	br.Ret = 200
 	br.Success = true

+ 8 - 0
models/resource_data.go

@@ -135,3 +135,11 @@ func GetCygxResourceDataByIdAndSource(sourceId int, source string) (item *CygxRe
 	err = o.Raw(sql, sourceId, source).QueryRow(&item)
 	return
 }
+
+// 获取数量
+func GetCygxResourceDataBySourceAndIdCount(sourceId int, source string) (count int, err error) {
+	o := orm.NewOrm()
+	sqlCount := ` SELECT COUNT(1) AS count  FROM cygx_resource_data  WHERE  source_id = ? AND source =?  `
+	err = o.Raw(sqlCount, sourceId, source).QueryRow(&count)
+	return
+}

+ 1 - 1
services/cygx_yanxuan_special.go

@@ -268,7 +268,7 @@ func UpdateYanxuanSpecialResourceData(sourceId int) {
 		}
 	} else {
 		//判断是否存在,如果不存在就新增,存在就更新
-		totalData, e := models.GetCygxReportSelectionBySourceAndId(sourceId, source)
+		totalData, e := models.GetCygxResourceDataBySourceAndIdCount(sourceId, source)
 		if e != nil {
 			err = errors.New("GetCygxReportSelectionBySourceAndId, Err: " + e.Error())
 			return

+ 1 - 1
services/es_comprehensive.go

@@ -585,7 +585,7 @@ func AddComprehensiveRoadshow() {
 }
 
 // Es研选专栏
-func AddYanxuanSpecial(sourceId int) {
+func EsAddYanxuanSpecial(sourceId int) {
 	var err error
 	defer func() {
 		if err != nil {

+ 1 - 1
services/resource_data.go

@@ -554,7 +554,7 @@ func UpdateArticleResourceData(sourceId int) {
 		}
 	} else {
 		//判断是否存在,如果不存在就新增,存在就更新
-		totalData, e := models.GetCygxReportSelectionBySourceAndId(sourceId, source)
+		totalData, e := models.GetCygxResourceDataBySourceAndIdCount(sourceId, source)
 		if e != nil {
 			err = errors.New("GetCygxReportSelectionBySourceAndId, Err: " + e.Error())
 			return