|
@@ -17,7 +17,7 @@ class brand_helper
|
|
|
|
|
|
private $mBrandPageResult;
|
|
|
private $mTimeInterval;
|
|
|
- private $mCountries;
|
|
|
+ private $mBaseInfo;
|
|
|
|
|
|
private function __construct()
|
|
|
{
|
|
@@ -39,8 +39,26 @@ class brand_helper
|
|
|
public function country($brand_id)
|
|
|
{
|
|
|
$brand_id = intval($brand_id);
|
|
|
- if(array_key_exists($brand_id,$this->mCountries)) {
|
|
|
- return $this->mCountries[$brand_id];
|
|
|
+ if(array_key_exists($brand_id,$this->mBaseInfo)) {
|
|
|
+ return $this->mBaseInfo[$brand_id]['country'];
|
|
|
+ } else {
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public function country_logo($brand_id)
|
|
|
+ {
|
|
|
+ $brand_id = intval($brand_id);
|
|
|
+ if(array_key_exists($brand_id,$this->mBaseInfo)) {
|
|
|
+ return $this->mBaseInfo[$brand_id]['country_logo'];
|
|
|
+ } else {
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public function author_desc($brand_id)
|
|
|
+ {
|
|
|
+ $brand_id = intval($brand_id);
|
|
|
+ if(array_key_exists($brand_id,$this->mBaseInfo)) {
|
|
|
+ return $this->mBaseInfo[$brand_id]['author_desc'];
|
|
|
} else {
|
|
|
return '';
|
|
|
}
|
|
@@ -50,11 +68,12 @@ class brand_helper
|
|
|
{
|
|
|
$prefix = 'mb_';
|
|
|
$ret = rcache('brandex', $prefix);
|
|
|
- if (empty($ret) || empty($this->mCountries)) {
|
|
|
+ if (empty($ret) || empty($this->mBaseInfo))
|
|
|
+ {
|
|
|
$model = Model('brand');
|
|
|
- $items = $model->field('brand_id,brand_logo,brand_name,brand_country')->where(array('brand_apply' => '1'))->order('brand_sort asc')->limit(false)->select();
|
|
|
+ $items = $model->field('brand_id,brand_logo,brand_name,brand_country,brand_country_logo,author_desc')->where(array('brand_apply' => '1'))->order('brand_sort asc')->limit(false)->select();
|
|
|
|
|
|
- $this->mCountries = [];
|
|
|
+ $this->mBaseInfo = [];
|
|
|
$brands = [];
|
|
|
foreach ($items as $brand)
|
|
|
{
|
|
@@ -68,13 +87,20 @@ class brand_helper
|
|
|
} else {
|
|
|
Log::record("cant getimagesize {$image}." ,Log::ERR);
|
|
|
}
|
|
|
- $brand_id = intval($brand['brand_id']);
|
|
|
- $this->mCountries[$brand_id] = $brand['brand_country'];
|
|
|
+ $brand_id = intval($brand['brand_country_logo']);
|
|
|
+
|
|
|
+ if(empty($brand['brand_logo'])) {
|
|
|
+ $this->mBaseInfo[$brand_id]['country_logo'] = '';
|
|
|
+ } else {
|
|
|
+ $this->mBaseInfo[$brand_id]['country_logo'] = UPLOAD_SITE_URL . $brand['brand_country_logo'];
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->mBaseInfo[$brand_id]['country'] = $brand['brand_country'];
|
|
|
+ $this->mBaseInfo[$brand_id]['author_desc'] = $brand['author_desc'];
|
|
|
}
|
|
|
|
|
|
$block = special_formater::format_grid_brands($brands);
|
|
|
wcache("brandex", array("brands" => serialize($brands), "block" => serialize($block)), $prefix);
|
|
|
-
|
|
|
$result = array("brands" => $brands, "block" => $block);
|
|
|
} else {
|
|
|
$brands = unserialize($ret['brands']);
|