| | |
| | | * @param int $appId 应用ID |
| | | * @return bool |
| | | */ |
| | | public function addParticipant($conversationId, $userId, $appId = 10001) |
| | | public function addParticipant($conversationId, $userId) |
| | | { |
| | | // 检查是否已存在 |
| | | $existing = $this->where('conversation_id', $conversationId) |
| | | ->where('user_id', $userId) |
| | | ->find(); |
| | | var_dump($existing); |
| | | if ($existing) { |
| | | return true; |
| | | } |
| | |
| | | $data = [ |
| | | 'conversation_id' => $conversationId, |
| | | 'user_id' => $userId, |
| | | 'app_id' => $appId, |
| | | 'app_id' => self::$app_id, |
| | | 'is_read' => 0, |
| | | 'join_time' => time(), |
| | | 'last_read_time' => time(), |
| | | 'create_time' => time(), |
| | | 'update_time' => time() |
| | | ]; |
| | | |
| | | return $this->save($data); |
| | | } |
| | | |
| | |
| | | ->find(); |
| | | |
| | | if ($participant) { |
| | | $participant->last_read_time = time(); |
| | | $participant->update_time = time(); |
| | | return $participant->save(); |
| | | $data=['last_read_time'=>time()]; |
| | | return $participant->save($data); |
| | | } |
| | | |
| | | return false; |