|
@@ -285,12 +285,12 @@ func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) (*[]map[strin
|
|
case 4, 5, 6, 7: //客服聊天
|
|
case 4, 5, 6, 7: //客服聊天
|
|
if in.UserType == 1 {
|
|
if in.UserType == 1 {
|
|
//客服聊天记录查看
|
|
//客服聊天记录查看
|
|
- sqlStr = "SELECT a.messag_id as messageId,b.*, IF ( a.own_id = a.send_user_id, 1, 2 ) AS fool, a.send_user_type, a.type AS itemType, d.nickname AS robotName, d.headimage AS robotImg, c.customer_service_name AS setName , c.user_id FROM socialize_message_mailbox a LEFT JOIN socialize_message b ON a.messag_id = b.id LEFT JOIN socialize_chat_session c ON IF ( a.send_user_type = 1, c.id = a.send_user_id, c.id = a.receive_user_id ) LEFT JOIN socialize_tenant_robot d ON c.ent_id = d.ent_id WHERE a.own_type = 1 AND c.ent_id = " + quitl.InterfaceToStr(in.EntId) + " AND c.user_id = " + quitl.InterfaceToStr(in.SendId) + " AND (a.type = 5 or a.type=4 or a.type=6 or a.type=7) " + lastStr + " ORDER BY a.create_time desc ,a.id asc limit 0 , " + quitl.InterfaceToStr(in.PageSize)
|
|
|
|
- countSql = "SELECT count(b.id) FROM socialize_message_mailbox a LEFT JOIN socialize_message b ON a.messag_id = b.id LEFT JOIN socialize_chat_session c ON IF ( a.send_user_type = 1, c.id = a.send_user_id, c.id = a.receive_user_id ) LEFT JOIN socialize_tenant_robot d ON c.ent_id = d.ent_id WHERE a.own_type = 1 AND c.ent_id = " + quitl.InterfaceToStr(in.EntId) + " AND c.user_id = " + quitl.InterfaceToStr(in.SendId) + " AND (a.type = 5 or a.type=4 or a.type = 5 or a.type=6 or a.type=7) " + lastStr
|
|
|
|
|
|
+ sqlStr = "SELECT a.messag_id as messageId,b.*, IF ( a.own_id = a.send_user_id, 1, 2 ) AS fool, a.send_user_type, a.type AS itemType, d.nickname AS robotName, d.headimage AS robotImg, c.customer_service_name AS setName , c.user_id FROM socialize_message_mailbox a LEFT JOIN socialize_message b ON a.messag_id = b.id LEFT JOIN socialize_chat_session c ON IF ( a.send_user_type = 1, c.id = a.send_user_id, c.id = a.receive_user_id ) AND c.ent_id = " + quitl.InterfaceToStr(in.EntId) + " AND c.user_id = " + quitl.InterfaceToStr(in.SendId) + " LEFT JOIN socialize_tenant_robot d ON c.ent_id = d.ent_id WHERE a.own_type = 1 AND (a.type = 5 or a.type=4 or a.type=6 or a.type=7) " + lastStr + " ORDER BY a.create_time desc ,a.id asc limit 0 , " + quitl.InterfaceToStr(in.PageSize)
|
|
|
|
+ countSql = "SELECT count(b.id) FROM socialize_message_mailbox a LEFT JOIN socialize_message b ON a.messag_id = b.id LEFT JOIN socialize_chat_session c ON IF ( a.send_user_type = 1, c.id = a.send_user_id, c.id = a.receive_user_id ) AND c.ent_id = " + quitl.InterfaceToStr(in.EntId) + " AND c.user_id = " + quitl.InterfaceToStr(in.SendId) + " LEFT JOIN socialize_tenant_robot d ON c.ent_id = d.ent_id WHERE a.own_type = 1 AND (a.type = 5 or a.type=4 or a.type = 5 or a.type=6 or a.type=7) " + lastStr
|
|
} else {
|
|
} else {
|
|
//用户聊天记录查看
|
|
//用户聊天记录查看
|
|
- sqlStr = "SELECT a.messag_id as messageId, b.*, IF ( a.own_id = a.send_user_id, 1, 2 ) AS fool , a.send_user_type, a.type as itemType, d.nickname as robotName, d.headimage as robotImg, c.customer_service_name as setName FROM socialize_message_mailbox a LEFT JOIN socialize_message b ON a.messag_id = b.id LEFT JOIN socialize_chat_session c ON IF ( a.send_user_type = 1, c.id = a.send_user_id, c.id = a.receive_user_id ) left join socialize_tenant_robot d on c.ent_id=d.ent_id WHERE a.own_type = 2 AND c.ent_id = " + quitl.InterfaceToStr(in.SendId) + " AND a.own_id = " + quitl.InterfaceToStr(in.NewUserId) + " AND c.user_id = " + quitl.InterfaceToStr(in.NewUserId) + " AND ( a.type = 4 OR a.type = 5 or a.type=6 or a.type=7) " + lastStr + " ORDER BY a.create_time desc ,a.id asc limit 0 , " + quitl.InterfaceToStr(in.PageSize)
|
|
|
|
- countSql = "SELECT count(a.id) FROM socialize_message_mailbox a LEFT JOIN socialize_message b ON a.messag_id = b.id LEFT JOIN socialize_chat_session c ON IF ( a.send_user_type = 1, c.id = a.send_user_id, c.id = a.receive_user_id ) left join socialize_tenant_robot d on c.ent_id=d.ent_id WHERE a.own_type = 2 AND c.ent_id =" + quitl.InterfaceToStr(in.SendId) + " AND a.own_id =" + quitl.InterfaceToStr(in.NewUserId) + " AND c.user_id =" + quitl.InterfaceToStr(in.NewUserId) + " AND ( a.type = 4 OR a.type = 5 or a.type=6 or a.type=7) " + lastStr
|
|
|
|
|
|
+ sqlStr = "SELECT a.messag_id as messageId, b.*, IF ( a.own_id = a.send_user_id, 1, 2 ) AS fool , a.send_user_type, a.type as itemType, d.nickname as robotName, d.headimage as robotImg, c.customer_service_name as setName FROM socialize_message_mailbox a LEFT JOIN socialize_message b ON a.messag_id = b.id LEFT JOIN socialize_chat_session c ON IF ( a.send_user_type = 1, c.id = a.send_user_id, c.id = a.receive_user_id ) and c.ent_id =" + quitl.InterfaceToStr(in.SendId) + " AND c.user_id = " + quitl.InterfaceToStr(in.NewUserId) + " left join socialize_tenant_robot d on c.ent_id=d.ent_id WHERE a.own_type = 2 AND a.own_id = " + quitl.InterfaceToStr(in.NewUserId) + " AND ( a.type = 4 OR a.type = 5 or a.type=6 or a.type=7) " + lastStr + " ORDER BY a.create_time desc ,a.id asc limit 0 , " + quitl.InterfaceToStr(in.PageSize)
|
|
|
|
+ countSql = "SELECT count(a.id) FROM socialize_message_mailbox a LEFT JOIN socialize_message b ON a.messag_id = b.id LEFT JOIN socialize_chat_session c ON IF ( a.send_user_type = 1, c.id = a.send_user_id, c.id = a.receive_user_id ) and c.ent_id = " + quitl.InterfaceToStr(in.SendId) + " AND c.user_id = " + quitl.InterfaceToStr(in.NewUserId) + " left join socialize_tenant_robot d on c.ent_id=d.ent_id WHERE a.own_type = 2 AND a.own_id =" + quitl.InterfaceToStr(in.NewUserId) + " AND ( a.type = 4 OR a.type = 5 or a.type=6 or a.type=7) " + lastStr
|
|
}
|
|
}
|
|
break
|
|
break
|
|
}
|
|
}
|