...
|
...
|
@@ -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 |
...
|
...
|
|