浏览代码

手机号搜索改为模糊匹配

WH01243 3 年之前
父节点
当前提交
b9f826922a
共有 1 个文件被更改,包括 1 次插入2 次删除
  1. 1 2
      service/message_mail_box.go

+ 1 - 2
service/message_mail_box.go

@@ -52,7 +52,7 @@ func (b MessaggeService) UserList(in *messagecenter.UserReq) (data *[]map[string
 	} else {
 		phoneSql := ""
 		if in.Phone != "" {
-			phoneSql = "and  b.phone='" + in.Phone + "'"
+			phoneSql = "and  b.phone like '%" + in.Phone + "%'"
 		}
 		startTimeSql := ""
 		if in.StartTime != "" {
@@ -62,7 +62,6 @@ func (b MessaggeService) UserList(in *messagecenter.UserReq) (data *[]map[string
 		if in.EndTime != "" {
 			endTimeSql = " and DATE_FORMAT(c.create_time,'%Y-%m-%d') <= '" + in.EndTime + "' "
 		}
-
 		//先获取每个用户最后聊天记录
 		userSql := " SELECT   MAX( c.id ) as messageId   FROM   socialize_message_mailbox c   LEFT JOIN socialize_chat_session d ON  IF   ( c.send_user_type = 1, d.id = c.send_user_id, d.id = c.receive_user_id )   WHERE   c.own_type = 1    AND d.customer_service_id = ?   and ( c.type = 4 OR c.type = 5 or  c.type=6 or  c.type=7 )   AND d.customer_service_id !=0    " + startTimeSql + endTimeSql + "   GROUP BY   (   CASE          WHEN  c.send_user_type =2 THEN  CONCAT( c.send_user_id )   WHEN c.send_user_type =1 THEN  CONCAT( c.receive_user_id )     END     ) "
 		v = append(v, in.EntUserId)