Browse Source

no message

xingzai 7 months ago
parent
commit
2fe5d62a43
2 changed files with 21 additions and 1 deletions
  1. 20 0
      models/cygx_yanxuan_special.go
  2. 1 1
      services/resource_data.go

+ 20 - 0
models/cygx_yanxuan_special.go

@@ -129,6 +129,26 @@ JOIN cygx_yanxuan_special_author AS b ON a.user_id = b.user_id
 	return
 }
 
+func GetYanxuanSpecialListHome(userId int, condition string, pars []interface{}, startSize, pageSize int) (items []*CygxYanxuanSpecialItem, err error) {
+	o := orm.NewOrm()
+	sql := ``
+	sql = `SELECT a.*,b.id AS special_column_id,b.bg_img,b.head_img,b.introduction,b.label,b.mobile,b.nick_name,b.real_name,b.special_name,b.status AS author_status
+FROM cygx_yanxuan_special AS a
+JOIN cygx_yanxuan_special_author AS b ON a.user_id = b.user_id 
+ WHERE 1=1 `
+	if condition != "" {
+		sql += condition
+	}
+	sql += `ORDER BY a.publish_time DESC `
+	if startSize+pageSize > 0 {
+		sql += ` LIMIT ?,? `
+		_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
+	} else {
+		_, err = o.Raw(sql, pars).QueryRows(&items)
+	}
+	return
+}
+
 type EnableCygxYanxuanSpecialReq struct {
 	Id     int    // 文章id
 	Status int    // 1通过2驳回

+ 1 - 1
services/resource_data.go

@@ -163,7 +163,7 @@ func GetResourceDataList(condition string, pars []interface{}, startSize, pageSi
 		pars = make([]interface{}, 0)
 		condition = ` AND a.id IN (` + utils.GetOrmInReplace(lenyanxuanSpecialIds) + `) `
 		pars = append(pars, yanxuanSpecialIds)
-		listyanxuanSpecial, e := models.GetYanxuanSpecialList(user.UserId, condition, pars, 0, 0)
+		listyanxuanSpecial, e := models.GetYanxuanSpecialListHome(user.UserId, condition, pars, 0, 0)
 		if e != nil {
 			err = errors.New("GetYanxuanSpecialList, Err: " + e.Error())
 			return