Authored by 周少峰

home page add new customer floor

... ... @@ -29,11 +29,11 @@ class Yohobuy
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
// const API_OLD = 'http://api2.open.yohobuy.com/';
const API_URL = 'http://api.yoho.cn/';
const API_URL2 = 'http://api.yoho.cn/';
const SERVICE_URL = 'http://service.yoho.cn/';
const YOHOBUY_URL = 'http://www.yohobuy.com/';
const API_OLD = 'http://api2.open.yohobuy.com/';
// const API_URL = 'http://api.yoho.cn/';
// const API_URL2 = 'http://api.yoho.cn/';
// const SERVICE_URL = 'http://service.yoho.cn/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
// const API_OLD = 'http://api2.open.yohobuy.com/';
/* 预览环境 java API */
// const API_URL = 'http://preapi.yoho.cn/';
... ... @@ -43,14 +43,14 @@ class Yohobuy
// const API_OLD = 'http://api2.open.yohobuy.com/';
/* 测试环境 java API*/
// const API_URL = 'http://testapi.yoho.cn:28078/'; // 'http://devapi.yoho.cn:58078/';
const API_URL = 'http://testapi.yoho.cn:28078/'; // 'http://devapi.yoho.cn:58078/';
// const API_URL = 'http://devapi.yoho.cn:58078/';
// const DEV_API_URL = 'http://devapi.yoho.cn:58078/';
// const SERVICE_URL = 'http://testservice.yoho.cn:28077/'; // 'http://devservice.yoho.cn:58077/';
// const DEV_SERVICE_URL = 'http://devservice.yoho.cn:58077/';
// const PRD_SERVICE_URL = 'http://serviceh5.yoho.cn/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
// const API_OLD = 'http://test2.open.yohobuy.com/';
const DEV_API_URL = 'http://devapi.yoho.cn:58078/';
const SERVICE_URL = 'http://testservice.yoho.cn:28077/'; // 'http://devservice.yoho.cn:58077/';
const DEV_SERVICE_URL = 'http://devservice.yoho.cn:58077/';
const PRD_SERVICE_URL = 'http://serviceh5.yoho.cn/';
const YOHOBUY_URL = 'http://www.yohobuy.com/';
const API_OLD = 'http://test2.open.yohobuy.com/';
/* 测试环境 php API*/
// const API_URL = 'http://test2.open.yohobuy.com/';
... ...
... ... @@ -54,17 +54,24 @@ class IndexData
* @param string $contentCode 内容位置码
* @param integer $limit 查询返回的最大限字数,默认为20
* @param integer $page 分页第几页,默认为第1页
* @param integer $uid 用户id
* @modify sefon 2016-4-19 13:33:49
* @return array 首页频道数据
*/
public static function getResourceData($gender, $contentCode, $limit = 20, $page = 1)
public static function getResourceData($gender, $contentCode, $limit = 20, $page = 1, $uid = 0)
{
$param = Yohobuy::param();
if ($uid) {
$param['uid'] = $uid;
} else {
//新设备(用户未登录状态,默认新设备):Y/N
$param['new_device'] = 'Y';
}
$param['gender'] = $gender;
$param['content_code'] = $contentCode;
$param['page'] = $page;
$param['limit'] = $limit;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::SERVICE_URL . 'operations/api/v5/resource/home', $param, false, false, 2);
}
... ...
... ... @@ -451,4 +451,32 @@ class FloorProcess
return $result;
}
/**
* 新人专享
* @param $data
* @param $type
* @author sefon 2016-4-19 11:43:56
* @return array
*/
private static function new_user_floor($data, $type)
{
$result = array();
$result['title']['title'] = $data['title']['title'];
$result['title']['name'] = $data['title']['name'];
$result['big_image']['url'] = $data['banner_image'][0]['url'];
$result['big_image']['title'] = $data['banner_image'][0]['title'];
$result['big_image']['img'] = Helpers::getImageUrl($data['banner_image'][0]['src'], 640, 200);
if (empty($data['list'])) {
return $result;
}
foreach ($data['list'] as $key => $val) {
$result['list'][$key]['url'] = Helpers::getUrlBySkc($val['product_id'], $val['goods_list'][0]['goods_id'], $val['cn_alphabet']);
$result['list'][$key]['img'] = helpers::getImageUrl($val['default_images'], 235, 314);
$result['list'][$key]['title'] = $val['product_name'];
$result['list'][$key]['salePrice'] = $val['sales_price'];
$result['list'][$key]['price'] = $val['market_price'];
}
return array('freshOnly'=>$result);
}
}
\ No newline at end of file
... ...
... ... @@ -22,15 +22,14 @@ class BoysController extends AbstractAction
// 设置浏览器缓存5分钟
$this->setExpires(300); // 缓存5分钟
}
// 设置网站标题
$this->setTitle('男生首页');
// 显示侧边栏
$this->setNavSide('boys');
// 显示底部TAB
$this->setNavFooterTab();
$content = Index\HomeModel::getBoysFloor();
$uid = $this->getUid();
$content = Index\HomeModel::getBoysFloor($uid);
// $content[] = array(
// 'notice' => array(
// 'open' => true,
... ...
... ... @@ -23,13 +23,13 @@ class GirlsController extends AbstractAction
$this->setNavSide('girls');
// 显示底部TAB
$this->setNavFooterTab();
$uid = $this->getUid();
// 渲染模板并输出
$this->_view->display('index', array(
'grilsHomePage' => true,
'homeHeader' => array('searchUrl' => Helpers::url('/search', null, 'search')),
'maybeLike' => true,
'content' => Index\HomeModel::getGirlsFloor(),
'content' => Index\HomeModel::getGirlsFloor($uid),
'pageFooter' => true,
));
}
... ...
... ... @@ -23,13 +23,13 @@ class KidsController extends AbstractAction
$this->setNavSide('kids');
// 显示底部TAB
$this->setNavFooterTab();
$uid = $this->getUid();
// 渲染模板并输出
$this->_view->display('index', array(
'kidsHomePage' => true,
'homeHeader' => array('searchUrl' => Helpers::url('/search', null, 'search')),
'maybeLike' => true,
'content' => Index\HomeModel::getKidsFloor(),
'content' => Index\HomeModel::getKidsFloor($uid),
'pageFooter' => true,
));
}
... ...
... ... @@ -23,13 +23,13 @@ class LifestyleController extends AbstractAction
$this->setNavSide('lifestyle');
// 显示底部TAB
$this->setNavFooterTab();
$uid = $this->getUid();
// 渲染模板并输出
$this->_view->display('index', array(
'lifestyleHomePage' => true,
'homeHeader' => array('searchUrl' => Helpers::url('/search', null, 'search')),
'maybeLike' => true,
'content' => Index\HomeModel::getLifestyleFloor(),
'content' => Index\HomeModel::getLifestyleFloor($uid),
'pageFooter' => true,
));
}
... ...
... ... @@ -178,10 +178,9 @@ class HomeModel
*
* @return array | false
*/
public static function getBoysFloor()
public static function getBoysFloor($uid = 0)
{
$result = array();
if (USE_CACHE) {
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result = Cache::get(CacheConfig::KEY_ACTION_BOYS_INDEX, 'master');
... ... @@ -189,9 +188,8 @@ class HomeModel
return $result;
}
}
// 调用接口获取楼层数据, 并封装成模板渲染需要的数据格式
$channelData = IndexData::getResourceData('1,3', self::CODE_FLOOR_BOYS);
$channelData = IndexData::getResourceData('1,3', self::CODE_FLOOR_BOYS, 20, 1, $uid);
if (isset($channelData['code']) && $channelData['code'] == 200) {
$result = FloorProcess::getContent($channelData['data']);
}
... ... @@ -215,7 +213,7 @@ class HomeModel
*
* @return array | false
*/
public static function getGirlsFloor()
public static function getGirlsFloor($uid = 0)
{
$result = array();
... ... @@ -228,7 +226,7 @@ class HomeModel
}
// 调用接口获取楼层数据, 并封装成模板渲染需要的数据格式
$channelData = IndexData::getResourceData('2,3', self::CODE_FLOOR_GIRLS);
$channelData = IndexData::getResourceData('2,3', self::CODE_FLOOR_GIRLS, 20, 1, $uid);
if (isset($channelData['code']) && $channelData['code'] == 200) {
$result = FloorProcess::getContent($channelData['data'], 2);
}
... ... @@ -249,10 +247,11 @@ class HomeModel
/**
* 获取潮童首页的楼层数据
*
* @param int $uid
* @modify sefon 2016-4-19 13:21:28
* @return array | false
*/
public static function getKidsFloor()
public static function getKidsFloor($uid = 0)
{
$result = false;
... ... @@ -267,7 +266,7 @@ class HomeModel
// 调用接口获取楼层数据, 并封装成模板渲染需要的数据格式
$channelData = IndexData::getResourceData('', self::CODE_FLOOR_KIDS);
if (isset($channelData['code']) && $channelData['code'] == 200) {
$result = FloorProcess::getContent($channelData['data'], 3);
$result = FloorProcess::getContent($channelData['data'], 3, 20, 1, $uid);
}
if (USE_CACHE) {
... ... @@ -286,10 +285,11 @@ class HomeModel
/**
* 获取创意生活首页的楼层数据
*
* @param int $uid
* @modify sefon 2016-4-19 13:22:34
* @return array | false
*/
public static function getLifestyleFloor()
public static function getLifestyleFloor($uid = 0)
{
$result = false;
... ... @@ -302,7 +302,7 @@ class HomeModel
}
// 调用接口获取楼层数据, 并封装成模板渲染需要的数据格式
$channelData = IndexData::getResourceData('', self::CODE_FLOOR_LIFESTYLE);
$channelData = IndexData::getResourceData('', self::CODE_FLOOR_LIFESTYLE, 20, 1, $uid);
if (isset($channelData['code']) && $channelData['code'] == 200) {
$result = FloorProcess::getContent($channelData['data'], 4);
}
... ...