|
@@ -59,14 +59,25 @@ func (m *MessageDAO) GetNewsListCount(locationid, title, orgid string) (int, err
|
59
|
59
|
// GetNewsByLocation 根据位置获取咨询信息
|
60
|
60
|
func (m *MessageDAO) GetNewsByLocation(locationid, orgid string) ([]model.TaCmsNews, error) {
|
61
|
61
|
var news []model.TaCmsNews
|
62
|
|
- err := m.db.Where("status>"+strconv.Itoa(models.STATUS_DEL)).And("org_id=?", orgid).In("news_id", builder.Select("news_id").From("ta_cms_location").Where(builder.Eq{"location_id": locationid})).Find(&news)
|
|
62
|
+ err := m.db.Where("status>"+strconv.Itoa(models.STATUS_DEL)).
|
|
63
|
+ And("org_id=?", orgid).
|
|
64
|
+ In("news_id", builder.Select("news_id").From("ta_cms_location").Where(builder.Eq{"location_id": locationid})).
|
|
65
|
+ Desc("create_date").
|
|
66
|
+ Find(&news)
|
63
|
67
|
return news, err
|
64
|
68
|
}
|
65
|
69
|
|
66
|
70
|
// GetNewsByLocationShow 根据位置获取咨询信息
|
67
|
71
|
func (m *MessageDAO) GetNewsByLocationShow(locationid, orgid string) ([]model.TaCmsNews, error) {
|
68
|
72
|
var news []model.TaCmsNews
|
69
|
|
- err := m.db.Where("status = ?", models.STATUS_NORMAL).And("org_id=?", orgid).In("news_id", builder.Select("news_id").From("ta_cms_location").Where(builder.Eq{"location_id": locationid})).Find(&news)
|
|
73
|
+
|
|
74
|
+ // 2018年10月9日 yansen 默认限制 20 条
|
|
75
|
+ err := m.db.Where("status = ?", models.STATUS_NORMAL).
|
|
76
|
+ And("org_id=?", orgid).
|
|
77
|
+ In("news_id", builder.Select("news_id").From("ta_cms_location").Where(builder.Eq{"location_id": locationid})).
|
|
78
|
+ Desc("public_date").
|
|
79
|
+ Limit(20).
|
|
80
|
+ Find(&news)
|
70
|
81
|
return news, err
|
71
|
82
|
}
|
72
|
83
|
|