public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $customerId = $this->_params['customerId'];
     // 判断经纪人是否存在
     $broker = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$broker) {
         throw new Exception_Broker_NotFound('BrokerId: ' . $brokerId);
     }
     // 获取客户最新信息
     $relation = Model_Mobile_BrokerUserRelation::getBrokerCustomerMonthLatestRelation($brokerId, $customerId);
     if (!$relation) {
         $relation = Model_Mobile_BrokerUserRelation::getBrokerCustomerLatestTryLockRelation($brokerId, $customerId);
         if (!$relation) {
             throw new Exception_CustomerRush_RelationNotFound("BrokerId: {$brokerId}; CustomerId: {$customerId};");
         }
     }
     switch ($relation->rentType) {
         case 1:
             $rentDesc = '整租';
             break;
         case 2:
             $rentDesc = '合租';
             break;
         default:
             $rentDesc = '';
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('preferPrice' => $relation->pricePreference, 'preferHouseType' => $relation->houseTypePreference, 'preferCommunities' => explode(',', $relation->commPreferenceDesc), 'channelType' => $relation->channelType, 'channelDesc' => $relation->channelDesc, 'rentType' => $relation->rentType, 'rentDesc' => $rentDesc));
 }
示例#2
0
 public function handle_request_internal()
 {
     header("Access-Control-Allow-Origin: *");
     $brokerId = $this->_params['brokerId'];
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     //经纪人所有二手房房源
     $tempHouseInfoList = Bll_House_EsfHouse::getBrokerAllPropInfoList($brokerId, $brokerInfo->cityId);
     //过滤违规房源
     $commIds = array();
     foreach ($tempHouseInfoList as $key => $houseInfo) {
         $illegal = isset($houseInfo['isVisible']) ? $houseInfo['isVisible'] : 1;
         if ($illegal == 0 && $houseInfo['ExpireWorker'] != 'propertyReport') {
             unset($tempHouseInfoList[$key]);
             continue;
         }
         $commIds[] = $houseInfo['commId'];
     }
     $commInfos = Bll_Community_APIComm::getInstance()->getInfoByIdMapping($commIds);
     $commlist = array();
     foreach ($commInfos as $commInfo) {
         $row = array();
         $row['commId'] = $commInfo['commId'];
         $row['commName'] = $commInfo['commName'];
         $row['commAddress'] = $commInfo['commLocal'];
         $commlist[] = $row;
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('commlist' => $commlist));
 }
示例#3
0
 public function before()
 {
     //防止端口城市对pp城市接口的访问
     //接受参数:判断是否是套餐经纪人,是报错,不是,继续执行
     $request_body = file_get_contents('php://input');
     if ($request_body) {
         $res = json_decode($request_body, true);
         if (is_array($res)) {
             foreach ($res as $k => $v) {
                 $_REQUEST[$k] = $v;
             }
         }
     }
     $params = $_REQUEST;
     $brokerId = $params['brokerId'];
     if (empty($brokerId)) {
         echo json_encode(Util_MobileAPI::error(Const_APIStatus::E_BROKER_PARAM_MISS));
         return self::STEP_EXIT;
     }
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (empty($brokerInfo)) {
         echo json_encode(Util_MobileAPI::error(Const_APIStatus::E_BROKER_PARAM_MISS));
         return self::STEP_EXIT;
     }
     $isComboCity = Bll_Combo_HouseRelation::isComboCity($brokerInfo->cityId);
     if ($isComboCity['code'] == 200) {
         if ($isComboCity['data']) {
             echo json_encode(Util_MobileAPI::error(Const_APIStatus::E_BROKER_ISNOT_PPC));
             return self::STEP_EXIT;
         }
     }
     return self::STEP_CONTINUE;
 }
示例#4
0
 public function handle_request_internal()
 {
     $business = $this->_params['business'];
     switch ($business) {
         case 'combo':
             $payType = 9999;
             break;
         default:
             $payType = 9999;
     }
     $brokerId = $this->_params['brokerId'];
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     $cityId = $brokerInfo['cityId'];
     $comboInfo = Bll_Combo_HouseRelation::isComboCity($cityId);
     if ($comboInfo['data']) {
         $timeBool = Model_Combo_BusinessUseConfig::getCityComboConfig($cityId);
         if (!empty($timeBool) && time() < $timeBool['startTime']) {
             //切换套餐 数据处理完成之前 不允许切换经纪人paytype
             return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('message' => '切换失败,城市尚未开放套餐'));
         }
         $brokerInfo->payType = $payType;
         if ($brokerInfo->save()) {
             $result = array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('message' => '切换成功'));
         } else {
             $result = array('status' => 'error', 'errcode' => __LINE__, 'message' => '切换失败');
         }
     } else {
         $result = array('status' => 'error', 'errcode' => __LINE__, 'message' => '非套餐城市');
     }
     return $result;
 }
 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));
 }
 public function before()
 {
     $request_body = file_get_contents('php://input');
     if ($request_body) {
         $res = json_decode($request_body, true);
         if (is_array($res)) {
             foreach ($res as $k => $v) {
                 $_REQUEST[$k] = $v;
             }
         }
     }
     $params = $_REQUEST;
     if (intval(date('Ymd', time())) <= 20141103 && !isset($params['forTest'])) {
         return self::STEP_CONTINUE;
     }
     $brokerId = $params['brokerId'];
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     $curCityId = $brokerInfo->cityId;
     $noValueAddedServiceCitys = APF::get_instance()->get_config("no_value_added_service_city", 'multicity');
     foreach ($noValueAddedServiceCitys as $cityId) {
         if ($cityId == $curCityId) {
             $data = array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => Const_APIStatus::E_BROKER_NO_VALUE_ADDED_SERVICE, 'message' => '当前城市暂不开通此业务。');
             header('Content-Type: application/json; charset=utf-8');
             echo json_encode($data);
             return self::STEP_EXIT;
         }
     }
     return self::STEP_CONTINUE;
 }
示例#7
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     //名片格式
     $bnsCardFileJson = json_decode($this->_params['bnsCardFile'], true);
     $size = $bnsCardFileJson['size'];
     $width = $bnsCardFileJson['width'];
     $height = $bnsCardFileJson['height'];
     $format = $bnsCardFileJson['format'];
     //判断图片大小,格式是否正确
     if ($size > 614400 || $size < 20480) {
         throw new Exception_Broker_UpLoadFailed('pic_error,文件应大于20KB,小于600KB');
     } elseif ($width < 300 || $height < 200) {
         throw new Exception_Broker_UpLoadFailed('pic_error,图片应大于300*200像素');
     } elseif (!in_array($format, array('JPEG', 'JPG', 'GIF', 'PNG'))) {
         throw new Exception_Broker_UpLoadFailed('pic_error,图片限jpg、jpeg、gif、png格式');
     }
     //上传名片接口
     $bnsCardFile = 'display/' . $bnsCardFileJson['hash'] . '_' . $bnsCardFileJson['host'];
     //$bnsCardFile = 'c9ed1c5f41cd95df97391e5e60ab3c96_1';
     $setBizCard = Bll_BrokerBaseBll::setBizCard($brokerId, $brokerInfo->cityId, $brokerInfo->areaCode, $brokerInfo->userMobile, '', $bnsCardFile, $brokerInfo->companyId, $brokerInfo->cstBrokerCompanyId);
     if ($setBizCard == 1) {
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('status' => 1));
     } else {
         throw new Exception_Broker_UpLoadApiFailed($setBizCard['message']);
     }
 }
 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));
 }
示例#9
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     // 判断经纪人是否存在
     $broker = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$broker) {
         throw new Exception_Broker_NotFound('BrokerId: ' . $brokerId);
     }
     $this->cityId = $broker->cityId;
     $data = $this->_params['data'];
     $data = json_decode($data, TRUE);
     //        file_put_contents('/data1/logs/addRang.txt',json_encode($data)."\n",FILE_APPEND);
     if (!is_array($data)) {
         return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'message' => '数据信息错误');
     }
     //添加区域板块
     $saleBlockData = $data['saleBlock'];
     if (!$this->doBlock($brokerId, $saleBlockData)) {
         return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'message' => '区域板块保存失败');
     }
     //添加主营小区
     $saleCommunityData = $data['saleCommunity'];
     if (!$this->doSaleCommunity($brokerId, $saleCommunityData)) {
         return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'message' => '主营小区保存失败');
     }
     //添加代理新盘
     $newCommunityData = $data['newCommunity'];
     if (!$this->doNewCommunity($brokerId, $newCommunityData)) {
         return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'message' => '代理新盘保存失败');
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('message' => '保存成功'));
 }
示例#10
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     //检查经纪人是否存在
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_Broker_NotFound('BrokerId: ' . $brokerId);
     }
     // 判断城市是否开通竞价业务
     $cityId = $brokerInfo->cityId;
     if (!Bll_City::isBidCity($cityId)) {
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('todayClicks' => 0, 'todayConsume' => 0, 'todayConsumeUnit' => '元', 'totalProps' => 0));
     }
     $data = array('todayClicks' => 0, 'todayConsume' => 0, 'todayConsumeUnit' => '元');
     $datei = date('Ymd');
     //获取经纪人竞价推广某天的点击和花费信息
     $allClickAndCostInfo = Model_Plan_HpProStatsDay::getBrokerClickAndCostDay($brokerId, $cityId, $datei);
     foreach ($allClickAndCostInfo as $row) {
         $data['todayClicks'] += $row->cnum;
         $data['todayConsume'] += $row->amount / 100;
     }
     $data['todayConsume'] = Util_Formatter::formatTodayConsume($data['todayConsume']);
     //获取计划数
     $data['totalProps'] = Model_Plan_EsfAjkPropSpread::getPlanCountByBroker($brokerId, Model_Plan_EsfAjkPropSpread::DEFAULTVERSION);
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => $data);
 }
示例#11
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     $usrCardState = $brokerInfo->usrCardState;
     $usrPhotoState = $brokerInfo->usrPhotoState;
     $photoFileJson = json_decode($this->_params['photoFile'], true);
     $size = $photoFileJson['size'];
     $format = $photoFileJson['format'];
     if ($size > 1048576) {
         throw new Exception_Broker_UpLoadFailed('头像图片不得大于1M');
     } elseif (!in_array($format, array('JPEG', 'JPG', 'GIF', 'PNG'))) {
         throw new Exception_Broker_UpLoadFailed('图片限jpg、jpeg、gif、png格式');
     }
     $photoFile = 'display/' . $photoFileJson['hash'] . '_' . $photoFileJson['host'];
     //调用上传头像的接口
     $setNewPhoto = Bll_BrokerBaseBll::setNewPhoto($brokerId, $photoFile);
     if ($setNewPhoto == 1) {
         if ($usrCardState == 1 || $usrCardState == 2) {
             Bll_Broker_BrokerCheckInfo::autoSendPass($brokerId);
         }
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('status' => 1));
     } else {
         throw new Exception_Broker_UpLoadApiFailed($setNewPhoto['message']);
     }
 }
 public function handle_request_internal()
 {
     // 修改微信号,并点亮微信号展示, 生成微信二维码--> 数据库保存
     $brokerId = $this->_params['brokerId'];
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     //修改微信号 点亮
     $wechatName = $this->_params['wechatName'];
     $ret = $this->upLoadQrImage($wechatName);
     if (!$ret) {
         throw new Exception_Chat_UpLoadQrImageFailed();
     }
     // 获取经纪人店铺
     $shop = Model_Weshop_Shop::getBrokerShop($brokerId);
     $shop->wechatName = $wechatName;
     $shop->isLighten = 1;
     $shop->qrHostId = $ret['image']['host'];
     $shop->qrHash = $ret['image']['hash'];
     $res = $shop->save();
     if ($res) {
         Bll_Mobile_ChatInfoBll::ModifyBrokerWechatNameNotice($brokerId);
         //通知用户端
     }
     //生成二维码
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('message' => '恭喜你,已点亮微信号展示'));
 }
示例#13
0
 /**
  * 获取支付中心账户id
  * @param $brokerId
  * @param $userId
  * @param $isCreate
  * @return accountId
  */
 public function getUserAccountId($brokerId, $userId = "", $isCreate = true)
 {
     if (empty($brokerId)) {
         return 0;
     }
     $tmp = Model_Mobile_CustomerBrokerAccount::getInstance()->getDataByBrokerId($brokerId);
     if (!empty($tmp)) {
         return $tmp['accountId'];
     } elseif ($isCreate) {
         if (empty($userId)) {
             $broker = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
             $userId = !empty($broker) ? $broker['userId'] : 0;
         }
         if (!$userId) {
             return 0;
         }
         // 创建账户
         $tmp = $this->createAccount($userId);
         if ($tmp['status'] === true) {
             // 插入数据库表
             $insertData = array('brokerId' => $brokerId, 'accountId' => $tmp['accountId'], 'createTime' => time());
             $this->insertUserAccount($insertData);
             return $tmp['accountId'];
         } else {
             return 0;
         }
     } else {
         return 0;
     }
 }
示例#14
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     // 判断经纪人是否存在
     $broker = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     $hzBrokerId = Model_Broker_MainBusiness::getHzBrokerIdByAjkBrokerId($brokerId);
     if (!$hzBrokerId || !$broker) {
         throw new Exception_Broker_NotFound('BrokerId: ' . $brokerId);
     }
     // 判断城市是否开通竞价业务
     $cityId = $broker['cityId'];
     if (!Bll_City::isBidCity($cityId)) {
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('todayClicks' => 0, 'todayConsume' => 0, 'todayConsumeUnit' => '元', 'totalProps' => 0));
     }
     // 获取今日房源点击和消费记录
     $clicksInfo = Model_Stats_PropClick::getClickInfoByBrokerId($hzBrokerId, $cityId);
     // 统计今日竞价点击和消费
     $todayClicks = 0;
     $todayConsume = 0;
     foreach ($clicksInfo as $objClick) {
         $todayClicks += $objClick->bid_cnum;
         $todayConsume += $objClick->bid_cost;
     }
     // 获取竞价房源数
     $bidPropNum = Bll_HzBidPlan::get_broker_bidprop_count($hzBrokerId);
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('todayClicks' => $todayClicks, 'todayConsume' => Util_Formatter::formatTodayConsume($todayConsume / 100), 'todayConsumeUnit' => '元', 'totalProps' => $bidPropNum));
 }
示例#15
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $hzBrokerId = Model_Broker_MainBusiness::getHzBrokerIdByAjkBrokerId($brokerId);
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     $cityId = $brokerInfo->cityId;
     if (!Bll_City::isChoiceCity($cityId, Const_Site::HAOZU)) {
         return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'errcode' => Const_APIStatus::E_NOT_CHOICE_CITY, 'message' => '非精选城市');
     }
     $bllChoice = new Bll_Zufang_Choice();
     $today = date('Ymd');
     $choiceInfo = $bllChoice->get_choice_info($hzBrokerId, $today, $cityId);
     $todayClicks = intval($choiceInfo[0]['bidClicks']);
     $todayConsume = intval($choiceInfo[0]['bidConsume']) / 100;
     // 获取精选推广房源数(精选计划和房源一一对应)
     $plansIds = array();
     $plans = $bllChoice->get_active_choice_plans($hzBrokerId, array(1, 13, 2, 3, 7, 8));
     foreach ($plans as $plan) {
         $plansIds[] = $plan->id;
     }
     $props = array();
     if ($plansIds) {
         $props = $bllChoice->get_prop($plansIds);
     }
     $totalProps = count($props);
     //将精选状态变化数目归零
     $keyData = array('brokerId' => $brokerId, 'bizType' => Model_Mobile_PropRedDot::TYPE_CHOICE_STATUS);
     $data = array('num' => 0);
     Bll_Mobile_PropRedDot::getInstance()->updateData($keyData, $data);
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('todayClicks' => $todayClicks, 'todayConsume' => Util_Formatter::formatTodayConsume($todayConsume), 'todayConsumeUnit' => '元', 'totalProps' => $totalProps));
 }
示例#16
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $customerId = $this->_params['customerId'];
     $pushDate = $this->_params['pushDate'];
     // 判断经纪人是否存在
     $broker = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$broker) {
         throw new Exception_Broker_NotFound('BrokerId: ' . $brokerId);
     }
     // 判断经纪人和客户之间关系是否存在(给定日期)
     $relation = Model_Mobile_BrokerUserRelation::getBrokerCustomerRelationWithDate($brokerId, $customerId, $pushDate);
     if (!$relation) {
         throw new Exception_CustomerRush_RelationNotFound("BrokerId: {$brokerId}; CustomerId: {$customerId}; Date: {$pushDate}");
     }
     // 判断经纪人和客户是否已经有效锁定(未过期临时锁定 或 永久锁定)
     $status = intval($relation->isLocked());
     if ($status) {
         if ($relation->isTempLocked()) {
             $statusMsg = '临时锁定';
         } else {
             $statusMsg = '永久锁定';
         }
     } else {
         $statusMsg = '客户失效了 重新抢吧';
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('status' => $status, 'statusMsg' => $statusMsg));
 }
示例#17
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $wechatName = isset($this->_params['wechatName']) ? trim($this->_params['wechatName']) : '';
     $introduce = trim($this->_params['introduce']);
     $shopImage = isset($this->_params['shopImage']) ? json_decode($this->_params['shopImage'], true) : array();
     // 判断经纪人是否存在
     $broker = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$broker) {
         throw new Exception_Broker_NotFound('BrokerId: ' . $brokerId);
     }
     // 获取经纪人店铺
     $shop = Model_Weshop_Shop::getBrokerShop($brokerId);
     // 更新店铺信息
     if ($wechatName) {
         $shop->wechatName = $wechatName;
     }
     $shop->introduce = $introduce;
     if (isset($shopImage['host']) && isset($shopImage['hash'])) {
         $shop->imageHostId = intval($shopImage['host']);
         $shop->imageHash = $shopImage['hash'];
     }
     $shop->save();
     // 拼装返回数据
     $data = array('message' => '保存成功');
     return API_Result::create()->ok()->data($data)->toArray();
 }
示例#18
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     //读取每日任务完成情况
     $currentTime = date("Ymd", time());
     if (Bll_Commsign::getDailySignedStatus($brokerId)) {
         Model_DailyQuest_DailyQuestStatus::insertDailySigned($brokerId);
     }
     $dailyQuestStatus = Model_DailyQuest_DailyQuestStatus::getDailyQuestStatusByBrokerId($brokerId, $currentTime);
     $questMsg = '完成任务,获得礼包,快去完成吧!';
     $signStatus = $dailyQuestStatus['signState'] ? $dailyQuestStatus['signState'] : 0;
     $shareStatus = $dailyQuestStatus['shareState'] ? $dailyQuestStatus['shareState'] : 0;
     $rewardStatus = $dailyQuestStatus['rewardState'] ? $dailyQuestStatus['rewardState'] : 0;
     $canGetReward = '0';
     //完成任务没领奖励
     if ($signStatus == '1' && $shareStatus == '1' && $rewardStatus == '0') {
         $questMsg = '恭喜您获得礼包,快去领奖吧!';
         $canGetReward = '1';
     }
     //完成任务已领取奖励
     if ($signStatus == '1' && $shareStatus == '1' && $rewardStatus == '1') {
         $questMsg = '您已完成任务获得抢客券一张!';
         $canGetReward = '0';
     }
     $data = array('brokerId' => $brokerId, 'signStatus' => $signStatus, 'shareStatus' => $shareStatus, 'canGetReward' => $canGetReward, 'questMsg' => $questMsg);
     return array('status' => 'ok', 'data' => $data);
 }
示例#19
0
 /**
  * 获取经纪人一天的点击和话费
  * 直接为controller调用
  *
  * @param $brokerId
  * @param $datei
  * @return array|bool
  */
 public function getBrokerClickAndCostDay($brokerId, $datei, $cityId = false)
 {
     try {
         if (!$cityId) {
             //获取经纪人基本信息
             $brokerBaseInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
             if (empty($brokerBaseInfo)) {
                 $this->error(bll_choice_EsfAPPAPIChoice::EMPTY_BROKER_ERROR, bll_choice_EsfAPPAPIChoice::EMPTY_BROKER_ERROR_MSG);
             }
             $cityId = $brokerBaseInfo->cityId;
         }
         //获取点击和花费信息
         $data = array('todayClicks' => 0, 'todayConsume' => 0, 'todayConsumeUnit' => '元');
         $allClickAndCostInfo = Model_Plan_HpProStatsDay::getBrokerClickAndCostDay($brokerId, $cityId, $datei);
         foreach ($allClickAndCostInfo as $row) {
             $data['todayClicks'] += $row->cnum;
             $data['todayConsume'] += $row->amount / 100;
         }
         return $data;
     } catch (Exception $e) {
         if ($e instanceof Exception_BllErrorException) {
             $this->errorCode = $e->getCode();
         } else {
             $this->errorCode = bll_choice_EsfAPPAPIChoice::UNKNOW_ERROR;
         }
         $this->errorMsg = $e->getMessage();
         return false;
     }
 }
示例#20
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     // 判断经纪人是否存在
     $broker = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$broker) {
         throw new Exception_Broker_NotFound('BrokerId: ' . $brokerId);
     }
     //区域板块
     $saleBlockList = Model_Mobile_CustomerSaleRange::getBrokerIdRange($brokerId, 1, 3);
     $saleBlock = array();
     if (!empty($saleBlockList)) {
         foreach ($saleBlockList as $key => $val) {
             $saleBlock[$key] = array('areaId' => $val['areaId'], 'area' => $val['area'], 'blockId' => $val['blockId'], 'block' => $val['block'], 'mapx' => $val['mapx'], 'mapy' => $val['mapy']);
         }
     }
     //主营小区
     $saleCommunityList = Model_Mobile_CustomerSaleRange::getBrokerIdRange($brokerId, 2, 10);
     $saleCommunity = array();
     if (!empty($saleCommunityList)) {
         foreach ($saleCommunityList as $key => $val) {
             $saleCommunity[$key] = array('communityId' => $val['communityId'], 'communityName' => $val['communityName']);
         }
     }
     //代理新盘
     $newCommunityList = Model_Mobile_CustomerNewPropRange::getBrokerIdRange($brokerId, 10);
     $newCommunity = array();
     if (!empty($newCommunityList)) {
         foreach ($newCommunityList as $key => $val) {
             $newCommunity[$key] = array('loupanId' => $val['loupanId'], 'loupanName' => $val['loupanName']);
         }
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('saleBlock' => array_values($saleBlock), 'saleCommunity' => array_values($saleCommunity), 'newCommunity' => array_values($newCommunity)));
 }
示例#21
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     //身份证
     $usrCardState = $brokerInfo->usrCardState;
     $userCardStatus = 0;
     if ($usrCardState == 2) {
         $userCardStatus = 1;
         //已认证
     }
     //头像
     $userPhoto = $brokerInfo->userPhoto;
     $usrPhotoState = $brokerInfo->usrPhotoState;
     $usrPhotoTmpState = $brokerInfo->usrPhotoTmpState;
     $photoStaus = 0;
     $imageUrl = '';
     if ($usrPhotoState == 2 || $usrPhotoTmpState == 1) {
         $photoStaus = 1;
         //已认证
         $imageUrl = Util_DisplayImages::get_img_url($userPhoto, -1, '100x133');
     }
     if ($photoStaus == 1 && $userCardStatus == 1) {
         $status = 1;
         //双证通过
     } else {
         $status = 0;
         //双证未通过审核
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('status' => $status, 'userPhotoPassUrl' => $imageUrl));
 }
示例#22
0
 public function handle_request_internal()
 {
     $this->brokerId = $this->_params['brokerId'];
     $this->operatorId = $this->_params['operatorId'] ? $this->_params['operatorId'] : 0;
     $this->operatorName = $this->_params['operatorName'] ? $this->_params['operatorName'] : '';
     $result = array('status' => 'error', 'message' => '');
     // 验证经纪人是否合法
     $broker = Model_Broker_AjkBrokerExtend::findWithBrokerId($this->brokerId);
     if (!$broker) {
         $result['message'] = '经纪人不合法';
         return $result;
     }
     // 获取活动劵类型数据
     $cityId = $broker['cityId'];
     $couponData = Bll_CustomerRush_Coupon::getInstance()->getCoupon($cityId, date("Ymd"), Model_Mobile_CustomerCoupon::TYPE_KCOUPON_PRESENT);
     if (empty($couponData)) {
         $result['message'] = '不存在活动劵信息';
         return $result;
     }
     $this->couponId = $couponData['id'];
     // 插入经纪人劵表
     $arr = array('brokerId' => $this->brokerId, 'couponId' => $this->couponId, 'status' => Model_Mobile_CustomerBrokerCoupon::STATUS_OK_USE, 'totalNum' => $couponData['totalNum'], 'usedNum' => 0, 'updateTime' => date("Y-m-d H:i:s"), 'createTime' => time());
     $this->brokerCouponId = Bll_CustomerRush_Coupon::getInstance()->insertBrokerCoupon($arr);
     if ($this->brokerCouponId) {
         // 记录日志
         $this->_insertPresentCouponLog();
         $result['status'] = 'ok';
         $result['message'] = '送劵完成';
     } else {
         $result['message'] = '赠送劵失败';
     }
     return $result;
 }
示例#23
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $op = $this->_params['op'];
     $result = array('status' => 'error', 'message' => '');
     // 验证经纪人是否合法
     $broker = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$broker) {
         $result['message'] = '经纪人不合法';
         return $result;
     }
     //  验证ip安全
     $checkResult = $this->_checkSave();
     if (!$checkResult) {
         $result['message'] = '非法访问';
         return $result;
     }
     if ($op == 'create') {
         return $this->_create($brokerId, $broker);
     } elseif ($op == 'active') {
         return $this->_active($brokerId);
     } else {
         $result['message'] = 'op参数不正确';
         return $result;
     }
 }
示例#24
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $skuId = $this->_params['skuId'];
     $password = $this->_params['password'];
     //经纪人信息
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     $userId = $brokerInfo->userId;
     if ($brokerInfo->payType != 9999) {
         return Util_MobileAPI::error(Const_APIStatus::E_BROKER_IS_NOT_COMBO);
         //非套餐经纪人不能购买套餐
     }
     //购买
     $md5_password = md5($password);
     //密码加密
     $baseencode_password = base64_encode($md5_password);
     $userInfo = Model_Broker_Member::getAjkMembersByUserId($userId);
     //验证密码
     if ($userInfo->userPwd == $baseencode_password) {
         $result = Bll_Combo_Broker_BrokerComboInfo::brokerBuyCombo($userId, $skuId);
         if ($result['status'] == 'ok') {
             return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('message' => '购买成功'));
         } else {
             switch ($result['code']) {
                 case '400539':
                 case '400015':
                 case '400540':
                 case '400545':
                 case '400498':
                 case '400541':
                 case '505008':
                 case '398489':
                 case '398491':
                 case '402205':
                 case '404086':
                     throw new Exception_JavaApiException($result['info']);
                     break;
                 case '398490':
                     throw new Exception_SameComboException('不支持再购买同类型套餐');
                     break;
                 case '402207':
                     throw new Exception_Account_BalanceNotEnough('余额不足');
                     break;
                 case '505007':
                     throw new Exception_Broker_NotPassCheck('您的双证审核未通过');
                     break;
                 default:
                     return Util_MobileAPI::error(Const_APIStatus::E_COMBO_BUY_COMBO_FAILED);
                     //购买失败
             }
         }
     } else {
         return Util_MobileAPI::error(Const_APIStatus::E_BROKER_PASSWORD_DIFFERENT);
         //密码错误
     }
 }
示例#25
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $customerId = $this->_params['customerId'];
     // 升级提示
     $rushStartTime = APF::get_instance()->get_config('v2_rush_customer_consume_coupon_time', 'customer');
     if (time() >= strtotime($rushStartTime)) {
         return array('status' => 'error', 'message' => "抢客户功能大升级!快去最新版本移动经纪人APP中体验吧!");
     }
     // 判断经纪人是否存在
     $broker = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$broker) {
         throw new Exception_Broker_NotFound('BrokerId: ' . $brokerId);
     }
     // 判断经纪人和客户之间关系是否存在(当日内)
     $relation = Model_Mobile_BrokerUserRelation::getBrokerCustomerTodayRelation($brokerId, $customerId);
     if (!$relation) {
         throw new Exception_CustomerRush_RelationNotFound("BrokerId: {$brokerId}, CustomerId: {$customerId}");
     }
     // 判断经纪人和客户是否已经有效锁定(未过期临时锁定 或 永久锁定)
     if ($relation->isLocked()) {
         throw new Exception_CustomerRush_IsLocked("BrokerId: {$brokerId}; CustomerId: {$customerId}; RelationId: {$relation->id}; Status: {$relation->status}; TempLockExpireTime: {$relation->tempLockExpireTime}");
     }
     // 判断经纪人是否可抢
     $brokerTodayLockTimes = Model_Mobile_BrokerUserRelation::getBrokerTodayLockTimes($brokerId);
     if ($brokerTodayLockTimes >= Const_CustomerRush::BROKER_MAX_RUSH_COUNT) {
         throw new Exception_CustomerRush_BrokerChanceUsedUp("BrokerId: {$brokerId};");
     }
     // 检测用户是否屏蔽
     if (!$relation->isCustomerAllowRush()) {
         throw new Exception_CustomerRush_CustomerNotAllowRush("BrokerId: {$brokerId}, CustomerId: {$customerId}");
     }
     // 判断用户是否可抢
     $customerTodayLockTimes = Model_Mobile_BrokerUserRelation::getCustomerTodayLockTimes($customerId);
     if ($customerTodayLockTimes >= Const_CustomerRush::CUSTOMER_MAX_RUSHED_COUNT) {
         throw new Exception_CustomerRush_CustomerChanceUsedUp("CustomerId: {$customerId};");
     }
     // 获取经纪人锁
     if (!Bll_Customer_Parallel::lockBroker($brokerId)) {
         throw new Exception_CustomerRush_LockBrokerFailed("BrokerId: {$brokerId}; CustomerId: {$customerId}; RelationId: {$relation->id};");
     }
     // 获取客户锁
     if (!Bll_Customer_Parallel::lockUser($customerId)) {
         Bll_Customer_Parallel::unlockBroker($brokerId);
         throw new Exception_CustomerRush_LockCustomerFailed("BrokerId: {$brokerId}; CustomerId: {$customerId}; RelationId: {$relation->id};");
     }
     // 临时锁定,更新关系
     $relation->tempLock();
     // 临时锁定,更新锁定
     Model_Mobile_CustomerLock::tempLock($relation->id, $relation->uploadDt, $relation->brokerId, $relation->userDeviceId);
     // 释放客户锁
     Bll_Customer_Parallel::unlockUser($customerId);
     // 释放经纪人锁
     Bll_Customer_Parallel::unlockBroker($brokerId);
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('status' => 1, 'statusMsg' => '抢成功'));
 }
示例#26
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$brokerInfo) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     $sendNumChangeDate = APF::get_instance()->get_config("customer_daily_mission_reward_num", "customer");
     if (time() >= strtotime($sendNumChangeDate)) {
         $sendNum = self::PRESENT_COUPON_NEW_NUM;
         $rewardMsg = APF::get_instance()->get_config("customer_daily_mission_reward_msg", "customer");
     } else {
         $sendNum = self::PRESENT_COUPON_NUM;
         $rewardMsg = "恭喜你,获得抢客券2张";
     }
     $data = array('brokerId' => $brokerId, 'rewardMsg' => $rewardMsg);
     $this->brokerId = $brokerId;
     // 获取活动劵类型数据
     $cityId = $brokerInfo['cityId'];
     $couponData = Bll_CustomerRush_Coupon::getInstance()->getCoupon($cityId, date("Ymd"), Model_Mobile_CustomerCoupon::TYPE_DAILYCOUPON_PRESENT);
     if (empty($couponData)) {
         return array('status' => 'error', 'message' => '不存在活动劵信息');
     }
     $this->couponId = $couponData['id'];
     $currentTime = date("Ymd", time());
     //验证是否可领取奖励
     if (Bll_Commsign::getAlreadyGetRewards($brokerId, $currentTime)) {
         return array('status' => 'error', 'message' => '已经领取过奖励');
     }
     $dailyQuestStatus = Model_DailyQuest_DailyQuestStatus::getDailyQuestStatusByBrokerId($brokerId, $currentTime);
     $signStatus = $dailyQuestStatus['signState'] ? $dailyQuestStatus['signState'] : 0;
     $shareStatus = $dailyQuestStatus['shareState'] ? $dailyQuestStatus['shareState'] : 0;
     $rewardStatus = $dailyQuestStatus['rewardState'] ? $dailyQuestStatus['rewardState'] : 0;
     if (!($signStatus == '1' && $shareStatus == '1' && $rewardStatus == '0')) {
         return array('status' => 'error', 'message' => '已经领取过奖励');
     }
     //赠送抢客劵
     for ($i = 0; $i < $sendNum; $i++) {
         // 插入经纪人劵表
         $arr = array('brokerId' => $this->brokerId, 'couponId' => $this->couponId, 'status' => Model_Mobile_CustomerBrokerCoupon::STATUS_OK_USE, 'totalNum' => $couponData['totalNum'], 'usedNum' => 0, 'updateTime' => date("Y-m-d H:i:s"), 'createTime' => time());
         $this->brokerCouponId = Bll_CustomerRush_Coupon::getInstance()->insertBrokerCoupon($arr);
         if ($this->brokerCouponId) {
             // 记录日志
             $this->_insertPresentCouponLog();
         } else {
             return array('status' => 'error', 'message' => '赠送失败');
         }
     }
     //更新已领取
     Bll_Commsign::alreadyGetRewards($brokerId, $currentTime);
     $status = Model_DailyQuest_DailyQuestStatus::updateGetReward($brokerId, $currentTime);
     if (!$status) {
         return array('status' => 'error', 'message' => '更新领取状态失败');
     }
     return array('status' => 'ok', 'data' => $data);
 }
示例#27
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (empty($brokerInfo)) {
         throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS);
     }
     $data = Bll_Mobile_PropRedDot::getInstance()->getDataByBrokerIdAndType($brokerId, Model_Mobile_PropRedDot::TYPE_CHOICE_STATUS);
     return array('status' => 'ok', 'data' => array('num' => (int) $data[0]['num']));
 }
示例#28
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     // 判断经纪人是否存在
     $broker = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$broker) {
         throw new Exception_Broker_NotFound('BrokerId: ' . $brokerId);
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('count' => Bll_CustomerRush_Basic::getBrokerLatestPushCountValue($brokerId)));
 }
示例#29
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     // 判断经纪人是否存在
     $broker = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$broker) {
         throw new Exception_Broker_NotFound('BrokerId: ' . $brokerId);
     }
     $titleInfo = APF::get_instance()->get_config('weshop_titleInfo');
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('title' => $titleInfo['title'], 'additionalInfo' => $titleInfo['additionalInfo']));
 }
示例#30
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']));
 }