public function __construct($app_id) { $this->app_id = $app_id; $this->app_dir = APP_DIR . '/' . $app_id; $this->res_dir = PUBLIC_DIR; $this->res_url = vmc::get_app_statics_host_url(); if (is_dir($this->res_dir . '/' . $app_id)) { $this->res_dir = $this->res_dir . '/' . $app_id; $this->res_url = vmc::get_app_statics_host_url() . '/' . $app_id; } $this->res_full_url = $this->res_url; }
/** * 格式化列表. */ private function _format(&$item, $router_app = 'site') { foreach ($item as $key => &$value) { switch ($key) { case 'product': $this->_format($value); break; case 'list_extension': foreach ($value as &$item) { $this->_format($item); } break; case 'product_id': $item['item_url'] = app::get($router_app)->router()->gen_url(array('full' => 'true', 'app' => 'b2c', 'ctl' => 'site_product', 'args' => array($item[$key]))); break; case 'image_default_id': case 'image_id': $item['image'] = base_storager::image_path($value, 'm'); break; case 'cat_id': $item['category'] = app::get('b2c')->model('goods_cat')->getRow('cat_id as id,cat_name', array('cat_id' => $value)); break; case 'brand_id': $item['brand'] = app::get('b2c')->model('brand')->getRow('brand_id as id,brand_name,brand_initial,brand_logo,brand_country', array('brand_id' => $value)); if ($item['brand']) { $item['brand']['brand_logo_image'] = base_storager::image_path($item['brand']['brand_logo']); $item['brand']['brand_country_flag'] = vmc::get_app_statics_host_url() . '/misc/flags/' . $item['brand']['brand_country'] . '.png'; } break; case 'price': case 'mktprice': case 'member_lv_price': case 'buy_price': $item[$key] = vmc::singleton('ectools_math')->formatNumber($value, app::get('ectools')->getConf('site_decimal_digit_count'), app::get('ectools')->getConf('site_decimal_digit_count')); break; } } $this->_hidden($item); }