|
@@ -311,7 +311,8 @@ func (b MessaggeService) ConversationList(in *messagecenter.ConversationReq) (da
|
|
|
a.timestamp,
|
|
|
b.nickname,
|
|
|
0 as unread,
|
|
|
- b.headimg
|
|
|
+ b.headimg,
|
|
|
+ b.phone
|
|
|
FROM
|
|
|
socialize_summary a
|
|
|
INNER JOIN base_user b ON (a.user_id = b.id AND a.ent_id = %d AND a.customer_service_access = 0
|
|
@@ -323,16 +324,44 @@ func (b MessaggeService) ConversationList(in *messagecenter.ConversationReq) (da
|
|
|
c.timestamp,
|
|
|
b.nickname,
|
|
|
a.unread,
|
|
|
- b.headimg
|
|
|
+ b.headimg,
|
|
|
+ b.phone
|
|
|
FROM
|
|
|
socialize_customer_service_user a
|
|
|
INNER JOIN base_user b ON ( a.customer_service_id = %d AND a.user_id = b.id %s)
|
|
|
INNER JOIN socialize_summary c ON ( a.ent_id = c.ent_id AND a.user_id = c.user_id))`, in.EntUserId, filtrationSql)
|
|
|
- sqlStr = aiSql + " UNION ALL " + serviceSql
|
|
|
+ restrictionSql := aiSql + " UNION ALL " + serviceSql
|
|
|
+
|
|
|
+ sqlStr = fmt.Sprintf(`SELECT
|
|
|
+ (
|
|
|
+ CASE
|
|
|
+ WHEN SUBSTR( a.nickname, 1, 3 ) = 'JY_' THEN
|
|
|
+ CONCAT( SUBSTR( a.phone, 1, 3 ), '****', SUBSTR( a.phone, 8, 11 ) )
|
|
|
+ WHEN a.nickname = ''
|
|
|
+ OR a.nickname IS NULL THEN
|
|
|
+ CONCAT( SUBSTR( a.phone, 1, 3 ), '****', SUBSTR( a.phone, 8, 11 ) ) ELSE a.nickname
|
|
|
+ END
|
|
|
+ ) AS name,
|
|
|
+ c.content,
|
|
|
+ c.title,
|
|
|
+ c.type,
|
|
|
+ c.link,
|
|
|
+ c.create_time,
|
|
|
+ a.message_id,
|
|
|
+ a.timestamp,
|
|
|
+ a.unread as number,
|
|
|
+ a.user_id as id,
|
|
|
+ a.headimg,
|
|
|
+ a.phone
|
|
|
+ FROM
|
|
|
+ (%s) a
|
|
|
+ LEFT JOIN socialize_message c ON ( a.message_id = c.id )
|
|
|
+ ORDER BY
|
|
|
+ a.timestamp DESC`, restrictionSql)
|
|
|
}
|
|
|
|
|
|
if sqlStr != "" {
|
|
|
- log.Println("查询列表sql:", sqlStr)
|
|
|
+ log.Println("ConversationList查询列表sql:", sqlStr)
|
|
|
data = IC.BaseMysql.SelectBySql(sqlStr)
|
|
|
log.Println("查询耗时2:", time.Since(tm), count)
|
|
|
}
|
|
@@ -564,8 +593,13 @@ func UserSynchronousList(customerServiceId, userId, entId, messageId int64, crea
|
|
|
nowForm := time.Now().Local()
|
|
|
create_time := nowForm.Format(util.Date_Full_Layout)
|
|
|
//查看汇总表
|
|
|
- log.Println(IC.BaseMysql.Count(util.SOCIALIZE_SUMMARY, map[string]interface{}{"user_id": userId, "ent_id": entId}))
|
|
|
- if IC.BaseMysql.Count(util.SOCIALIZE_SUMMARY, map[string]interface{}{"user_id": userId, "ent_id": entId}) > 0 {
|
|
|
+ data := IC.BaseMysql.FindOne(util.SOCIALIZE_SUMMARY, map[string]interface{}{"user_id": userId, "ent_id": entId}, "", "")
|
|
|
+ if data != nil && len(*data) > 0 {
|
|
|
+ if (*data)["customer_service_access"] == 0 && customerServiceId > 0 {
|
|
|
+ customerServiceId = 1
|
|
|
+ } else {
|
|
|
+ customerServiceId = quitl.Int64All((*data)["customer_service_access"])
|
|
|
+ }
|
|
|
//更新汇总表
|
|
|
ok := int64(0)
|
|
|
if sendUserType == 1 {
|