|
@@ -74,63 +74,6 @@ func GetCygxAskserieVideoLabelMap(askserieVideoIds []int) (mapResp map[int]strin
|
|
|
// UpdateAskserieVideoResourceData(75)
|
|
|
//}
|
|
|
|
|
|
-// 更新问答系列 写入首页最新 cygx_resource_data 表
|
|
|
-func UpdateAskserieVideoResourceData(sourceId int) {
|
|
|
- var err error
|
|
|
- defer func() {
|
|
|
- if err != nil {
|
|
|
- fmt.Println(err)
|
|
|
- go alarm_msg.SendAlarmMsg(fmt.Sprint("更新问答系列ourceId: ", sourceId, err.Error()), 2)
|
|
|
- }
|
|
|
- }()
|
|
|
- var source = utils.CYGX_OBJ_ASKSERIEVIDEO
|
|
|
- var condition string
|
|
|
- var pars []interface{}
|
|
|
- condition = ` AND publish_status = 1 AND askserie_video_id = ? `
|
|
|
- pars = append(pars, sourceId)
|
|
|
- total, e := cygx.GetCygxAskserieVideoCount(condition, pars)
|
|
|
-
|
|
|
- if e != nil {
|
|
|
- err = errors.New("GetCygxAskserieVideoCount, Err: " + e.Error())
|
|
|
- return
|
|
|
- }
|
|
|
- //如果取消发布了就做删除处理
|
|
|
- if total == 0 {
|
|
|
- e = cygx.DeleteResourceData(sourceId, source)
|
|
|
- if e != nil {
|
|
|
- err = errors.New("DeleteResourceData, Err: " + e.Error())
|
|
|
- return
|
|
|
- }
|
|
|
- } else {
|
|
|
- //判断是否存在,如果不存在就新增,存在就更新
|
|
|
- totalData, e := cygx.GetCygxResourceDataBySourceAndIdCount(sourceId, source)
|
|
|
- if e != nil {
|
|
|
- err = errors.New("GetCygxReportSelectionBySourceAndId, Err: " + e.Error())
|
|
|
- return
|
|
|
- }
|
|
|
- publishDate := time.Now().Format(utils.FormatDateTime)
|
|
|
- item := new(cygx.CygxResourceData)
|
|
|
- item.SourceId = sourceId
|
|
|
- item.Source = source
|
|
|
- item.PublishDate = publishDate
|
|
|
- item.CreateTime = time.Now()
|
|
|
- if totalData == 0 {
|
|
|
- _, e := cygx.AddCygxResourceData(item)
|
|
|
- if e != nil {
|
|
|
- err = errors.New("AddCygxResourceData, Err: " + e.Error())
|
|
|
- return
|
|
|
- }
|
|
|
- } else {
|
|
|
- e = cygx.UpdateResourceDataByItem(item)
|
|
|
- if e != nil {
|
|
|
- err = errors.New("UpdateResourceDataByItem, Err: " + e.Error())
|
|
|
- return
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
func init12() {
|
|
|
var conditionupload string
|
|
|
var pars []interface{}
|
|
@@ -182,12 +125,12 @@ func init12() {
|
|
|
fmt.Println(item.PublishDate, "PublishDate")
|
|
|
//fmt.Println(item, strings.Join(industrialManagementIds, ","))
|
|
|
|
|
|
- //newId, err := cygx.AddCygxAskserieVideo(item, strings.Join(industrialManagementIds, ","))
|
|
|
- //fmt.Println(newId)
|
|
|
- //if err != nil {
|
|
|
- // fmt.Println(err)
|
|
|
- // return
|
|
|
- //}
|
|
|
+ newId, err := cygx.AddCygxAskserieVideo(item, strings.Join(industrialManagementIds, ","))
|
|
|
+ fmt.Println(newId)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println(err)
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|