示例#1
0
 public function handle_request_internal()
 {
     if (!$this->isBrokerLogin()) {
         $this->redirect_to_login();
     }
     /**
      * @var $request AJKRequest
      */
     $request = APF::get_instance()->get_request();
     $objResponse = APF::get_instance()->get_response();
     $params = $request->get_parameters();
     $brokerId = $request->getBrokerId();
     $cityId = $request->getBrokerCityId();
     $sukId = $params['sukId'];
     $brokerInfo = self::$BrokerInfo['BaseInfo'];
     $companyId = intval($brokerInfo['COMPANYID']);
     if ($companyId > 0) {
         /** 通过配置文件配置那些城市的非独立经纪人不可以购买月套餐 */
         $canNotBuyMonthlyComboCitySet = APF::get_instance()->get_config('can_not_buy_monthly_combo_city_set');
         if (is_array($canNotBuyMonthlyComboCitySet) && in_array($cityId, $canNotBuyMonthlyComboCitySet)) {
             $companyId = 0;
         }
     }
     //经纪人能否购买
     $buyComboInfo = Bll_Combo_Broker_BrokerComboInfo::getBrokerallowBuy($brokerId, $cityId, $sukId, $companyId);
     $objResponse->set_content_type('application/json');
     echo json_encode($buyComboInfo);
     return false;
 }
示例#2
0
 public function handle_request_internal()
 {
     if (!$this->isBrokerLogin()) {
         $this->redirect_to_login();
     }
     /**
      * @var $request AJKRequest
      */
     $request = APF::get_instance()->get_request();
     $objResponse = APF::get_instance()->get_response();
     $params = $request->get_parameters();
     $brokerId = $request->getBrokerId();
     $cityId = $request->getBrokerCityId();
     $userId = $request->getUserId();
     $sukId = $params['combo'];
     $password = $params['brokerPassword'];
     $act = $params['act'];
     $brokerInfo = self::$BrokerInfo['BaseInfo'];
     //非套餐经纪人不能进入该页面,跳转到首页
     if ($brokerInfo['PAYTYPE'] != 9999) {
         $this->redirect('/user/broker/brokerhome');
     }
     //查询账户余额
     $balance = Bll_Service_Payment::balance(Bll_Service_Payment::SITE_ANJUKE, array('userId' => $userId));
     $UserAccountAll = $balance['data']['balance'] / 100.0;
     //账户余额
     $UserAccountPerson = $balance['data']['personBalance'] / 100.0;
     //账户余额(个人)
     $UserAccountCompany = $balance['data']['companyBalance'] / 100.0;
     //账户余额(公司)
     $companyId = intval($brokerInfo['COMPANYID']);
     if ($companyId > 0) {
         /** 通过配置文件配置那些城市的非独立经纪人不可以购买月套餐 */
         $canNotBuyMonthlyComboCitySet = APF::get_instance()->get_config('can_not_buy_monthly_combo_city_set');
         if (is_array($canNotBuyMonthlyComboCitySet) && in_array($cityId, $canNotBuyMonthlyComboCitySet)) {
             $companyId = 0;
         }
     }
     //经纪人能否购买
     $buyComboInfo = Bll_Combo_Broker_BrokerComboInfo::getBrokerallowBuy($brokerId, $cityId, $sukId, $companyId);
     $this->setAttribute('buyComboInfo', $buyComboInfo);
     $this->setAttribute('UserAccountAll', number_format($UserAccountAll, 2));
     $request->set_attribute("UserAccountPerson", number_format($UserAccountPerson, 2));
     $request->set_attribute("UserAccountCompany", number_format($UserAccountCompany, 2));
     $this->setAttribute('params', $params);
     //看能不能购买
     if (!$buyComboInfo['allowBuy']) {
         return 'Combo_Buy_Result';
     }
     //购买
     if ($act == 'pay') {
         //密码加密
         $md5_password = md5($password);
         $baseencode_password = base64_encode($md5_password);
         //查询经纪人信息
         $userInfo = Model_Broker_Member::getAjkMembersByUserId($userId);
         //验证密码
         if ($userInfo->userPwd == $baseencode_password) {
             //购买
             $buySuccess = Bll_Combo_Broker_BrokerComboInfo::buyCombo($userId, $sukId);
             //购买是否成功
             $this->setAttribute('buySuccess', $buySuccess);
             return 'Combo_Buy_Result';
         } else {
             //密码错误
             $this->setAttribute('pwdErr', 1);
         }
     }
     return 'Combo_Buy_Pay';
 }