|
|
@@ -220,7 +220,7 @@ class MessageService extends BaseService
|
|
|
->where($where)
|
|
|
->where('a.chat_key','>', 0)
|
|
|
->where('a.create_time','>=', time() - $expire)
|
|
|
- ->where(function($query) use($params){
|
|
|
+ ->where(function($query) use($params, $userId){
|
|
|
$chatKey = isset($params['chat_key'])? trim($params['chat_key']) : '';
|
|
|
if($chatKey){
|
|
|
$query->where('a.chat_key', $chatKey);
|
|
|
@@ -235,6 +235,12 @@ class MessageService extends BaseService
|
|
|
if($chatType){
|
|
|
$query->where('a.chat_type', $chatType);
|
|
|
}
|
|
|
+
|
|
|
+ if($userId){
|
|
|
+ $query->where(function($query) use($userId){
|
|
|
+ $query->where(['a.from_uid'=>$userId])->orWhere(['a.to_uid'=>$userId]);
|
|
|
+ });
|
|
|
+ }
|
|
|
})
|
|
|
->select($field)
|
|
|
->groupBy('chat_key')
|