瀏覽代碼

Merge branch 'dev' of http://git.ycjcjy.com/SpaceOfCheng/services into dev

胡轶钦 6 年之前
父節點
當前提交
e21472c983
共有 2 個檔案被更改,包括 14 行新增3 行删除
  1. 13
    2
      models/message/news.go
  2. 1
    1
      service/bodycheck/bodycheck.go

+ 13
- 2
models/message/news.go 查看文件

59
 // GetNewsByLocation 根据位置获取咨询信息
59
 // GetNewsByLocation 根据位置获取咨询信息
60
 func (m *MessageDAO) GetNewsByLocation(locationid, orgid string) ([]model.TaCmsNews, error) {
60
 func (m *MessageDAO) GetNewsByLocation(locationid, orgid string) ([]model.TaCmsNews, error) {
61
 	var news []model.TaCmsNews
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
 	return news, err
67
 	return news, err
64
 }
68
 }
65
 
69
 
66
 // GetNewsByLocationShow 根据位置获取咨询信息
70
 // GetNewsByLocationShow 根据位置获取咨询信息
67
 func (m *MessageDAO) GetNewsByLocationShow(locationid, orgid string) ([]model.TaCmsNews, error) {
71
 func (m *MessageDAO) GetNewsByLocationShow(locationid, orgid string) ([]model.TaCmsNews, error) {
68
 	var news []model.TaCmsNews
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
 	return news, err
81
 	return news, err
71
 }
82
 }
72
 
83
 

+ 1
- 1
service/bodycheck/bodycheck.go 查看文件

97
 		return errors.New("获取体检信息失败")
97
 		return errors.New("获取体检信息失败")
98
 	}
98
 	}
99
 
99
 
100
-	if checkinfo == nil || checkinfo.Id != "" || time.Now().Local().Format("2006-01-02") != checkinfo.CreateDate.Format("2006-01-02") {
100
+	if checkinfo == nil || checkinfo.Id == "" || time.Now().Local().Format("2006-01-02") != checkinfo.CreateDate.Format("2006-01-02") {
101
 		caseEquipment, err := s.dao.GetCaseEquipment(result.EquipmentId)
101
 		caseEquipment, err := s.dao.GetCaseEquipment(result.EquipmentId)
102
 		if err != nil {
102
 		if err != nil {
103
 			utils.LogError("获取设备信息失败:", err)
103
 			utils.LogError("获取设备信息失败:", err)