public static function saveRecord($desk, $client, $status, $accountId) { $chatConversation = new ChatConversation(); $channelName = self::getChannelName($desk->_id, $client['openId']); $chatConversation->conversation = $channelName; $chatConversation->status = $status; $chatConversation->desk = ['id' => $desk->_id, 'badge' => $desk->badge, 'email' => $desk->email, 'avatar' => $desk->avatar, 'name' => $desk->name]; $chatConversation->client = $client; $chatConversation->accountId = $accountId; $chatConversation->lastChatTime = TimeUtil::msTime(); if (!$chatConversation->save()) { LogUtil::error(['message' => 'save chat conversation failed', 'error' => $chatConversation->errors], 'helpdesk'); throw new ServerErrorHttpException('save chatConversation failed'); } else { HelpDesk::incClientCount($desk->_id); } return $chatConversation; }