Authored by xuqi

Merge branch 'develop' of http://git.dev.yoho.cn/web/yohobuy into develop

Showing 43 changed files with 978 additions and 305 deletions
... ... @@ -13,22 +13,22 @@
price: 1000,
tags: [
{
isNew: true //NEW
is_new: true //NEW
},
{
isSale: true //SALE
is_discount: true //SALE
},
{
isLimit: false //限量商品
is_limited: false //限量商品
},
{
isNewFestival: false //新品节
is_yohood: // YOHOOD
},
{
isReNew: true //再到着
is_advance: true //再到着
}
],
isFew: true //即将售罄
is_soon_sold_out: true //即将售罄
}
### 侧栏导航
... ...
... ... @@ -4,7 +4,7 @@
* 所有Controller控制器的基类
*
* @name AbstractAction
* @package
* @package library
* @copyright yoho.inc
* @version 1.0 (2015-9-15 11:55:25)
* @author fei.hong <fei.hong@yoho.cn>
... ... @@ -27,21 +27,34 @@ class AbstractAction extends Controller_Abstract
protected $_request;
/**
* 用户相关信息
*/
protected $_uid = 0;
protected $_uname = '';
/**
* 存放模板数据
*
* @var array
*/
protected $_data;
/**
* 初始化
*/
public function init()
{
$this->_request = $this->getRequest();
// 设置环境变量
switch (APPLICATION_ENV) {
case 'production':
case 'production': // 生产
$this->_view->assign('rlsEnv', true);
break;
case 'testing':
case 'testing': // 测试
$this->_view->assign('testEnv', true);
break;
case 'develop':
case 'develop': // 开发
default:
$this->_view->assign('devEnv', true);
break;
... ... @@ -144,7 +157,7 @@ class AbstractAction extends Controller_Abstract
* @param integer $path cookie可用的路径
* @param string $domain cookie可用域名
*/
protected function setCookie($name, $value, $expire = 0, $path = '/',$domain = 'yohobuy.com')
protected function setCookie($name, $value, $expire = 0, $path = '/', $domain = '.yohobuy.com')
{
setcookie($name, $value, $expire, $path, $domain);
}
... ... @@ -158,9 +171,9 @@ class AbstractAction extends Controller_Abstract
*/
protected function getCookie($name, $default = '')
{
return $this->request->getCookie($name, $default);
return $this->_request->getCookie($name, $default);
}
/**
* 设置缓存
*
... ... @@ -173,7 +186,7 @@ class AbstractAction extends Controller_Abstract
{
Cache::set($key, $value, $expire);
}
/**
* 获取缓存
*
... ... @@ -189,7 +202,7 @@ class AbstractAction extends Controller_Abstract
return Cache::get($key, 'slave');
}
}
/**
* 获取当前登录的用户ID
*
... ... @@ -198,9 +211,19 @@ class AbstractAction extends Controller_Abstract
*/
protected function getUid()
{
return 0;
if (!$this->_uid) {
$cookie = $this->getCookie('_UID');
if (!empty($cookie)) {
$cookieList = explode('::', $cookie);
if (isset($cookieList[1]) && is_numeric($cookieList)) {
$this->_uid = $cookieList[1];
$this->_uname = $cookieList[0];
}
}
}
return $this->_uid;
}
/**
* 获取客户端唯一标识
*
... ... @@ -216,12 +239,33 @@ class AbstractAction extends Controller_Abstract
return $udid;
}
/**
* 获取当前登录的用户名字
*
* @return int
* @todo
*/
protected function getUname()
{
if (!$this->_uname) {
$cookie = $this->getCookie('_UID');
if (!empty($cookie)) {
$cookieList = explode('::', $cookie);
if (isset($cookieList[0])) {
$this->_uname = $cookieList[0];
}
}
}
return $this->_uname;
}
/*
* 设置网站SEO的标题
*
* @param string $title 标题
* @return void
*/
protected function setTitle($title)
{
$this->_view->assign('title', $title . ' | ');
... ... @@ -284,22 +328,23 @@ class AbstractAction extends Controller_Abstract
$footer = array();
// 已登录 @todo
if (false) {
$name = $this->getUname();
if (!empty($name)) {
$footer['user'] = array();
$footer['user']['name'] = 'goodboy'; // 昵称
$footer['user']['name'] = $name; // 昵称
$footer['user']['url'] = ''; // 个人中心链接
$footer['user']['signoutUrl'] = ''; // 登出链接
$footer['user']['signoutUrl'] = '/passport/login/out'; // 登出链接
}
// 未登录
else {
$footer = array();
$footer['loginUrl'] = '/signin.html'; // 登录链接
$footer['signupUrl'] = '/login.html'; // 注册链接
$footer['signupUrl'] = '/reg.html'; // 注册链接
}
$this->_view->assign('pageFooter', $footer);
}
/**
* 设置侧边栏信息
*
... ... @@ -313,25 +358,25 @@ class AbstractAction extends Controller_Abstract
'textCn' => '男生',
'textEn' => 'BOYS',
'styleClass' => 'boys',
'url' => '/boys.html',
'url' => '/boys',
),
1 => array(
'textCn' => '女生',
'textEn' => 'GIRLS',
'styleClass' => 'girls',
'url' => '/girls.html',
'url' => '/girls',
),
2 => array(
'textCn' => '潮童',
'textEn' => 'KIDS',
'styleClass' => 'kids',
'url' => '/kids.html',
'url' => '/kids',
),
3 => array(
'textCn' => '创意生活',
'textEn' => 'LIFE STYLE',
'styleClass' => 'life',
'url' => '/life.html',
'url' => '/lifestyle',
),
4 => array(
'textCn' => '逛',
... ... @@ -370,9 +415,8 @@ class AbstractAction extends Controller_Abstract
)
),
));
}
/**
* 返回顶部软件下载有关数据
* @return array 下载有关数据
... ... @@ -381,7 +425,7 @@ class AbstractAction extends Controller_Abstract
{
return array(
'img' => 'http://img11.static.yhbimg.com/adpic/2015/02/28/18/01d83bfad41c8fca8fd1ad334216d7d733.jpg?imageView/2/w/640/h/480',
'url' => 'http://www.baidu.com'
'url' => 'http://www.baidu.com'
);
}
... ... @@ -405,7 +449,7 @@ class AbstractAction extends Controller_Abstract
{
$download = array(
'img' => 'http://img11.static.yhbimg.com/adpic/2015/02/28/18/01d83bfad41c8fca8fd1ad334216d7d733.jpg?imageView/2/w/640/h/480',
'url' => 'http://www.baidu.com'
'url' => 'http://www.baidu.com'
);
$this->_view->assign('headerDownload', $download);
... ...
... ... @@ -9,6 +9,7 @@
* @version 1.0 (2015-9-30 16:42:51)
* @author fei.hong <fei.hong@yoho.cn>
*/
namespace Api;
use Plugin\Cache;
... ... @@ -16,8 +17,14 @@ use Plugin\Cache;
class Yohobuy
{
const API_URL = 'http://api2.open.yohobuy.com/';
const SERVICE_URL = 'http://service.api.yohobuy.com/';
// /* 正式环境 */
// const API_URL = 'http://api2.open.yohobuy.com/';
// const SERVICE_URL = 'http://service.api.yohobuy.com/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
/* 测试环境 */
const API_URL = 'http://test2.open.yohobuy.com/';
const SERVICE_URL = 'http://test.service.api.yohobuy.com/';
const YOHOBUY_URL = 'http://www.yohobuy.com/';
/**
... ... @@ -95,24 +102,13 @@ class Yohobuy
*
* @param string $url 接口URL
* @param array $data 参数列表
* @parma mixed $cache 控制是否启用接口数据的缓存(时间单位为秒). 如3600表示缓存1小时, false表示不缓存
* @param bool $returnJson 控制是否返回json格式数据
* @param int $timeout 超时时间
* @return mixed
*/
public static function get($url, $data = array(), $returnJson = false, $timeout = 5)
public static function get($url, $data = array(), $cache = false, $returnJson = false, $timeout = 5)
{
// // 代表是否开启缓存
// $useCache = $cache && isset($data['client_secret']);
//
// /* 先尝试获取一级缓存(master), 有数据则直接返回 */
// if ($useCache) {
// $key = md5($url . $data['client_secret']);
// $result = Cache::get($key, 'master');
// if (!empty($result)) {
// return $result;
// }
// }
// 销毁私钥参数
if (isset($data['private_key'])) {
unset($data['private_key']);
... ... @@ -121,6 +117,15 @@ class Yohobuy
$url = self::httpBuildQuery($url, $data);
}
/* 开启缓存的情况 */
if ($cache) {
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result = Cache::get($url, 'master');
if (!empty($result)) {
return $result;
}
}
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
... ... @@ -131,18 +136,18 @@ class Yohobuy
}
curl_close($ch);
$data = array();
// /* 设置一级二级缓存 或 获取二级缓存(slave) */
// if ($useCache) {
// // 如果接口异常没数据返回,则获取二级缓存
// if (empty($result)) {
// $result = Cache::get($key, 'slave');
// }
// // 如果接口正常有数据返回,则设置数据缓存
// else {
// Cache::set($key, $result);
// }
// }
/* 开启缓存的情况 */
if ($cache) {
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if (empty($result)) {
$result = Cache::get($url, 'slave');
}
// 接口调用成功时,这里会设置一级(master)和二级(slave)的缓存数据.
else {
Cache::set($url, $result, $cache);
}
}
return $result;
}
... ... @@ -165,8 +170,7 @@ class Yohobuy
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
if (!empty($header)) {
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
}
else {
} else {
curl_setopt($ch, CURLOPT_HEADER, 0);
}
... ... @@ -202,12 +206,22 @@ class Yohobuy
*
* @param array $urlList 接口列表
* @param array $options CURL设置项
* @parma mixed $cache 控制是否启用接口数据的缓存 如3600表示缓存1小时, false表示不缓存
* @parma mixed $cache 控制是否启用接口数据的缓存(时间单位为秒). 如3600表示缓存1小时, false表示不缓存
* @param int $timeout 超时时间,单位是秒
* @return array
*/
public static function getMulti($urlList = array(), $options = array(), $cache = false, $timeout = 3)
{
/* 开启缓存的情况 */
if ($cache) {
$key = md5(implode(',', array_values($urlList)));
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result = Cache::get($key, 'master');
if (!empty($result)) {
return $result;
}
}
$result = array();
$response = array();
$running = 0;
... ... @@ -242,8 +256,7 @@ class Yohobuy
do {
do {
$status = curl_multi_exec($mh, $running);
}
while ($status == CURLM_CALL_MULTI_PERFORM);
} while ($status == CURLM_CALL_MULTI_PERFORM);
if ($status != CURLM_OK) {
break;
... ... @@ -252,8 +265,7 @@ class Yohobuy
if ($running > 0) {
curl_multi_select($mh, 0.5);
}
}
while ($running);
} while ($running);
// 获取API接口响应的结果
foreach ($urlList as $name => $api) {
... ... @@ -278,6 +290,18 @@ class Yohobuy
}
curl_multi_close($mh);
/* 开启缓存的情况 */
if ($cache) {
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if (empty($result)) {
$result = Cache::get($key, 'slave');
}
// 接口调用成功时,这里会设置一级(master)和二级(slave)的缓存数据.
else {
Cache::set($key, $result, $cache);
}
}
return $result;
}
... ... @@ -285,24 +309,51 @@ class Yohobuy
* rpc调用远程服务(YAR)
*
* @see http://php.net/manual/zh/yar-client.setopt.php
* @param string $uri
* @param string $method
* @param array $parameters
* @param mixed $cache 控制是否启用接口数据的缓存(时间单位为秒). 如3600表示缓存1小时, false表示不缓存
* @param int $timeout
* @return array
*/
public static function yarClient($uri, $method, $parameters = array(), $timeout = 3000)
public static function yarClient($uri, $method, $parameters = array(), $cache = false, $timeout = 3000)
{
/* 开启缓存的情况 */
if ($cache) {
$key = self::httpBuildQuery($uri . $method, $parameters);
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result = Cache::get($key, 'master');
if (!empty($result)) {
return $result;
}
}
$client = new \Yar_Client($uri);
$client->SetOpt(YAR_OPT_PACKAGER, 'php');
$client->SetOpt(YAR_OPT_TIMEOUT, $timeout);
$client->SetOpt(YAR_OPT_CONNECT_TIMEOUT, $timeout);
try {
$result = call_user_func_array(array($client, $method), $parameters);
} catch (\Exception $e) {
$result = array();
}
/* 开启缓存的情况 */
if ($cache) {
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if (empty($result)) {
$result = Cache::get($key, 'slave');
}
// 接口调用成功时,这里会设置一级(master)和二级(slave)的缓存数据.
else {
Cache::set($key, $result, $cache);
}
}
return $result;
}
/**
* 并行(异步)调用远程服务
*
... ... @@ -322,6 +373,7 @@ class Yohobuy
YAR_OPT_CONNECT_TIMEOUT => $timeout
));
}
public static function yarConcurrentLoop($callback = null)
{
\Yar_Concurrent_Client::loop($callback);
... ...
<?php
namespace Configs;
/**
* 缓存配置文件
*/
class CacheConfig
{
/* 控制器方法中的数据缓存 */
const KEY_ACTION_INDEX_INDEX = 'key_action_index_index'; // 频道选择
const KEY_ACTION_BOYS_INDEX = 'key_action_boys_index'; // 男生首页
const KEY_ACTION_GIRLS_INDEX = 'key_action_girls_index'; // 女生首页
const KEY_ACTION_KIDS_INDEX = 'key_action_kids_index'; // 潮童首页
const KEY_ACTION_LIFESTYLE_INDEX = 'key_action_lifestyle_index'; // 创意生活首页
}
... ...
<?php
namespace LibModels\Wap\Category;
use Api\Yohobuy;
... ... @@ -15,22 +16,22 @@ use Api\Sign;
*/
class BrandData
{
/**
* 获取品牌数据
/**
* 获取品牌数据
*
* @param integer $channel 是否,默认1表示是,传值为空是app中用于品牌搜索的数据
* @param integer $channel 是否,默认1表示是,传值为空是app中用于品牌搜索的数据
*
* @return array 品牌数据
*/
* @return array 品牌数据
*/
public static function getBrandsData($channel = 1)
{
// 构建必传参数
$param = Yohobuy::param();
// 构建必传参数
$param = Yohobuy::param();
$param['method'] = 'app.brand.brandlist';
$param['yh_channel'] = $channel;
$param['yh_channel'] = $channel;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
... ... @@ -41,13 +42,12 @@ class BrandData
*/
public static function getBrandTopData()
{
// 构建必传参数
$param = Yohobuy::param();
$param['content_code'] = 'ce6ac059493ec26241a8cbe0bfa1b17a';
// 构建必传参数
$param = Yohobuy::param();
$param['content_code'] = 'ce6ac059493ec26241a8cbe0bfa1b17a';
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::SERVICE_URL.'operations/api/v5/resource/get', $param);
return Yohobuy::get(Yohobuy::SERVICE_URL . 'operations/api/v5/resource/get', $param);
}
/**
... ... @@ -60,11 +60,10 @@ class BrandData
{
// 构建必传参数
$param = Yohobuy::param();
$param['brand_id'] = '$brandId';
$param['brand_id'] = $brandId;
$param['method'] = 'app.brand.getBrandIntro';
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
... ... @@ -77,11 +76,10 @@ class BrandData
{
// 构建必传参数
$param = Yohobuy::param();
$param['brand_id'] = '$brandId';
$param['brand_id'] = $brandId;
$param['method'] = 'app.brand.banner';
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
... ... @@ -113,7 +111,9 @@ class BrandData
'p_d' => $p_d
);
// 拉取筛选参数
$queriedParams = array_filter($selectItems, function($v) {return $v !== null;});
$queriedParams = array_filter($selectItems, function($v) {
return $v !== null;
});
// 构建必传参数
$param = Yohobuy::param();
... ... @@ -123,7 +123,8 @@ class BrandData
$param['limit'] = $limit;
$param['yh_channel'] = $channel;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
}
... ...
... ... @@ -20,21 +20,17 @@ class IndexData
/**
* 获取启动轮播图
*
* @param string $contentCode 内容位置码
* @return array 轮播图有关数据
*/
public static function getBannerStart()
public static function getBannerStart($contentCode)
{
// 构建必传参数
$param = Yohobuy::param();
$param['content_code'] = '7ba9118028f9b22090b57341487567eb';
$param['content_code'] = $contentCode;
$param['client_secret'] = Sign::getSign($param);
$response = Yohobuy::get(Yohobuy::SERVICE_URL . 'operations/api/v5/resource/get', $param);
$result = '';
if (isset($response['data'][0]['data']['list'][0]['src'])) {
$result = $response['data'][0]['data']['list'][0]['src'];
}
return $result;
return Yohobuy::get(Yohobuy::SERVICE_URL . 'operations/api/v5/resource/get', $param);
}
/**
... ... @@ -53,42 +49,23 @@ class IndexData
}
/**
* 获取用户个人信息
*
* @param integer $uid 用户ID
* @return array 用户个人信息数据
*/
public static function getUserProfile($uid)
{
// 构建必传参数
$param = Yohobuy::param();
$param['method'] = 'app.passport.profile';
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 获取首页频道数据(除了可能喜欢的各楼层有关数据)
* @param integer $uid 用户ID
* @param string $gender 用户性别, "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
* @param string $contentCode 内容位置码
* @param integer $limit 查询返回的最大限字数,默认为20
* @param integer $page 分页第几页,默认为第1页
* @return array 首页频道数据
*/
public static function getUserChannelData($uid, $gender, $contentCode, $limit = 20, $page = 1)
public static function getResourceData($gender, $contentCode, $limit = 20, $page = 1)
{
$param = Yohobuy::param();
$param['uid'] = $uid;
$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);
return Yohobuy::get(Yohobuy::SERVICE_URL . 'operations/api/v5/resource/home', $param);
}
}
... ...
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
namespace LibModels\Wap\Product;
use Api\Sign;
use Api\Yohobuy;
/**
* 商品详情相关的数据模型
*
* @name DetailData
* @package LibModels/Wap/Product
* @copyright yoho.inc
* @version 1.0 (2015-10-8 11:51:32)
* @author fei.hong <fei.hong@yoho.cn>
*/
class DetailData
{
}
... ...
... ... @@ -8,7 +8,7 @@ use Api\Yohobuy;
/**
* 商品推荐相关的数据模型
*
* @name RecomModel
* @name RecomData
* @package LibModels/Wap/Product
* @copyright yoho.inc
* @version 1.0 (2015-10-8 11:51:32)
... ...
... ... @@ -17,19 +17,43 @@ class NewsaleData
{
/**
* 获取新品到着,折扣专区焦点图数据
* @param string $contentCode 内容位置码
* @return array 新品到着焦点图有关数据
* 模糊搜索提供的关键词
* @param string $keyword 关键词
* @return array 根据跟定关键词搜索到的结果,包括数据数目count和提供的关键词keyword
*/
public static function getNewsaleFocus($contentCode)
public static function searchFuzzyDatas($keyword)
{
// 构建必传参数
$param = Yohobuy::param();
$param['content_code'] = $contentCode;
$param['keyword'] = $keyword;
$param['method'] = 'app.search.fuzzy';
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::SERVICE_URL.'operations/api/v5/resource/get', $param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 根据跟定查询数据搜索数据列表
* @param string $query 查询条件
* @param string $order 排列顺序,默认为倒序
* @param integer $page 指定查询是多少页,默认为第一页
* @param integer $limit 指定查询多少个,默认是60哥
* @return array 搜索到的数据
*/
public static function searchLiDatas($query, $order = 's_t_desc', $page = 1, $limit = 60)
{
// 构建必传参数
$param = Yohobuy::param();
$param['query'] = $query;
$param['method'] = 'app.search.li';
$param['order'] = $order;
$param['page'] = $page;
$param['limit'] = $limit;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
}
... ...
... ... @@ -33,17 +33,21 @@ class Cache
* @param int $expire 缓存有效期(单位秒, 0表示永久)
* @return void
*/
public static function set($key, $value, $expire = 3600)
public static function set($key, $value, $expire = 0)
{
// WINDOWS
if (PATH_SEPARATOR === '\\') {
HoodCache::Memcache('master')->set(self::makeKey($key, 'master'), $value, $expire);
HoodCache::Memcache('slave')->set(self::makeKey($key, 'slave'), $value, 0);
}
// LINUX
else {
HoodCache::Memcached('master')->set(self::makeKey($key, 'master'), $value, $expire);
HoodCache::Memcached('slave')->set(self::makeKey($key, 'slave'), $value, 0);
try {
// WINDOWS
if (DIRECTORY_SEPARATOR === '\\') {
HoodCache::Memcache('master')->set(self::makeKey($key, 'master'), $value, $expire);
HoodCache::Memcache('slave')->set(self::makeKey($key, 'slave'), $value, 0);
}
// LINUX
else {
HoodCache::Memcached('master')->set(self::makeKey($key, 'master'), $value, $expire);
HoodCache::Memcached('slave')->set(self::makeKey($key, 'slave'), $value, 0);
}
} catch (Exception $e) {
// do nothing
}
}
... ... @@ -58,13 +62,17 @@ class Cache
{
$result = array();
// WINDOWS
if (PATH_SEPARATOR === '\\') {
$result = HoodCache::Memcache($node)->get(self::makeKey($key, $node));
}
// LINUX
else {
$result = HoodCache::Memcached($node)->get(self::makeKey($key, $node));
try {
// WINDOWS
if (DIRECTORY_SEPARATOR === '\\') {
$result = HoodCache::Memcache($node)->get(self::makeKey($key, $node));
}
// LINUX
else {
$result = HoodCache::Memcached($node)->get(self::makeKey($key, $node));
}
} catch (Exception $e) {
$result = array();
}
return $result;
... ... @@ -79,7 +87,7 @@ class Cache
public static function delete($key)
{
// WINDOWS
if (PATH_SEPARATOR === '\\') {
if (DIRECTORY_SEPARATOR === '\\') {
HoodCache::Memcache('master')->delete(self::makeKey($key, 'master'));
HoodCache::Memcache('slave')->delete(self::makeKey($key, 'slave'));
}
... ...
<?php
namespace Plugin\DataProcess;
use Plugin\Helpers;
/**
... ... @@ -17,20 +18,21 @@ class FloorProcess
public static function getContent($data, $type = 1)
{
$result = array();
if(empty($data['list'])){
return $result;
}
foreach ($data['list'] as $v){
$fun = $v['template_name'];
$data = self::$fun($v['data'],$type);
if(empty($data)){
continue;
if (!empty($data['list'])) {
$build = array();
foreach ($data['list'] as $v) {
$fun = $v['template_name'];
if (!is_callable("self::$fun")) {
continue;
}
$build = self::$fun($v['data'], $type);
if (empty($build)) {
continue;
}
$result[] = $build;
}
$result[] = $data;
}
return $result;
}
/**
... ... @@ -44,12 +46,12 @@ class FloorProcess
$result = array();
foreach ($data as &$one) {
$one['img'] = Helpers::getImageUrl($one['src'], 750, 364, 1);
unset($one['src']);
$one['img'] = Helpers::getImageUrl($one['src'], 750, 364, 1);
unset($one['src']);
}
$result['list'] = $data;
return array('bannerTop'=>$result);
return array('bannerTop' => $result);
}
/**
... ... @@ -63,12 +65,12 @@ class FloorProcess
$result = array();
foreach ($data as &$one) {
$one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
unset($one['src']);
$one['img'] = Helpers::getImageUrl($one['src'], 186, 203, 1);
unset($one['src']);
}
$result['list'] = $data;
return array('iconsEnter'=>$result);
return array('iconsEnter' => $result);
}
/**
... ... @@ -79,15 +81,16 @@ class FloorProcess
*/
private static function single_image($data, $type)
{
if(empty($data)){
if (empty($data)) {
return array();
}
foreach ($data as &$one) {
$one['img'] = Helpers::getImageUrl($one['src'], 750, 364, 1);
unset($one['src']);
}
return array('banner'=>$data);
return array('banner' => $data);
}
/**
... ... @@ -109,7 +112,7 @@ class FloorProcess
unset($data['title']);
$result = $data;
return array('hotCategory'=>$result);
return array('hotCategory' => $result);
}
/**
... ... @@ -131,7 +134,7 @@ class FloorProcess
}
$result = $data;
return array('hotBrands'=>$result);
return array('hotBrands' => $result);
}
/**
... ... @@ -154,7 +157,7 @@ class FloorProcess
}
$result = $data;
return array('trendColloaction'=>$result);
return array('trendColloaction' => $result);
}
/**
... ... @@ -173,7 +176,7 @@ class FloorProcess
}
$result = $data;
return array('trendTopics'=>$result);
return array('trendTopics' => $result);
}
/**
... ... @@ -199,7 +202,7 @@ class FloorProcess
}
$result = $data;
return array('goodsCategory'=>$result);
return array('goodsCategory' => $result);
}
/**
... ... @@ -226,7 +229,7 @@ class FloorProcess
}
$result = $data;
return array('creativeLife'=>$result);
return array('creativeLife' => $result);
}
/**
... ... @@ -245,7 +248,7 @@ class FloorProcess
}
$result = $data;
return array('small_pic'=>$result);
return array('small_pic' => $result);
}
/**
... ... @@ -254,14 +257,16 @@ class FloorProcess
* @param $type 类型 默认1:男首页 2:女首页 3:kids 4:lifestyle
* @return array 处理之后的单名字图片数据
*/
private static function single_name_image($data,$type){
if(empty($data)){
private static function single_name_image($data, $type)
{
if (empty($data)) {
return array();
}
$data['name'] = $data['title'];
$data['img'] = Images::getImageUrl($data['src'], 640, 198, 2);
return array('plusStar'=>$data['data']);
$data['img'] = Helpers::getImageUrl($data['src'], 640, 198, 2);
return array('plusStar' => $data);
}
}
... ...
server
{
listen 80;
server_name wap.yohobuy.com;
#access_log /Data/logs/access.wap.yohobuy.com.log combined;
error_log /Data/logs/error.wap.yohobuy.com.log warn;
root /Data/code/git/yohobuy/yohobuy/m.yohobuy.com/public;
location ~* \.html$ {
root /Data/PE/yohobuy/assets;
if (!-f $request_filename){
root /Data/PE/yohobuy/yohobuy/m.yohobuy.com/public;
rewrite ^/(.+)$ /index.php?$1& last;
}
expires 7d;
}
location / {
index index.php;
if (!-f $request_filename){
rewrite ^/(.+)$ /index.php?$1& last;
}
}
location ~* \.(ico|woff)$ {
expires 7d;
}
location = /crossdomain.xml {
expires 7d;
}
location ~ .*\.php?$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
error_page 403 = http://wap.yohobuy.com;
error_page 404 = http://wap.yohobuy.com/error.html;
}
server
{
listen 80;
server_name static.wap.yohobuy.com;
#access_log /Data/logs/access.static.wap.yohobuy.com.log combined;
#error_log /Data/logs/error.static.wap.yohobuy.com.log warn;
root /Data/PE/yohobuy/static;
location / {
log_not_found off;
access_log off;
expires 30d;
}
location ~* \.(svg|eot|ttf|woff|otf)$ {
add_header Access-Control-Allow-Origin *;
expires 30d;
}
}
\ No newline at end of file
... ...
This diff could not be displayed because it is too large.

6.5 KB | W: | H:

9.08 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
/**
* 分类
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/10/14
*/
var $ = require('yoho.zepto'),
Swiper = require('yoho.iswiper'),
lazyLoad = require('yoho.zeptolazyload');
var swiper;
swiper = new Swiper('.swiper-container', {
lazyLoading: true,
loop: true,
autoplay: 3000,
pagination: '.swiper-pagination'
});
lazyLoad($('img.lazy'));
\ No newline at end of file
... ...
/**
* 男首
* @author: liangzhifeng<zhifeng.liang@yoho.cn>
* @date: 2015/10/12
*/
var $ = require('yoho.zepto'),
lazyLoad = require('yoho.zeptolazyload');
//Init LazyLoad
lazyLoad($('img.lazy'));
\ No newline at end of file
.brand-page {
font-size: 30rem / $pxConvertRem;
.hot-brand {
margin: (30rem / $pxConvertRem) 0 0;
.hot-brand-list {
background: #fff;
li {
float: left;
width: 158rem / $pxConvertRem;
height: 158rem / $pxConvertRem;
.img-box {
width: 100%;
height: 100%;
}
}
}
}
}
\ No newline at end of file
... ...
.hot-category {
margin: (30rem / $pxConvertRem) 0 0;
border-top: 1px solid #e0e0e0;
.category-banner {
height: 198rem / $pxConvertRem;
img {
display: block;
width: 100%;
height: 100%;
}
}
.category-list {
background: #fff;
border-top: 1px solid #e0e0e0;
li {
float: left;
width: 158rem / $pxConvertRem;
height: 174rem / $pxConvertRem;
border-bottom: 1px solid #e0e0e0;
border-left: 1px solid #e0e0e0;
.img-box {
width: 100%;
height: 138rem / $pxConvertRem;
text-align: center;
vertical-align: middle;
img {
max-width: 100%;
max-height: 100%;
vertical-align: middle;
}
}
}
}
}
\ No newline at end of file
... ...
... ... @@ -29,12 +29,7 @@
vertical-align: middle;
}
}
.category-title {
line-height: 22rem / $pxConvertRem;
color: #aaa;
font-size: 18rem / $pxConvertRem;
text-align: center;
}
}
}
}
\ No newline at end of file
... ...
... ... @@ -92,4 +92,5 @@ a {
@include border-radius(10px);
}
@import "layout/header", "layout/footer", "good", "filter", "passport/index", "guang/index", "home/index", "category/index", "product/index", "index/index", "shopping-cart/index";
\ No newline at end of file
@import "layout/header", "layout/footer", "good", "filter", "passport/index", "guang/index", "home/index", "category/index", "product/index", "index/index", "shopping-cart/index";
... ...
{{> layout/header}}
<div class="brand-page yoho-page">
{{# bannerTop}}
{{> home/banner_top}}
{{/ bannerTop}}
{{# hotBrand}}
<div class="hot-brand">
<ul class="hot-brand-list clearfix">
{{# list}}
<li>
<a href="{{url}}">
<div class="img-box">
<img class="lazy" data-original="{{img}}" alt="">
</div>
</a>
</li>
{{/ list}}
</ul>
</div>
{{/ hotBrand}}
{{# brandList}}
<div class="brand-list">
<div class="title-bar">
<h2 style="position: static;">{{title}}</h2>
</div>
{{# list}}
<p>
<a href="{{url}}">{{name}}
<i class="icon-hot">
</i>
{{# isHot}}
<i class="icon-hot"></i>
{{/ isHot}}
{{# isNew}}
<i class="icon-new"></i>
{{/ isNew}}
</a>
</p>
{{/ list}}
</div>
{{/ brandList}}
<div id="right-bar" class="right-bar" style="width: 30px; top: 88px;">
<div class="con" id="con">
<b>#</b>
<b>A</b>
<b>B</b>
<b>C</b>
<b>D</b>
<b>E</b>
<b>F</b>
<b>G</b>
<b>H</b>
<b>I</b>
<b>J</b>
<b>K</b>
<b>L</b>
<b>M</b>
<b>N</b>
<b>O</b>
<b>P</b>
<b>Q</b>
<b>R</b>
<b>S</b>
<b>T</b>
<b>U</b>
<b>V</b>
<b>W</b>
<b>X</b>
<b>Y</b>
<b>Z</b>
<b>&nbsp;</b>
<b>&nbsp;</b>
</div>
</div>
</div>
{{> layout/footer}}
\ No newline at end of file
... ...
... ... @@ -133,6 +133,12 @@
seajs.use('js/category/index');
</script>
{{/if}}
{{!-- 品牌 --}}
{{#if brandPage}}
<script>
seajs.use('js/category/brand');
</script>
{{/if}}
{{!-- 搜索 --}}
{{#if searchPage}}
... ...
<?php
use Action\AbstractAction;
use LibModels\Wap\Home\IndexData;
use Plugin\DataProcess\FloorProcess;
/**
* 男生首页
... ... @@ -10,29 +8,25 @@ use Plugin\DataProcess\FloorProcess;
class BoysController extends AbstractAction
{
/**
* 男生首页
*/
public function indexAction()
{
// 设置网站标题
$this->setTitle('男生首页');
// 显示侧边栏
$this->setNavSide();
// 显示顶部下载
$this->setHeaderDownload();
// 设置顶部信息(搜索)
$this->setHomeChannelHeader();
$data = array('boysHomePage' => true);
// 频道数据
$channelData = IndexData::getUserChannelData(0, '1,3', '201504091403001');
if (isset($channelData['code']) && $channelData['code'] == 200) {
$data['content'] = FloorProcess::getContent($channelData['data']);
}
// 渲染模板并输出
$this->_view->display('index', array(
'boysHomePage' => true,
'maybeLike' => true,
'content' => Index\HomeModel::getBoysFloor()
));
$data['maybeLike'] = true;
$this->_view->display('index', $data);
}
}
... ...
<?php
use Action\AbstractAction;
use LibModels\Wap\Home\IndexData;
use Plugin\DataProcess\FloorProcess;
/**
* 女生首页
... ... @@ -10,27 +8,25 @@ use Plugin\DataProcess\FloorProcess;
class GirlsController extends AbstractAction
{
/**
* 女生首页
*/
public function indexAction()
{
// 设置网站标题
$this->setTitle('女生首页');
// 显示侧边栏
$this->setNavSide();
// 显示顶部下载
$this->setHeaderDownload();
// 设置顶部信息(搜索)
$this->setHomeChannelHeader();
$data = array('grilsHomePage' => true);
// 频道数据
$channelData = IndexData::getUserChannelData(0, '2,3', '201504091403002');
if (isset($channelData['code']) && $channelData['code'] == 200) {
$data['content'] = FloorProcess::getContent($channelData['data'], 2);
}
$this->_view->display('index', $data);
// 渲染模板并输出
$this->_view->display('index', array(
'grilsHomePage' => true,
'maybeLike' => true,
'content' => Index\HomeModel::getGirlsFloor()
));
}
}
... ...
<?php
use Action\AbstractAction;
use LibModels\Wap\Home\IndexData;
use Plugin\Helpers;
/**
* 频道选择
... ... @@ -11,26 +9,13 @@ class IndexController extends AbstractAction
{
/**
* 启动首页频道选择
* 频道选择页
*/
public function indexAction()
{
$data = array();
// 背景图获取
$banner = IndexData::getBannerStart();
if ($banner) {
$data['background'] = Helpers::getImageUrl($banner, 640, 800, 1);
}
// 设置底部导航信息
$this->setNavFooter();
// 生成HTML (index.html)
$this->_view->html('index');
// 渲染模板
$this->_view->display('index', $data);
$this->_view->display('index', array(
'background' => Index\HomeModel::getBgImage()
));
}
}
... ...
<?php
use Action\AbstractAction;
use LibModels\Wap\Home\IndexData;
use Plugin\DataProcess\FloorProcess;
/**
* 儿童首页
... ... @@ -10,29 +8,25 @@ use Plugin\DataProcess\FloorProcess;
class KidsController extends AbstractAction
{
/**
* 潮童首页
*/
public function indexAction()
{
// 设置网站标题
$this->setTitle('潮童首页');
// 显示侧边栏
$this->setNavSide();
// 显示顶部下载
$this->setHeaderDownload();
// 设置顶部信息(搜索)
$this->setHomeChannelHeader();
$data = array('kidsHomePage' => true);
// 频道数据
$channelData = IndexData::getUserChannelData(0, '', 'e9875682c1599a886bfbdb965b740022');
if (isset($channelData['code']) && $channelData['code'] == 200) {
$data['content'] = FloorProcess::getContent($channelData['data'], 3);
}
$data['maybeLike'] = true;
// 渲染模板并输出
$this->_view->display('index', array(
'kidsHomePage' => true,
'maybeLike' => true,
'content' => Index\HomeModel::getKidsFloor()
));
$this->_view->display('index', $data);
}
}
... ...
<?php
use Action\AbstractAction;
use LibModels\Wap\Home\IndexData;
use Plugin\DataProcess\FloorProcess;
/**
* 创意生活首页
... ... @@ -10,29 +8,25 @@ use Plugin\DataProcess\FloorProcess;
class LifestyleController extends AbstractAction
{
/**
* 创意生活首页
*/
public function indexAction()
{
// 设置网站标题
$this->setTitle('创意生活首页');
// 显示侧边栏
$this->setNavSide();
// 显示顶部下载
$this->setHeaderDownload();
// 设置顶部信息(搜索)
$this->setHomeChannelHeader();
$data = array('lifestyleHomePage' => true);
// 频道数据
$channelData = IndexData::getUserChannelData(0, '', '9aa25f5133f011ec96c2045eb15ae425');
if (isset($channelData['code']) && $channelData['code'] == 200) {
$data['content'] = FloorProcess::getContent($channelData['data'], 4);
}
// 渲染模板并输出
$this->_view->display('index', array(
'lifestyleHomePage' => true,
'maybeLike' => true,
'content' => Index\HomeModel::getLifestyleFloor()
));
$data['maybeLike'] = true;
$this->_view->display('index', $data);
}
}
... ...
<?php
namespace Index;
use LibModels\Wap\Home\IndexData;
use Plugin\Helpers;
use Plugin\Cache;
use Plugin\DataProcess\FloorProcess;
use Configs\CacheConfig;
/**
* 首页相关的模板数据模型
*
* @name HomeModel
* @package models
* @copyright yoho.inc
* @version 1.0 (2015-10-21 11:08:21)
* @author fei.hong <fei.hong@yoho.cn>
*/
class HomeModel
{
/* 频道选择页取背景图片的位置码 */
const CODE_BG = '7ba9118028f9b22090b57341487567eb';
/* 男生楼层资源的位置码 */
const CODE_FLOOR_BOYS = '8512bf0755cc549ac323f852c9fd945d';
/* 女生楼层资源的位置码 */
const CODE_FLOOR_GIRLS = '189b6686065dbd6755dd6906cf03c002';
/* 潮童楼层资源的位置码 */
const CODE_FLOOR_KIDS = '66cad79d93e055ad6fc5c8744086066d'; // 'b8c1bff53d4ea60f978926d538620636';
/* 创意生活楼层资源的位置码 */
const CODE_FLOOR_LIFESTYLE = '61cd852c6afcf60660196154f66a3a62';
/* 男生底部广告的位置码 */
const CODE_BANNER_BOTTOM_BOYS = 'a2ec977c027d0cd9cdccb356ddf16b08';
/* 女生底部广告的位置码 */
const CODE_BANNER_BOTTOM_GIRLS = '8c8bd1b89a22e5895f05882e0825b493';
/**
* 获取频道选择页的背景图片
*
* @return string | false
*/
public static function getBgImage()
{
if (USE_CACHE) {
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result = Cache::get(CacheConfig::KEY_ACTION_INDEX_INDEX, 'master');
if (!empty($result)) {
return $result;
}
}
// 调用接口获取数据
$banner = IndexData::getBannerStart(self::CODE_BG);
if (isset($banner['data'][0]['data']['list'][0]['src'])) {
$result = Helpers::getImageUrl($banner['data'][0]['data']['list'][0]['src'], 640, 800, 1);
} else {
$result = false;
}
if (USE_CACHE) {
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if (empty($result)) {
$result = Cache::get(CacheConfig::KEY_ACTION_INDEX_INDEX, 'slave');
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else {
Cache::set(CacheConfig::KEY_ACTION_INDEX_INDEX, $result);
}
}
return $result;
}
/**
* 获取男生首页的楼层数据
*/
public static function getBoysFloor()
{
if (USE_CACHE) {
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result = Cache::get(CacheConfig::KEY_ACTION_BOYS_INDEX, 'master');
if (!empty($result)) {
return $result;
}
}
// 调用接口获取楼层数据, 并封装成模板渲染需要的数据格式
$channelData = IndexData::getResourceData('1,3', self::CODE_FLOOR_BOYS);
if (isset($channelData['code']) && $channelData['code'] == 200) {
$result = FloorProcess::getContent($channelData['data']);
}
if (USE_CACHE) {
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if (empty($result)) {
$result = Cache::get(CacheConfig::KEY_ACTION_BOYS_INDEX, 'slave');
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else {
Cache::set(CacheConfig::KEY_ACTION_BOYS_INDEX, $result);
}
}
return $result;
}
/**
* 获取女生首页的楼层数据
*/
public static function getGirlsFloor()
{
if (USE_CACHE) {
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result = Cache::get(CacheConfig::KEY_ACTION_GIRLS_INDEX, 'master');
if (!empty($result)) {
return $result;
}
}
// 调用接口获取楼层数据, 并封装成模板渲染需要的数据格式
$channelData = IndexData::getResourceData('2,3', self::CODE_FLOOR_GIRLS);
if (isset($channelData['code']) && $channelData['code'] == 200) {
$result = FloorProcess::getContent($channelData['data']);
}
if (USE_CACHE) {
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if (empty($result)) {
$result = Cache::get(CacheConfig::KEY_ACTION_GIRLS_INDEX, 'slave');
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else {
Cache::set(CacheConfig::KEY_ACTION_GIRLS_INDEX, $result);
}
}
return $result;
}
/**
* 获取潮童首页的楼层数据
*/
public static function getKidsFloor()
{
if (USE_CACHE) {
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result = Cache::get(CacheConfig::KEY_ACTION_KIDS_INDEX, 'master');
if (!empty($result)) {
return $result;
}
}
// 调用接口获取楼层数据, 并封装成模板渲染需要的数据格式
$channelData = IndexData::getResourceData('', self::CODE_FLOOR_KIDS);
if (isset($channelData['code']) && $channelData['code'] == 200) {
$result = FloorProcess::getContent($channelData['data'], 3);
}
if (USE_CACHE) {
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if (empty($result)) {
$result = Cache::get(CacheConfig::KEY_ACTION_KIDS_INDEX, 'slave');
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else {
Cache::set(CacheConfig::KEY_ACTION_KIDS_INDEX, $result);
}
}
return $result;
}
/**
* 获取创意生活首页的楼层数据
*/
public static function getLifestyleFloor()
{
if (USE_CACHE) {
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result = Cache::get(CacheConfig::KEY_ACTION_LIFESTYLE_INDEX, 'master');
if (!empty($result)) {
return $result;
}
}
// 调用接口获取楼层数据, 并封装成模板渲染需要的数据格式
$channelData = IndexData::getResourceData('', self::CODE_FLOOR_LIFESTYLE);
if (isset($channelData['code']) && $channelData['code'] == 200) {
$result = FloorProcess::getContent($channelData['data'], 4);
}
if (USE_CACHE) {
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if (empty($result)) {
$result = Cache::get(CacheConfig::KEY_ACTION_LIFESTYLE_INDEX, 'slave');
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else {
Cache::set(CacheConfig::KEY_ACTION_LIFESTYLE_INDEX, $result);
}
}
return $result;
}
}
... ...
... ... @@ -10,7 +10,7 @@ class BrandController extends AbstractAction
public function indexAction()
{
// 获取品牌数据
$brandTopData = BrandData::getBrandTopData();
/*$brandTopData = BrandData::getBrandTopData();
$brandsData = BrandData::getBrandsData();
$brandTop = array();
... ... @@ -25,9 +25,117 @@ class BrandController extends AbstractAction
}
echo '<pre>';
var_dump($brandTop, $brands);exit;
var_dump($brandTop, $brands);exit;*/
$data = array (
'brandPage' => true,
'bannerTop' => array (
'list' => array (
array (
'url' => '',
'img' => 'http://img10.static.yhbimg.com/adpic/2015/10/15/10/01c161398d3baec2868abe85e26ba1a71d.jpg?imageMogr2/thumbnail/640x300/extent/640x300/background/d2hpdGU=/position/center/quality/90'
),
array (
'url' => '',
'img' => 'http://img13.static.yhbimg.com/adpic/2015/10/15/10/027c45cdc03e23c367ec0ff3d29b7c3f79.jpg?imageMogr2/thumbnail/640x300/extent/640x300/background/d2hpdGU=/position/center/quality/90'
),
array (
'url' => '',
'img' => 'http://img13.static.yhbimg.com/adpic/2015/10/15/10/022e2ac6daa33fc3cb8a0f04025a35994f.jpg?imageMogr2/thumbnail/640x300/extent/640x300/background/d2hpdGU=/position/center/quality/90'
)
)
),
'hotBrand' => array (
'list' => array (
array (
'url' => '',
'img' => 'http://img13.static.yhbimg.com/brandLogo/2014/08/12/17/0233d54f34d2534c08271a8fc27090a6af.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'
),
array (
'url' => '',
'img' => 'http://img12.static.yhbimg.com/brandLogo/2014/01/27/11/020b17265b2103b49005c57395b8b154a9.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'
),
array (
'url' => '',
'img' => 'http://img13.static.yhbimg.com/brandLogo/2014/11/27/09/02b403bdcbfb965bdc632fea5c29816746.png?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'
),
array (
'url' => '',
'img' => 'http://img13.static.yhbimg.com/brandLogo/2013/11/01/14/027e68260ba30c01b165c17fe043f2ce2c.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'
),
array (
'url' => '',
'img' => 'http://img11.static.yhbimg.com/brandLogo/2014/04/25/14/0179fa8eacf51fd1a89ec6f7fdeab88fc2.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'
),
array (
'url' => '',
'img' => 'http://img12.static.yhbimg.com/brandLogo/2014/01/27/11/02608437f8d8b6b7b15786214b0a5ef502.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'
),
array (
'url' => '',
'img' => 'http://img12.static.yhbimg.com/brandLogo/2013/02/28/17/020aae69720d683a7962c9b7fd3a92c801.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'
),
array (
'url' => '',
'img' => 'http://img13.static.yhbimg.com/brandLogo/2014/01/27/11/02bca7ac6414c7475b4a337e28a0365590.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'
)
)
),
'brandList' => array (
array (
'title' => '0~9',
'list' => array(
array (
'name' => '004',
'isHot' => true
),
array (
'name' => '10*1',
'isNew' => true
),
array (
'name' => '2%'
)
)
),
array (
'title' => 'A',
'list' => array(
array (
'name' => 'Aape',
'isHot' => true
),
array (
'name' => 'Adfdfd',
'isNew' => true
),
array (
'name' => 'Acrwewwe'
)
)
),
array (
'title' => 'B',
'list' => array(
array (
'name' => 'Bape'
),
array (
'name' => 'Bdfdfd'
),
array (
'name' => 'Bcrwewwe'
)
)
)
)
);
$this->_view->assign('title', 'YOHO!有货');
$this->_view->display('brand', compact('brands'));
//$this->_view->display('brand', compact('brands'));
$this->_view->display('index', $data);
}
}
\ No newline at end of file
... ...
... ... @@ -4,7 +4,7 @@ use LibModels\Wap\Category\ClassData;
use Plugin\DataProcess\ClassProcess;
/**
* 品
* 品
*/
class ClassController extends AbstractAction
{
... ...
... ... @@ -59,6 +59,18 @@ class LoginController extends AbstractAction
// 渲染模板
$this->_view->display('interational', $data);
}
/**
* 退出
*
* @todo
*/
public function outAction()
{
$this->setCookie('_UID', '');
headers_sent() || header('Location: /');
}
/**
* 登录操作
... ... @@ -95,9 +107,23 @@ class LoginController extends AbstractAction
/* 调用登录接口进行登录 */
$data = LoginData::signin($area, $profile, $password);
if ($data['code'] == 200) {
$data['data'] = '/'; // @todo
if ($data['code'] != 200 || !isset($data['data']['uid'])) {
break;
}
// /* 获取用户的信息 */
// $profile = LoginData::profile($data['data']['uid']);
// $name = 'YOHO!';
// if (!empty($profile['data']['nickname'])) {
// $name = $profile['data']['nickname'];
// } elseif (!empty($profile['data']['username'])) {
// $name = $profile['data']['username'];
// } elseif (!empty($profile['data']['email'])) {
// $name = $profile['data']['email'];
// } elseif (!empty($profile['data']['mobile'])) {
// $name = $profile['data']['mobile'];
// }
$data['data'] = '/'; // @todo
}
while (false);
... ...
... ... @@ -19,7 +19,7 @@ application.dispatcher.defaultController = "index"
application.dispatcher.defaultAction = "index"
;;初始化命名空间
application.namespaces = "Action,Api,LibModels,Plugin"
application.namespaces = "Action,Api,Configs,LibModels,Plugin"
;;使用composer
composer.autoload = 0
... ...
... ... @@ -19,7 +19,7 @@ application.dispatcher.defaultController = "index"
application.dispatcher.defaultAction = "index"
;;初始化命名空间
application.namespaces = "Action,Api,LibModels,Plugin"
application.namespaces = "Action,Api,Configs,LibModels,Plugin"
;;使用composer
composer.autoload = 0
... ...
... ... @@ -19,7 +19,7 @@ application.dispatcher.defaultController = "index"
application.dispatcher.defaultAction = "index"
;;初始化命名空间
application.namespaces = "Action,Api,LibModels,Plugin"
application.namespaces = "Action,Api,Configs,LibModels,Plugin"
;;使用composer
composer.autoload = 0
... ...
[common]
servers.host = 127.0.0.1:11211:90
[memcached:common]
servers.hosts = 127.0.0.1:11213
[memcached]
master.hosts = 127.0.0.1:11212,127.0.0.1:11213
slave.hosts = 127.0.0.1:11212,127.0.0.1:11213
[redis]
servers.hosts = 127.0.0.1:6379
\ No newline at end of file
... ...
... ... @@ -5,7 +5,7 @@ collation = utf8_unicode_ci
timeout = 3
[database]
yhb_bill.username = yohodb
yhb_bill.passwd = yohonj_9646_mysql
yhb_bill.write = 123.56.86.219:5511
yhb_bill.read = 123.56.86.219:5511
\ No newline at end of file
yhb_test.username = test
yhb_test.passwd = 123456
yhb_test.write = 127.0.0.1:5511
yhb_test.read = 127.0.0.1:5511
\ No newline at end of file
... ...
... ... @@ -5,7 +5,7 @@ collation = utf8_unicode_ci
timeout = 3
[database]
yhb_bill.username = yohodb
yhb_bill.passwd = yohonj_9646_mysql
yhb_bill.write = 123.56.86.219:5511
yhb_bill.read = 123.56.86.219:5511
\ No newline at end of file
yhb_test.username = test
yhb_test.passwd = 123456
yhb_test.write = 127.0.0.1:5511
yhb_test.read = 127.0.0.1:5511
\ No newline at end of file
... ...
... ... @@ -5,7 +5,7 @@ collation = utf8_unicode_ci
timeout = 3
[database]
yhb_bill.username = yohodb
yhb_bill.passwd = yohonj_9646_mysql
yhb_bill.write = 10.170.183.158:5511
yhb_bill.read = 10.170.183.158:5511
\ No newline at end of file
yhb_test.username = test
yhb_test.passwd = 123456
yhb_test.write = 127.0.0.1:5511
yhb_test.read = 127.0.0.1:5511
\ No newline at end of file
... ...
<?php
use Yaf\Application;
define('SITE_DOMAIN', 'm.dev.yohobuy.com'); // 网站主域名
define('USE_CACHE', false); // 缓存的开关
define('APPLICATION_PATH', dirname(__DIR__));
define('ROOT_PATH', dirname(dirname(APPLICATION_PATH)));
defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'developer');
... ...
<?php
use Yaf\Application;
define('SITE_DOMAIN', 'buy.test.yoho.cn'); // 网站主域名
define('USE_CACHE', true); // 缓存的开关
define('APPLICATION_PATH', dirname(__DIR__));
define('ROOT_PATH', dirname(dirname(APPLICATION_PATH)));
defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'testing');
... ...
<?php
use Yaf\Application;
define('SITE_DOMAIN', 'wap.yohobuy.com'); // 网站主域名
define('USE_CACHE', true); // 缓存的开关
define('APPLICATION_PATH', dirname(__DIR__));
define('ROOT_PATH', dirname(dirname(APPLICATION_PATH)));
defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'production');
... ...
User-agent: *
Disallow: /
\ No newline at end of file
... ...