Authored by whb

修改最新上架以及路由

... ... @@ -71,6 +71,7 @@ class Yohobuy
}
// 苹果IPAD
elseif (strstr($_SERVER['HTTP_USER_AGENT'], 'iPad')) {
return 'ipad';
}
elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'android')) {
... ... @@ -78,7 +79,7 @@ class Yohobuy
}
// 其它
else {
return 'web';
return 'android';
}
}
... ...
... ... @@ -39,6 +39,6 @@ class IndexData
$params['content_code'] = $content_code;
$params['client_type'] = $client_type;
$params['client_secret'] = Sign::getSign($params);
return Yohobuy::get(Yohobuy::SERVICE_URL . 'operations/api/v5/resource/get', $params);
return Yohobuy::get(Yohobuy::SERVICE_URL . self::URL_OPERATIONS_RESOURCE_GET, $params);
}
}
\ No newline at end of file
... ...
... ... @@ -70,8 +70,12 @@ class Bootstrap extends Bootstrap_Abstract
$module = 'Index';
$controller = 'Index';
$action = 'Index';
$levelNum = 2;
if(APPLICATION_ENV == 'developer') {
$levelNum = 3;
}
// 三级域名
if (2 === $level) {
if ($levelNum === $level) {
$subDomain = strval($hostParts[0]);
switch (strtolower($subDomain)) {
case 'www':
... ...
... ... @@ -3,6 +3,7 @@ use Action\WebAction;
use Index\HomeModel;
use Plugin\Cache;
use Configs\CacheConfig;
use Api\Yohobuy;
class CommonController extends WebAction
{
... ... @@ -58,10 +59,47 @@ class CommonController extends WebAction
}
$result = array(
'code' => 200,
'commodity' => $result
'goods' => $result
);
} while (false);
$this->echoJson($result);
}
/**
* 获取资源位banner
*
* @return jsonp
*/
public function getbannerAction()
{
$url = 'http://service.api.yohobuy.com/operations/api/v4/resource/get?';
$content_code = $this->_get('content_code', '');
$client_type = $this->_get('client_type', 'web');
$callback = $this->_get('callback', '');
$params = array(
'content_code' => $content_code,
'client_type' => $client_type
);
$data = Yohobuy::get($url.http_build_query($params));
if(empty($data))
{
return $this->helpJsonCallbackResult($callback, 200, '没有数据', '');
}
else
{
$data = json_decode($data, true);
$banner = '';
if(isset($data['data'][0]['data']))
{
$banner = current($data['data'][0]['data']);
if(!empty($banner)) {
$banner['src'] = Images::getImageUrl($banner['src'], 2600, 60 ,2);
//str_replace('?imageView/{mode}/w/{width}/h/{height}', '', $banner['src']);
}
}
}
return $this->helpJsonCallbackResult($callback, $data['code'], $data['message'], $banner);
}
}
\ No newline at end of file
... ...
... ... @@ -210,7 +210,6 @@ class HomeModel
foreach ($goodsList as $goods) {
// 格式化数据
$val = Helpers::formatProduct($goods, true, true, true, 280, 373);
$val['img'] = $val['thumb'];
if ($val['price'] == false) {
$val['price'] = $val['salePrice'];
}
... ...