作者 yangfu

公告修改

... ... @@ -39,6 +39,8 @@ const (
const (
//用户未读消息列表
SqlUserMsgsUnRead = "select * from user_msg where company_id=? and receive_user_id=? and msg_type=? and is_read=0 order by create_at desc" //所有未读消息
//用户未读消息列表
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" //所有未读消息
//用户未读消息 - 单个
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" //特定未读消息
//用户消息 - 按 1.源id 2.接收者id 3.消息类型
... ... @@ -160,7 +162,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 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 `
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 `
sqlCount += where
if err = utils.ExecuteQueryOne(&total, sqlCount, userId, companyId, msgType, companyId); err != nil {
return
... ...
... ... @@ -1836,6 +1836,7 @@ func ChanceDetail(header *protocol.RequestHeader, request *protocol.ChanceDetail
UpdateTime: chance.UpdateAt.Unix() * 1000,
}
jsonUnmarshal(chance.SourceContent, &item.FormList)
item.FormList = clearEmptyForm(item.FormList)
if chanceData, err = models.GetChanceDataByChanceId(chance.Id); err == nil {
jsonUnmarshal(chanceData.Images, &item.Pictures)
jsonUnmarshal(chanceData.Speechs, &item.Speechs)
... ...
... ... @@ -134,7 +134,7 @@ func Announcements(header *protocol.RequestHeader, request *protocol.Announcemen
)
rsp = &protocol.AnnouncementsResponse{}
rsp.Lists = make([]protocol.Announcement, 0)
if err = utils.ExecuteQueryAll(&userMsg, models.SqlUserMsgsUnRead, header.CompanyId, header.UserId, models.MsgTypeBulletin); err != nil {
if err = utils.ExecuteQueryAll(&userMsg, models.SqlUserMsgsUnReadWithPublic, header.CompanyId, header.UserId, models.MsgTypeBulletin); err != nil {
if err == orm.ErrNoRows {
err = nil
return
... ...