Esempio n. 1
0
 public function handle_request_internal()
 {
     $requireId = $this->_params['requireId'];
     $broSum = Model_RecommendCus_ServedCustomer::getServedBrokerSumByRequireId($requireId);
     $isFull = $broSum >= self::maxBroSum ? 'true' : 'false';
     return array("status" => "ok", "data" => array('isFull' => $isFull));
 }
 public function handle_request_internal()
 {
     header("Access-Control-Allow-Origin: *");
     $brokerId = $this->_params['brokerId'];
     $result = array('status' => 'error', 'message' => '');
     $broker = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$broker) {
         $result['message'] = '经纪人不存在';
         return $result;
     }
     //获取经纪人已服务客户数
     $servicedCusSum = Model_RecommendCus_ServedCustomer::getServedRequireSumByBrokerId($brokerId);
     //获取每个用户请求的基本信息
     $tmpRequireBaseInfo = Model_RecommendCus_PushedRecommendCus::findRequireInfoWithBrokerId($brokerId);
     // 修复BI重复推送数据
     $requireBaseInfo = $this->dealRequireBaseInfo($tmpRequireBaseInfo);
     if (empty($requireBaseInfo)) {
         return array("status" => "ok", "data" => array("brokerId" => $brokerId, "servicedCusSum" => $servicedCusSum, "requireList" => array()));
     }
     //根据请求id获取每个请求的详细信息
     $requireInfo = Bll_RecommendCus::getRequireInfoByRequireId($requireBaseInfo);
     if ($requireInfo['message'] == '数据错误') {
         $result['message'] = '数据错误';
         return $result;
     }
     $requireList = Bll_RecommendCus::getRequireDetailInfo($requireInfo);
     return array("status" => "ok", "data" => array("brokerId" => $brokerId, "servicedCusSum" => $servicedCusSum, "requireList" => $requireList));
 }
Esempio n. 3
0
 public static function getRequireDetailInfo($requireInfo)
 {
     $requireList = array();
     foreach ($requireInfo['baseInfo'] as $key => $value) {
         $requireListTmp = array();
         $requireDetail = $requireInfo['detailInfo'][$key];
         $ChatInfo = Model_RecommendCus_ChatUserBasic::getUserInfoByUserId($value['chatId']);
         $requireListTmp['requireId'] = $key;
         $requireListTmp['app'] = $value['appName'];
         $requireListTmp['udid2'] = $value['udid2'];
         $requireListTmp['guid'] = $value['guid'];
         $requireListTmp['macId'] = $value['macId'];
         $requireListTmp['userId'] = $value['userId'];
         $requireListTmp['chatId'] = $value['chatId'];
         $requireListTmp['userPhoto'] = $ChatInfo['icon'];
         $requireListTmp['otherRequire'] = $requireDetail['otherRequire'];
         $requireListTmp['tags'] = implode(' ', json_decode($requireDetail['tags'], true));
         $requireListTmp['area'] = self::getAreaOrBlockNameV2($requireDetail['areaId']);
         $requireListTmp['block'] = self::getAreaOrBlockNameV2($requireDetail['blockId']);
         $requireListTmp['Price'] = self::formatPrice($requireDetail['minPrice'], $requireDetail['maxPrice']);
         $requireListTmp['roomNum'] = self::getRoomNum($requireDetail['roomNum']);
         $broSum = Model_RecommendCus_ServedCustomer::getServedBrokerSumByRequireId($key);
         $requireListTmp['broSum'] = $broSum >= 5 ? 5 : $broSum;
         $requireListTmp['canServed'] = $requireListTmp['broSum'] >= 5 ? 'false' : 'true';
         $requireListTmp['customerName'] = Bll_Mobile_UserList::getUserName(isset($ChatInfo['nickName']) ? $ChatInfo['nickName'] : '', isset($ChatInfo['phone']) ? $ChatInfo['phone'] : '', $value['userId']);
         $requireListTmp['updateTime'] = self::formatTime($value['createTime']);
         $requireList[] = $requireListTmp;
     }
     return $requireList;
 }
 public function handle_request_internal()
 {
     header("Access-Control-Allow-Origin: *");
     $brokerId = $this->_params['brokerId'];
     $result = array('status' => 'error', 'message' => '');
     $broker = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$broker) {
         $result['message'] = '经纪人不存在';
         return $result;
     }
     //获取已服务的客户列表
     $servedCustomerList = Model_RecommendCus_ServedCustomer::getServedRequireByBrokerId($brokerId);
     $servedrequireIds = array();
     foreach ($servedCustomerList as $key => $value) {
         $servedrequireIds[] = $value['requirePropId'];
     }
     //获取每个用户请求的基本信息
     $requireBaseInfo = Model_RecommendCus_PushedRecommendCus::findRequireInfoWithRequireId($brokerId, $servedrequireIds);
     if (empty($requireBaseInfo)) {
         return array("status" => "ok", "data" => array("brokerId" => $brokerId, "requireList" => array()));
     }
     //根据请求id获取每个请求的详细信息
     $requireInfo = Bll_RecommendCus::getRequireInfoByRequireId($requireBaseInfo);
     if ($requireInfo['message'] == '数据错误') {
         $result['message'] = '数据错误';
         return $result;
     }
     $requireList = Bll_RecommendCus::getRequireDetailInfo($requireInfo);
     return array("status" => "ok", "data" => array("brokerId" => $brokerId, "requireList" => $requireList));
 }
Esempio n. 5
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $customerId = $this->_params['customerId'];
     $chatBody = $this->_params['chatBody'];
     $authToken = $this->_params['authToken'];
     $requireId = $this->_params['requireId'];
     $source = $this->_params['source'];
     if ($requireId == 'false' || $requireId == 'true') {
         $requireId = 0;
     } else {
         $requireId = intval($requireId);
     }
     // 判断经纪人是否存在
     $broker = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$broker) {
         throw new Exception_Broker_NotFound('BrokerId: ' . $brokerId);
     }
     // 控制当日发送的微聊消息数量
     if (APF::get_instance()->get_config('enable_require_chat_send_count_limit', 'customer_rush')) {
         $chatCountDailyLimit = APF::get_instance()->get_config('require_chat_send_count_daily_limit', 'customer_rush');
         $todayChatCount = Bll_CustomerRush_Chat::getTodayRequireChatCount($brokerId, $customerId);
         if ($todayChatCount['count'] >= $chatCountDailyLimit) {
             throw new Exception_CustomerRush_TooManyChat("Today Count: {$todayChatCount}; Daily Limit: {$chatCountDailyLimit}");
         }
     }
     // 格式化输入的参数:chatBody
     if (!is_array($chatBody)) {
         $chatBody = json_decode($chatBody, true);
     }
     // 判断是否是第一次发送
     if (Bll_CustomerRush_Chat::isFirstRequireChat($brokerId, $customerId)) {
         $chatBody['first_send'] = 1;
     }
     //跟抢客户不同的好友类型 帮你找房 类型为2
     $chatBody['source'] = $source;
     // 发送微聊消息
     $chatResponse = Bll_CustomerRush_Chat::sendAppMessage($authToken, $chatBody);
     if ($chatResponse) {
         if (!empty($requireId)) {
             $params = array();
             $params['brokerId'] = $brokerId;
             $params['requirePropId'] = $requireId;
             $params['createdTime'] = date('Y-m-d H:i:s');
             Model_RecommendCus_ServedCustomer::insertRecord($params);
             //写服务记录表
             Bll_CustomerRush_Chat::updateRequireServeStatus($brokerId, $requireId);
             //更新已推送需求的状态
         }
         Bll_CustomerRush_Chat::saveRequireChat($brokerId, $customerId);
         //保存聊天数量表
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('status' => 1, 'statusMsg' => '成功', 'msgId' => $chatResponse['msg_id']));
 }