作者 yangfu

公告消息

@@ -155,7 +155,7 @@ func GetUserMsgs(userId, companyId int64, msgType int, sourceType int, lastId in @@ -155,7 +155,7 @@ func GetUserMsgs(userId, companyId int64, msgType int, sourceType int, lastId in
155 155
156 //获取公告消息列表 156 //获取公告消息列表
157 func GetUserMsgsBulletin(userId, companyId int64, msgType int, lastId int64, pageSize int, v interface{}) (total int, err error) { 157 func GetUserMsgsBulletin(userId, companyId int64, msgType int, lastId int64, pageSize int, v interface{}) (total int, err error) {
158 - sql := `select b.id,b.title,unix_timestamp(b.update_at)*1000 update_at,a.is_read ` 158 + sql := `select a.id msg_id,b.id,b.title,unix_timestamp(a.create_at)*1000 update_at,a.is_read `
159 sqlCount := `select count(0) ` 159 sqlCount := `select count(0) `
160 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 ` 160 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 `
161 sqlCount += where 161 sqlCount += where
@@ -168,7 +168,7 @@ func GetUserMsgsBulletin(userId, companyId int64, msgType int, lastId int64, pag @@ -168,7 +168,7 @@ func GetUserMsgsBulletin(userId, companyId int64, msgType int, lastId int64, pag
168 if v == nil { 168 if v == nil {
169 return 169 return
170 } 170 }
171 - where += ` order by b.update_at desc` 171 + where += ` order by a.create_at desc`
172 sql += where + " limit ?" 172 sql += where + " limit ?"
173 if err = utils.ExecuteQueryAll(v, sql, userId, companyId, msgType, companyId, pageSize); err != nil { 173 if err = utils.ExecuteQueryAll(v, sql, userId, companyId, msgType, companyId, pageSize); err != nil {
174 return 174 return
@@ -111,7 +111,8 @@ type MsgInteractiveResponse struct { @@ -111,7 +111,8 @@ type MsgInteractiveResponse struct {
111 } 111 }
112 112
113 type UserMsg struct { 113 type UserMsg struct {
114 - Id int64 `json:"msgId"` 114 + MsgId int64 `json:"msgId"`
  115 + BulletinId int64 `json:"-"`
115 SourceType int `json:"msgType"` 116 SourceType int `json:"msgType"`
116 Content string `json:"content"` 117 Content string `json:"content"`
117 CreateAt int64 `json:"msgTime"` 118 CreateAt int64 `json:"msgTime"`
@@ -71,7 +71,7 @@ func MsgInteractive(header *protocol.RequestHeader, request *protocol.MsgInterac @@ -71,7 +71,7 @@ func MsgInteractive(header *protocol.RequestHeader, request *protocol.MsgInterac
71 for i := range userMsgs { 71 for i := range userMsgs {
72 msg := userMsgs[i] 72 msg := userMsgs[i]
73 userMsg := &protocol.UserMsg{ 73 userMsg := &protocol.UserMsg{
74 - Id: msg.Id, 74 + BulletinId: msg.Id,
75 Content: msg.Message, 75 Content: msg.Message,
76 CreateAt: msg.CreateAt.Unix(), 76 CreateAt: msg.CreateAt.Unix(),
77 IsRead: int(msg.IsRead), 77 IsRead: int(msg.IsRead),
@@ -166,6 +166,7 @@ func AnnouncementRead(header *protocol.RequestHeader, request *protocol.Announce @@ -166,6 +166,7 @@ func AnnouncementRead(header *protocol.RequestHeader, request *protocol.Announce
166 //消息中心-公司公告 166 //消息中心-公司公告
167 func MsgCompanyNotice(header *protocol.RequestHeader, request *protocol.MsgCompanyNoticeRequest) (rsp *protocol.MsgCompanyNoticeResponse, err error) { 167 func MsgCompanyNotice(header *protocol.RequestHeader, request *protocol.MsgCompanyNoticeRequest) (rsp *protocol.MsgCompanyNoticeResponse, err error) {
168 type MsgBulletin struct { 168 type MsgBulletin struct {
  169 + MsgId int64 `orm:"column(msg_id)"`
169 Id int `orm:"column(id)"` 170 Id int `orm:"column(id)"`
170 Title string `orm:"column(title)"` 171 Title string `orm:"column(title)"`
171 UpdateTime int64 `orm:"column(update_at)"` 172 UpdateTime int64 `orm:"column(update_at)"`
@@ -184,7 +185,8 @@ func MsgCompanyNotice(header *protocol.RequestHeader, request *protocol.MsgCompa @@ -184,7 +185,8 @@ func MsgCompanyNotice(header *protocol.RequestHeader, request *protocol.MsgCompa
184 for i := range msgBulletins { 185 for i := range msgBulletins {
185 tmp := msgBulletins[i] 186 tmp := msgBulletins[i]
186 rsp.Lists = append(rsp.Lists, protocol.UserMsg{ 187 rsp.Lists = append(rsp.Lists, protocol.UserMsg{
187 - Id: int64(tmp.Id), 188 + MsgId: tmp.MsgId,
  189 + BulletinId: int64(tmp.Id),
188 SourceType: models.MsgTypeBulletin, 190 SourceType: models.MsgTypeBulletin,
189 Content: tmp.Title, 191 Content: tmp.Title,
190 CreateAt: tmp.UpdateTime, 192 CreateAt: tmp.UpdateTime,