|
@@ -625,30 +625,30 @@ func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string
|
|
}
|
|
}
|
|
switch in.MsgType {
|
|
switch in.MsgType {
|
|
case 2: //点对点聊天
|
|
case 2: //点对点聊天
|
|
- sqlStr = fmt.Sprintf("SELECT a.messag_id as messageId,b.* ,if(a.own_id = a.send_user_id,1,2) as fool "+
|
|
|
|
|
|
+ sqlStr = fmt.Sprintf("SELECT a.messag_id as messageId,a.send_user_type,a.type AS itemType,b.* ,if(a.own_id = a.send_user_id,1,2) as fool "+
|
|
"FROM %s a "+
|
|
"FROM %s a "+
|
|
- "LEFT JOIN %s b on a.messag_id=b.id "+
|
|
|
|
- "LEFT JOIN %s c on c.id=a.send_user_id "+
|
|
|
|
- "LEFT JOIN %s d on d.id=a.receive_user_id "+
|
|
|
|
- "where a.own_id= %d and a.iswithdraw = 0"+
|
|
|
|
- "AND ((a.send_user_id= %d AND a.receive_user_id= %d) or (a.send_user_id= %d AND a.receive_user_id= %d)) "+
|
|
|
|
|
|
+ "LEFT JOIN %s b on a.messag_id=b.id "+
|
|
|
|
+ "LEFT JOIN %s c on c.id=a.send_user_id "+
|
|
|
|
+ "LEFT JOIN %s d on d.id=a.receive_user_id "+
|
|
|
|
+ "where a.own_id= %d and a.iswithdraw = 0 "+
|
|
|
|
+ "AND ((a.send_user_id= %d AND a.receive_user_id= %d) or (a.send_user_id= %d AND a.receive_user_id= %d)) "+
|
|
"AND a.type IN ( 2, 6 ) %s "+
|
|
"AND a.type IN ( 2, 6 ) %s "+
|
|
- "AND a.chat_group_id = 0 "+
|
|
|
|
|
|
+ "AND a.chat_group_id IS null "+
|
|
"AND a.send_user_type = a.receive_user_type "+
|
|
"AND a.send_user_type = a.receive_user_type "+
|
|
- "ORDER BY a.create_time desc,a.id asc "+
|
|
|
|
|
|
+ "ORDER BY a.create_time desc,a.id asc "+
|
|
"limit 0 , %d ",
|
|
"limit 0 , %d ",
|
|
util.SOCIALIZE_MESSAGE_MAILBOX, util.SOCIALIZE_MESSAGE, util.BASE_USER, util.BASE_USER,
|
|
util.SOCIALIZE_MESSAGE_MAILBOX, util.SOCIALIZE_MESSAGE, util.BASE_USER, util.BASE_USER,
|
|
in.PositionId, in.PositionId, in.SendId, in.SendId, in.PositionId, lastStr, in.PageSize)
|
|
in.PositionId, in.PositionId, in.SendId, in.SendId, in.PositionId, lastStr, in.PageSize)
|
|
break
|
|
break
|
|
case 3: //群聊天
|
|
case 3: //群聊天
|
|
|
|
|
|
- sqlStr = fmt.Sprintf("SELECT a.messag_id AS messageId,b.*,"+
|
|
|
|
|
|
+ sqlStr = fmt.Sprintf("SELECT a.messag_id AS messageId,b.*,a.send_user_type,a.type AS itemType,"+
|
|
"IF ( a.own_id = a.send_user_id, 1, 2 ) AS fool,"+
|
|
"IF ( a.own_id = a.send_user_id, 1, 2 ) AS fool,"+
|
|
"IF ( a.own_id = a.send_user_id, 0, a.send_user_id ) AS send_position_id,"+
|
|
"IF ( a.own_id = a.send_user_id, 0, a.send_user_id ) AS send_position_id,"+
|
|
"a.send_user_type,a.type AS itemType FROM %s a "+
|
|
"a.send_user_type,a.type AS itemType FROM %s a "+
|
|
"LEFT JOIN %s b ON a.messag_id = b.id "+
|
|
"LEFT JOIN %s b ON a.messag_id = b.id "+
|
|
"WHERE a.own_type = 2 AND a.own_id = %d "+
|
|
"WHERE a.own_type = 2 AND a.own_id = %d "+
|
|
- "AND a.chat_group_id = %d AND a.type IN ( 3, 6 ) %s"+
|
|
|
|
|
|
+ "AND a.chat_group_id = %d AND a.type IN ( 3, 6 ) %s "+
|
|
"ORDER BY a.create_time desc,a.id DESC "+
|
|
"ORDER BY a.create_time desc,a.id DESC "+
|
|
"LIMIT 0, %d",
|
|
"LIMIT 0, %d",
|
|
util.SOCIALIZE_MESSAGE_MAILBOX, util.SOCIALIZE_MESSAGE, in.PositionId,
|
|
util.SOCIALIZE_MESSAGE_MAILBOX, util.SOCIALIZE_MESSAGE, in.PositionId,
|