...
|
...
|
@@ -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
|
...
|
...
|
|