Пример #1
0
 /**
  * 获取那天城市价格
  * $tmp = array('cityId'=>$cityid,'status'=>1,'startDate'=>20140516);
  * @param $data
  * @return bool|mixed|null
  */
 public function getCityPrice($data, $dataBase)
 {
     if ($dataBase == Const_ShowcaseOrders::SALE_DB) {
         return Model_Broker_AdConfigCityPriceSale::getInstance()->getCityPrice($data);
     } else {
         if ($dataBase == Const_ShowcaseOrders::RENT_DB) {
             return Model_Broker_AdConfigCityPriceRent::getInstance()->getCityPrice($data);
         } else {
             return array();
         }
     }
 }
 public function getCityPrice($data)
 {
     $obj = new Model_Broker_AdConfigCityPriceSale();
     if (empty($data) || !is_array($data)) {
         return false;
     }
     if (!$obj->checkDataField($data)) {
         return false;
     }
     $db = self::data_access();
     foreach ($data as $key => $val) {
         if ($key == 'startDate') {
             $db->filter_by_op('startDate', '<=', $val);
         } else {
             $db->filter_by_op($key, '=', $val);
         }
     }
     $db->sort('startDate', 'desc');
     $dataRows = $db->find_only();
     return $dataRows;
 }