Authored by whb

地图

... ... @@ -162,117 +162,62 @@ class Controller_MobileApi extends Controller_Abstract
$limit = 500;
$brands = Facade_Brand::getBrandByState($offset, $limit, $state);
$data = array('total'=> '0', 'list'=> array(),
'boothMapImage3F' => SITE_RES.'/images/yohood/yohood3F-app.jpg',
'boothMapImage4F' => SITE_RES.'/images/yohood/yohood4F-3.jpg',
'boothMapImage' => SITE_RES.'/images/yohood/yohood4F-3.jpg',
'boothMapImage1F' => SITE_RES.'/images/yohood/yohood1F.jpg',
'boothMapImage4F' => SITE_RES.'/images/yohood/yohood4F.jpg',
);
$data['total'] = Facade_Brand::getBrandTotal($state);
$boothList = Facade_Brand::getBoothList();
$data['total'] = count($boothList);
$yohobuyBrands = Facade_Brand::getYohobuyBrand();
$signBrands = Facade_Brand::getSignBrand();
$boothListPositions = array();
foreach($boothList as $booth)
{
$boothListPositions[$booth['booth_id']] = $booth['position'];
}
foreach($brands as $brand)
{
$boothPositions = array();
$styles = json_decode($brand['pics'], true);
$image = '';
$video = '';
foreach($styles as $style)
{
if($style['type'] == 'pic')
{
$image = Lib_Images::getImageUrl($style['url'], 'source','fragmentimg');
}
else
{
$video = Lib_Video::getVideoUrl($style['url']);
}
}
$brand['name'] = trim($brand['name']);
$yohobuyBrandId = "0";
//店铺没有数据的品牌ID
$shopNoBrandIIds = array(18,55,56,77,111,112,134,147,160,188,240,243,245,253,264,270,
290,294,299,309,333,403,404,405,427,485,497,508,514,515,546,582,595,602,603,605,608,609,610,612,613,614,615,616,617,618,
619,620,621,622,623);
//切换为有货品牌ID
foreach($signBrands as $signBrand)
{
$signBrand['brand_name'] = trim(strtolower($signBrand['brand_name']));
if(strtolower($brand['name']) == $signBrand['brand_name'])
{
$yohobuyBrandId = $signBrand['brand_id'];
break;
}
}
if(empty($yohobuyBrandId))
{
foreach($yohobuyBrands as $yohobuyBrand)
{
$yohobuyBrand['brand_name'] = trim(strtolower($yohobuyBrand['brand_name']));
if(strtolower($brand['name']) == $yohobuyBrand['brand_name'])
{
$yohobuyBrandId = $yohobuyBrand['brand_id'];
break;
}
}
}
$url = SITE_MAIN.'/brand/detail/id/'.$brand['id'];
if($isLike && empty($yohobuyBrandId)) //最喜欢的品牌
{
$yohobuyBrandId = $brand['id'];
}
if(empty($isLike))
{
if(array_search($yohobuyBrandId, $shopNoBrandIIds) !== false)
{
$yohobuyBrandId = '0';
}
}
$brand['id'] = $yohobuyBrandId;
$index = Lib_Utils_StringHelper::getFirstLetter($brand['name']);
if(empty($index))
{
$index = substr($brand['name'], 0, 1);
}
$index = strtoupper($index);
if(is_numeric($index))
{
$index = '0-9';
}
$boothIds = explode(',', $brand['booth_id']);
$booths = array();
foreach($boothIds as $boothId)
{
if(empty($boothId))
{
continue;
}
$x = 0;
$y = 0;
if(isset( $boothListPositions[$boothId]))
{
$position = explode('|', $boothListPositions[$boothId]);
$x = $position[0];
$y = $position[1];
}
$booths[] = array('id' => $boothId, 'x'=> strval($x / 4000.0), 'y' => strval($y / 1567.0) );
}
$data['list'][$index][] = array(
'id' => $brand['id'], 'name' => $brand['name'],
'booths' => $booths,
'boothId'=> $brand['booth_id'],
'logo' => Lib_Images::getImageUrl($brand['logo'], 'source','fragmentimg'),
'image' => $image,
'video'=> $video,
'description'=> $brand['description'],
'brief' => Lib_Utils_StringHelper::substr_cn($brand['description'], 95),
'url' => $url,
);
$index = Lib_Utils_StringHelper::getFirstLetter($booth['brand_name']);
if(empty($index))
{
$index = substr($booth['brand_name'], 0, 1);
}
$index = strtoupper($index);
if(is_numeric($index))
{
$index = '0-9';
}
$x = $y = 0;
if($booth['floor'] == 1)
{
$x = strval(intval($booth['x']) / 3802.0);
$y = strval(intval($booth['y']) / 2019.0);
}
else if($booth['floor'] == 4)
{
$x = strval(intval($booth['x']) / 3775.0);
$y = strval(intval($booth['y']) / 2104.0);
}
$yohobuyBrandId = '0';
foreach($yohobuyBrands as $yohobuyBrand)
{
if(strtolower($yohobuyBrand['brand_name']) == strtolower($booth['brand_name']))
{
$yohobuyBrandId = $yohobuyBrand['brand_id'];
break;
}
}
$url = '';
foreach($brands as $brand)
{
if(strtolower($brand['name']) == strtolower($booth['brand_name']))
{
$url = SITE_MAIN.'/brand/detail/id/'.$brand['id'];
break;
}
}
$data['list'][$index][] = array(
'id' => $yohobuyBrandId,
'name' => $booth['brand_name'],
'booths' => array('id' => $booth['booth_id'], 'x'=> $x, 'y' => $y ),
'boothId'=> $booth['booth_id'],
'url' => $url,
'floor'=> $booth['floor']
);
}
ksort($data['list']);
return $this->returnJson(self::SUCCESS_STATUS_CODE, Config_Code_Mobile::$success_opt['code'], $data, Config_Code_Mobile::$success_opt['message']);
... ...
... ... @@ -10,7 +10,7 @@ class Controller_Video extends Controller_Abstract
$total = Facade_News::getTotal($tag);
$page = new Lib_Helper_Pagination($total, 24);
list($offset, $limit) = $page->getLimit();
$list = Facade_News::getListByHits($tag, $offset, $limit);
$list = Facade_News::getList($tag, $offset, $limit);
$this->_view['pagination'] = $page->getPagination();
$this->_view['list'] = $list;
}
... ...