Example #1
0
 /**
  * 1得到取车地国家列表
  * @return  json
  * url:/index.php?r=CarrentalApi/rc/PickUpCountryListRQ
  *
  * 更新redis
  * /index.php?r=CarrentalApi/rc/PickUpCountryListRQ&updateRedis=Yes
  */
 public function actionPickUpCountryListRQ()
 {
     $Redis = YiiRedis::getInstance();
     $updateRedis = Yii::app()->request->getParam('updateRedis');
     $is_updateRedis = true;
     if (!empty($updateRedis)) {
         if ($updateRedis == 'Yes') {
             $is_updateRedis = false;
         }
     }
     if ($Redis->hGet('currental_area', 'countryList') && $is_updateRedis) {
         $Rs = $Redis->hGet('currental_area', 'countryList');
     } else {
         $Redis->hdel('currental_area', 'countryList');
         $Rs = RcManager::PickUpCountryListRQ();
         $Rs_array = json_decode($Rs, true);
         if ($Rs_array['status']) {
             //过滤国家[S]
             $Rs_array_data = $Rs_array['data'];
             $Rs_boss_arr = RcManager::GetOffLineShopList();
             if (is_array($Rs_boss_arr)) {
                 foreach ($Rs_array_data as $key => $val) {
                     if (in_array($val, $Rs_boss_arr)) {
                         unset($Rs_array_data[$key]);
                     }
                 }
                 $re_arr = array('status' => true, 'data' => $Rs_array_data);
                 $Rs = json_encode($re_arr);
             }
             //过滤国家[E]
             $Redis->hSet('currental_area', 'countryList', $Rs);
         }
     }
     ApiLogManage::addRentalcars('PickUpCountryListRQ-redis', '', '', $Rs, time(), time(), 1);
     //记录日志
     echo $Rs;
 }