|
@@ -1,13 +1,14 @@
|
|
|
package service
|
|
|
|
|
|
import (
|
|
|
- quitl "app.yhyue.com/moapp/jybase/common"
|
|
|
- util "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/entity"
|
|
|
- "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/messagecenter"
|
|
|
"database/sql"
|
|
|
"fmt"
|
|
|
"log"
|
|
|
"time"
|
|
|
+
|
|
|
+ quitl "app.yhyue.com/moapp/jybase/common"
|
|
|
+ util "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/entity"
|
|
|
+ "bp.jydev.jianyu360.cn/SocialPlatform/messageCenter/rpc/messagecenter/messagecenter"
|
|
|
)
|
|
|
|
|
|
type MessaggeService struct{}
|
|
@@ -98,7 +99,7 @@ func (b MessaggeService) UserList(in *messagecenter.UserReq) (data *[]map[string
|
|
|
"SELECT f.nickname AS name, b.ent_id AS id, e.title,f.headimage AS headimg, e.type, e.link, e.content, 1 AS userType, a.create_time, a.type AS itemType, "+
|
|
|
"( SELECT count( h.id ) FROM %s h WHERE ( h.type = 4 OR h.type = 5 ) AND h.own_id = %d AND h.own_type = 2 AND h.send_user_type = 1 AND h.receive_user_id = %d AND h.isread = 0 ) AS number "+
|
|
|
"FROM %s a "+
|
|
|
- "LEFT JOIN %s b ON IF ( a.send_user_type = 1, b.id = a.send_user_id, b.id = a.receive_user_id ) "+
|
|
|
+ "LEFT JOIN %s b ON IF ( a.send_user_type = 1, a.send_user_id, a.receive_user_id ) = b.id "+
|
|
|
"LEFT JOIN %s e ON e.id = a.messag_id "+
|
|
|
"LEFT join %s f on f.ent_id=b.ent_id "+
|
|
|
"WHERE a.id IN ( %s ) "+
|
|
@@ -156,7 +157,7 @@ func (b MessaggeService) UserList(in *messagecenter.UserReq) (data *[]map[string
|
|
|
"AND h.isread = 0 "+
|
|
|
"AND i.customer_service_id= %d ) AS number "+
|
|
|
"FROM %s a "+
|
|
|
- "LEFT JOIN %s b ON if (a.send_user_type=1 ,a.receive_user_id=b.id,a.send_user_id=b.id) "+
|
|
|
+ "LEFT JOIN %s b ON if (a.send_user_type=1 ,a.receive_user_id,a.send_user_id)=b.id "+
|
|
|
"LEFT JOIN %s e ON e.id = a.messag_id "+
|
|
|
"LEFT JOIN %s f ON a.own_type=1 AND a.own_id=f.id "+
|
|
|
"WHERE a.id IN ( %s) %s ORDER BY a.create_time DESC",
|
|
@@ -411,7 +412,7 @@ func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string
|
|
|
sqlStr = fmt.Sprintf("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 %s a "+
|
|
|
"LEFT JOIN %s b ON a.messag_id = b.id "+
|
|
|
- "LEFT JOIN %s c ON IF ( a.send_user_type = 1, c.id = a.send_user_id, c.id = a.receive_user_id ) AND c.ent_id = %d AND c.user_id = %d "+
|
|
|
+ "LEFT JOIN %s c ON IF ( a.send_user_type = 1, a.send_user_id, a.receive_user_id ) = c.id AND c.ent_id = %d AND c.user_id = %d "+
|
|
|
"LEFT JOIN %s d on c.ent_id=d.ent_id "+
|
|
|
"WHERE a.own_type = 2 "+
|
|
|
"AND a.own_id = %d "+
|