public function handle_request_internal() { if (!$this->isBrokerLogin()) { $this->redirect_to_login(); } $request = APF::get_instance()->get_request(); $params = $request->get_parameters(); $userId = $request->getUserId(); $orderId = $params['orderId']; $sukId = $params['upDateComboName']; $orderName = $params['orderName']; $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; //账户余额(公司) //升级需要的金额 $result = Bll_Combo_Broker_BrokerComboInfo::getUpdatePrice($sukId, $orderId); //假数据 //$result['data'] = array('price' => 1000, 'startTime' => '2014-10-30 00:00:00.0', 'endTime' => '2014-12-30 00:00:00.0'); $errorInfo = ''; if ($result['result'] === false) { $errorInfo = '套餐升级api获取失败'; } if ($result['status'] == 'error') { $errorInfo = $result['info']; } if (!empty($errorInfo)) { $this->setAttribute('errorInfo', $errorInfo); } $buyComboInfo['price'] = round($result['data']['price'] / 100, 2); $buyComboInfo['startTime'] = date('Y.m.d', strtotime($result['data']['startTime'])); $buyComboInfo['endTime'] = date('Y.m.d', strtotime($result['data']['endTime'])); $buyComboInfo['day'] = floor((strtotime(date('Y-m-d', strtotime($result['data']['endTime']))) - strtotime(date('Y-m-d', strtotime($result['data']['startTime'])))) / 86400) + 1; $buyComboInfo['orderName'] = $orderName; if ($act != 'pay') { $str = ''; if ($params['AjkNum'] > 0) { $str .= '二手房' . $params['AjkNum'] . '套'; } if ($params['HzNum'] > 0) { $str .= ($str ? ',' : '') . '租房' . $params['HzNum'] . '套'; } if ($params['JpNum'] > 0) { $str .= ($str ? ',' : '') . '金铺' . $params['JpNum'] . '套'; } } else { $str = $params['NumStr']; } $buyComboInfo['propStr'] = $str; $buyComboInfo['sukId'] = $sukId; $buyComboInfo['orderId'] = $orderId; $buyComboInfo['AjkNum'] = $params['AjkNum']; $buyComboInfo['HzNum'] = $params['HzNum']; $buyComboInfo['JpNum'] = $params['JpNum']; $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 ($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::upgradeCombo($userId, $sukId, $orderId); //升级是否成功 $this->setAttribute('buySuccess', $buySuccess['status']); $this->setAttribute('buyMessage', $buySuccess['errMsg']); return 'Combo_Update_Result'; } else { //密码错误 $this->setAttribute('pwdErr', 1); } } return 'Combo_Update_Pay'; }