|
|
<?php
|
|
|
|
|
|
use Action\WebAction;
|
|
|
use Index\HomeModel;
|
|
|
use Configs\WebCacheConfig;
|
...
|
...
|
@@ -31,8 +32,8 @@ class CommonController extends WebAction |
|
|
$key = WebCacheConfig::KEY_WEB_INDEX_BRANDS_LIST_DATA . '_' . $type;
|
|
|
// array('logoBrand'=>'','moreBrand'=>'')
|
|
|
$data = Cache::get($key);
|
|
|
}
|
|
|
while (false);
|
|
|
|
|
|
} while (false);
|
|
|
|
|
|
$this->echoJson($data);
|
|
|
}
|
...
|
...
|
@@ -49,7 +50,7 @@ class CommonController extends WebAction |
|
|
$result = array();
|
|
|
do {
|
|
|
/* 判断是不是AJAX请求 */
|
|
|
if (! $this->isAjax()) {
|
|
|
if (!$this->isAjax()) {
|
|
|
break;
|
|
|
}
|
|
|
$channels = array(
|
...
|
...
|
@@ -61,7 +62,7 @@ class CommonController extends WebAction |
|
|
$channel = $this->post('type', '');
|
|
|
$pageIndex = (int) $this->post('pageIndex', 0);
|
|
|
$pageCount = (int) $this->post('pageCount', 8);
|
|
|
if (! in_array($channel, $channels)) {
|
|
|
if (!in_array($channel, $channels)) {
|
|
|
break;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -98,43 +99,34 @@ class CommonController extends WebAction |
|
|
*/
|
|
|
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');
|
|
|
$contentCode = $this->get('content_code', '');
|
|
|
$callback = $this->get('callback', '');
|
|
|
$width = $this->get('width', '');
|
|
|
$height = $this->get('height', '');
|
|
|
$params = array(
|
|
|
'content_code' => $content_code,
|
|
|
'client_type' => $client_type
|
|
|
);
|
|
|
$data = IndexData::getResourceData($content_code);//Yohobuy::get($url.http_build_query($params));
|
|
|
if(empty($data['data']))
|
|
|
{
|
|
|
|
|
|
$data = IndexData::getResourceData($contentCode);
|
|
|
if (empty($data['data'])) {
|
|
|
return $this->helpJsonCallbackResult($callback, 200, '没有数据', '');
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
} else {
|
|
|
$banner = '';
|
|
|
if(isset($data['data'][0]['data']))
|
|
|
{
|
|
|
if($data['data'][0]['template_name'] == 'single_image') {
|
|
|
if (isset($data['data'][0]['data'])) {
|
|
|
if ($data['data'][0]['template_name'] == 'single_image') {
|
|
|
$banner = current($data['data'][0]['data']);
|
|
|
} else if($data['data'][0]['template_name'] == 'single_name_image') {
|
|
|
} else if ($data['data'][0]['template_name'] == 'single_name_image') {
|
|
|
$banner = $data['data'][0]['data'];
|
|
|
}
|
|
|
if(!empty($banner)) {
|
|
|
if(empty($width) || empty($height) ) {
|
|
|
$width = 2600;//通栏广告
|
|
|
if (!empty($banner)) {
|
|
|
if (empty($width) || empty($height)) {
|
|
|
$width = 2600; //通栏广告
|
|
|
$height = 60;
|
|
|
}
|
|
|
$banner['src'] = Images::getImageUrl($banner['src'], $width, $height ,2);
|
|
|
$banner['src'] = Images::getImageUrl($banner['src'], $width, $height, 2);
|
|
|
//str_replace('?imageView/{mode}/w/{width}/h/{height}', '', $banner['src']);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return $this->helpJsonCallbackResult($callback, $data['code'], $data['message'], $banner);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取邮件订阅
|
...
|
...
|
@@ -148,7 +140,7 @@ class CommonController extends WebAction |
|
|
$uid = intval($this->get('uid', '0'));
|
|
|
$data = array();
|
|
|
//验证邮件
|
|
|
if(Helpers::verifyEmail($email)) {
|
|
|
if (Helpers::verifyEmail($email)) {
|
|
|
$data = IndexData::emailSubscriber($email, $uid);
|
|
|
return $this->helpJsonCallbackResult($callback, $data['code'], $data['message'], $data['data']);
|
|
|
} else {
|
...
|
...
|
@@ -168,7 +160,7 @@ class CommonController extends WebAction |
|
|
$question_id = intval($this->get('question_id', 0));
|
|
|
$answer = trim($this->get('answer'));
|
|
|
$solution = intval($this->get('solution', 0));
|
|
|
if(!empty($feedback_id) || !empty($question_id) || !empty($answer) || !empty($solution)) {
|
|
|
if (!empty($feedback_id) || !empty($question_id) || !empty($answer) || !empty($solution)) {
|
|
|
$data = IndexData::suggestFeedback($feedback_id, $question_id, $answer, $solution);
|
|
|
return $this->helpJsonCallbackResult($callback, $data['code'], $data['message'], $data['data']);
|
|
|
} else {
|
...
|
...
|
@@ -179,7 +171,6 @@ class CommonController extends WebAction |
|
|
/*
|
|
|
* 简单头部
|
|
|
*/
|
|
|
|
|
|
public function getSimpleHeaderAction()
|
|
|
{
|
|
|
$result = array();
|
...
|
...
|
@@ -190,12 +181,11 @@ class CommonController extends WebAction |
|
|
}
|
|
|
|
|
|
//获取用户
|
|
|
$uid = $this->getUid(true);
|
|
|
$uid = $this->getUid(false);
|
|
|
if (!$uid) {
|
|
|
$isLogin = false;
|
|
|
$username = '';
|
|
|
}
|
|
|
else {
|
|
|
} else {
|
|
|
$isLogin = true;
|
|
|
$username = $this->_uname;
|
|
|
}
|
...
|
...
|
@@ -212,8 +202,7 @@ class CommonController extends WebAction |
|
|
'userCenter' => Helpers::url('/home?t=' . time()), //用户中心链接
|
|
|
'logout' => Helpers::url('/logout.html?t=' . time()), //退出
|
|
|
);
|
|
|
}
|
|
|
else {
|
|
|
} else {
|
|
|
$tool+=array(
|
|
|
'login' => Helpers::url('/signin.html'), //登录链接,已登录不传
|
|
|
'register' => Helpers::url('/reg.html'), //注册链接,已登录不传
|
...
|
...
|
@@ -233,8 +222,7 @@ class CommonController extends WebAction |
|
|
'code' => 200,
|
|
|
'data' => $simpleHeader
|
|
|
);
|
|
|
}
|
|
|
while (false);
|
|
|
} while (false);
|
|
|
|
|
|
$this->echoJson($result);
|
|
|
}
|
...
|
...
|
|