コード例 #1
1
 public function actionHotCity()
 {
     $sql = "SELECT a.*,b.Name as ContinentName FROM rentalcars_hot_city AS a INNER JOIN rentalcars_hot_continent AS b ON  a.ContinentId=b.ID order by  b.Sort  ASC ,a.Sort ASC";
     $ListHotArea = RentalcarsHotCity::model()->dbConnection->createCommand($sql)->queryAll();
     $countryList = array();
     $Redis = YiiRedis::getInstance();
     if ($Redis->hGet('currental_area', 'countryList')) {
         $Rs = $Redis->hGet('currental_area', 'countryList');
     } else {
         $Rs = RcManager::PickUpCountryListRQ();
         $Rs_array = json_encode($Rs, true);
         if ($Rs_array['status']) {
             $Redis->hSet('currental_area', 'countryList', $Rs);
         }
     }
     if (!empty($Rs)) {
         $countryList = json_decode($Rs, true);
     }
     $this->render('hotCity', array('ListHotArea' => $ListHotArea, 'countryList' => $countryList['data']));
 }
コード例 #2
0
 public function actionTest()
 {
     ini_set('max_execution_time', '0');
     // $Redis = YiiRedis::getInstance();
     $return_arr = array();
     //要返回的数组
     $return_key = 0;
     //获取国家列表
     // if ($Redis->hGet('currental_area', 'countryList')) {
     //   $Rs_countryList_josn = $Redis->hGet('currental_area', 'countryList');
     //    $Rs_countryList_array=json_decode($Rs_countryList_josn,true);
     //  } else {
     $Rs_countryList_josn = RcManager::PickUpCountryListRQ();
     $Rs_countryList_array = json_decode($Rs_countryList_josn, true);
     //    if($Rs_countryList_array['status']){
     //       $Redis->hSet('currental_area', 'countryList', $Rs_countryList_josn);
     //    }
     //}
     //{"country":"\u4e2d\u56fd"}
     if ($Rs_countryList_array['status']) {
         $countryList_data = $Rs_countryList_array['data'];
         if (!is_array($countryList_data)) {
             exit('国家不是数组格式');
         }
         //获取城市列表
         //$countryList_data=array('Dominica');
         $countryList_data = array('美国-加州');
         foreach ($countryList_data as $k_contry => $v_contry) {
             $contry_json = json_encode(array('country' => $v_contry));
             //  $city_redisKey= 'cityList_pickUp_'.md5($contry_json);
             //   if ($Redis->hGet('currental_area',$city_redisKey)&&false) {
             //      $Rs_city_josn = $Redis->hGet('currental_area', $city_redisKey);
             //    $Rs_cityt_array=json_decode($Rs_city_josn,true);
             //}else {
             $Rs_city_josn = RcManager::PickUpCityListRQ($contry_json);
             $Rs_cityt_array = json_decode($Rs_city_josn, true);
             //    if($Rs_cityt_array['status']&&false){
             //       $Redis->hSet('currental_area',$city_redisKey, $Rs_city_josn);
             //  }
             // }
             if ($Rs_cityt_array['status']) {
                 $cityList_data = $Rs_cityt_array['data'];
                 if (is_array($cityList_data)) {
                     //获取门店列表
                     foreach ($cityList_data as $k_city => $v_city) {
                         //{"country":"\u4e2d\u56fd","city":"Beijing - \u5317\u4eac"}
                         $country_city_json = json_encode(array('country' => $v_contry, 'city' => $v_city));
                         //  $location_redisKey= 'locationList_pickUp_'.md5($country_city_json);
                         //  if ($Redis->hGet('currental_area',$location_redisKey)&&false) {
                         //      $Rs_location_json = $Redis->hGet('currental_area', $location_redisKey);
                         //       $Rs_locaton_array=json_decode($Rs_location_json,true);
                         //   }else {
                         $Rs_location_json = RcManager::PickUpLocationListRQ($country_city_json);
                         $Rs_locaton_array = json_decode($Rs_location_json, true);
                         //     if($Rs_locaton_array['status']&&false){
                         //        $Redis->hSet('currental_area',$location_redisKey, $Rs_location_json);
                         //     }
                         //   }
                         sleep(1);
                         if ($Rs_locaton_array['status']) {
                             $locaton_data = $Rs_locaton_array['data'];
                             if (is_array($locaton_data)) {
                                 foreach ($locaton_data as $k_location => $v_location) {
                                     if (!empty($v_location['id']) && !empty($v_location['value'])) {
                                         $location_id = $v_location['id'];
                                         $location_value = $v_location['value'];
                                         $return_arr[$return_key] = array('locationId' => $location_id, 'locationValue' => $location_value, 'city' => $v_city, 'country' => $v_contry);
                                         $return_key++;
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     echo json_encode($return_arr);
 }
コード例 #3
0
ファイル: RcManager.php プロジェクト: lovecheng/brs-demo2
 /**
  *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;
     }
 }
コード例 #4
0
ファイル: RcController.php プロジェクト: lovecheng/brs-demo2
 /**
  * 31  获得下线的租车公司名称   接口说明[来自boss]
  * 用于车辆搜索做过滤条件
  *  url:/index.php?r=CarrentalApi/Rc/CarRentalTapeCompany
  */
 public function actionCarRentalTapeCompany()
 {
     $updateRedis = Yii::app()->request->getParam('updateRedis');
     $RS_boss_json = RcManager::CarRentalTapeCompany($updateRedis);
     echo $RS_boss_json;
 }