...
|
...
|
@@ -20,6 +20,7 @@ type UserMsg struct { |
|
|
IsPublic int8 `orm:"column(is_public)" description:"1:公开 0:不公开"`
|
|
|
IsRead int8 `orm:"column(is_read)" description:"1:已读 0:未读"`
|
|
|
CreateAt time.Time `orm:"column(create_at);type(timestamp);auto_now" description:"创建时间"`
|
|
|
ChanceId int64 `orm:"column(chance_id)" description:"机会编号"`
|
|
|
}
|
|
|
|
|
|
const (
|
...
|
...
|
@@ -180,11 +181,11 @@ func GetUserMsgsBulletin(userId, companyId int64, msgType int, lastId int64, pag |
|
|
func GetChanceMsg(uid, lastId int64, pageSize int, msgType int, v interface{}) (total int, err error) {
|
|
|
sql := `select a.*,b.images,b.speechs,b.videos from (
|
|
|
select a.*,b.source_content,b.enable_status,b.user_id chance_user_id,b.create_at,b.review_status,b.approve_data from (
|
|
|
select id,company_id,receive_user_id,message,source_id,is_read
|
|
|
select id,company_id,receive_user_id,message,source_id,is_read,chance_id,create_at msg_time
|
|
|
from user_msg where receive_user_id=? and source_type=1 and (?=0 or id<?) and msg_type=?
|
|
|
)a left outer join chance b on a.source_id = b.id
|
|
|
)a left outer join chance_data b on a.source_id =b.chance_id
|
|
|
order by a.create_at desc
|
|
|
order by a.msg_time desc
|
|
|
LIMIT ?`
|
|
|
|
|
|
sqlCount := `select count(0)
|
...
|
...
|
@@ -205,12 +206,12 @@ func GetChanceCommentMsg(uid, lastId int64, pageSize int, msgType int, v interfa |
|
|
sql := `select a.*,b.content commented_content,b.create_at commented_time,b.user_id commented_user_id from (
|
|
|
select a.*,b.images,b.speechs,b.videos from (
|
|
|
select a.*,b.source_content,b.enable_status,b.user_id chance_user_id,b.create_at,b.review_status from (
|
|
|
select id,message content,source_type,source_id,is_read,create_at comment_time from user_msg
|
|
|
select id,message content,source_type,source_id,is_read,create_at comment_time,chance_id from user_msg
|
|
|
where receive_user_id =? and (?=0 or id<?) and msg_type=?
|
|
|
)a left outer join chance b on a.source_id = b.id and source_type=1
|
|
|
)a left outer join chance_data b on a.source_id = b.chance_id and source_type = 1
|
|
|
)a left outer join comment b on a.source_id = b.id and a.source_type=2
|
|
|
order by a.create_at desc
|
|
|
order by a.comment_time desc
|
|
|
LIMIT ?`
|
|
|
|
|
|
sqlCount := `select count(0)
|
...
|
...
|
|