コード例 #1
0
 public function handle_request()
 {
     $fixPlanList = $this->getFixPlanList();
     if (count($fixPlanList) < self::PLAN_LIMIT) {
         file_put_contents($this->_doneFile, 'DONE');
     } else {
         file_put_contents($this->_doneFile, 'NO');
     }
     if (empty($fixPlanList)) {
         $this->logMsg(sprintf('没有获取到定价计划[id=%d]', $this->_startId));
         return;
     }
     foreach ($fixPlanList as $fixPlan) {
         $fixPlanId = $fixPlan['id'];
         $this->setCursor($fixPlanId);
         $brokerInfo = Model_Broker_HzUsersSearch::getUserInfoByUserId($fixPlan['user_id']);
         if (empty($brokerInfo)) {
             $this->logMsg(sprintf('没有获取到经纪人[%d]的信息', $fixPlan['user_id']));
         }
         $cityId = $brokerInfo['cityId'];
         if (Model_Plan_HzPlanBasic::updateFixPlanCityId($fixPlanId, $cityId)) {
             $this->logMsg(sprintf('更新计划[%d]的cityId为[%d]成功', $fixPlanId, $cityId));
         } else {
             $this->logMsg(sprintf('更新计划[%d]的cityId为[%d]失败', $fixPlanId, $cityId));
         }
     }
 }
コード例 #2
0
ファイル: HzPropView.php プロジェクト: emilymwang8/ajk-broker
 /**
  * init env
  * @param AJKRequest $request
  * @param array $out
  * @throws Exception
  */
 private static function initEnv($request, &$out)
 {
     $out['debug'] = isset($_GET['debug']) ? true : false;
     $out['cityId'] = $request->getBrokerCityId();
     $out['ajkBrokerId'] = $request->getBrokerId();
     $route_matches = $request->get_router_matches();
     $out['proId'] = trim($route_matches[2], "/ \t\n\r\v");
     if (!$out['proId']) {
         throw new Exception('缺少房源Id参数');
     }
     // 获取好租brokerId
     $out['hzBrokerId'] = Model_Broker_HzMapping::get_hz_broker_id($out['ajkBrokerId']);
     // 是否精选
     $out['isChoiceCity'] = Bll_City::isChoiceCity($out['cityId'], Const_Site::HAOZU);
     $out['isBidCity'] = false;
     // 获取经纪人信息
     if (!($out['brokerInfo'] = Model_Broker_HzUsersSearch::getUserInfoByUserId($out['hzBrokerId']))) {
         throw new Exception('获取好租经纪人信息失败:hzBrokerId [' . $out['hzBrokerId'] . ']');
     }
     // 身份是否通过
     $out['isPassVerify'] = Bll_Broker_HzBroker::isPassVerify($out['brokerInfo']['profileVerify']);
     // 获取套餐相关
     //$out['brokerLimitInfo'] = Bll_Broker_BrokerLimit::getPpcBrokerLimitInfo($out['ajkBrokerId'], Bll_Broker_BrokerLimit::PPC_BROKER_LIMIT_ZF_SITE);
     // 获取经纪人主推房源
     $out['mainSpreadProIds'] = array();
     $mainSpreads = Model_Broker_AdPropsShowRent::getInstance()->getBrokerAdPropInfo($out['ajkBrokerId']);
     if ($mainSpreads) {
         foreach ($mainSpreads as $v) {
             $out['mainSpreadProIds'][$v->propId] = $v->propId;
         }
     }
 }
コード例 #3
0
ファイル: HzPropList.php プロジェクト: emilymwang8/ajk-broker
 /**
  * init env
  * @param $request
  * @param $out
  * @throws Exception
  */
 private static function initEnv($request, &$out)
 {
     $out['debug'] = isset($_GET['debug']) ? true : false;
     $out['cityId'] = $request->getBrokerCityId();
     $out['ajkBrokerId'] = $request->getBrokerId();
     // 获取好租brokerId
     $out['hzBrokerId'] = Model_Broker_HzMapping::get_hz_broker_id($out['ajkBrokerId']);
     // 获取账户余额
     $balance = Bll_Broker_HzBroker::getAccountInfo($out['ajkBrokerId'], 'balance');
     if (!$balance['status']) {
         throw new Exception_BllErrorException($balance['msg']);
     }
     $out['validMoney'] = $balance['msg'] ? round($balance['msg'] / 100, 2) : 0;
     // 是否精选
     $out['isChoiceCity'] = Bll_City::isChoiceCity($out['cityId'], Const_Site::HAOZU);
     $out['isBidCity'] = false;
     $out['isShowCaseCity'] = Bll_City::isShowCaseCity($out['cityId'], Const_Site::HAOZU);
     // 获取经纪人信息
     if (!($out['brokerInfo'] = Model_Broker_HzUsersSearch::getUserInfoByUserId($out['hzBrokerId']))) {
         throw new Exception('获取好租经纪人信息失败:hzBrokerId [' . $out['hzBrokerId'] . ']');
     }
     // 身份是否通过
     $out['isPassVerify'] = Bll_Broker_HzBroker::isPassVerify($out['brokerInfo']['profileVerify']);
     // 获取套餐相关
     $out['brokerLimitInfo'] = Bll_Broker_BrokerLimit::getPpcBrokerLimitInfo($out['ajkBrokerId'], Bll_Broker_BrokerLimit::PPC_BROKER_LIMIT_ZF_SITE);
     // 获取经纪人主推房源
     $out['mainSpreadProIds'] = array();
     $mainSpreads = Model_Broker_AdPropsShowRent::getInstance()->getBrokerAdPropInfo($out['ajkBrokerId']);
     if ($mainSpreads) {
         foreach ($mainSpreads as $v) {
             $out['mainSpreadProIds'][$v->propId] = $v->propId;
         }
     }
 }
コード例 #4
0
ファイル: BrokerApi.php プロジェクト: emilymwang8/ajk-broker
 /**
  * 查询经纪人新封顶模式信息
  * @param $params
  * @return bool|mixed
  */
 public static function getPpcBrokerLimitInfo($params)
 {
     $apiInfo = self::getBase('service-internal/rest/broker/showBrokerLimitConfig', $params);
     if (!$apiInfo || $apiInfo['status'] != 'ok' || !isset($apiInfo['data']['amountLimit'])) {
         // 获取好租brokerId
         $hzBrokerId = Model_Broker_HzMapping::get_hz_broker_id($params['brokerId']);
         // 取城市封顶
         if ($userInfo = Model_Broker_HzUsersSearch::getUserInfoByUserId($hzBrokerId)) {
             $cityId = $userInfo['cityId'];
             $cityTop = Model_City_CityTopConfig::getCityTopConfig($cityId, date("Ymd"));
         }
         if ($userInfo && $cityTop && $cityTop->money) {
             $cityopMoney = $cityTop->money;
         } else {
             $cityopMoney = -1;
         }
         // 如果一切ok, 无限额情况
         if ($apiInfo && !isset($apiInfo['data']['amountLimit'])) {
             $apiInfo['data']['amountLimit'] = $cityopMoney;
         } else {
             $apiInfo['status'] = 'ok';
             $apiInfo['data']['tempId'] = 0;
             $apiInfo['data']['tempName'] = '无限额';
             $apiInfo['data']['amountLimit'] = $cityopMoney;
             $apiInfo['data']['publishLimit'] = 80;
             $apiInfo['data']['promotionLimit'] = 50;
         }
     }
     return $apiInfo;
 }
コード例 #5
0
 /**
  * 根据经纪人类型获取经纪人列表
  *
  * @param int $pkgType
  * @param int $userId
  * @param int $limit
  * @return array
  */
 public static function getUsersSearchInfoByPkgType($pkgType = Model_Broker_HzUsersSearch::PKGTYPE_HAOZU_PPC_BROKER, $userId = 0, $limit = 1000, $cityid = null)
 {
     try {
         $dao = Model_Broker_HzUsersSearch::data_access();
         if ($cityid && is_array($cityid)) {
             $dao->filter('cityId', $cityid);
         }
         $userList = $dao->filter('pkgType', $pkgType)->filter('idCardVerify', '2')->filter_by_op('userId', APF_DB_MysqlAccessor::OP_GREATER_THAN, $userId)->limit($limit)->sort('userId', 'ASC')->get_all();
         if (!is_array($userList)) {
             return array();
         }
         return $userList;
     } catch (Exception $e) {
         return array();
     }
 }
コード例 #6
0
ファイル: ManageHz.php プロジェクト: emilymwang8/ajk-broker
 /**
  * @param AJKRequest $request
  * @param array $out
  * @throws Exception
  */
 public static function initEnv($request, &$out)
 {
     $out['debug'] = isset($_GET['debug']) ? true : false;
     $out['cityId'] = $request->getBrokerCityId();
     $out['ajkBrokerId'] = $request->getBrokerId();
     // 获取好租brokerId
     $out['hzBrokerId'] = Model_Broker_HzMapping::get_hz_broker_id($out['ajkBrokerId']);
     // 获取账户余额
     /*$balance = Bll_Broker_HzBroker::getAccountInfo($out['ajkBrokerId'], 'balance');
       if (!$balance['status'])
           throw new Exception_BllErrorException($balance['msg']);
       $out['validMoney'] = $balance['msg'] ? round($balance['msg'] / 100, 2) : 0;
       */
     // 是否精选
     $out['isChoiceCity'] = Bll_City::isChoiceCity($out['cityId'], Const_Site::HAOZU);
     $out['isBidCity'] = false;
     $out['isShowCaseCity'] = Bll_City::isShowCaseCity($out['cityId'], Const_Site::HAOZU);
     $out['bidTip'] = '精选';
     // 获取经纪人信息
     if (!($out['brokerInfo'] = Model_Broker_HzUsersSearch::getUserInfoByUserId($out['hzBrokerId']))) {
         throw new Exception('获取好租经纪人信息失败:hzBrokerId [' . $out['hzBrokerId'] . ']');
     }
     // 身份是否通过
     $out['isPassVerify'] = Bll_Broker_HzBroker::isPassVerify($out['brokerInfo']['profileVerify']);
     // 获取该经纪人房源
     $out['props'] = Bll_House_HzHouse::getValidPropsByBrokerIdEx($out['ajkBrokerId'], $out['cityId']);
     // 获取改经纪人所有房源质量
     //$out['propsQuality'] = Model_Stats_HzPropQuality::getPropsquality(array_keys($out['props']));
     $out['propsQuality'] = static::getHzPropsQuality($out['props']);
     if (count($out['props']) > 0) {
         foreach ($out['props'] as $proId => $prop) {
             $out['props'][$proId]['proId'] = $proId;
             // 获取剩余时间
             $out['props'][$proId]['leftDays'] = Bll_House_HzHouse::getLeftDays($prop['created']);
             // 是否手机房源
             $out['props'][$proId]['isMobileProp'] = Bll_House_HzHouse::isMobileProp($prop['from'] ? $prop['from'] : '');
         }
     }
     // 获取经纪人主推房源
     $out['mainSpreadProIds'] = array();
     $mainSpreads = Model_Broker_AdPropsShowRent::getInstance()->getBrokerAdPropInfo($out['ajkBrokerId']);
     if ($mainSpreads) {
         foreach ($mainSpreads as $v) {
             $out['mainSpreadProIds'][$v->propId] = $v->propId;
         }
     }
 }
コード例 #7
0
 public function handle_request()
 {
     if ($this->_hzBrokerId <= 0) {
         $this->usage();
         return;
     }
     $hzBrokerInfo = Model_Broker_HzUsersSearch::getUserInfoByUserId($this->_hzBrokerId);
     if (empty($hzBrokerInfo)) {
         $this->setLog('获取好租经纪人信息失败');
         return;
     }
     $ajkBrokerId = $this->getAjkBrokerId($this->_hzBrokerId);
     if ($ajkBrokerId <= 0) {
         $this->setLog('获取二手房经纪人Id失败');
         return;
     }
     $this->setLog(sprintf('经纪人的ajkBrokerId=%d', $ajkBrokerId));
     $this->repairPropSearch($this->_hzBrokerId, $ajkBrokerId, $hzBrokerInfo['cityId']);
 }
コード例 #8
0
ファイル: PublishHz.php プロジェクト: emilymwang8/ajk-broker
 public function afterPost()
 {
     // 推广
     if ($this->ctx['html_action'] == 'publish') {
         //伪登陆不能推广
         if ($this->ctx['isManagerCookie']) {
             $this->redirect2Result(Const_PublishCode::PSEUDO_ERROR, $this->site, $this->action, $this->ctx['proId']);
         }
         if (Bll_City::isComboCity($this->ctx['cityId'])) {
             // 套餐推广
             $spreadResult = Bll_Combo_HouseRelation::houseStartComboSpreadV2($this->ctx['ajkBrokerId'], $this->ctx['cityId'], $this->ctx['proId'], Bll_Combo_HouseRelation::SITE_TYPE_HZ);
         } else {
             // 双证审核未通过 不能推广
             // 获取经纪人信息
             $brokerInfo = Model_Broker_HzUsersSearch::getUserInfoByUserId($this->ctx['hzBrokerId']);
             // 身份是否通过
             $this->ctx['isPassVerify'] = $brokerInfo && Bll_Broker_HzBroker::isPassVerify($brokerInfo['profileVerify']);
             //if (!$isPassVerify)
             //    $this->redirect2Result(Const_PublishCode::NOT_PASS_VERIFY, $this->site, $this->action, $this->ctx['proId']);
             // 获取账户余额
             $balance = Bll_Broker_HzBroker::getAccountInfo($this->ctx['ajkBrokerId'], 'balance');
             $this->ctx['validMoney'] = $balance && $balance['msg'] ? round($balance['msg'] / 100, 2) : 0;
             //if (!$validMoney)
             //   $this->redirect2Result(Const_PublishCode::NOT_MONEY, $this->site, $this->action, $this->ctx['proId']);
             // ppc推广
             $spreadResult = Bll_Plan_Fix_HzFix::addPropToPlan($this->ctx['planId'], $this->ctx['proId'], $this->ctx['cityId'], $this->ctx['ajkBrokerId']);
         }
         // 推广出错
         if ($spreadResult['status'] <= 0) {
             $this->redirect2Result(Const_PublishCode::SPREAD_PROP_HANDLE_STOP, $this->site, $this->action, $this->ctx['proId'], $spreadResult['msg']);
         }
     }
     //++++++ others actions
     // 委托
     if (isset($this->ctx['isCommission']) && $this->ctx['isCommission']) {
         // 房源发布成功,回写委托信息
         if ($this->ctx['commission'] && $this->ctx['proId']) {
             Bll_House_HzHouse::updateCommission($this->ctx['commissionId'], $this->ctx['proId']);
         }
     }
 }
コード例 #9
0
 /**
  * 批量获取 PPC 经纪人
  *
  * @param int $userId
  * @param int $limit
  * @return array
  */
 public function scanUsers($userId, $limit = self::SCAN_USER_BATCH_LIMIT, $cityid = null)
 {
     $this->logMessage(sprintf('扫描经纪人列表,从%d开始的%d条;CityIds:%s', $userId, $limit, $cityid));
     /*
     $dao = Model_Broker_MainBusiness::data_access();
     if ($cityid) {
         $where = ' and b.cityid in('.$cityid.')';
     } else {
         $where = ' ';
     }
     return $dao->native_sql("SELECT a.hz_brokerid AS userId, b.cityid AS cityId FROM ajk_broker_main_business AS a LEFT JOIN `ajk_brokerextend` AS b ON a.member_id=b.`UserId` WHERE b.brokerLevel IN ('K','L') AND a.hz_brokerid>? {$where} ORDER BY userId ASC limit {$limit}", array($userId));
     */
     if ($cityid) {
         $cityid = explode(',', $cityid);
     } else {
         $cityid = null;
     }
     return Model_Broker_HzUsersSearch::getUsersSearchInfoByPkgType(Model_Broker_HzUsersSearch::PKGTYPE_HAOZU_PPC_BROKER, $userId, $limit, $cityid);
 }
コード例 #10
0
 private function updateHzPersonalId($userId, $personalId)
 {
     if (1 != Model_Broker_HzUsersSearch::updateUserInfo($userId, array('personalId' => strtolower(trim($personalId))))) {
         $this->log(sprintf('更新好租经纪人(userId: %s) 身份证号(%s)码 失败', $userId, $personalId));
         return false;
     }
     $this->log(sprintf('更新好租经纪人(userId: %s) 身份证号(%s)码 成功', $userId, $personalId));
     return true;
 }
コード例 #11
0
 /**
  * 批量获取 PPC 经纪人
  *
  * @param int $userId
  * @param int $limit
  * @return array
  */
 public function scanUsers($userId, $limit = self::SCAN_USER_BATCH_LIMIT)
 {
     $this->logMessage(sprintf('扫描经纪人列表,从%d开始的%d条', $userId, $limit));
     return Model_Broker_HzUsersSearch::getUsersSearchInfoByPkgType(Model_Broker_HzUsersSearch::PKGTYPE_HAOZU_PPC_BROKER, $userId, $limit);
 }
コード例 #12
0
ファイル: HzChoice.php プロジェクト: emilymwang8/ajk-broker
 /**
  * 拼接参数,供上下文使用
  * @param $params
  * @return array
  */
 private static function joinParams(&$params)
 {
     // 获取basic
     // bug42309 需取master
     if (!($basic = Dao_Broker_HzPlan::get_plan($params['planId'], true))) {
         return Bll_HzPropBll::build_return(0, array("获取好租计划失败"));
     }
     $params['userId'] = $basic['user_id'];
     $params['blockId'] = $basic['blockId'];
     $params['priceId'] = $basic['priceId'];
     $params['status'] = $basic['status'];
     $params['flag'] = $basic['flag'];
     $params['bidVersion'] = $basic['bidVersion'];
     //精选标记 1-竞价,2-精选
     $params['planId'] = $basic['id'];
     //计划id
     $params['totalConsume'] = $basic['total_consume'];
     //竞价、精选花费
     $params['is_valid'] = $params['isValid'] = $basic['status'];
     // 由于经纪人操作太快, 可能关系里的plan_id已经被更新成新的了
     // 所以队列表里加了proId
     // 此处兼容proId=0的情况
     if (!isset($params['proId']) || $params['proId'] == 0) {
         // 获取planning
         $planning = Dao_Broker_HzPlan::get_planning($params['planId'], 2, '', true);
         if (count($planning) < 1) {
             return Bll_HzPropBll::build_return(0, array("获取好租关系失败"));
         }
         $params['proId'] = $planning[0]['proid'];
     }
     // 获取城市id
     $userInfo = Model_Broker_HzUsersSearch::getUserInfoByUserId($params['userId']);
     $params['cityId'] = isset($userInfo['cityId']) ? $userInfo['cityId'] : 0;
     return Bll_HzPropBll::build_return(1, array("success"));
 }
コード例 #13
0
ファイル: HzHouse.php プロジェクト: emilymwang8/ajk-broker
 /**
  * 获取发房模版
  * @param $hzBrokerId
  * @param int $limit
  * @return array
  */
 public static function getPropTempletes($hzBrokerId, $limit = 5)
 {
     $selfData = Model_House_HzPropTemplete::getList(array(array('userId', '=', $hzBrokerId), array('flag', '=', 0)), $limit);
     $selfDataResult = array();
     if ($selfData) {
         foreach ($selfData as $data) {
             $selfDataResult[] = array('id' => $data['id'], 'title' => htmlspecialchars($data['tName'], ENT_COMPAT | ENT_HTML401, 'UTF-8'), 'content' => $data['tContent']);
         }
     }
     $userInfo = Model_Broker_HzUsersSearch::getUserInfoByUserId($hzBrokerId);
     // 获取公司模版
     $companyData = array();
     $companyDataResult = array();
     if ($userInfo['companyId']) {
         $companyData = Model_House_HzCompanyPropTemplete::getList(array(array('isDelete', '=', 0), array('type', '=', 2), array('companyId', '=', $userInfo['companyId'])));
         foreach ($companyData as $companyTemplate) {
             $companyTemplate['title'] = htmlspecialchars($companyTemplate['title'], ENT_COMPAT | ENT_HTML401, 'UTF-8');
             $companyDataResult[] = $companyTemplate;
         }
     }
     //return array_merge($selfData, $companyData);
     return array('commTpl' => $companyDataResult, 'propTpl' => $selfDataResult);
 }