Exemple #1
0
 public function createThreeSiteAccountMust($userId, $ajkBrokerId)
 {
     //查询三网mapping
     $objMapping = Model_Payment_AccountMapping::getAccountMappingByUserId($userId);
     if (!$objMapping || !$objMapping->accountidAjk || !$objMapping->accountidHz || !$objMapping->accountidJp) {
         //获取安居客账户
         $objajkAccount = Model_Payment_AjkUserAccount::getAjkUserAccountByUserId($userId);
         if ($objajkAccount) {
             $ajkAccount = $objajkAccount->accountId;
         } else {
             $ajkAccount = $this->createAjkAccountId($userId);
         }
         //获取租房账户
         $hzBrokerId = Model_Broker_HzMapping::get_hz_broker_id($ajkBrokerId);
         $objHzAccount = Model_Payment_HzUsersAccountMapping::getHzUserAccountByUserId($hzBrokerId);
         if ($objHzAccount) {
             $hzAccount = $objHzAccount->accountId;
         } else {
             $hzAccount = $this->createHzAccountId($hzBrokerId);
         }
         //获取金铺账户
         $objJpMember = Model_Broker_JpBroker::getJpBrokerInfoByAjkBrokerId($ajkBrokerId);
         $objJpAccount = Model_Payment_JpPayAccount::getAccountByBrokerId($objJpMember->id);
         if ($objJpAccount) {
             $jpAccount = $objJpAccount->account;
         } else {
             $jpAccount = $this->createJpAccountId($objJpMember->id);
         }
         //创建三网账号
         $this->doCreateThreeSiteAccountMust($userId, $ajkAccount, $hzAccount, $jpAccount, $objMapping);
     }
 }
 /**
  * 经纪人套餐升级(使用个人账户)
  *
  * @param $brokerId
  * @param $siteType
  * @return array
  */
 public static function upgradeCombo($userId, $sukId, $orderId)
 {
     if (empty($userId) || empty($sukId) || empty($orderId)) {
         return array('status' => 'error', 'errMsg' => '升级套餐API,缺少参数');
     }
     $accountInfo = Model_Payment_AccountMapping::getAccountMappingByUserId($userId);
     $api = new BLL_Service_Api();
     $result = array();
     $tmpArr = array('userId' => $userId, 'reqId' => $userId . '' . time(), 'accountId' => $accountInfo->accountidAjk, 'skuId' => $sukId, 'orderId' => $orderId, 'note' => '经纪人后台');
     //请求三次
     for ($i = 0; $i < 3; $i++) {
         $result = $api->sendCurl('service-combo/rest/combo/order/brokerUpgradeCombo?json', $tmpArr, 2, 2);
         if ($result['result'] !== false) {
             break;
         }
     }
     //返回值
     if ($result['status'] == 'ok') {
         return array('status' => 'ok');
     } else {
         return array('status' => 'error', 'errMsg' => $result['info']);
     }
 }