Authored by xuqi

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

Showing 35 changed files with 1173 additions and 1060 deletions
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>国际账号登录</title>
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta http-equiv="cleartype" content="on">
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta content="telephone=no" name="format-detection" />
<meta content="email=no" name="format-detection" />
<script type="text/javascript">
(function (doc, win) {
var docEl = doc.documentElement;
(function () {
var clientWidth = docEl.clientWidth;
if (!clientWidth) {
return;
}
docEl.style.fontSize = 20 * (clientWidth / 320) + 'px';
}());
})(document, window);
</script>
<link rel="stylesheet" href="http://172.16.6.248:8088/css/index.css">
</head>
<body class=passport-body>
<div class="login-interational-page passport-page yoho-page">
<div class="header">
<a class="go-back" href=/>
<img src="http://static.dev.yohobuy.com/img/passport/go-back.png">
</a>
<p class="title">登录</p>
</div> <div class="content">
<div class="select-container row">
<span class="select-title">国家和地区</span>
<select id="country-select" class="country-select select in-android-uc">
<option value=+61 >澳大利亚</option>
<option value=+82 >韩国</option>
<option value=+1 >加拿大</option>
<option value=+60 >马来西亚</option>
<option value=+1 >美国</option>
<option value=+81 >日本</option>
<option value=+65 >新加坡</option>
<option value=+44 >英国</option>
<option value=+86 selected>中国</option>
<option value=+853 >中国澳门</option>
<option value=+886 >中国台湾</option>
<option value=+852 >中国香港</option>
</select>
<div class="arrow-right"></div>
</div> <div class="input-container phone-container row has-clear">
<span id="area-code" class="area-code">+86</span>
<input id="phone-num" class="input phone-num" type="text" placeholder="手机号" value=>
</div>
<div class="input-container row has-eye">
<input id="pwd" class="pwd input" type="password" placeholder="密码">
</div>
<span id="btn-login" class="btn btn-login disble row">登录</span>
</div>
</div>
<script src="http://172.16.6.248:8000/static/js/sea.js?nowrap"></script>
<script>
seajs.config({
base: 'http://172.16.6.248:8000'
});
</script>
<script>
seajs.use('js/passport/login/interational');
</script>
<script>
seajs.use('js/homePage/girls');
</script></body>
</html>
\ No newline at end of file
... ...
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>注册</title>
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta http-equiv="cleartype" content="on">
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta content="telephone=no" name="format-detection" />
<meta content="email=no" name="format-detection" />
<script type="text/javascript">
(function (doc, win) {
var docEl = doc.documentElement;
(function () {
var clientWidth = docEl.clientWidth;
if (!clientWidth) {
return;
}
docEl.style.fontSize = 20 * (clientWidth / 320) + 'px';
}());
})(document, window);
</script>
<link rel="stylesheet" href="http://172.16.6.248:8088/css/index.css">
</head>
<body class=passport-body>
<div class="reg-page passport-page yoho-page">
<div class="header">
<a class="go-back" href=/>
<img src="http://static.dev.yohobuy.com/img/passport/go-back.png">
</a>
<p class="title">注册</p>
</div> <div class="content">
<div class="select-container row">
<span class="select-title">国家和地区</span>
<select id="country-select" class="country-select select in-android-uc">
<option value=+61 >澳大利亚</option>
<option value=+82 >韩国</option>
<option value=+1 >加拿大</option>
<option value=+60 >马来西亚</option>
<option value=+1 >美国</option>
<option value=+81 >日本</option>
<option value=+65 >新加坡</option>
<option value=+44 >英国</option>
<option value=+86 selected>中国</option>
<option value=+853 >中国澳门</option>
<option value=+886 >中国台湾</option>
<option value=+852 >中国香港</option>
</select>
<div class="arrow-right"></div>
</div> <div class="input-container phone-container row has-clear">
<span id="area-code" class="area-code">+86</span>
<input id="phone-num" class="input phone-num" type="text" placeholder="手机号">
</div>
<span id="btn-next" class="btn btn-next disable row">下一步</span>
<p class="register-tip">YOHO!Family账号可登录YOHO!有货、YOHO!Boys、YOHO!Girls及SHOW</p>
</div>
</div>
<script src="http://172.16.6.248:8000/static/js/sea.js?nowrap"></script>
<script>
seajs.config({
base: 'http://172.16.6.248:8000'
});
</script>
<script>
seajs.use('js/passport/register/register');
</script>
<script>
seajs.use('js/homePage/girls');
</script></body>
</html>
\ No newline at end of file
... ...
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>登录</title>
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta http-equiv="cleartype" content="on">
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta content="telephone=no" name="format-detection" />
<meta content="email=no" name="format-detection" />
<script type="text/javascript">
(function (doc, win) {
var docEl = doc.documentElement;
(function () {
var clientWidth = docEl.clientWidth;
if (!clientWidth) {
return;
}
docEl.style.fontSize = 20 * (clientWidth / 320) + 'px';
}());
})(document, window);
</script>
<link rel="stylesheet" href="http://172.16.6.248:8088/css/index.css">
</head>
<body class=passport-body>
<div class="login-page passport-page yoho-page">
<div class="header">
<a class="go-back" href=/>
<img src="http://static.dev.yohobuy.com/img/passport/go-back.png">
</a>
<img class="img-header" src="http://static.dev.yohobuy.com/img/passport/yoho-family.png">
</div> <div class="content">
<div class="acc-container input-container row has-clear">
<div class="yoho-logo"></div>
<input id="account" class="input account" type="text" placeholder="手机号/邮箱" autocomplete="off" value=>
</div>
<div class="input-container row has-eye">
<input id="pwd" class="pwd input" type="password" placeholder="密码">
</div>
<span id="btn-login" class="btn btn-login disable">登录</span>
<p class="op-container">
<a class="go-register" href=/reg.html>免费注册</a>
<span id="forget-pwd" class="forget-pwd">忘记密码</span>
</p>
<div class="third-party-login">
<span>其他登录方式</span>
<div class="tp-link">
<a class="alipay" href=></a>
<a class="weibo" href=></a>
<a class="qq" href=></a>
</div>
</div>
<a class="interational" href=/login.html>Interational Customer</a>
<div class="login-tip">
<div class="info-icon"></div>
Yoho!Family账号可登录YOHO!有货
</div>
<div id="retrive-pwd-mask" class="mask"></div>
<ul id="retrive-pwd-ways" class="retrive-pwd-ways">
<li>
<a href=/phoneback.html>通过手机找回密码</a>
</li>
<li>
<a href=/emailback.html>通过邮箱找回密码</a>
</li>
<li id="cancel-retrive">
取消
</li>
</ul>
</div>
</div>
<script src="http://172.16.6.248:8000/static/js/sea.js?nowrap"></script>
<script>
seajs.config({
base: 'http://172.16.6.248:8000'
});
</script>
<script>
seajs.use('js/passport/login/login');
</script>
</body>
</html>
\ No newline at end of file
... ...
... ... @@ -14,8 +14,7 @@ namespace Action;
use Yaf\Controller_Abstract;
use Yaf\Dispatcher;
use Hood\Cache;
use LibModels\Wap\Home\SideData;
use Plugin\Cache;
class AbstractAction extends Controller_Abstract
{
... ... @@ -33,6 +32,20 @@ class AbstractAction extends Controller_Abstract
public function init()
{
$this->_request = $this->getRequest();
// 设置环境变量
switch (APPLICATION_ENV) {
case 'production':
$this->_view->assign('rlsEnv', true);
break;
case 'testing':
$this->_view->assign('testEnv', true);
break;
case 'develop':
default:
$this->_view->assign('devEnv', true);
break;
}
}
/**
... ... @@ -60,25 +73,6 @@ class AbstractAction extends Controller_Abstract
}
/**
* 使用Memcache缓存
*
* @param string $node
* @param string $childNode
* @return object
*/
protected function memcache($node = null, $childNode = 'hosts')
{
// WINDOWS
if (PATH_SEPARATOR === '\\') {
return Cache::memcache($node, $childNode);
}
// LINUX
else {
return Cache::memcached($node, $childNode);
}
}
/**
* 关闭模板自动渲染
*
* @return void
... ... @@ -138,7 +132,7 @@ class AbstractAction extends Controller_Abstract
{
headers_sent() || header('Location: /error.html');
exit;
exit();
}
/**
... ... @@ -152,7 +146,7 @@ class AbstractAction extends Controller_Abstract
*/
protected function setCookie($name, $value, $expire = 0, $path = '/',$domain = 'yohobuy.com')
{
setcookie('alipay_redirect', $value, $expire, $path, $domain);
setcookie($name, $value, $expire, $path, $domain);
}
/**
... ... @@ -166,17 +160,34 @@ class AbstractAction extends Controller_Abstract
{
return $this->request->getCookie($name, $default);
}
/**
* 返回顶部软件下载有关数据
* @return array 下载有关数据
* 设置缓存
*
* @param string $key 键名
* @param mixed $value 需要缓存的数据
* @param int $expire 缓存有效期(单位秒, 0表示永久)
* @return void
*/
protected function getHeaderDownload()
protected function setCache($key, $value, $expire)
{
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'
);
Cache::set($key, $value, $expire);
}
/**
* 获取缓存
*
* @param string $key 键名
* @param bool $isMaster 控制是到主服务器取,还是到从服务器取缓存
* @return mixed
*/
protected function getCache($key, $isMaster = true)
{
if ($isMaster) {
return Cache::get($key, 'master');
} else {
return Cache::get($key, 'slave');
}
}
/*
... ... @@ -334,6 +345,45 @@ class AbstractAction extends Controller_Abstract
)
),
));
}
/**
* 返回顶部软件下载有关数据
* @return array 下载有关数据
*/
protected function getHeaderDownload()
{
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'
);
}
/**
* 设置首页以及频道页顶部信息
*
* @return void
*/
protected function setHomeChannelHeader()
{
$header['searchUrl'] = '';
$this->_view->assign('homeHeader', $header);
}
/**
* 返回顶部软件下载有关数据
* @return array 下载有关数据
*/
protected function setHeaderDownload()
{
$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'
);
$this->_view->assign('headerDownload', $download);
}
}
... ...
... ... @@ -20,15 +20,94 @@ class RegData
/**
* 获取地区数据
*
* 备注:
* 考虑到该接口数据很少发生变化,改成静态配置,不调用接口.
* 以后有需要,可以打开注释,改成调用接口.
*
* @return array 地区数据
*/
public static function getAreasData()
{
$param = Yohobuy::param();
$param['method'] = 'app.passport.getArea';
$param['client_secret'] = Sign::getSign($param);
// $param = Yohobuy::param();
// $param['method'] = 'app.passport.getArea';
// $param['client_secret'] = Sign::getSign($param);
// $data = Yohobuy::get(Yohobuy::API_URL, $param);
// $result = array();
// if (!empty($data['data'])) {
// $build = array();
// foreach ($data['data'] as $value) {
// $build = array();
// $build['areaCode'] = '+' . $value['area'];
// $build['selected'] = ($value['area'] === '86');
// $build['name'] = $value['name'];
// $result[] = $build;
// }
// $data = array();
// }
// return $result;
return Yohobuy::get(Yohobuy::API_URL, $param);
return array(
0 => array(
'areaCode' => '+61',
'selected' => false,
'name' => '澳大利亚',
),
1 => array(
'areaCode' => '+82',
'selected' => false,
'name' => '韩国',
),
2 => array(
'areaCode' => '+1',
'selected' => false,
'name' => '加拿大',
),
3 => array(
'areaCode' => '+60',
'selected' => false,
'name' => '马来西亚',
),
4 => array(
'areaCode' => '+1',
'selected' => false,
'name' => '美国',
),
5 => array(
'areaCode' => '+81',
'selected' => false,
'name' => '日本',
),
6 => array(
'areaCode' => '+65',
'selected' => false,
'name' => '新加坡',
),
7 => array(
'areaCode' => '+44',
'selected' => false,
'name' => '英国',
),
8 => array(
'areaCode' => '+86',
'selected' => true,
'name' => '中国',
),
9 => array(
'areaCode' => '+853',
'selected' => false,
'name' => '中国澳门',
),
10 => array(
'areaCode' => '+886',
'selected' => false,
'name' => '中国台湾',
),
11 => array(
'areaCode' => '+852',
'selected' => false,
'name' => '中国香港',
),
);
}
/**
... ... @@ -48,7 +127,7 @@ class RegData
return Yohobuy::post(Yohobuy::API_URL, $param);
}
/**
* 验证手机注册的识别码
*
... ... @@ -68,7 +147,7 @@ class RegData
return Yohobuy::post(Yohobuy::API_URL, $param);
}
/**
* 通过手机注册
*
... ...
<?php
namespace Plugin;
use Hood\Cache as HoodCache;
/**
* 数据缓存的操作类
*
* @name Cache
* @package
* @package Plugin
* @copyright yoho.inc
* @version 1.0 (2015-10-10 11:23:47)
* @author fei.hong <fei.hong@yoho.cn>
*/
class Cache
{
/**
* 设置缓存
*
* 备注:
* 采用主从分布式缓存
* master 代表主缓存服务器
* slave 代表从缓存服务器
*
* 作用:
* 在后端的服务异常挂掉了并且主服务器缓存(master)的数据时间到期后,
* 能获取从服务器缓存(slave)的数据,不影响前端页面的正常访问.
*
* @param string $key 键名
* @param mixed $value 需要缓存的数据
* @param int $expire 缓存有效期(单位秒, 0表示永久)
* @return void
*/
public static function set($key, $value, $expire = 3600)
{
// 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);
}
}
/**
* 获取缓存
*
* @param string $key 键名
* @param string $node master代表主服务器, slave代表从服务器
* @return mixed
*/
public static function get($key, $node = 'master')
{
$result = array();
// WINDOWS
if (PATH_SEPARATOR === '\\') {
$result = HoodCache::Memcache($node)->get(self::makeKey($key, $node));
}
// LINUX
else {
$result = HoodCache::Memcached($node)->set(self::makeKey($key, $node));
}
return $result;
}
/**
* 清除缓存
*
* @param string $key 键名
* @return void
*/
public static function delete($key)
{
// WINDOWS
if (PATH_SEPARATOR === '\\') {
HoodCache::Memcache('master')->delete(self::makeKey($key, 'master'));
HoodCache::Memcache('slave')->delete(self::makeKey($key, 'slave'));
}
// LINUX
else {
HoodCache::Memcached('master')->delete(self::makeKey($key, 'master'));
HoodCache::Memcached('slave')->delete(self::makeKey($key, 'slave'));
}
}
/**
* 生成键名
*
* @param string $key 键名
* @param string $prefix 前缀标识
* @return string
*/
public static function makeKey($key, $prefix)
{
return md5($prefix . '_' . $key);
}
}
... ...
... ... @@ -9,11 +9,36 @@ class FloorProcess
{
/**
* 处理首页内容
* @param $data
* @param $type 类型 默认1:男首页 2:女首页 3:kids 4:lifestyle
*/
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;
}
$result[] = $data;
}
return $result;
}
/**
* 焦点图数据处理方法
* @param array $data 焦点图数据
* @param $type 类型 默认1:男首页 2:女首页 3:kids 4:lifestyle
* @return array 处理之后的焦点图数据
*/
public static function focus($data)
private static function focus($data, $type)
{
$result = array();
... ... @@ -23,15 +48,16 @@ class FloorProcess
}
$result['list'] = $data;
return $result;
return array('bannerTop'=>$result);
}
/**
* 图标列表数据处理方法
* @param array $data 图标列表数据
* @param $type 类型 默认1:男首页 2:女首页 3:kids 4:lifestyle
* @return array 处理之后的图标列表数据
*/
public static function app_icon_list($data)
private static function app_icon_list($data, $type)
{
$result = array();
... ... @@ -41,15 +67,16 @@ class FloorProcess
}
$result['list'] = $data;
return $result;
return array('iconsEnter'=>$result);
}
/**
* 单图片数据处理方法
* @param array $data 单图片数据
* @param $type 类型 默认1:男首页 2:女首页 3:kids 4:lifestyle
* @return array 处理之后的单图片数据
*/
public static function single_image($data)
private static function single_image($data, $type)
{
$result = array();
... ... @@ -58,15 +85,16 @@ class FloorProcess
}
$result['list'] = $data;
return $result;
return array('singleImage'=>$result);
}
/**
* 带标题的12个小图推荐数据处理方法
* @param array $data 带标题的12个小图推荐数据
* @param $type 类型 默认1:男首页 2:女首页 3:kids 4:lifestyle
* @return array 处理之后的带标题的12个小图推荐数据
*/
public static function recommend_content_five($data)
private static function recommend_content_five($data, $type)
{
$result = array();
... ... @@ -79,19 +107,20 @@ class FloorProcess
unset($data['title']);
$result = $data;
return $result;
return array('hotCategory'=>$result);
}
/**
* 推荐品牌数据处理方法
* @param array $data 推荐品牌数据
* @param $type 类型 默认1:男首页 2:女首页 3:kids 4:lifestyle
* @return array 处理之后的推荐品牌数据
*/
public static function app_hot_brands($data)
private static function app_hot_brands($data, $type)
{
$result = array();
$data['is_show_name'] = $data['is_show_name'] == 'Y' ? 1 : 0;
$data['is_show_name'] = (isset($data['is_show_name']) && $data['is_show_name'] == 'Y') ? 1 : 0;
$data['name'] = $data['title']['title'];
unset($data['title']);
foreach ($data['list'] as &$one) {
... ... @@ -100,15 +129,16 @@ class FloorProcess
}
$result = $data;
return $result;
return array('hotBrands'=>$result);
}
/**
* 潮人·搭配数据处理方法
* @param array $data 潮人·搭配数据
* @param $type 类型 默认1:男首页 2:女首页 3:kids 4:lifestyle
* @return array 处理之后的潮人·搭配数据
*/
public static function trendsetter_collocation($data)
private static function trendsetter_collocation($data, $type)
{
$result = array();
... ... @@ -122,15 +152,16 @@ class FloorProcess
}
$result = $data;
return $result;
return array('trendColloaction'=>$result);
}
/**
* 潮品·话题数据处理方法
* @param array $data 潮品·话题数据
* @param $type 类型 默认1:男首页 2:女首页 3:kids 4:lifestyle
* @return array 处理之后的潮品·话题数据
*/
public static function trendgoods_topic($data)
private static function trendgoods_topic($data, $type)
{
$result = array();
... ... @@ -140,15 +171,16 @@ class FloorProcess
}
$result = $data;
return $result;
return array('trendTopics'=>$result);
}
/**
* 一张大图一个大的推荐和4个小图推荐数据处理方法
* @param array $data 一张大图一个大的推荐和4个小图推荐数据
* @param $type 类型 默认1:男首页 2:女首页 3:kids 4:lifestyle
* @return array 处理之后的一张大图一个大的推荐和4个小图推荐数据
*/
public static function recommend_content_one($data)
private static function recommend_content_one($data, $type)
{
$result = array();
... ... @@ -165,15 +197,16 @@ class FloorProcess
}
$result = $data;
return $result;
return array('goodsCategory'=>$result);
}
/**
* 一张大图和6个小图推荐数据处理方法
* @param array $data 一张大图和6个小图推荐数据
* @param $type 类型 默认1:男首页 2:女首页 3:kids 4:lifestyle
* @return array 处理之后的一张大图和6个小图推荐数据
*/
public static function recommend_content_two($data)
private static function recommend_content_two($data, $type)
{
$result = array();
... ... @@ -197,9 +230,10 @@ class FloorProcess
/**
* 小图片数据处理方法
* @param array $data 小图片数据
* @param $type 类型 默认1:男首页 2:女首页 3:kids 4:lifestyle
* @return array 处理之后的小图片数据
*/
public static function small_pic($data)
private static function small_pic($data, $type)
{
$result = array();
... ... @@ -209,23 +243,37 @@ class FloorProcess
}
$result = $data;
return $result;
return array('small_pic'=>$result);
}
/**
* 也许喜欢数据处理方法
* @param array $data 也许喜欢数据
* @param $type 类型 默认1:男首页 2:女首页 3:kids 4:lifestyle
* @return array 处理之后的也许喜欢数据
*/
public static function maybeLike($data)
private static function maybeLike($data, $type)
{
$result = array();
foreach ($data as &$one) {
$one['img'] = Helpers::getImageUrl($one['src'], 235, 314, 1);
unset($one['src']);
$result = array('goods'=>array());
foreach ($data as $one) {
$product = array();
$product['id'] = $one['brand_id'];
$product['thumb'] = Helpers::getImageUrl($one['default_images'], 235, 314, 1);
$product['price'] = $one['market_price'];
$product['salePrice'] = $one['sales_price'];
// 处理tags
$product['tags'] = array();
foreach ($one['tags'] as $val) {
$product['tags'][$val] = 1;
}
$product['is_soon_sold_out'] = $one['is_soon_sold_out'];
$product['name'] = $one['product_name'];
$product['url'] = $one['product_skn'];
$result['goods'][] = $product;
}
$result = $data;
return $result;
}
... ...
... ... @@ -9,32 +9,35 @@
* @version 1.0 (2015-9-15 14:14:02)
* @author fei.hong <fei.hong@yoho.cn>
*/
namespace Plugin;
use Yaf\View_Interface;
use Yaf\Dispatcher;
use Yaf\Application;
use Plugin\LightnCandy;
class TemplateLayout implements View_Interface
{
/* 属性 */
/* 模板变量 */
protected $_tpl_vars;
/* 模板目录 */
protected $_tpl_dir;
/* HTML路径 */
protected $_html_path;
/**
* 传递给视图变量
*
* @param mixed $name
* @param mixed $value
* @return void
*/
public function assign($name, $value = null)
{
$this->_tpl_vars[$name] = $value;
}
/**
* 清除一个视图变量
*
... ... @@ -43,14 +46,32 @@ class TemplateLayout implements View_Interface
*/
public function clear($name = null)
{
// 清空指定的变更值
if (isset($this->_tpl_vars[$name])) {
unset($this->_tpl_vars[$name]);
} else {
}
// 清空整个变量值
else {
$this->_tpl_vars = array();
}
}
/**
* 设置生成HTML及存放路径
*
* 如"xxx"则生成"xxx.html"文件, 如"path/xxx"则生成"path/xxx.html"
*
* @param string $htmlPath 生成的Html名字或路径
* @return void
*/
public function html($htmlPath)
{
if (is_string($htmlPath)) {
$this->_html_path = $htmlPath;
}
}
/**
* 渲染视图模板,并直接输出到客户端
*
* @param string $tpl
... ... @@ -70,8 +91,18 @@ class TemplateLayout implements View_Interface
*/
public function render($tpl, $tpl_vars = array())
{
$request = Dispatcher::getInstance()->getRequest();
$config = Application::app()->getConfig()->get('application');
$useHtml = isset($this->_html_path) && isset($config->assets->path);
// 有生成过HTML的,则先尝试获取HTML内容. 有则返回内容,不渲染模板
if ($useHtml) {
$result = $this->getHtml($config->assets->path, $this->_html_path);
if (!empty($result)) {
return $result;
}
}
$request = Dispatcher::getInstance()->getRequest();
$tplExt = $config->template->ext;
$viewPath = $config->template->path;
$viewName = $viewPath . '/' . strtolower($request->module) . '/' . strtolower($request->controller) . '/' . $tpl . $tplExt;
... ... @@ -79,7 +110,7 @@ class TemplateLayout implements View_Interface
if (!file_exists($viewName)) {
return '';
}
// 合并通过assign传递的参数
if (is_array($this->_tpl_vars)) {
$tpl_vars = array_merge($this->_tpl_vars, $tpl_vars);
... ... @@ -93,12 +124,12 @@ class TemplateLayout implements View_Interface
$compilePath = $config->template->compile;
// 模板编译成PHP文件所存放的文件路径
$compilePhp = $compilePath . '/' . $makeKey . '.php';
// 已渲染过该模板,则直接引PHP文件
if (is_readable($compilePhp)) {
LightnCandy::getContext();
$renderer = include($compilePhp);
}
}
// 第一次渲染该模板的流程:取得模板内容 => 预编译成PHP函数 => 写入服务器生成PHP文件
else {
$template = file_get_contents($viewName, false, null);
... ... @@ -114,18 +145,78 @@ class TemplateLayout implements View_Interface
// 将编译过的函数写入PHP文件
file_put_contents($compilePhp, $phpStr);
}
// 装载内容,调用PHP函数
try {
$result = $renderer($tpl_vars);
} catch (Exception $e) {
}
catch (Exception $e) {
$result = '';
}
// 保存成指定名字的html文件
if ($useHtml && !empty($result)) {
$this->toHtml($config->assets->path, $this->_html_path, $result);
}
$config = null;
$request = null;
$tpl_vars = null;
return $result;
}
/**
* 生成HTML
*
* @param string $assetsPath 存放静态页面的目录
* @param string $htmlPath 指定的html文件路径
* @param string $result 需要存的内容
* @return void
*/
public function toHtml($assetsPath, $htmlPath, $result)
{
$htmlName = $assetsPath . '/' . ltrim($htmlPath, '/') . '.html';
// 判断是否存在目录
if (strstr($htmlPath, '/')) {
$this->makedir(dirname($htmlName));
}
// 写入html文件
file_put_contents($htmlName, $result);
}
/**
* 获取HTML
*
* @param string $assetsPath 存放静态页面的目录
* @param string $htmlPath 指定的html文件路径
* @return string
*/
public function getHtml($assetsPath, $htmlPath)
{
$result = '';
$htmlName = $assetsPath . '/' . ltrim($htmlPath, '/') . '.html';
// 判断文件是否已存在, 存在则不重复生成
if (file_exists($htmlName)) {
$result = file_get_contents($htmlName, false, null);
}
return $result;
}
/**
* 递归创建目录
*
* @param string $path 文件路径
* @return boolean (false:失败,true:成功)
*/
protected function makeDir($path)
{
return is_dir($path) || ($this->makeDir(dirname($path)) && @mkdir($path, 0755));
}
/**
* 设置视图模板目录
*
* @param string $path
... ... @@ -134,10 +225,12 @@ class TemplateLayout implements View_Interface
public function setScriptPath($path)
{
$result = false;
if (is_dir($path)) {
$this->_tpl_dir = $path;
$result = true;
}
return $result;
}
... ...
... ... @@ -18,7 +18,7 @@
"dependencies": {
"yoho.zepto": "1.1.60",
"yoho.jquery": "1.8.3",
"yoho.lazyload": "1.1.0",
"yoho.lazyload":"1.1.0",
"mlellipsis": "0.0.6",
"yoho.iswiper": "3.0.1",
"iscroll": "5.1.2"
... ...
.hot-brands {
background: #fff;
border-bottom: 1px solid #e0e0e0;
a {
display: block;
text-decoration: none;
height: 100%;
}
.brand {
float: left;
width: 158rem / $pxConvertRem;
height: 174rem / $pxConvertRem;
border-right: 1px solid #e0e0e0;
border-top: 1px solid #e0e0e0;
overflow: hidden;
.brand-logo {
width: 100%;
height: 128rem / $pxConvertRem;
line-height: 128rem / $pxConvertRem;
text-align: center;
font-size: 0;
img {
vertical-align: middle;
max-width: 100%;
max-height: 100%;
}
}
.brand-name {
line-height: 44rem / $pxConvertRem;
font-size: 18rem / $pxConvertRem;
color: #babac2;
text-align: center;
text-decoration: none;
border-bottom: none;
overflow: hidden;
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
white-space: nowrap;
}
}
.brand:nth-child(4n) {
border-right: none;
}
.more {
float: left;
width: 317rem / $pxConvertRem;
height: 174rem / $pxConvertRem;
border-top: 1px solid #e0e0e0;
a {
display: block;
width: 100%;
height: 100%;
background: image-url("more-brand.png") no-repeat;
background-size: 100% 100%;
}
}
}
.hot-brands.girls {
background: transparent;
}
... ...
@import "header-download", "banner-top","banner-center", "side-nav", "floor-header", "banner-top", "banner-bottom", "hot-brands", "fine-brands", "creative-life", "plus-star", "footer", "maybe-like",
@import "header-download", "banner-top","banner-center", "side-nav", "floor-header", "banner-top", "banner-bottom", "hot-brands", "fine-brands", "creative-life", "plus-star", "footer", "maybe-like",
"icons-enter","trendsetter-collocation",
"trend-topics","goods-category","hot-brands", "hot-category", "home-header";
\ No newline at end of file
"trend-topics","goods-category","hot-brands", "hot-category", "home-header";
... ...
... ... @@ -13,15 +13,15 @@
{{> common/content}}
{{! 商品列表}}
{{# twoColumnGoods}}
{{> common/two_column_goods}}
{{/ twoColumnGoods}}
{{! 底部banner}}
{{# bannerBottom}}
{{> common/banner_bottom}}
{{/ bannerBottom}}
{{! 商品列表}}
{{# twoColumnGoods}}
{{> common/two_column_goods}}
{{/ twoColumnGoods}}
{{! 底部banner}}
{{# bannerBottom}}
{{> common/banner_bottom}}
{{/ bannerBottom}}
<div class="overlay"></div>
</div>
... ...
{{> layout/header}}
<div class="mobile-container">
<div class="mobile-wrap kids-wrap">
{{! 首页header}}
{{# homeHeader}}
{{> home_header}}
{{/ homeHeader}}
{{# content}}
{{! 头部banner}}
{{# bannerTop}}
{{> common/banner_top}}
{{/ bannerTop}}
{{! 图标入口}}
{{# iconsEnter}}
{{> common/icons_enter}}
{{/ iconsEnter}}
{{! 潮流搭配}}
{{# trendColloaction}}
{{> common/trendsetter_collocation}}
{{/trendColloaction}}
{{! 潮流话题}}
{{# trendTopics}}
{{> common/trend_topics}}
{{/ trendTopics}}
{{! 潮流上装}}
{{# goodsCategory}}
{{> common/goods_category}}
{{/ goodsCategory}}
{{! 热门品牌}}
{{# hotBrands}}
{{> common/hot_brands}}
{{/ hotBrands}}
{{! 优选品牌}}
{{# fineBrands}}
{{> common/fine_brands}}
{{/ fineBrands}}
{{! 热门分类}}
{{# hotCategory}}
{{> girls/hot_category}}
{{/ hotCategory}}
{{! 热门品牌可滑动}}
{{# hotBrandsScroll}}
{{> girls/hot_brands}}
{{/ hotBrandsScroll}}
{{! 中间banner}}
{{# bannerCenter}}
{{> common/banner_center}}
{{/ bannerCenter}}
{{! 创意生活}}
{{# creativeLife}}
{{> common/creative_life}}
{{/ creativeLife}}
{{! PLUS}}
{{# plusStar}}
{{> common/plus_star}}
{{/ plusStar}}
{{/ content}}
{{! 商品列表}}
{{# twoColumnGoods}}
{{> common/two_column_goods}}
{{/ twoColumnGoods}}
{{! 底部banner}}
{{# bannerBottom}}
{{> common/banner_bottom}}
{{/ bannerBottom}}
{{! footer}}
{{# footer}}
{{> footer}}
{{/ footer}}
<div class="overlay"></div>
</div>
</div>
{{> layout/footer}}
\ No newline at end of file
... ...
{{> layout/header}}
<div class="mobile-wrap lifestyle-wrap">
{{# headerDownload}}
{{> common/header_download}}
{{/ headerDownload}}
{{! 首页header}}
{{# homeHeader}}
{{> common/home_header}}
... ...
<div class="banner-top">
<div class="banner-swiper swiper-container">
<ul class="swiper-wrapper">
{{# list}}
<li class="swiper-slide">
<a href="{{url}}">
<img src="{{img}}" alt="">
</a>
</li>
{{/ list}}
</ul>
</div>
<div class="swiper-pagination">
<div class="pagination-inner">
</div>
</div>
</div>
\ No newline at end of file
... ... @@ -9,8 +9,18 @@
{{# iconsEnter}}
{{> common/icons_enter}}
{{/ iconsEnter}}
{{! 热门品类}}
{{# hotCategory}}
{{> girls/hot_category}}
{{/ hotCategory}}
{{! 热门品牌}}
{{# hotBrands}}
{{> common/hot_brands_list}}
{{/ hotBrands}}
{{! 搭配}}
{{! 搭配}}
{{# trendColloaction}}
{{> common/trendsetter_collocation}}
{{/trendColloaction}}
... ... @@ -20,21 +30,12 @@
{{> common/trend_topics}}
{{/ trendTopics}}
{{# bannerCategory}}
{{> common/banner_category}}
{{/ bannerCategory}}
{{! 潮流时装/经典裤裙/时尚靴履/潮人配饰}}
{{# goodsCategory}}
{{> common/goods_category}}
{{/ goodsCategory}}
{{! 热门分类}}
{{# hotCategory}}
{{> girls/hot_category}}
{{/ hotCategory}}
{{! 热门品牌}}
{{# hotBrands}}
{{> girls/hot_brands}}
{{/ hotBrands}}
{{! 可能喜欢}}
{{# maybeLike}}
{{> common/maybe_like}}
... ...
<div class="floor-header">
<h2>{{name}}</h2>
</div>
\ No newline at end of file
{{# title}}
<div class="floor-header">
<h2>{{name}}</h2>
</div>
{{/ title}}
... ...
{{> common/floor_header_more}}
<div class="goods-category">
{{# banner}}
{{# big_image}}
<div class="category-swiper">
<ul class="swiper-wrapper clearfix">
{{# list}}
... ... @@ -16,7 +16,7 @@
</div>
</div>
</div>
{{/ banner}}
{{/ big_image}}
<ul class="category-list clearfix">
{{# list}}
<li>
... ...
{{> common/floor_header}}
<ul class="hot-brands clearfix">
{{> common/floor_header}}
{{# list}}
<li class="brand">
<a href="{{url}}">
... ... @@ -13,4 +13,4 @@
<li class="more">
<a href="{{more}}"></a>
</li>
</ul>
\ No newline at end of file
</ul>
... ...
<div class="hot-category">
{{> common/floor_header}}
<ul class="category-list clearfix">
{{# list}}
<li>
... ...
<div class="good-info" data-id="{{id}}">
<div class="tag-container clearfix">
{{# tags}}
{{# isNew}}
{{# is_new}}
<p class="good-tag new-tag">NEW</p>
{{/ isNew}}
{{# isReNew}}
{{/ is_new}}
{{# is_advance}}
<p class="good-tag renew-tag">再到着</p>
{{/ isReNew}}
{{# isSale}}
{{/ is_advance}}
{{# is_discount}}
<p class="good-tag sale-tag">SALE</p>
{{/ isSale}}
{{# isNewFestival}}
<p class="good-tag new-festival-tag">新品节</p>
{{/ isNewFestival}}
{{# isLimit}}
{{/ is_discount}}
{{# is_yohoood}}
<div class="good-tag yohood-tag"></div>
{{/ is_yohoood}}
{{# is_limited}}
<p class="good-tag limit-tag">限量商品</p>
{{/ isLimit}}
{{/ is_limited}}
{{/ tags}}
</div>
<div class="good-detail-img">
<a class="good-thumb" href="{{url}}">
<img class="lazy" data-original="{{thumb}}">
</a>
{{# isFew}}
{{# is_soon_sold_out}}
<p class="few-tag">即将售罄</p>
{{/ isFew}}
{{/ is_soon_sold_out}}
</div>
<div class="good-detail-text">
<div class="name">
... ...
{{# hotCategory}}
<div class="hot-category">
<div class="category-banner">
<img src="{{img}}" alt="">
</div>
<ul class="category-list clearfix">
{{# list}}
<li>
<a href="{{url}}">
<div class="img-box">
<img src="{{img}}" alt="">
</div>
<p class="category-title">{{textCn}}</p>
</a>
</li>
{{/ list}}
</ul>
</div>
{{/ hotCategory}}
\ No newline at end of file
<?php
use Action\AbstractAction;
use LibModels\Wap\Home\IndexData as Index;
use LibModels\Wap\Home\IndexData;
use Plugin\FloorProcess;
/**
* 男生首页
*/
class BoysController extends AbstractAction
{
public function indexAction()
{
// 频道数据
$channelData = Index::getUserChannelData(0, '1,3', '201504091403001');
echo '<pre>';
print_r($channelData);
$this->_view->assign('title', 'YOHO!有货');
$this->_view->display('index', compact('channelData'));
$data = array(
'headerDownload' => 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'
),
'homeHeader' => array(
'searchUrl' => ''
),
'sideNav' => array(
array(
'textCn' => '男生',
'textEn' => 'BOYS',
'styleClass' => 'boys',
'url' => ''
),
array(
'textCn' => '女生',
'textEn' => 'GIRLS',
'styleClass' => 'girls',
'url' => ''
),
array(
'textCn' => '潮童',
'textEn' => 'KIDS',
'styleClass' => 'kids',
'url' => ''
),
array(
'textCn' => '创意生活',
'textEn' => 'LIFE STYLE',
'styleClass' => 'life',
'url' => ''
),
array(
'textCn' => '逛',
'textEn' => 'TRENDFINDER',
'styleClass' => 'guang',
'subNav' => array(
'list' => array(
array(
'textCn' => '逛',
'textEn' => 'TrendFinder',
'back' => true
),
array(
'textCn' => '查看全部',
'url' => ''
),
array(
'textCn' => '只看男生',
'textEn' => 'Boys',
'url' => '',
'isSelect' => true
),
array(
'textCn' => '只看女生',
'textEn' => 'Girls',
'url' => ''
)
)
)
)
),
'content' => array(
'bannerTop' => array(
'list' => array(
array(
'url' => '',
'img' => 'http://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg'
),
array(
'url' => '',
'img' => 'http://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg'
),
array(
'url' => '',
'img' => 'http://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg'
)
)
),
'iconsEnter' => array(
'list' => array(
array(
'url' => '',
'img' => 'http://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg',
'text' => '新品到着'
),
array(
'url' => '',
'img' => 'http://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg',
'text' => '全球优选'
),
array(
'url' => '',
'img' => 'http://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg',
'text' => '明星潮牌'
),
array(
'url' => '',
'img' => 'http://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg',
'text' => '全部品类'
),
array(
'url' => '',
'img' => 'http://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg',
'text' => '逛'
),
array(
'url' => '',
'img' => 'http://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg',
'text' => '搭配指南'
),
array(
'url' => '',
'img' => 'http://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg',
'text' => '潮品推荐'
),
array(
'url' => '',
'img' => 'http://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg',
'text' => '折扣精选'
)
)
),
'hotCategory' => 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',
'list' => array(
array(
'textCn' => '打底衫',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'textCn' => '打底衫',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'textCn' => '打底衫',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'textCn' => '打底衫',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'textCn' => '打底衫',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'textCn' => '打底衫',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'textCn' => '打底衫',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'textCn' => '打底衫',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'textCn' => '打底衫',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
)
)
),
'hotBrandsScroll' => array(
'name' => '热门品牌',
'list' => array(
array(
'textCn' => 'Moussy',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'textCn' => 'Moussy',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'textCn' => 'Moussy',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'textCn' => 'Moussy',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'textCn' => 'Moussy',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'textCn' => 'Moussy',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'textCn' => 'Moussy',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'textCn' => 'Moussy',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'textCn' => 'Moussy',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
)
)
),
'hotBrands' => array(
'name' => '热门品牌',
'more' => 'www.baidu.com',
'brands' => array(
array(
'name' => 'Front Row Shop',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'name' => 'dress lab',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'name' => 'DEVIL NUT',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'name' => 'casselini',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'name' => 'haso',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'name' => 'EVISU',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
)
)
),
'trendColloaction' => array(
'name' => '潮人 ▪ 搭配',
'more' => '',
'leftspan' => array(
'url' => '',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg'
),
'rightspan' => array(
'url' => '',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg'
),
'recommendlist' => array(
array(
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
)
)
),
'trendTopics' => array(
'name' => '潮品 ▪ 话题',
'more' => '',
'list' => array(
array(
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => '',
'title' => '现代裁剪',
'time' => '2月13日 12:34'
),
array(
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => '',
'title' => '现代裁剪',
'time' => '2月13日 12:34'
),
array(
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => '',
'title' => '现代裁剪',
'time' => '2月13日 12:34'
)
)
),
'goodsCategory' => array(
'name' => '经典裤装',
'more' => '',
'banner' => array(
'list' => array(
array(
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
)
)
),
'list' => array(
array(
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => '',
'textCn' => '手表'
),
array(
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => '',
'textCn' => '烛台'
),
array(
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => '',
'textCn' => '围巾'
),
array(
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => '',
'textCn' => '盘子'
),
array(
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => '',
'textCn' => '耳机'
)
)
),
'goodsCategory' => array(
'name' => '时尚鞋履',
'more' => '',
'banner' => array(
'list' => array(
array(
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
)
)
),
'list' => array(
array(
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => '',
'textCn' => '手表'
),
array(
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => '',
'textCn' => '烛台'
),
array(
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => '',
'textCn' => '围巾'
),
array(
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => '',
'textCn' => '盘子'
),
array(
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => '',
'textCn' => '耳机'
)
)
),
'goodsCategory' => array(
'name' => '潮人配饰',
'more' => '',
'banner' => array(
'list' => array(
array(
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
)
)
),
'list' => array(
array(
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => '',
'textCn' => '手表'
),
array(
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => '',
'textCn' => '烛台'
),
array(
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => '',
'textCn' => '围巾'
),
array(
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => '',
'textCn' => '盘子'
),
array(
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => '',
'textCn' => '耳机'
)
)
),
'bannerCenter' => array(
'img' => 'http://img02.yohoboys.com/staticimg/2015/06/24/16/02ee02f1dd11c9103f7cf7995eafdaa605.jpg',
'url' => ''
),
'creativeLife' => array(
'name' => '创意生活',
'more' => '',
'url' => '',
'banner' => 'http://img10.static.yhbimg.com/yhb-img01/2015/07/09/18/0119ffceddb0819d36d74b408bd743b4a9.jpg?imageView/2/w/640/h/640',
'classify' => array(
array(
'url' => '',
'img' => 'http://img13.static.yhbimg.com/goodsimg/2015/04/10/05/029bef1041343ea2e31dc0423f2f176589.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'name' => '手表'
), array(
'url' => '',
'img' => 'http://img12.static.yhbimg.com/goodsimg/2015/07/07/09/02271a775d17649860abec4387b4559e26.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'name' => '烛台'
), array(
'url' => '',
'img' => 'http://img12.static.yhbimg.com/goodsimg/2015/05/19/07/02a269d20ed44803eee33e255fe88d7873.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'name' => '围巾'
), array(
'url' => '',
'img' => 'http://img13.static.yhbimg.com/goodsimg/2015/06/01/07/02fe94083352435ce53b5d90812cc5bdbd.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'name' => '盘子'
), array(
'url' => '',
'img' => 'http://img12.static.yhbimg.com/goodsimg/2015/07/08/07/028db8a2afbe4ecbf37bebc7e98e8e1e80.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'name' => '耳机'
), array(
'url' => '',
'img' => 'http://img13.static.yhbimg.com/goodsimg/2015/04/22/02/02a1b688b6dafd786f391e0624aea1e93b.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'name' => '生活'
)
)
),
'plusStar' => array(
'name' => 'PLUS 全球优选',
'url' => '',
'img' => 'http://img11.static.yhbimg.com/yhb-img01/2015/07/13/15/014f7ba48071160053ac3b8f045b9fc264.jpg?imageView/2/w/640/h/640'
),
'bannerCenter' => array(
'img' => 'http://img02.yohoboys.com/staticimg/2015/06/24/16/02ee02f1dd11c9103f7cf7995eafdaa605.jpg',
'url' => ''
),
'plusStar' => array(
'name' => 'STAR 明星潮牌',
'url' => '',
'img' => 'http://img11.static.yhbimg.com/yhb-img01/2015/07/13/15/014f7ba48071160053ac3b8f045b9fc264.jpg?imageView/2/w/640/h/640'
),
'bannerCenter' => array(
'img' => 'http://img02.yohoboys.com/staticimg/2015/06/24/16/02ee02f1dd11c9103f7cf7995eafdaa605.jpg',
'url' => ''
),
'maybeLike' => array(
'goods' => array(
array(
'id' => 1,
'thumb' => 'http://img11.static.yhbimg.com/goodsimg/2015/03/02/07/01ebfb219e22770ffb0c2c3a2cbb2b4bef.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'name' => 'GAWS DIGI 丛林数码印花拼接卫衣',
'isLike' => false,
'price' => 1268,
'salePrice' => 589,
'isSale' => true,
'isFew' => true,
'isNew' => false,
'url' => ''
), array(
'id' => 2,
'thumb' => 'http://img13.static.yhbimg.com/goodsimg/2015/03/03/08/023d70c59e81ccbfb39404487aaf642da2.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'name' => 'CLOTtee 撞色连帽外套',
'isLike' => false,
'price' => 488,
'salePrice' => 139,
'isSale' => true,
'isFew' => true,
'isNew' => false,
'url' => ''
), array(
'id' => 3,
'thumb' => 'http://img12.static.yhbimg.com/goodsimg/2015/03/02/08/02e2d44125e95495e3152aa459fa6b9b0c.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'name' => 'HALFGIRL 插肩棒球服短裙套装',
'isLike' => true,
'price' => 478,
'salePrice' => 208,
'isSale' => true,
'isFew' => true,
'isNew' => false,
'url' => ''
), array(
'id' => 4,
'thumb' => 'http://img12.static.yhbimg.com/goodsimg/2015/03/03/08/022f25fbe177ee12803c522f04fcce06d0.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'name' => '黄伟文Wyman X yohood联名商品YYYOHOOD连帽卫衣',
'isLike' => false,
'salePrice' => 148,
'isSale' => false,
'isFew' => false,
'isNew' => true,
'url' => ''
)
)
),
'bannerBottom' => array(
'img' => 'http://img02.yohoboys.com/staticimg/2015/06/24/16/02ee02f1dd11c9103f7cf7995eafdaa605.jpg',
'url' => ''
)
),
);
$this->_view->assign('title', '首页');
$this->_view->display('index', $data);
}
public function indexAction()
{
// 显示侧边栏
$this->setNavSide();
// 显示顶部下载
$this->setHeaderDownload();
// 设置顶部信息(搜索)
$this->setHomeChannelHeader();
$data = array(
'sideNav' => array(),
'content' => array()
);
$sideDatas = IndexData::getHomeChannels();
if($sideDatas['code'] == 200)
{
$data['sideNav'] = $sideDatas['data'];
}
// 频道数据
$channelData = IndexData::getUserChannelData(0, '1,3', '201504091403001');
$channels = array();
if($channelData['code'] == 200)
{
$data['content'] = FloorProcess::getContent($channelData['data']);
}
$this->_view->assign('title', '首页');
$this->_view->display('index', $data);
}
}
\ No newline at end of file
... ...
... ... @@ -22,8 +22,13 @@ class ErrorController extends AbstractAction
header('HTTP/1.1 404 Not Found');
header('Status: 404 Not Found');
// @todo debug
echo $exception->getMessage();
//$this->_view->render('error');
// // 生成HTML (error.html)
// $this->_view->html('error');
// // 渲染模板
// $this->_view->display('error');
}
}
... ...
... ... @@ -2,8 +2,6 @@
use Action\AbstractAction;
use LibModels\Wap\Home\IndexData;
use LibModels\Wap\Product\RecomData;
use Plugin\Helpers;
use Plugin\FloorProcess;
/**
* 女生首页
... ... @@ -16,13 +14,12 @@ class GirlsController extends AbstractAction
// 显示侧边栏
$this->setNavSide();
/*$data = array(
'headerDownload' => $this->getHeaderDownload(),
'homeHeader' => array(
'bgColor' => '#FF88AE',
'searchUrl' => ''
),
'searchUrl' => '',
// 显示顶部下载
$this->setHeaderDownload();
// 设置顶部信息(搜索)
$this->setHomeChannelHeader();
$data = array(
'sideNav' => array(),
'content' => array()
);
... ... @@ -38,89 +35,20 @@ class GirlsController extends AbstractAction
$channels = array();
if($channelData['code'] == 200)
{
$content = array();
$bannerTop = array();
$iconsEnter = array();
$singleImage = array();
$hotCategory = array();
$hotBrands = array();
$trendColloaction = array();
$trendTopics = array();
$goodsCategory = array();
$recommend_content_two = array();
$small_pic = array();
foreach ($channelData['data']['list'] as $val) {
$template = $val['template_name'];
$floorData = $val['data'];
switch ($template) {
case 'focus': // 焦点图
$oneFocus = FloorProcess::$template($floorData);
$bannerTop[] = $oneFocus;
break;
case 'app_icon_list': // 图标列表
$oneIcon = FloorProcess::$template($floorData);
$iconsEnter[] = $oneIcon;
break;
case 'single_image': // 单图片
$oneImage = FloorProcess::$template($floorData);
$singleImage[] = $oneImage;
break;
case 'recommend_content_five': // 带标题的12个小图推荐
$oneHot = FloorProcess::$template($floorData);
$hotCategory[] = $oneHot;
break;
case 'app_hot_brands': // 推荐品牌
$oneHotBrand = FloorProcess::$template($floorData);
$hotBrands[] = $oneHotBrand;
break;
case 'trendsetter_collocation': // 潮人·搭配
$oneTrendSetter = FloorProcess::$template($floorData);
$trendColloaction[] = $oneTrendSetter;
break;
case 'trendgoods_topic': // 潮品·话题
$oneTopic = FloorProcess::$template($floorData);
$trendTopics[] = $oneTopic;
break;
case 'recommend_content_one': // 一张大图一个大的推荐和4个小图推荐
$oneGoodCategory = FloorProcess::$template($floorData);
$goodsCategory[] = $oneGoodCategory;
break;
case 'recommend_content_two': // 一张大图和6个小图推荐
$oneRecoContTwo = FloorProcess::$template($floorData);
$recommend_content_two[] = $oneRecoContTwo;
break;
case 'small_pic': // 小图片
$oneSmallPic = FloorProcess::$template($floorData);
$small_pic[] = $oneSmallPic;
break;
default:
break;
}
}
$content = array(
'bannerTop' => $bannerTop,
'iconsEnter' => $iconsEnter,
'hotCategory' => $hotCategory,
'hotBrands' => $hotBrands,
'trendColloaction' => $trendColloaction,
'trendTopics' => $trendTopics,
'goodsCategory' => $goodsCategory
);
$data['content'] = $content;
$data['content'] = FloorProcess::getContent($channelData['data'], 2);
}
// 也许喜欢
$maybeLikeData = RecomData::mayLike('2,3', 2);
/*// 也许喜欢
$maybeLikeData = RecomData::mayLike('2,3', 2, false);
$maybeLike = array();
if($maybeLike['code'] == 200)
if($maybeLikeData['code'] == 200)
{
$maybeLike = $maybeLike['data']['product_list'];
$maybeLike = FloorProcess::maybeLike($maybeLikeData['data']['product_list']);
$num = count($data['content']);
$data['content'][] = array('maybeLike' =>$maybeLike);
}*/
$data = array(
'headerDownload' => array(
'img' => 'http://img11.static.yhbimg.com/adpic/2015/02/28/18/01d83bfad41c8fca8fd1ad334216d7d733.jpg?imageView/2/w/640/h/480',
... ... @@ -248,21 +176,17 @@ class GirlsController extends AbstractAction
)
),
'hotCategory' => 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',
'title' => array(
'name' => '热门品类'
),
'list' => array(
array(
'textCn' => '打底衫',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'textCn' => '打底衫',
'textCn' => '卫衣',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'textCn' => '打底衫',
'textCn' => 'T恤',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
... ... @@ -295,11 +219,13 @@ class GirlsController extends AbstractAction
'textCn' => '打底衫',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
)
)
)
),
'hotBrandsScroll' => array(
'name' => '热门品牌',
'hotBrands' => array(
'title' => array(
'name' => '热门品牌'
),
'list' => array(
array(
'textCn' => 'Moussy',
... ... @@ -330,72 +256,28 @@ class GirlsController extends AbstractAction
'textCn' => 'Moussy',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'textCn' => 'Moussy',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'textCn' => 'Moussy',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'textCn' => 'Moussy',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
)
)
),
'hotBrands' => array(
'name' => '热门品牌',
'more' => 'www.baidu.com',
'brands' => array(
array(
'name' => 'Front Row Shop',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'name' => 'dress lab',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'name' => 'DEVIL NUT',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'name' => 'casselini',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'name' => 'haso',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'name' => 'EVISU',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
)
)
),
'trendColloaction' => array(
'name' => '潮人 ▪ 搭配',
'more' => '',
'leftspan' => array(
'url' => '',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg'
'title' => array(
'title' => '潮人 ▪ 搭配',
'more_name' => '...',
'more_url' => 'http://www.yohobuy.com?openby:yohobuy={"action":"go.guangchannel","params":{"id":3,"name":"\u6f6e\u4eba"}}'
),
'article' => array(
array(
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
),
array(
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
)
),
'rightspan' => array(
'url' => '',
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg'
),
'recommendlist' => array(
'recommend_collocation' => array(
array(
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
'url' => ''
... ... @@ -418,9 +300,12 @@ class GirlsController extends AbstractAction
)
)
),
'trendTopics' => array(
'name' => '潮品 ▪ 话题',
'more' => '',
'trendTopics' => array(
'title' => array(
'title' => '潮品 ▪ 话题',
'more_name' => '...',
'more_url' => 'http://www.yohobuy.com?openby:yohobuy={"action":"go.guangchannel","params":{"id":3,"name":"\u6f6e\u4eba"}}'
),
'list' => array(
array(
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
... ... @@ -443,9 +328,12 @@ class GirlsController extends AbstractAction
)
),
'goodsCategory' => array(
'name' => '经典裤装',
'more' => '',
'banner' => array(
'title' => array(
'title' => '潮流时装',
'more_name' => '...',
'more_url' => 'http://www.yohobuy.com?openby:yohobuy={"action":"go.guangchannel","params":{"id":3,"name":"\u6f6e\u4eba"}}'
),
'big_image' => array(
'list' => array(
array(
'img' => 'http://img.alicdn.com/imgextra/i1/2086467111/TB2CsqHdXXXXXaDXpXXXXXXXXXX_!!2086467111.jpg',
... ... @@ -481,6 +369,7 @@ class GirlsController extends AbstractAction
)
)
),
'bannerCenter' => array(
... ... @@ -601,6 +490,7 @@ class GirlsController extends AbstractAction
));
$this->_view->assign('title', 'YOHO!有货');
$this->_view->display('index', $data);
}
... ...
<?php
use Action\AbstractAction;
use LibModels\Wap\Home\IndexData as Index;
use LibModels\Wap\Home\IndexData;
use Plugin\FloorProcess;
/**
* 童首页
* 童首页
*/
class KidsController extends AbstractAction
class kidsController extends AbstractAction
{
public function indexAction()
{
// 频道数据
$channelData = Index::getUserChannelData(0, '', 'e9875682c1599a886bfbdb965b740022');
echo '<pre>';
print_r($channelData);
$this->_view->assign('title', 'YOHO!有货');
$this->_view->display('kids', compact('channelData'));
// 显示侧边栏
$this->setNavSide();
// 显示顶部下载
$this->setHeaderDownload();
// 设置顶部信息(搜索)
$this->setHomeChannelHeader();
$data = array(
'sideNav' => array(),
'content' => array()
);
$sideDatas = IndexData::getHomeChannels();
if($sideDatas['code'] == 200)
{
$data['sideNav'] = $sideDatas['data'];
}
// 频道数据
$channelData = IndexData::getUserChannelData(0, '', 'e9875682c1599a886bfbdb965b740022');
$channels = array();
if($channelData['code'] == 200)
{
$data['content'] = FloorProcess::getContent($channelData['data'], 3);
}
$this->_view->assign('title', 'YOHO!有货');
$this->_view->display('index', $data);
}
}
\ No newline at end of file
... ...
<?php
use Action\AbstractAction;
<<<<<<< HEAD
use LibModels\Wap\Home\IndexData as Index;
=======
use LibModels\Wap\Home\IndexData;
use Plugin\FloorProcess;
>>>>>>> 3ceb824c00a2188f954835e78b5e4222bf3c78f8
/**
* 创意生活首页
*/
class LifestyleController extends AbstractAction
class kidsController extends AbstractAction
{
public function indexAction()
{
// 频道数据
$channelData = Index::getUserChannelData(0, '1,3', '9aa25f5133f011ec96c2045eb15ae425');
// 显示侧边栏
$this->setNavSide();
echo '<pre>';
print_r($channelData);
// 显示顶部下载
$this->setHeaderDownload();
// 设置顶部信息(搜索)
$this->setHomeChannelHeader();
$this->_view->assign('title', 'YOHO!有货');
$this->_view->display('lifestyle', compact('channelData'));
$data = array(
'sideNav' => array(),
'content' => array()
);
// 显示侧边栏
$this->setNavSide();
}
$sideDatas = IndexData::getHomeChannels();
if($sideDatas['code'] == 200)
{
$data['sideNav'] = $sideDatas['data'];
}
// 频道数据
$channelData = IndexData::getUserChannelData(0, '1,3', '9aa25f5133f011ec96c2045eb15ae425');
$channels = array();
if($channelData['code'] == 200)
{
$data['content'] = FloorProcess::getContent($channelData['data'], 4);
}
$this->_view->assign('title', 'YOHO!有货');
$this->_view->display('index', $data);
}
}
... ...
... ... @@ -11,24 +11,28 @@ use Plugin\Partner\Factory;
*/
class LoginController extends AbstractAction
{
/**
* 登录页
*/
public function indexAction()
{
$this->setTitle('登录');
$data = array(
'loginIndex' => true,
'backUrl' => '/',
'showHeaderImg' => true,
'isPassportPage' => true,
'registerUrl' => '/reg.html',
'interationalUrl' => '/login.html',
'phoneRetriveUrl' => '',
'emailRetriveUrl' => '',
'loginIndex' => true, // 模板中使用JS的标识
'backUrl' => '/', // 返回的URL链接
'showHeaderImg' => true, // 控制显示头部图片
'isPassportPage' => true, // 模板中模块标识
'registerUrl' => '/reg.html', // 注册的URL链接
'interationalUrl' => '/login.html', // 国际号登录的URL链接
'phoneRetriveUrl' => '/phoneback.html', // 通过手机号找回密码的URL链接
'emailRetriveUrl' => '/emailback.html', // 通过邮箱找回密码的URL链接
);
// 生成HTML(signin.html)
$this->_view->html('signin');
// 渲染模板
$this->_view->display('index', $data);
}
... ... @@ -38,41 +42,21 @@ class LoginController extends AbstractAction
public function interationalAction()
{
$this->setTitle('国际账号登录');
$data = array();
$data['loginInterational'] = true;
$data['backUrl'] = '/';
$data['headerText'] = '登录';
$data['isPassportPage'] = true;
$data['areaCode'] = '+86';
// 获取地区数据列表
$area = RegData::getAreasData();
// 有数据
if (!empty($area['data'])) {
$build = array();
foreach ($area['data'] as $value) {
$build = array();
$build['areaCode'] = '+' . $value['area'];
$build['selected'] = $value['area'] === '86';
$build['name'] = $value['name'];
$data['countrys'][] = $build;
}
}
// 没数据
else {
$data['countrys'][0] = array();
$data['countrys'][0]['areaCode'] = '+86';
$data['countrys'][0]['selected'] = true;
$data['countrys'][0]['name'] = '中国';
}
$this->_view->display('interational', $data);
$data = array();
$area = array();
$data['loginInterational'] = true; // 模板中使用JS的标识
$data['backUrl'] = '/'; // 返回的URL链接
$data['headerText'] = '登录'; // 头部信息
$data['isPassportPage'] = true; // 模板中模块标识
$data['areaCode'] = '+86'; // 默认区号
$data['countrys'] = RegData::getAreasData(); // 地区信息列表
//
// 生成HTML(login.html)
$this->_view->html('login');
// 渲染模板
$this->_view->display('interational', $data);
}
/**
* 登录操作
*
... ... @@ -84,13 +68,13 @@ class LoginController extends AbstractAction
public function authAction()
{
$data = array('code' => 400, 'message' => '账号或密码不正确', 'data' => '');
do {
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
break;
}
/* 判断参数是否传递 */
$area = $this->post('areaCode', '86');
$profile = $this->post('account');
... ... @@ -98,23 +82,22 @@ class LoginController extends AbstractAction
if (!is_numeric($area) || empty($profile) || empty($password)) {
break;
}
/* 判断参数是否有效 */
$verifyEmail = Helpers::verifyEmail($profile);
$verifyMobile = ($area === '86') ? Helpers::verifyMobile($profile)
: Helpers::verifyAreaMobile($profile);
$verifyMobile = ($area === '86') ? Helpers::verifyMobile($profile) : Helpers::verifyAreaMobile($profile);
if (!$verifyEmail && !$verifyMobile) {
break;
}
/* 调用登录接口进行登录 */
$data = LoginData::signin($area, $profile, $password);
if ($data['code'] == 200) {
$data['data'] = '/'; // @todo
}
} while (false);
}
while (false);
$this->echoJson($data);
}
... ... @@ -124,8 +107,7 @@ class LoginController extends AbstractAction
public function alipayAction()
{
$redirect = $this->_request->getServer('HTTP_REFERER', '');
if($redirect != '')
{
if ($redirect != '') {
$this->setCookie('alipay_redirect', $redirect);
}
Factory::create('alipay')->getAuthorizeUrl();
... ... @@ -133,15 +115,13 @@ class LoginController extends AbstractAction
exit();
}
/**
* QQ账号登录:授权页面
*/
public function qqAction()
{
$redirect = $this->_request->getServer('HTTP_REFERER', '');
if($redirect != '')
{
if ($redirect != '') {
$this->setCookie('qq_redirect', $redirect);
}
Factory::create('qqconnect')->getAuthorizeUrl();
... ... @@ -149,15 +129,13 @@ class LoginController extends AbstractAction
exit();
}
/**
* 新浪微博账号登录:授权页面
*/
public function sinaAction()
{
$redirect = $this->_request->getServer('HTTP_REFERER', '');
if($redirect != '')
{
if ($redirect != '') {
$this->setCookie('sina_redirect', $redirect);
}
header('Location:' . Factory::create('sinaweibo')->getAuthorizeUrl());
... ... @@ -174,19 +152,16 @@ class LoginController extends AbstractAction
$alipay = Factory::create('alipay');
$access = $alipay->getAccessToken();
if (!isset($_GET['real_name']))
{
if (!isset($_GET['real_name'])) {
/* 获取支付宝用户的详细信息 */
$userInfo = $alipay->getUserInfo($access);
if ($userInfo && $userInfo['is_success'] === 'T' && isset($userInfo['response']['user_info']['user_name']))
{
if ($userInfo && $userInfo['is_success'] === 'T' && isset($userInfo['response']['user_info']['user_name'])) {
$nickname = $userInfo['response']['user_info']['user_name'];
$alipayEmail = $userInfo['response']['user_info']['email'];
}
var_dump($userInfo);
}
else
{
else {
$nickname = $_GET['real_name'];
$alipayEmail = isset($_GET['email']) ? $_GET['email'] : '';
}
... ... @@ -194,8 +169,7 @@ class LoginController extends AbstractAction
$result = LoginData::signinByOpenID($nickname, $access['user_id'], 'qq');
if($result['code'] == 200)
{
if ($result['code'] == 200) {
$redirect = $this->_request->getCookie('alipay_redirect');
$redirect && $this->redirect($redirect);
}
... ... @@ -213,12 +187,10 @@ class LoginController extends AbstractAction
/* 获取QQ腾讯用户的详细信息 */
$partnerInfo = $qqconnect->getUserInfo($access);
if ($partnerInfo && is_array($partnerInfo))
{
if ($partnerInfo && is_array($partnerInfo)) {
$result = LoginData::signinByOpenID($partnerInfo['nickname'], $access['openid'], 'qq');
if($result['code'] == 200)
{
if ($result['code'] == 200) {
$redirect = $this->_request->getCookie('qq_redirect');
$redirect && $this->redirect($redirect);
}
... ... @@ -237,17 +209,16 @@ class LoginController extends AbstractAction
/* 获取QQ腾讯用户的详细信息 */
$partnerInfo = $sina->getUserInfo($access);
if ($partnerInfo && is_array($partnerInfo))
{
if ($partnerInfo && is_array($partnerInfo)) {
$result = LoginData::signinByOpenID($partnerInfo['screen_name'], $access['uid'], 'sina');
if($result['code'] == 200)
{
if ($result['code'] == 200) {
$redirect = $this->_request->getCookie('sina_redirect');
$redirect && $this->redirect($redirect);
}
}
}
$this->redirect('/');
$this->redirect('/');
}
}
\ No newline at end of file
}
... ...
... ... @@ -16,38 +16,18 @@ class RegController extends AbstractAction
{
$this->setTitle('注册');
$data = array();
$data['regIndex'] = true;
$data['backUrl'] = '/';
$data['headerText'] = '注册';
$data['isPassportPage'] = true;
$data['countrys'] = array();
$data['areaCode'] = '+86';
// 获取地区数据列表
$area = RegData::getAreasData();
// 有数据
if (!empty($area['data'])) {
$build = array();
foreach ($area['data'] as $value) {
$build = array();
$build['areaCode'] = '+' . $value['area'];
$build['selected'] = $value['area'] === '86';
$build['name'] = $value['name'];
$data['countrys'][] = $build;
}
}
// 没数据
else {
$data['countrys'][0] = array();
$data['countrys'][0]['areaCode'] = '+86';
$data['countrys'][0]['selected'] = true;
$data['countrys'][0]['name'] = '中国';
}
$data = array();
$data['regIndex'] = true; // 模板中使用JS的标识
$data['backUrl'] = '/'; // 返回的URL链接
$data['headerText'] = '注册'; // 头部信息
$data['isPassportPage'] = true; // 模板中模块标识
$data['areaCode'] = '+86'; // 默认的区号
$data['countrys'] = RegData::getAreasData(); // 地区信息列表
// 生成HTML(reg.html)
$this->_view->html('reg');
// 渲染模板
$this->_view->display('index', $data);
$data = array();
$area = array();
}
/**
... ... @@ -70,15 +50,16 @@ class RegController extends AbstractAction
$this->setTitle('注册-验证码');
$data = array();
$data['regCode'] = true;
$data['backUrl'] = '/';
$data['headerText'] = '注册';
$data['isPassportPage'] = true;
$data['areaCode'] = '+' . $area;
$data['phoneNum'] = $mobile;
$data['token'] = $token;
$data = array(
'regCode' => true, // 模板中使用JS的标识
'backUrl' => '/', // 返回的URL链接
'headerText' => '注册', // 头部信息
'isPassportPage' => true, // 模板中模块标识
'areaCode' => '+' . $area, // 地区编号
'phoneNum' => $mobile, // 手机号
'token' => $token, // 访问令牌
);
$this->_view->display('code', $data);
}
... ... @@ -103,14 +84,15 @@ class RegController extends AbstractAction
$this->setTitle('注册-设置密码');
$data = array();
$data['regPwd'] = true;
$data['backUrl'] = '/';
$data['headerText'] = '注册';
$data['isPassportPage'] = true;
$data['areaCode'] = $area;
$data['phoneNum'] = $mobile;
$data['token'] = $token;
$data = array(
'regPwd' => true, // 模板中使用JS的标识
'backUrl' => '/', // 返回的URL链接
'headerText' => '注册', // 头部信息
'isPassportPage' => true, // 模板中模块标识
'areaCode' => $area, // 地区编号
'phoneNum' => $mobile, // 手机号
'token' => $token, // 访问令牌
);
$this->_view->display('password', $data);
}
... ... @@ -209,7 +191,7 @@ class RegController extends AbstractAction
*/
public function sendcodeAction()
{
$data = array('code' => 400, 'message' => '参数不正确!', 'data' => '');
$data = array('code' => 400, 'message' => '发送验证码失败', 'data' => '');
do {
/* 判断是不是AJAX请求 */
... ...
... ... @@ -44,4 +44,7 @@ application.dispatcher.catchException = True
application.template.compile = ROOT_PATH "/compile/m.yohobuy.com"
application.template.path = ROOT_PATH "/template/m.yohobuy.com/actions"
application.template.partials = ROOT_PATH "/template/m.yohobuy.com/partials"
application.template.ext = ".phtml"
\ No newline at end of file
application.template.ext = ".phtml"
;静态HTML页面的存放目录, 该目录需要有读写权限
application.assets.path = ROOT_PATH "/assets"
\ No newline at end of file
... ...
... ... @@ -44,4 +44,7 @@ application.dispatcher.catchException = False
application.template.compile = ROOT_PATH "/compile/m.yohobuy.com"
application.template.path = ROOT_PATH "/template/m.yohobuy.com/actions"
application.template.partials = ROOT_PATH "/template/m.yohobuy.com/partials"
application.template.ext = ".phtml"
\ No newline at end of file
application.template.ext = ".phtml"
;静态HTML页面的存放目录, 该目录需要有读写权限
application.assets.path = ROOT_PATH "/assets"
\ No newline at end of file
... ...
... ... @@ -44,4 +44,7 @@ application.dispatcher.catchException = True
application.template.compile = ROOT_PATH "/compile/m.yohobuy.com"
application.template.path = ROOT_PATH "/template/m.yohobuy.com/actions"
application.template.partials = ROOT_PATH "/template/m.yohobuy.com/partials"
application.template.ext = ".phtml"
\ No newline at end of file
application.template.ext = ".phtml"
;静态HTML页面的存放目录, 该目录需要有读写权限
application.assets.path = ROOT_PATH "/assets"
\ No newline at end of file
... ...
[common]
servers.host = 127.0.0.1:11211:90
[memcached:common]
servers.hosts = 127.0.0.1:11212:90,127.0.0.1:11213:10
[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 = 192.168.1.168:6379
\ No newline at end of file
... ...
... ... @@ -33,4 +33,19 @@ routes.interational.route.module = Passport
routes.interational.route.controller = Login
routes.interational.route.action = Interational
; 找回密码(手机号)
routes.phoneback.type = "rewrite"
routes.phoneback.match = "/phoneback.html$"
routes.phoneback.route.module = Passport
routes.phoneback.route.controller = Back
routes.phoneback.route.action = Mobile
; 找回密码(邮箱)
routes.emailback.type = "rewrite"
routes.emailback.match = "/emailback.html$"
routes.emailback.route.module = Passport
routes.emailback.route.controller = Back
routes.emailback.route.action = Email
... ...