private function push($brokerId, $chatId) { $iosGaBrokerId = APF::get_instance()->get_config('customer_ios_broker_id_ga', 'customer'); if (in_array($brokerId, $iosGaBrokerId)) { return false; } // 如果经纪人禁用了抢客户消息推送,直接返回 if (Bll_Broker_AppSwitch::isOff($brokerId, Const_AppSwitch::TYPE_CUSTOMER_PUSH)) { return false; } // 如果是好友关系,则不发送推送消息 $isFrend = $this->isFriend($chatId, $brokerId); if ($isFrend) { return false; } $temp = APF::get_instance()->get_config('chat_api_host'); $this->chat_api = $temp['host']; $broker_chat_id = Model_Mobile_BrokerChatInfo::getBrokerChatInfo($brokerId, array('chatId')); if (empty($broker_chat_id)) { return false; } $message_url = $this->chat_api . '/common/sendUserNotify/' . $broker_chat_id['chatId'] . '?from_idc=1&from=mobile-ajk-broker'; $message = json_encode(array('message' => '客户出现了,快去搭讪!', 'msgType' => 'push', 'type' => 'customer', 'body' => array('type' => 'customer', 'msg' => '客户出现了,快去搭讪!'))); $result = Util_API::postData($message_url, $message); if ($result['status'] == 'OK') { $this->setLog(date('Y-m-d H:i:s') . ' - broker_id: ' . $brokerId . ', push_result:' . var_export($result, true)); return true; } return false; }
public function handle_request_internal() { $brokerId = $this->_params['brokerId']; $type = $this->_params['type']; Bll_Broker_AppSwitch::off($brokerId, $type); return API_Result::create()->ok()->data(array('status' => 1))->toArray(); }
public function handle_request_internal() { $brokerId = $this->_params['brokerId']; return API_Result::create()->ok()->data(Bll_Broker_AppSwitch::all($brokerId))->toArray(); }
public function push($brokerId, $msg, $entrustId, $entrustType) { // 如果经纪人禁用了抢房源消息推送,直接返回 if (Bll_Broker_AppSwitch::isOff($brokerId, Const_AppSwitch::TYPE_ENTRUST_PUSH)) { return false; } $broker_info = Dao_Broker_BrokerInfo::get_broker_base_info($brokerId); if (!empty($broker_info) && preg_match('/^1((3[0-9])|(4[0-9])|(5[0-9])|(7[0-9])|(8[0-9]))[0-9]{8}$/', $broker_info['USERMOBILE'])) { $api_host = APF::get_instance()->get_config('chat_api_host'); $api_url = $api_host['host'] . '/user/brokerSearch/' . $broker_info['USERMOBILE'] . '?from_idc=1&from=mobile-ajk-broker'; $result = Util_API::getData($api_url, ''); if ($result['status'] == 'OK' && intval($result['result']['user_id']) > 0) { $cv = APF::get_instance()->get_config("free_entrust_min_cv"); $chatId = intval($result['result']['user_id']); $this->message[] = array('user_id' => $chatId, 'message' => $msg, 'msgType' => 'push', 'type' => 'commission', 'min_cv' => $cv, 'eId' => $entrustId, 'eType' => $entrustType, 'body' => array('type' => 'commission', 'msg' => $msg, 'entrustId' => $entrustId, 'entrustType' => $entrustType)); return true; } return false; } return false; }
private function push($brokerId, $userId) { // 如果经纪人禁用了抢客户消息推送,直接返回 if (Bll_Broker_AppSwitch::isOff($brokerId, Const_AppSwitch::TYPE_CUSTOMER_PUSH)) { return false; } //该用户是否是该经纪人的已抢客户 if ($this->isCustomerRush($brokerId, $userId)) { return false; } $temp = APF::get_instance()->get_config('chat_api_host'); $broker_chat_id = Model_Mobile_BrokerChatInfo::getBrokerChatInfo($brokerId, array('chatId')); if (empty($broker_chat_id)) { return false; } $message_url = $temp['host'] . '/common/sendUserNotify/' . $broker_chat_id['chatId'] . '?from_idc=1&from=mobile-ajk-broker'; $message = json_encode(array('message' => '有客户发布了与你相关的找房需求,快去看看!', 'msgType' => 'push', 'type' => 'require', 'body' => array('type' => 'require', 'msg' => '有客户发布了与你相关的找房需求,快去看看!'))); $result = Util_API::postData($message_url, $message); if ($result['status'] == 'OK') { $this->setLog(date('Y-m-d H:i:s') . ' - broker_id: ' . $brokerId . ', push_result:' . var_export($result, true)); return true; } return false; }