Example #1
0
 /**
  *12.3 将前端下单数据存到BRS做数据备份,再请求rentalcars
  * @param $bookArr
  * @return bool
  */
 public static function MakebookingToBrs($bookArr)
 {
     $rc_ordervehicle = new RentalcarsOrdervehicle();
     $rc_ordervehicle->OrderID = $bookArr['bookingID'];
     //租车订单号
     $rc_ordervehicle->CarOrderID = '';
     //提车单ID
     $rc_ordervehicle->CustCode = $bookArr['CustSource'];
     //会员编号
     $rc_ordervehicle->CustName = $bookArr['ContactMan'];
     //联系人名称
     $rc_ordervehicle->ContactMan = $bookArr['ContactMan'];
     //联系人名称
     $rc_ordervehicle->ContactMobile = $bookArr['ContactMobile'];
     //联系人手机
     $rc_ordervehicle->ContactTel = '';
     //联系人电话
     $rc_ordervehicle->ContactOffTel = '';
     //联系人办公室电话
     $rc_ordervehicle->ContactEmail = $bookArr['ContactEmail'];
     //联系人邮箱
     $rc_ordervehicle->ContactFax = '';
     //联系人传真
     $rc_ordervehicle->ContactAddress = $bookArr['DriverInfo']['Address']['country'] . $bookArr['DriverInfo']['Address']['city'] . $bookArr['DriverInfo']['Address']['street'];
     //联系人地址
     $rc_ordervehicle->SuppID = 'RentalCars';
     //供应商ID
     $rc_ordervehicle->Company = $bookArr['Vehicle']['company'];
     //车辆公司名称
     $rc_ordervehicle->CompanyLogo = $bookArr['Vehicle']['companyLogo'];
     //车辆公司logo
     $rc_ordervehicle->PickupShopID = $bookArr['PickUp']['location_id'];
     //提车门店ID
     $rc_ordervehicle->PickupShopName = $bookArr['PickUp']['shopName'];
     //提车门店名称
     $rc_ordervehicle->DropOffShopID = $bookArr['DropOff']['location_id'];
     //还车门店ID
     $rc_ordervehicle->DropOffShopName = $bookArr['DropOff']['shopName'];
     //还车门店名称
     $rc_ordervehicle->PickupContinentID = '';
     //大洲ID(按取车门店)
     $rc_ordervehicle->PickupCountryID = '';
     //国家ID(按取车门店)
     $rc_ordervehicle->PickupCity = '';
     //城市ID(按取车门店)
     $rc_ordervehicle->DropOffContinentID = '';
     //大洲ID(还车门店)
     $rc_ordervehicle->DropOffCountryID = '';
     //国家ID(还车门店)
     $rc_ordervehicle->DropOffCityID = '';
     //城市ID(还车门店)
     $rc_ordervehicle->Status = 2;
     //预定状态(0取消1订单确认2订单未确认3询价4订单完成)
     $pickUp_date = $bookArr['PickUp']['Date']['year'] . '-' . $bookArr['PickUp']['Date']['month'] . '-' . $bookArr['PickUp']['Date']['day'] . ' ' . $bookArr['PickUp']['Date']['hour'] . ':' . $bookArr['PickUp']['Date']['minute'] . ':00';
     //取车时间
     $dropOff_date = $bookArr['DropOff']['Date']['year'] . '-' . $bookArr['DropOff']['Date']['month'] . '-' . $bookArr['DropOff']['Date']['day'] . ' ' . $bookArr['DropOff']['Date']['hour'] . ':' . $bookArr['DropOff']['Date']['minute'] . ':00';
     //还车时间
     $rc_ordervehicle->PickupTime = strtotime($pickUp_date);
     //提车时间
     $rc_ordervehicle->PrckupAddress = '';
     //取车地址
     $rc_ordervehicle->PickupStatus = '';
     //提车状态(1已取车)
     $rc_ordervehicle->DropOffTime = strtotime($dropOff_date);
     //还车时间
     $rc_ordervehicle->DropOffAddress = '';
     //还车地址
     $rc_ordervehicle->DropOffStatus = '';
     //还车状态(1已还车)
     $rc_ordervehicle->CommissionFee = 0;
     //佣金
     $rc_ordervehicle->CurrencyCode = $bookArr['Vehicle']['currencyCode'];
     //结算货币
     $rc_ordervehicle->Price = $bookArr['Vehicle']['price'];
     //结算价
     $rc_ordervehicle->Prefcurr = $bookArr['Vehicle']['prefcurr'];
     //展示货币
     $rc_ordervehicle->PrefPrice = $bookArr['Vehicle']['prefPrice'];
     //展示货币价格
     $rc_ordervehicle->ExchangeRate = 0;
     //汇率
     $rc_ordervehicle->Deposit = 0;
     //押金
     $rc_ordervehicle->Discount = $bookArr['Vehicle']['discount'];
     //折扣
     $rc_ordervehicle->VehicleID = $bookArr['Vehicle']['id'];
     //车辆类型ID
     $rc_ordervehicle->GroupCode = $bookArr['Vehicle']['group'];
     //用车类型
     $rc_ordervehicle->Automatic = $bookArr['Vehicle']['automatic'];
     //排挡类型
     $rc_ordervehicle->Aircon = $bookArr['Vehicle']['aircon'];
     //空调类型
     $rc_ordervehicle->Airbag = $bookArr['Vehicle']['airbag'];
     //气囊类型
     $rc_ordervehicle->Petrol = $bookArr['Vehicle']['petrol'];
     //燃油类型
     $rc_ordervehicle->Doors = $bookArr['Vehicle']['doors'];
     //车门数量
     $rc_ordervehicle->Seats = $bookArr['Vehicle']['seats'];
     //车辆座位数
     $rc_ordervehicle->FuelPolicy = $bookArr['Vehicle']['fuelPolicy'];
     //车辆的燃料标识符
     $rc_ordervehicle->FreeCancellation = '';
     //免费取消
     $rc_ordervehicle->ImageURL = $bookArr['Vehicle']['imageURL'];
     //车辆的图片路径
     $rc_ordervehicle->DriverName = $bookArr['DriverInfo']['DriverName']['name'];
     //驾驶员中文名称
     $rc_ordervehicle->DriverTitle = $bookArr['DriverInfo']['DriverName']['title'];
     //驾驶员称谓
     $rc_ordervehicle->DriverAge = $bookArr['DriverInfo']['DriverAge'];
     //驾驶员年龄
     $rc_ordervehicle->DriverBirthday = $bookArr['DriverInfo']['DriverName']['birthday'];
     //驾驶员出生日期.
     $rc_ordervehicle->DriverAddressCountry = $bookArr['DriverInfo']['Address']['country'];
     //驾驶员国家
     $rc_ordervehicle->DriverAddressCity = $bookArr['DriverInfo']['Address']['city'];
     //驾驶员城市
     $rc_ordervehicle->DriverAddressStreet = $bookArr['DriverInfo']['Address']['street'];
     //驾驶员街道
     $rc_ordervehicle->DriverAddressPostcode = $bookArr['DriverInfo']['Address']['postcode'];
     //驾驶员邮编
     $rc_ordervehicle->DriverEmail = $bookArr['DriverInfo']['Email'];
     //驾驶员邮箱
     $rc_ordervehicle->DriverMobile = $bookArr['DriverInfo']['Telephone'];
     //驾驶员电话
     $rc_ordervehicle->DriverPassportNum = $bookArr['DriverInfo']['DriverName']['passportNum'];
     //驾驶员护照号
     $rc_ordervehicle->DriverPassportFirstname = $bookArr['DriverInfo']['DriverName']['firstname'];
     //驾驶员护照英文姓
     $rc_ordervehicle->DriverPassportLastname = $bookArr['DriverInfo']['DriverName']['lastname'];
     //驾驶员护照英文名
     $rc_ordervehicle->CarType = $bookArr['Vehicle']['CarType'];
     //车辆类型名称
     //生成车辆的额外服务[S]   id,name,amount,currency
     $client_extra_string = '';
     //生成符合bos的额外服务格式
     if (!empty($bookArr['ExtraList']['Extra'])) {
         $client_extra_arr = $bookArr['ExtraList']['Extra'];
         if (is_array($client_extra_arr)) {
             foreach ($client_extra_arr as $extra_key => $extra_val) {
                 if ($extra_key !== 0) {
                     $client_extra_string .= ';';
                 }
                 $client_extra_string .= $extra_val['id'];
                 $client_extra_string .= ',';
                 $client_extra_string .= !empty($extra_val['name']) ? $extra_val['name'] : '';
                 $client_extra_string .= ',';
                 $client_extra_string .= !empty($extra_val['amount']) ? $extra_val['amount'] : '';
                 $client_extra_string .= ',';
                 $client_extra_string .= !empty($extra_val['currency']) ? $extra_val['currency'] : '';
                 //展示货币价格
             }
         }
     }
     $rc_ordervehicle->ExtraService = $client_extra_string;
     //得到车辆额外服务列表
     //生成车辆的额外服务[E]
     //获取门店的条款信息[S]
     $rentalTermsRQ = json_encode(array('location_id' => $bookArr['PickUp']['location_id'], 'remoteIp' => '106.2.184.106'));
     $rentalTermsRS = RcManager::RentalTermsFilterRQ($rentalTermsRQ);
     $rentalTerms_arr = json_decode($rentalTermsRS, true);
     $rc_ordervehicle->RentalTerms = $rentalTermsRS;
     //租赁门店条款信息
     if ($rentalTerms_arr['status'] && !empty($rentalTerms_arr['data']['Inclusive'])) {
         $rentalTerms_licheng = isset($rentalTerms_arr['data']['Inclusive']['Licheng']) ? $rentalTerms_arr['data']['Inclusive']['Licheng'] : '';
         //里程
         $rentalTerms_baoxian = isset($rentalTerms_arr['data']['Inclusive']['Baoxian']) ? $rentalTerms_arr['data']['Inclusive']['Baoxian'] : '';
         //保险
         $rentalTerms_baoxian = is_array($rentalTerms_baoxian) ? implode(',', $rentalTerms_baoxian) : '';
         $rentalTerms_shuifei = isset($rentalTerms_arr['data']['Inclusive']['Shuifei']) ? $rentalTerms_arr['data']['Inclusive']['Shuifei'] : '';
         //税费
         $rentalTerms_shuifei = is_array($rentalTerms_shuifei) ? implode(',', $rentalTerms_shuifei) : '';
     } else {
         $rentalTerms_licheng = '';
         //里程
         $rentalTerms_baoxian = '';
         //保险
         $rentalTerms_shuifei = '';
         //税费
     }
     $rc_ordervehicle->UnlimitedMileage = $rentalTerms_licheng;
     //里程限制
     $rc_ordervehicle->Insurance = $rentalTerms_baoxian;
     //车辆保险
     $rc_ordervehicle->Expense = $rentalTerms_shuifei;
     //税费
     //获取门店的条款信息[E]
     $rc_ordervehicle->CreateTime = time();
     if ($rc_ordervehicle->save()) {
         return true;
     } else {
         //var_dump( $rc_ordervehicle->getErrors());
         return false;
     }
 }
Example #2
0
 /**
  * 10 得到门店的条款信息
  * @param json json_params{location_id}
  * $return $arr_result
  * [{"type":"Inclusive","value":[{"Caption":"\u60a8\u7684","Body":"\u9650\u5236},
  *                               {"Caption":"\u60a8\u7684","Body":"\u9650\u5236}]},
  *  {"type":"Inclusive","value":[{"Caption":"\u60a8\u7684","Body":"\u9650\u5236},
  *                              {"Caption":"\u60a8\u7684","Body":"\u9650\u5236}]}]
  * url:/index.php?r=CarrentalApi/rc/RentalTermsRQ&json_params={"location_id":"1124991"}
  */
 public function actionRentalTermsRQ()
 {
     $json_params = Yii::app()->request->getParam('json_params');
     //客户端请求的json参数
     //测试用例[S]
     $json_params_go = Yii::app()->request->getParam('go');
     if ($json_params_go == 'go') {
         $array_params = json_decode($json_params, true);
         $array_params['remoteIp'] = '106.2.184.106';
         $array_params['location_id'] = '476008';
         $json_params = json_encode($array_params);
     }
     //测试用例[E]
     $Rs = RcManager::RentalTermsFilterRQ($json_params);
     echo $Rs;
 }