Ver Fonte

no message

xingzai há 1 ano atrás
pai
commit
f7de5c0efd
2 ficheiros alterados com 31 adições e 2 exclusões
  1. 10 0
      models/cygx_yanxuan_special.go
  2. 21 2
      services/cygx_yanxuan_special.go

+ 10 - 0
models/cygx_yanxuan_special.go

@@ -153,6 +153,16 @@ JOIN cygx_yanxuan_special_author AS b ON a.user_id = b.user_id
 	return
 }
 
+func GetYanxuanSpecialBySpecialId(specialId int) (item *CygxYanxuanSpecialItem, err error) {
+	o := orm.NewOrm()
+	sql := ``
+	sql = `SELECT a.*
+FROM cygx_yanxuan_special AS a
+ WHERE a.id=? `
+	err = o.Raw(sql, specialId).QueryRow(&item)
+	return
+}
+
 type CygxYanxuanSpecialReq struct {
 	Id           int    `orm:"column(id);pk"`
 	Content      string // 内容

+ 21 - 2
services/cygx_yanxuan_special.go

@@ -226,7 +226,20 @@ func SendWxMsgSpecialAuthor(specialId, status int) (err error) {
 }
 
 //func init() {
-//	UpdateYanxuanSpecialResourceData(185)
+//
+//	var condition string
+//	var pars []interface{}
+//
+//	condition = " AND   a.user_id = 103354  "
+//	list, tmpErr := models.GetYanxuanSpecialList(0, condition, pars)
+//
+//	fmt.Println(len(list))
+//	fmt.Println(tmpErr)
+//
+//	for _, v := range list {
+//		fmt.Println(v.Id)
+//		EsAddYanxuanSpecial(v.Id)
+//	}
 //}
 
 // 更新研选专栏  写入首页最新  cygx_resource_data 表
@@ -261,7 +274,13 @@ func UpdateYanxuanSpecialResourceData(sourceId int) {
 			err = errors.New("GetCygxReportSelectionBySourceAndId, Err: " + e.Error())
 			return
 		}
-		publishDate := time.Now().Format(utils.FormatDateTime)
+
+		detail, e := models.GetYanxuanSpecialBySpecialId(sourceId)
+		if e != nil {
+			err = errors.New("GetYanxuanSpecialBySpecialId, Err: " + e.Error())
+			return
+		}
+		publishDate := detail.PublishTime
 		item := new(models.CygxResourceData)
 		item.SourceId = sourceId
 		item.Source = source