ziwen 1 year ago
parent
commit
a8830c5328
2 changed files with 10 additions and 8 deletions
  1. 2 1
      controllers/yanxuan_special.go
  2. 8 7
      models/cygx_yanxuan_special.go

+ 2 - 1
controllers/yanxuan_special.go

@@ -110,7 +110,8 @@ func (this *YanxuanSpecialController) Detail() {
 
 	if item.Status != 3 && item.Status != 2 {
 		br.Msg = "获取失败,专栏未发布"
-		br.ErrMsg = "获取失败, Err:" + tmpErr.Error()
+		br.ErrMsg = "获取失败, 专栏未发布"
+		br.Ret = 200
 		return
 	}
 

+ 8 - 7
models/cygx_yanxuan_special.go

@@ -43,6 +43,8 @@ type CygxYanxuanSpecialItem struct {
 	Reason       string // 理由
 	Title        string // 标题
 	Type         string // 类型1:笔记,2:观点
+	CollectNum   int
+	IsCollect    int
 }
 
 func GetYanxuanSpecialList(condition string, pars []interface{}) (items []*CygxYanxuanSpecialItem, err error) {
@@ -115,31 +117,30 @@ func UpdateYanxuanSpecial(item *CygxYanxuanSpecial) (err error) {
 	sql := ``
 	sql = `UPDATE cygx_yanxuan_special SET title=?,content=?,tags=?,img_url=?,doc_url=?,type=?,status=?,
 	modify_time=NOW(),publish_time=NOW() WHERE id = ? `
-	_, err = o.Raw(sql, item.Title, item.Content,item.Tags,item.ImgUrl,item.DocUrl,item.Type,item.Status).Exec()
+	_, err = o.Raw(sql, item.Title, item.Content, item.Tags, item.ImgUrl, item.DocUrl, item.Type, item.Status, item.Id).Exec()
 	return
 }
 
-
-
 func GetYanxuanSpecialIndustry(keyword string) (IndustryNames []string, err error) {
 	o := orm.NewOrm()
 	sql := ``
-	if keyword == ""{
+	if keyword == "" {
 		sql = `SELECT industry_name FROM cygx_yanxuan_special_industry `
 	} else {
-		sql = `SELECT industry_name FROM cygx_yanxuan_special_industry WHERE industry_name LIKE '%`+keyword+`%' `
+		sql = `SELECT industry_name FROM cygx_yanxuan_special_industry WHERE industry_name LIKE '%` + keyword + `%' `
 	}
 	_, err = o.Raw(sql).QueryRows(&IndustryNames)
 	return
 }
 
 type CancelPublishCygxYanxuanSpecialReq struct {
-	Id     int    // 文章id
+	Id int // 文章id
 }
+
 func CancelPublishYanxuanSpecial(id int) (err error) {
 	o := orm.NewOrm()
 	sql := ``
 	sql = `UPDATE cygx_yanxuan_special SET status=1,publish_time=NOW() WHERE id = ? `
 	_, err = o.Raw(sql, id).Exec()
 	return
-}
+}