作者 yangfu

公告修改

@@ -39,6 +39,8 @@ const ( @@ -39,6 +39,8 @@ const (
39 const ( 39 const (
40 //用户未读消息列表 40 //用户未读消息列表
41 SqlUserMsgsUnRead = "select * from user_msg where company_id=? and receive_user_id=? and msg_type=? and is_read=0 order by create_at desc" //所有未读消息 41 SqlUserMsgsUnRead = "select * from user_msg where company_id=? and receive_user_id=? and msg_type=? and is_read=0 order by create_at desc" //所有未读消息
  42 + //用户未读消息列表
  43 + SqlUserMsgsUnReadWithPublic = "select * from user_msg where company_id=? and receive_user_id=? and msg_type=? and is_read=0 and is_public=1 order by create_at desc" //所有未读消息
42 //用户未读消息 - 单个 44 //用户未读消息 - 单个
43 SqlUserMsgUnRead = "select * from user_msg where source_id=? and company_id=? and receive_user_id=? and msg_type=? and is_read=0 order by create_at desc" //特定未读消息 45 SqlUserMsgUnRead = "select * from user_msg where source_id=? and company_id=? and receive_user_id=? and msg_type=? and is_read=0 order by create_at desc" //特定未读消息
44 //用户消息 - 按 1.源id 2.接收者id 3.消息类型 46 //用户消息 - 按 1.源id 2.接收者id 3.消息类型
@@ -160,7 +162,7 @@ func GetUserMsgs(userId, companyId int64, msgType int, sourceType int, lastId in @@ -160,7 +162,7 @@ func GetUserMsgs(userId, companyId int64, msgType int, sourceType int, lastId in
160 func GetUserMsgsBulletin(userId, companyId int64, msgType int, lastId int64, pageSize int, v interface{}) (total int, err error) { 162 func GetUserMsgsBulletin(userId, companyId int64, msgType int, lastId int64, pageSize int, v interface{}) (total int, err error) {
161 sql := `select a.id msg_id,b.id,b.title,unix_timestamp(a.create_at)*1000 update_at,a.is_read ` 163 sql := `select a.id msg_id,b.id,b.title,unix_timestamp(a.create_at)*1000 update_at,a.is_read `
162 sqlCount := `select count(0) ` 164 sqlCount := `select count(0) `
163 - where := `from user_msg a,bulletin b where a.receive_user_id =? and a.company_id=? and a.source_id = b.id and a.msg_type=? and a.company_id=? and b.status=2 ` 165 + where := `from user_msg a,bulletin b where a.receive_user_id =? and a.company_id=? and a.source_id = b.id and a.msg_type=? and a.is_public=1 and a.company_id=? and b.status=2 `
164 sqlCount += where 166 sqlCount += where
165 if err = utils.ExecuteQueryOne(&total, sqlCount, userId, companyId, msgType, companyId); err != nil { 167 if err = utils.ExecuteQueryOne(&total, sqlCount, userId, companyId, msgType, companyId); err != nil {
166 return 168 return
@@ -1836,6 +1836,7 @@ func ChanceDetail(header *protocol.RequestHeader, request *protocol.ChanceDetail @@ -1836,6 +1836,7 @@ func ChanceDetail(header *protocol.RequestHeader, request *protocol.ChanceDetail
1836 UpdateTime: chance.UpdateAt.Unix() * 1000, 1836 UpdateTime: chance.UpdateAt.Unix() * 1000,
1837 } 1837 }
1838 jsonUnmarshal(chance.SourceContent, &item.FormList) 1838 jsonUnmarshal(chance.SourceContent, &item.FormList)
  1839 + item.FormList = clearEmptyForm(item.FormList)
1839 if chanceData, err = models.GetChanceDataByChanceId(chance.Id); err == nil { 1840 if chanceData, err = models.GetChanceDataByChanceId(chance.Id); err == nil {
1840 jsonUnmarshal(chanceData.Images, &item.Pictures) 1841 jsonUnmarshal(chanceData.Images, &item.Pictures)
1841 jsonUnmarshal(chanceData.Speechs, &item.Speechs) 1842 jsonUnmarshal(chanceData.Speechs, &item.Speechs)
@@ -134,7 +134,7 @@ func Announcements(header *protocol.RequestHeader, request *protocol.Announcemen @@ -134,7 +134,7 @@ func Announcements(header *protocol.RequestHeader, request *protocol.Announcemen
134 ) 134 )
135 rsp = &protocol.AnnouncementsResponse{} 135 rsp = &protocol.AnnouncementsResponse{}
136 rsp.Lists = make([]protocol.Announcement, 0) 136 rsp.Lists = make([]protocol.Announcement, 0)
137 - if err = utils.ExecuteQueryAll(&userMsg, models.SqlUserMsgsUnRead, header.CompanyId, header.UserId, models.MsgTypeBulletin); err != nil { 137 + if err = utils.ExecuteQueryAll(&userMsg, models.SqlUserMsgsUnReadWithPublic, header.CompanyId, header.UserId, models.MsgTypeBulletin); err != nil {
138 if err == orm.ErrNoRows { 138 if err == orm.ErrNoRows {
139 err = nil 139 err = nil
140 return 140 return