作者 yangfu

公告消息

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