Authored by Rock Zhang

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

Showing 37 changed files with 836 additions and 207 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 //即将售罄
}
### 侧栏导航
... ... @@ -702,4 +702,39 @@
url: ''
}
]
}
## 品牌
{
bannerTop: {
list: [
{
url: '',
img: ''
},
...
]
},
hotBrand: {
list: [
{
url: '',
img: '',
name: ''
},
...
]
},
brandList: [
title: '',
list: {
name: '',
url: '',
isHot: true/false,
isNew: true/false
},
...
]
}
\ No newline at end of file
... ...
... ... @@ -25,12 +25,19 @@ class AbstractAction extends Controller_Abstract
* @var object
*/
protected $_request;
/**
* 用户相关信息
*/
protected $_uid;
protected $_uname;
protected $_uid = 0;
protected $_uname = '';
/**
* 存放模板数据
*
* @var array
*/
protected $_data;
/**
* 初始化
... ... @@ -38,7 +45,7 @@ class AbstractAction extends Controller_Abstract
public function init()
{
$this->_request = $this->getRequest();
// 设置环境变量
switch (APPLICATION_ENV) {
case 'production': // 生产
... ... @@ -166,7 +173,7 @@ class AbstractAction extends Controller_Abstract
{
return $this->_request->getCookie($name, $default);
}
/**
* 设置缓存
*
... ... @@ -179,7 +186,7 @@ class AbstractAction extends Controller_Abstract
{
Cache::set($key, $value, $expire);
}
/**
* 获取缓存
*
... ... @@ -195,7 +202,7 @@ class AbstractAction extends Controller_Abstract
return Cache::get($key, 'slave');
}
}
/**
* 获取当前登录的用户ID
*
... ... @@ -216,7 +223,7 @@ class AbstractAction extends Controller_Abstract
}
return $this->_uid;
}
/**
* 获取客户端唯一标识
*
... ... @@ -231,7 +238,7 @@ class AbstractAction extends Controller_Abstract
}
return $udid;
}
/**
* 获取当前登录的用户名字
*
... ... @@ -258,6 +265,7 @@ class AbstractAction extends Controller_Abstract
* @param string $title 标题
* @return void
*/
protected function setTitle($title)
{
$this->_view->assign('title', $title . ' | ');
... ... @@ -336,7 +344,7 @@ class AbstractAction extends Controller_Abstract
$this->_view->assign('pageFooter', $footer);
}
/**
* 设置侧边栏信息
*
... ... @@ -368,7 +376,7 @@ class AbstractAction extends Controller_Abstract
'textCn' => '创意生活',
'textEn' => 'LIFE STYLE',
'styleClass' => 'life',
'url' => '/life',
'url' => '/lifestyle',
),
4 => array(
'textCn' => '逛',
... ... @@ -407,9 +415,8 @@ class AbstractAction extends Controller_Abstract
)
),
));
}
/**
* 返回顶部软件下载有关数据
* @return array 下载有关数据
... ... @@ -418,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'
);
}
... ... @@ -442,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);
... ...
... ... @@ -12,6 +12,8 @@
namespace Api;
use Plugin\Cache;
class Yohobuy
{
... ... @@ -100,11 +102,12 @@ 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)
{
// 销毁私钥参数
if (isset($data['private_key'])) {
... ... @@ -114,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);
... ... @@ -125,6 +137,18 @@ class Yohobuy
curl_close($ch);
$data = array();
/* 开启缓存的情况 */
if ($cache) {
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if (empty($result)) {
$result = Cache::get($url, 'slave');
}
// 接口调用成功时,这里会设置一级(master)和二级(slave)的缓存数据.
else {
Cache::set($url, $result, $cache);
}
}
return $result;
}
... ... @@ -182,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;
... ... @@ -256,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;
}
... ... @@ -263,10 +309,25 @@ 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);
... ... @@ -278,6 +339,18 @@ class Yohobuy
$result = array();
}
/* 开启缓存的情况 */
if ($cache) {
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if (empty($result)) {
$result = Cache::get($key, 'slave');
}
// 接口调用成功时,这里会设置一级(master)和二级(slave)的缓存数据.
else {
Cache::set($key, $result, $cache);
}
}
return $result;
}
... ...
... ... @@ -7,7 +7,12 @@ namespace Configs;
*/
class CacheConfig
{
const KEY_ACTION_INDEX_INDEX = 'key_action_index_index';
/* 控制器方法中的数据缓存 */
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'; // 创意生活首页
}
... ...
... ... @@ -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)
... ...
... ... @@ -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'));
}
... ...
... ... @@ -19,16 +19,17 @@ class FloorProcess
{
$result = array();
if (!empty($data['list'])) {
$build = array();
foreach ($data['list'] as $v) {
$fun = $v['template_name'];
if (!is_callable("self::$fun")) {
continue;
}
$data = self::$fun($v['data'], $type);
if (empty($data)) {
$build = self::$fun($v['data'], $type);
if (empty($build)) {
continue;
}
$result[] = $data;
$result[] = $build;
}
}
return $result;
... ... @@ -83,6 +84,7 @@ class FloorProcess
if (empty($data)) {
return array();
}
foreach ($data as &$one) {
$one['img'] = Helpers::getImageUrl($one['src'], 750, 364, 1);
unset($one['src']);
... ... @@ -257,7 +259,6 @@ class FloorProcess
*/
private static function single_name_image($data, $type)
{
if (empty($data)) {
return array();
}
... ...
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
... ... @@ -2,4 +2,4 @@
* 频道选择
* @author: liangzhifeng<zhifeng.liang@yoho.cn>
* @date: 2015/10/12
*/
\ No newline at end of file
*/
... ...
... ... @@ -4,4 +4,5 @@
* @date: 2015/10/19
*/
require('./search');
\ No newline at end of file
require('./search');
require('./channel');
\ No newline at end of file
... ...
... ... @@ -16,6 +16,7 @@ var winH = $(window).height(),
index = 0,
num;
var swiper;
swiper = new Swiper('.swiper-container', {
... ...
.brand-page {
.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%;
}
}
}
}
.brand-list {
width: 100%;
.title-bar {
width: 100%;
background: #eeeeee;
color: #999999;
font-weight: bold;
position: relative;
h2 {
width: 100%;
height: 25px;
line-height: 25px;
font-size: 17px;
border-top: 1px solid #e6e6e6;
background-color: #f4f4f4;
}
}
p {
cursor: pointer;
height: 25px;
padding-right: 10px;
a {
display: block;
font-size: 17px;
border-bottom: 1px solid #f3f3f3;
border-top: 1px solid #f9f9f9;
i {
position: relative;
top: 1px;
color: #ff0000;
padding-left: 16px;
}
}
}
}
.right-bar {
width: 30px;
top: 120px !important;
overflow: hidden;
position: fixed;
right: 1px;
border-radius: 6px;
background: rgba(0,0,0,.8);
b {
height: 16px;
line-height: 14px;
text-align: center;
display: block;
color: #999999;
font-weight: bold;
}
}
.con {
padding-top: 5px;
}
}
\ 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,4 @@ a {
@include border-radius(10px);
}
@import "layout/header", "layout/footer", "good", "filter", "passport/index", "guang/index", "home/index", "category/index", "product/index", "index/index";
\ No newline at end of file
@import "layout/header", "layout/footer", "good", "filter", "passport/index", "guang/index", "home/index", "category/index","category/brand", "product/index", "index/index";
\ No newline at end of file
... ...
... ... @@ -5,8 +5,8 @@
{{/ bannerTop}}
{{# hotBrand}}
<div class="hot-category">
<ul class="category-list clearfix">
<div class="hot-brand">
<ul class="hot-brand-list clearfix">
{{# list}}
<li>
<a href="{{url}}">
... ... @@ -42,6 +42,37 @@
</div>
{{/ brandList}}
<div id="right-bar" class="right-bar">
<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>
</div>
</div>
</div>
{{> layout/footer}}
\ No newline at end of file
... ...
... ... @@ -123,6 +123,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,6 +8,9 @@ use Plugin\DataProcess\FloorProcess;
class BoysController extends AbstractAction
{
/**
* 男生首页
*/
public function indexAction()
{
// 设置网站标题
... ... @@ -19,18 +20,13 @@ class BoysController extends AbstractAction
// 设置顶部信息(搜索)
$this->setHomeChannelHeader();
$data = array('boysHomePage' => true);
$uid = $this->getUid();
// 频道数据
$channelData = IndexData::getUserChannelData($uid, '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,6 +8,9 @@ use Plugin\DataProcess\FloorProcess;
class GirlsController extends AbstractAction
{
/**
* 女生首页
*/
public function indexAction()
{
// 设置网站标题
... ... @@ -19,16 +20,13 @@ class GirlsController extends AbstractAction
// 设置顶部信息(搜索)
$this->setHomeChannelHeader();
$data = array('grilsHomePage' => true);
$uid = $this->getUid();
// 频道数据
$channelData = IndexData::getUserChannelData($uid, '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,24 +9,13 @@ class IndexController extends AbstractAction
{
/**
* 启动首页频道选择
* 频道选择页
*/
public function indexAction()
{
// 背景图获取
$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,6 +8,9 @@ use Plugin\DataProcess\FloorProcess;
class KidsController extends AbstractAction
{
/**
* 潮童首页
*/
public function indexAction()
{
// 设置网站标题
... ... @@ -19,18 +20,13 @@ class KidsController extends AbstractAction
// 设置顶部信息(搜索)
$this->setHomeChannelHeader();
$data = array('kidsHomePage' => true);
$uid = $this->getUid();
// 频道数据
$channelData = IndexData::getUserChannelData($uid, '', '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,6 +8,9 @@ use Plugin\DataProcess\FloorProcess;
class LifestyleController extends AbstractAction
{
/**
* 创意生活首页
*/
public function indexAction()
{
// 设置网站标题
... ... @@ -19,18 +20,13 @@ class LifestyleController extends AbstractAction
// 设置顶部信息(搜索)
$this->setHomeChannelHeader();
$data = array('lifestyleHomePage' => true);
$uid = $this->getUid();
// 频道数据
$channelData = IndexData::getUserChannelData($uid, '', '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;
}
}
... ...
... ... @@ -28,19 +28,20 @@ class BrandController extends AbstractAction
var_dump($brandTop, $brands);exit;*/
$data = array (
'brandPage' => true,
'bannerTop' => array (
'list' => array (
array (
'url' => '',
'img' => 'http://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg'
'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://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg'
'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://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg'
'img' => 'http://img13.static.yhbimg.com/adpic/2015/10/15/10/022e2ac6daa33fc3cb8a0f04025a35994f.jpg?imageMogr2/thumbnail/640x300/extent/640x300/background/d2hpdGU=/position/center/quality/90'
)
)
),
... ... @@ -48,43 +49,35 @@ class BrandController extends AbstractAction
'list' => array (
array (
'url' => '',
'img' => 'http://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg',
'name' => '手表'
'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://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg',
'name' => '烛台'
'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://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg',
'name' => '烛台'
'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://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg',
'name' => '烛台'
'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://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg',
'name' => '烛台'
'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://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg',
'name' => '烛台'
'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://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg',
'name' => '烛台'
'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://img02.yohoboys.com/staticimg/2015/06/30/21/02912cd7f0b2c67939404c71ef00e3f513.jpg',
'name' => '烛台'
'img' => 'http://img13.static.yhbimg.com/brandLogo/2014/01/27/11/02bca7ac6414c7475b4a337e28a0365590.jpg?imageMogr2/thumbnail/144x144/extent/144x144/background/d2hpdGU=/position/center/quality/90'
)
)
),
... ... @@ -134,6 +127,104 @@ class BrandController extends AbstractAction
'name' => 'Bcrwewwe'
)
)
),
array (
'title' => 'B',
'list' => array(
array (
'name' => 'Bape'
),
array (
'name' => 'Bdfdfd'
),
array (
'name' => 'Bcrwewwe'
)
)
),
array (
'title' => 'B',
'list' => array(
array (
'name' => 'Bape'
),
array (
'name' => 'Bdfdfd'
),
array (
'name' => 'Bcrwewwe'
)
)
),
array (
'title' => 'B',
'list' => array(
array (
'name' => 'Bape'
),
array (
'name' => 'Bdfdfd'
),
array (
'name' => 'Bcrwewwe'
)
)
),
array (
'title' => 'B',
'list' => array(
array (
'name' => 'Bape'
),
array (
'name' => 'Bdfdfd'
),
array (
'name' => 'Bcrwewwe'
)
)
),
array (
'title' => 'B',
'list' => array(
array (
'name' => 'Bape'
),
array (
'name' => 'Bdfdfd'
),
array (
'name' => 'Bcrwewwe'
)
)
),
array (
'title' => 'B',
'list' => array(
array (
'name' => 'Bape'
),
array (
'name' => 'Bdfdfd'
),
array (
'name' => 'Bcrwewwe'
)
)
),
array (
'title' => 'B',
'list' => array(
array (
'name' => 'Bape'
),
array (
'name' => 'Bdfdfd'
),
array (
'name' => 'Bcrwewwe'
)
)
)
)
... ...
[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');
... ...