| | |
| | | |
| | | $data = [ |
| | | 'business_card_id' => $businessCardId, |
| | | 'app_id' => self::$app_id, |
| | | ]; |
| | | try { |
| | | $this->save($data); |
| | |
| | | */ |
| | | public function getUserConversations($param = []) |
| | | { |
| | | return $this->with(['businessCard', 'participants.user', 'messages']) |
| | | return $this->with(['businessCard', 'participants.user']) |
| | | ->order('update_time', 'desc') |
| | | ->paginate($param); |
| | | } |
| | |
| | | ->where('business_card_id', $businessCardId) |
| | | ->find(); |
| | | } |
| | | public function getConversationByBusinessCardUser($businessCardId,$userId) |
| | | { |
| | | $conversation_ids=(new Participant())->where('user_id',$userId)->column('conversation_id'); |
| | | return $this->with(['businessCard', 'participants.user']) |
| | | ->where('business_card_id', $businessCardId) |
| | | ->where('conversation_id', 'in', $conversation_ids) |
| | | ->find(); |
| | | } |
| | | |
| | | /** |
| | | * 更新会话时间 |