Authored by unknown

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

... ... @@ -32,17 +32,16 @@ class HelperSearch
{
$options = self::$options;
$channel = HomeModel::getSwitchChannel();
$uri = '/'.$channel;
$channelName = '/'.$channel;
if (isset($options['brandName']) && !empty($options['brandName'])) {
$brandNav = $options['brandNameEn'] . $options['brandNameCn'];
$brandNav = $options['brandNameEn'] . ' ' . $options['brandNameCn'];
self::$listNav = array(
array(
'href' => Helpers::url($uri),
'name' => strtoupper($channel).'首页'
'href' => Helpers::url($channelName),
'name' => strtoupper($channel) . '首页'
),
array(
'href' => '',
'href' => Helpers::url('/brands/brands'),
'name' => '品牌一览'
),
array(
... ... @@ -52,13 +51,16 @@ class HelperSearch
);
}else{
self::$listNav[0] = array(
'href' => Helpers::url($uri),
'href' => Helpers::url($channelName),
'name' => strtoupper($channel).'首页'
);
self::$listNav[1] = array(
if ($options['action'] == 'new') {
self::$listNav[1] = array(
'href' => '',
'name' => $options['action'] == 'new' ? '新品到着' : '列表'
);
'name' => '新品到着'
);
}
}
}
/**
... ... @@ -75,17 +77,21 @@ class HelperSearch
unset(self::$params['page']);
self::$filter = isset($data['product']['filter']) ? $data['product']['filter'] : array();
//产品列表
$result['goods'] = isset($data['product']['product_list']) ? self::getProductList($data['product']['product_list'], $options['imgSize']) : array();
$result['goods'] = isset($data['product']['product_list']) ? self::getProductList($data['product']['product_list'], $options) : array();
//总页数
$result['page_total'] = isset($data['product']['page_total']) ? $data['product']['page_total'] : '';
self::$pageTotal = $result['page_total'];
self::$total = isset($data['product']['total']) ? $data['product']['total'] : 0;
if (isset($data['product']['page_total'])) {
$result['page_total'] = $data['product']['page_total'];
self::$pageTotal = $result['page_total'];
}
if (isset($data['product']['total'])) {
self::$total = $data['product']['total'];
}
//当前页
self::$page = $result['page'] = isset($data['product']['page']) ? $data['product']['page'] : '';
//筛选条件
$result['filters'] = isset($data['product']['filter']) ? self::filter() : array();
//排序方式、显示数量等其他选项
$result['opts'] = isset($data['product']['filter']) ? self::getOpts() : array();
$result['opts'] = self::getOpts();
//下一页
if (isset($data['product']['page_total'])) {
$result['hasNextPage'] = self::next($data['product']['page_total']);
... ... @@ -146,7 +152,7 @@ class HelperSearch
* @author sefon 2015-12-21 17:24:04
* @return array
*/
public static function getProductList($product, $imgSize)
public static function getProductList($product, $options)
{
$params = self::$params;
$goods = array();
... ... @@ -166,6 +172,15 @@ class HelperSearch
//再到着
//年终大促
// 年中大促
if ($options['controller'] == 'List' && $options['action'] == 'new') {
$isNew = false;
$isSale = false;
//TODO再到着不显示
}
if ($options['controller'] == 'List' && $options['action'] == 'sale') {
$isNew = false;
$isSale = false;
}
$gender = 0;
if (isset(self::$options['gender'])) {
$genderArr = explode(',', self::$options['gender']);
... ... @@ -188,7 +203,7 @@ class HelperSearch
}
}
if (!empty($val['default_images'])) {
$val['default_images'] = Images::getImageUrl($val['default_images'],$imgSize[0],$imgSize[1]);
$val['default_images'] = Images::getImageUrl($val['default_images'],$options['imgSize'][0],$options['imgSize'][1]);
}
//搜索关键字高亮
if (isset(self::$params['query']) && !empty(self::$params['query']) && preg_match("/".self::$params['query']."/i", $val['product_name'], $match)) {
... ... @@ -621,7 +636,15 @@ class HelperSearch
//设置已选中价格
if (!empty($priceId)) {
$price = explode(',' ,$priceId);
$customName = self::$params['price'] == '2000,99999' ? '¥2000以上' : '¥' . (int)$price[0] . '-' . (int)$price[1];
if (isset($price[1]) && empty($price[1])) {
$customName = '¥' . intval($price[0]) . '-99999';
}
elseif (isset($price[1]) && $price[1] == 99999) {
$customName = '¥'.intval($price[0]-1).'以上';
}
else {
$customName = '¥' . intval($price[0]) . '-' . intval($price[1]);
}
$name = isset($filter['price'][$priceId]) ? $filter['price'][$priceId] : $customName;
self::$selected['price'] = array(
'name' => $name,
... ... @@ -860,10 +883,12 @@ class HelperSearch
}
$result = array(
'name' => '最新',
'href' => isset(self::$params['order']) && self::$params['order'] == 's_t_desc' ? self::buildUrl($params) : self::buildUrl(array_merge($params, array(
'href' => isset(self::$params['order']) && self::$params['order'] == 's_t_desc' ? self::buildUrl(array_merge($params, array(
'order' => 's_t_asc'
))) : self::buildUrl(array_merge($params, array(
'order' => 's_t_desc'
))) ,
'active' => isset(self::$params['order']) && self::$params['order'] == 's_t_asc' ? true : ''
'active' => isset(self::$params['order']) && self::$params['order'] == 's_t_desc' ? true : ''
);
return $result;
}
... ... @@ -1076,7 +1101,6 @@ class HelperSearch
public static function current()
{
$url = explode('?', 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
self::$listNav[0]['href'] = $url[0];
return $url[0];
}
/**
... ... @@ -1333,6 +1357,9 @@ class HelperSearch
elseif ($controller == 'list' && $action == 'sale') {
$type = isset(self::$params['discount']) && self::$params['discount'] ? self::$params['discount'] : '0,0.9';
}
elseif ($controller == 'sale' && $action == 'index') {
$type = isset(self::$params['specialsale_id']) && self::$params['specialsale_id'] ? self::$params['specialsale_id'] : '';
}
// 品牌
elseif ($controller == 'list' && $action == 'sale') {
$type = isset(self::$params['brandId']) && self::$params['brandId'] ? self::$params['brandId'] : '';
... ...
... ... @@ -304,7 +304,7 @@
</script>
<script type="text/html" id="tmpl-my-login-new">
<div class="myyoho-info-header clearfix">
<div class="myyoho-photo" ><img src="\{\{headimg it.head_ico\}\}" alt="" data-url =""></div>
<div class="myyoho-photo" ><img src="\{\{headerimg head_ico\}\}" alt="" data-url =""></div>
<h3 class="user-email"><a href="http://www.yohobuy.com/home?t=\{\{random\}\}">\{\{profile_name\}\}</a></h3>
<h3 class="user-level">
VIP:
... ...
... ... @@ -3,15 +3,22 @@
{{#each pathNav}}
{{#if href}}
<a href="{{href}}">
{{name}}
{{#if @last}}
<b>{{name}}</b>
{{else}}
{{name}}
{{/if}}
{{#unless @last}}
<span class="iconfont">&#xe601;</span>
{{/unless}}
</a>
{{^}}
{{{name}}}
{{#if @last}}
<b>{{name}}</b>
{{else}}
{{name}}
{{/if}}
{{#unless @last}}
<span>
... ... @@ -22,4 +29,4 @@
{{/if}}
{{/each}}
</p>
{{/if}}
\ No newline at end of file
{{/if}}
... ...
... ... @@ -38,7 +38,7 @@
<input id="agree-terms" class="agree-terms" type="checkbox" checked="">
<span>
我已阅读并同意遵守
<a class="link go-yoho-items" href="{{itemUrl}}">YOHO!有货服务条款</a>
<a class="link go-yoho-items" href="{{itemUrl}}" target="_blank">YOHO!有货服务条款</a>
</span>
</li>
<li class="clearfix">
... ...
... ... @@ -623,6 +623,22 @@ handlebars.registerHelper('timestamp', function() {
return new Date().getTime();
});
/**
* 头像
* @param {[type]} v1 [description]
* @param {[type]} options) { if (v1 [description]
* @return {[type]} [description]
*/
handlebars.registerHelper('headerimg', function(headerimg) {
if (headerimg === '') {
return 'http://img10.static.yhbimg.com/headimg/2013/11/28/09/01cae078abe5fe320c88cdf4c220212688.gif' +
'?imageView/2/w/100/h/100';
} else {
return headerimg;
}
});
/**
* 判断等级为3的helper
* @param {[type]} v1 [description]
* @param {[type]} options) { if (v1 [description]
... ... @@ -1542,7 +1558,7 @@ function actionGetBannerAndNotice() {
if (url.indexOf('kids') !== -1) {
code = bannerMap[INDEXKIDS];
}
if (url.indexOf('woman') !== -1) {
if (url.indexOf('woman') !== -1 || url.indexOf('girls') !== -1) {
code = bannerMap[INDEXWOMAN];
}
if (url.indexOf('lifestyle') !== -1) {
... ... @@ -1808,8 +1824,7 @@ function init() {
actionCover(); //初次登录弹框
actionAddKeyWords(); //增加关键字
}
init();
init();
});
define("js/simple-header", ["jquery"], function(require, exports, module){
var $ = require("jquery");
... ... @@ -2577,18 +2592,14 @@ $goodInfoMain.on('click', '.col-btn', function() {
if (res.code === 200) {
$this.toggleClass('coled');
} else if (res.code === 403) {
location.href = '/signin.html?refer=' + encodeURIComponent(location.href);
location.href = 'http://www.yohobuy.com/signin.html?refer=' + encodeURIComponent(location.href);
}
});
});
// 左侧导航
$productListNav.click(function(event) {
var $this = $(this);
if (!$this.hasClass('product-list-nav')) {
return;
}
$productListNav.find('h3').click(function(event) {
var $this = $(this).closest('.product-list-nav');
if ($this.hasClass('active')) {
... ... @@ -2746,7 +2757,7 @@ $('#brand-favor').on('click', function() {
$this.find('i').removeClass('coled');
}
} else if (res.code === 403) {
location.href = '/signin.html?refer=' + encodeURIComponent(location.href);
location.href = 'http://www.yohobuy.com/signin.html?refer=' + encodeURIComponent(location.href);
}
});
});
... ...
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
... ... @@ -294,13 +294,14 @@ handlebars.registerHelper('timestamp', function() {
* @return {[type]} [description]
*/
handlebars.registerHelper('headerimg', function(headerimg) {
if(headerimg ===''){
return 'http://img10.static.yhbimg.com/headimg/2013/11/28/09/01cae078abe5fe320c88cdf4c220212688.gif?imageView/2/w/100/h/100';
}else{
if (headerimg === '') {
return 'http://img10.static.yhbimg.com/headimg/2013/11/28/09/01cae078abe5fe320c88cdf4c220212688.gif' +
'?imageView/2/w/100/h/100';
} else {
return headerimg;
}
});
/**
* 判断等级为3的helper
... ... @@ -1488,4 +1489,4 @@ function init() {
actionCover(); //初次登录弹框
actionAddKeyWords(); //增加关键字
}
init();
init();
\ No newline at end of file
... ...
... ... @@ -285,7 +285,7 @@ $('#login-btn').on('click', function() {
}
} else {
$passwordTip.removeClass('hide').children('em').html(data.message);
$password.addClass('error');
$password.addClass('error').val('');
}
},
complete: function() {
... ...
... ... @@ -25,7 +25,7 @@ $('#brand-favor').on('click', function() {
$this.find('i').removeClass('coled');
}
} else if (res.code === 403) {
location.href = '/signin.html?refer=' + encodeURIComponent(location.href);
location.href = 'http://www.yohobuy.com/signin.html?refer=' + encodeURIComponent(location.href);
}
});
});
... ...
... ... @@ -150,7 +150,8 @@ $brandMulti.click(function() {
$brandMore.trigger('click');
}
$brandPanel.addClass('multi'); //显示出checkbox
brandShowMore();
$brandPanel.removeClass('hide').addClass('multi'); //显示出checkbox
$(this).addClass('hide');
});
... ... @@ -232,7 +233,8 @@ $('.multi-select-cancel').click(function() {
$brandMore.trigger('click');
}
$panel.removeClass('multi');
$panel.addClass('hide').removeClass('multi');
brandHideMore();
clearChecked($panel.find('.checkbox.checked')); //清除选中状态
});
... ...
... ... @@ -180,18 +180,14 @@ $goodInfoMain.on('click', '.col-btn', function() {
if (res.code === 200) {
$this.toggleClass('coled');
} else if (res.code === 403) {
location.href = '/signin.html?refer=' + encodeURIComponent(location.href);
location.href = 'http://www.yohobuy.com/signin.html?refer=' + encodeURIComponent(location.href);
}
});
});
// 左侧导航
$productListNav.click(function(event) {
var $this = $(this);
if (!$this.hasClass('product-list-nav')) {
return;
}
$productListNav.find('h3').click(function(event) {
var $this = $(this).closest('.product-list-nav');
if ($this.hasClass('active')) {
... ...
... ... @@ -8,6 +8,10 @@
"plugin/slider",
"pager";
b {
font-weight: bold;
}
body {
font-family: arial,"Microsoft YaHei";
}
... ...
... ... @@ -67,9 +67,9 @@ class HotrankModel
public static function getHotrankResource($data, $sid, $page)
{
//焦点图 热门品牌
// $focus = self::getFocusResource($data['channel'], $data['code']);
// $data['slide'] = $focus[0]['slide'];
// $data['hotBrands'] = $focus[1]['hotBrands'];
$focus = self::getFocusResource($data['channel'], $data['code']);
$data['slide'] = $focus[0]['slide'];
$data['hotBrands'] = $focus[1]['hotBrands'];
//人气单品 一周热卖
$sort = ($sid == 1) ? '' : $sid;
$config = array(
... ... @@ -203,6 +203,7 @@ class HotrankModel
public static function getProductList($result, $page, $ajax = 0)
{
$product = array();
$url = Helpers::url('/product/pro', '', 'item');
if (empty($result) || empty($result['data']) || empty($result['data']['product_list'])) {
return $product;
}
... ... @@ -213,36 +214,35 @@ class HotrankModel
if (empty($val['goods_list'])) {
continue;
}
$defaultGoodsId = 0;
//$defaultGoodsId = 0;
foreach ($val['goods_list'] as $v) {
if ($v['is_default'] == 'Y') {
$defaultGoodsId = $v['goods_id'];
$defaultGoodsId = empty($v['goods_id']) ? $val['goods_list'][0]['goods_id'] : $v['goods_id'];
}
}
if (empty($defaultGoodsId)) {
$defaultGoodsId = $val['goods_list'][0]['goods_id'];
}
$product_id = empty($val['product_id']) ? '' : $val['product_id'];
$product['name'] = $val['product_name'];
if ($key <= 9 && $page == 1 && $ajax == 0) {
//人气单品
$product['rank'] = $key + 1;
$product['href'] = 'http://item.yohobuy.com/product/pro_' . $product_id . '_' . $defaultGoodsId . '.html';
$product['title'] = $val['product_name'];
$product['href'] = $url . '_' . $product_id . '_' . $defaultGoodsId . '.html';
$product['price'] = (int) $val['market_price'] == (int) $val['sales_price'] ? '' : $val['market_price'];
$product['sPrice'] = empty($val['sales_price']) ? '' : $val['sales_price'];
if ($key <= 5) {
//6张大图
$product['img'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 378, 504, 2);
$popular['list'][] = $product;
}
else {
//4张小图
$product['img'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 280, 373, 2);
$popular['list'][] = $product;
}
}
else {
//一周热卖
// $product['url'] = 'http://item.yohobuy.com/product/pro_' . $product_id . '_' . $defaultGoodsId . '.html';
$product['url'] = Helpers::url('/product/pro',array('product_id' => $product_id,'defaultGoodsId'=> $defaultGoodsId),'item');
$product['name'] = $val['product_name'];
$product['url'] = $url . '_' . $product_id . '_' . $defaultGoodsId . '.html';
$product['marketPrice'] = (int) $val['market_price'] == (int) $val['sales_price'] ? '' : $val['market_price'];
$product['salePrice'] = empty($val['sales_price']) ? '' : $val['sales_price'];
$product['rank'] = '';
... ...
... ... @@ -31,6 +31,7 @@ class SearchModel
/* 过滤请求参数 */
$condition = filter_input_array(INPUT_GET, array(
'query' => FILTER_SANITIZE_STRING,
'keyword' => FILTER_SANITIZE_STRING,
'brand' => FILTER_SANITIZE_STRING,
'sort' => FILTER_VALIDATE_INT,
'msort' => FILTER_SANITIZE_STRING,
... ... @@ -49,6 +50,10 @@ class SearchModel
'viewNum' => FILTER_VALIDATE_INT,
'rowNum' => FILTER_VALIDATE_INT,
'page' => FILTER_VALIDATE_INT), false);
//keyword=>query关键字
if (isset($condition['keyword']) && !empty($condition['keyword'])) {
$condition['query'] = rawurldecode($condition['keyword']);
}
//关键字
if (isset($condition['query']) && !empty($condition['query'])) {
$condition['query'] = rawurldecode($condition['query']);
... ...
... ... @@ -87,18 +87,14 @@ class AutosignController extends WebAction
}
//判定是否需要绑定手机号
if (isset($result['data']['mobile']) && $result['data']['mobile'] == '') {
$token = Helpers::makeToken($result['data']['uid']);
$this->setSession('_TOKEN', $token);
$this->setSession('_LOGIN_UID', $result['data']['uid']);
$this->setCookie('_TOKEN', $token);
$fillHerf = rawurlencode(Helpers::url('/passport/autouserinfo/userinfo', array('openId' => $userId, 'sourceType' => 'alipay', 'nickname' => $realName)));
$this->go(Helpers::syncUserSession($result['data']['uid'], $fillHerf));
if (isset($result['data']['is_bind']) && $result['data']['is_bind'] == 'N') {
$fillHerf = Helpers::url('/passport/thirdlogin/index', array('openId' => $userId, 'sourceType' => 'alipay', 'nickname' => $realName));
$this->go($fillHerf);
}
$refer = $this->getCookie('refer');
if (empty($refer)) {
$refer = SITE_MAIN . '/?go=1';
$refer = SITE_MAIN;
}
else {
$refer = rawurldecode($refer);
... ... @@ -174,18 +170,14 @@ class AutosignController extends WebAction
}
//判定是否需要绑定手机号
if (isset($result['data']['mobile']) && $result['data']['mobile'] == '') {
$token = Helpers::makeToken($result['data']['uid']);
$this->setSession('_TOKEN', $token);
$this->setSession('_LOGIN_UID', $result['data']['uid']);
$this->setCookie('_TOKEN', $token);
$fillHerf = rawurlencode(Helpers::url('/passport/autouserinfo/userinfo', array('openId' => $access['uid'], 'sourceType' => 'sina', 'nickname' => $partnerInfo['screen_name'])));
$this->go(Helpers::syncUserSession($result['data']['uid'], $fillHerf));
if (isset($result['data']['is_bind']) && $result['data']['is_bind'] == 'N') {
$fillHerf = Helpers::url('/passport/thirdlogin/index', array('openId' => $access['uid'], 'sourceType' => 'sina', 'nickname' => $partnerInfo['screen_name']));
$this->go($fillHerf);
}
$refer = $this->getCookie('refer');
if (empty($refer)) {
$refer = SITE_MAIN . '/?go=1';
$refer = SITE_MAIN;
}
else {
$refer = rawurldecode($refer);
... ... @@ -218,6 +210,10 @@ class AutosignController extends WebAction
}
//判定是否需要绑定手机号
if (isset($result['data']['is_bind']) && $result['data']['is_bind'] == 'N') {
$fillHerf = Helpers::url('/passport/thirdlogin/index', array('openId' => $access['uid'], 'sourceType' => 'sina', 'nickname' => $partnerInfo['screen_name']));
$this->go($fillHerf);
}
if (isset($result['data']['mobile']) && $result['data']['mobile'] == '') {
$token = Helpers::makeToken($result['data']['uid']);
$this->setSession('_TOKEN', $token);
... ... @@ -229,7 +225,7 @@ class AutosignController extends WebAction
$refer = $this->getCookie('refer');
if (empty($refer)) {
$refer = SITE_MAIN . '/?go=1';
$refer = SITE_MAIN;
}
else {
$refer = rawurldecode($refer);
... ... @@ -264,18 +260,13 @@ class AutosignController extends WebAction
}
//判定是否需要绑定手机号
if (isset($result['data']['mobile']) && $result['data']['mobile'] == '') {
$token = Helpers::makeToken($result['data']['uid']);
$this->setSession('_TOKEN', $token);
$this->setSession('_LOGIN_UID', $result['data']['uid']);
$this->setCookie('_TOKEN', $token);
$fillHerf = rawurlencode(Helpers::url('/passport/autouserinfo/userinfo', array('openId' => $access['douban_user_id'], 'sourceType' => 'douban', 'nickname' => $partnerInfo['name'])));
$this->go(Helpers::syncUserSession($result['data']['uid'], $fillHerf));
if (isset($result['data']['is_bind']) && $result['data']['is_bind'] == 'N') {
$fillHerf = Helpers::url('/passport/thirdlogin/index', array('openId' => $access['douban_user_id'], 'sourceType' => 'douban', 'nickname' => $partnerInfo['name']));
$this->go($fillHerf);
}
$refer = $this->getCookie('refer');
if (empty($refer)) {
$refer = SITE_MAIN . '/?go=1';
$refer = SITE_MAIN;
}
else {
$refer = rawurldecode($refer);
... ... @@ -311,18 +302,14 @@ class AutosignController extends WebAction
}
//判定是否需要绑定手机号
if (isset($result['data']['mobile']) && $result['data']['mobile'] == '') {
$token = Helpers::makeToken($result['data']['uid']);
$this->setSession('_TOKEN', $token);
$this->setSession('_LOGIN_UID', $result['data']['uid']);
$this->setCookie('_TOKEN', $token);
$fillHerf = rawurlencode(Helpers::url('/passport/autouserinfo/userinfo', array('openId' => $partnerInfo['openid'], 'sourceType' => 'wechat', 'nickname' => $partnerInfo['nickname'])));
$this->go(Helpers::syncUserSession($result['data']['uid'], $fillHerf));
if (isset($result['data']['is_bind']) && $result['data']['is_bind'] == 'N') {
$fillHerf = Helpers::url('/passport/thirdlogin/index', array('openId' => $partnerInfo['openid'], 'sourceType' => 'wechat', 'nickname' => $partnerInfo['nickname']));
$this->go($fillHerf);
}
$refer = $this->getCookie('refer');
if (empty($refer)) {
$refer = SITE_MAIN . '/?go=1';
$refer = SITE_MAIN;
}
else {
$refer = rawurldecode($refer);
... ...
... ... @@ -3,6 +3,8 @@
use Action\WebAction;
use LibModels\Web\Passport\RegData;
use LibModels\Wap\Passport\BindData;
use LibModels\Web\Home\UserData;
use WebPlugin\Images;
use Passport\PassportModel as PassportModel;
use WebPlugin\Helpers;
... ... @@ -10,7 +12,7 @@ class AutouserinfoController extends WebAction
{
/**
* 第三方登录完善个人信息
* 第三方登录完善个人信息(旧)
* 绑定手机号
*/
public function indexAction()
... ... @@ -29,16 +31,6 @@ class AutouserinfoController extends WebAction
$refer = rawurldecode($refer);
}
//获取用户
$uid = $this->getUid(true);
if (!$uid) {
$isLogin = false;
$username = '';
}
else {
$isLogin = true;
$username = $this->_uname;
}
$simpleHeader = PassportModel::getSimpleHeader();
$cover = PassportModel::getLeftBanner(PassportModel::AUTOUSERINFO_LEFT_BANNER_CODE);
... ... @@ -66,12 +58,10 @@ class AutouserinfoController extends WebAction
}
/**
* 完善信息页面
* 完善信息页面(中间跳转页-旧)
*/
public function userInfoAction()
{
//获取用户
$uid = $this->getUid(false);
$nickname = $this->get('nickname');
$openId = $this->get('openId');
$sourceType = $this->get('sourceType');
... ... @@ -94,6 +84,8 @@ class AutouserinfoController extends WebAction
/**
* 绑定前手机号校验
* 若已注册,则查询用户头像,昵称信息
*
*/
public function bindCheckAction()
{
... ... @@ -105,22 +97,34 @@ class AutouserinfoController extends WebAction
break;
}
$phoneNum = trim($this->post('mobile'));
$mobile = trim($this->post('mobile'));
$openId = trim($this->post('openId'));
$areaCode = trim($this->post('area', '86'));
$area = trim($this->post('area', '86'));
$sourceType = trim($this->post('sourceType'));
if (!is_numeric($phoneNum) || !$openId || !$areaCode || !$sourceType) {
if (!is_numeric($mobile) || !$openId || !$area || !$sourceType) {
break;
}
$res = BindData::bindCheck($phoneNum, $openId, $sourceType, $areaCode);
$res = BindData::bindCheck($mobile, $openId, $sourceType, $area);
if (!isset($res['code'])) {
break;
}
//未注册 未绑定
if ($res['code'] == 200) {
$data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('isReg' => $res['data']['is_register']));
$next = Helpers::url('/thirdlogin/index', array(
'openId' => $openId,
'sourceType' => $sourceType,
'area' => $area,
'mobile' => $mobile,
));
$data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('next' => $next));
}
//506 - 已注册 未绑定 / 505 - 已注册 已绑定
elseif ($res['code'] == 506 || $res['code'] == 505) {
$user = self::getUserInfo($area, $mobile);
$data = array('code' => $res['code'], 'message' => $res['message'], 'data' => array('user' => $user));
}
else {
$data = array('code' => $res['code'], 'message' => $res['message'], 'data' => isset($res['data']) ? $res['data'] : '');
... ... @@ -131,6 +135,20 @@ class AutouserinfoController extends WebAction
$this->echoJson($data);
}
public static function getUserInfo($area, $mobile)
{
$userInfo = UserData::getUserInfoByMobile($area, $mobile);
$user = array('username' => '', 'headImg' => '');
$userTmp = current($userInfo['data']);
if ($userTmp) {
$user = array(
'username' => $userTmp['profile_name'],
'headImg' => (!empty($userTmp['head_ico'])) ? Images::getImageUrl($userTmp['head_ico'], 100, 100, 2, 'headimg') : '',
);
}
return $user;
}
/**
* 发送验证码
*/
... ... @@ -146,8 +164,6 @@ class AutouserinfoController extends WebAction
$phoneNum = trim($this->post('mobile'));
$areaCode = trim($this->post('area'));
$verifyCode = trim($this->post('verifyCode'));
//校验手机号格式
if (!is_numeric($phoneNum) || !is_numeric($areaCode)) {
$data['code'] = 400;
... ... @@ -155,13 +171,6 @@ class AutouserinfoController extends WebAction
break;
}
//检测验证码不正确
if (!PassportModel::verifyCode($verifyCode)) {
$data['code'] = 400;
$data['message'] = '图形验证码不正确';
break;
}
$data = BindData::sendBindMsg($areaCode, $phoneNum);
if (!isset($data['code'])) {
break;
... ... @@ -172,32 +181,6 @@ class AutouserinfoController extends WebAction
$this->echoJson($data);
}
/*
* 校验图形验证码
*/
public function checkPicCodeAction()
{
$data = array('code' => 400, 'message' => '', 'data' => '');
do {
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
break;
}
$verifyCode = trim($this->post('verifyCode'));
$picFlag = PassportModel::verifyCode($verifyCode);
if ($picFlag) {
$data = array('code' => 200, 'message' => '验证码正确', 'data' => '');
}
else {
$data = array('code' => 400, 'message' => '验证码错误', 'data' => '');
}
}
while (false);
$this->echoJson($data);
}
/**
* 校验短信验证码
*/
... ... @@ -249,8 +232,6 @@ class AutouserinfoController extends WebAction
$openId = trim($this->post('openId'));
$sourceType = trim($this->post('sourceType'));
$code = trim($this->post('code')); //短信验证码
$verifyCode = trim($this->post('verifyCode')); //图形验证码
// $nickname = trim($this->post('nickname'));//nickname不同步信息
$password = trim($this->post('password'));
$password = empty($password) ? '' : $password;
... ... @@ -260,13 +241,6 @@ class AutouserinfoController extends WebAction
$data['message'] = '手机号码格式不正确';
break;
}
//校验图形验证码
$picFlag = PassportModel::verifyCode($verifyCode);
if (!$picFlag) {
$data['code'] = 400;
$data['message'] = '图形验证码不正确';
break;
}
//校验手机验证码
$bindMsgFlag = BindData::checkBindCode($areaCode, $phoneNum, $code);
if (isset($bindMsgFlag['code']) && $bindMsgFlag['code'] != 200) {
... ...
... ... @@ -8,24 +8,14 @@ class ThirdloginController extends WebAction
{
/**
* 第三方联合登录手机绑定流程页
* 第三方联合登录手机绑定流程页1
*/
public function indexAction()
{
$this->setTitle('联合登录补全信息');
// $nickname = $this->get('nickname');
$openId = trim($this->get('openId'));
$sourceType = trim($this->get('sourceType'));
//登录后跳转页面
$refer = $this->getCookie('refer');
if (empty($refer)) {
$refer = SITE_MAIN;
}
else {
$refer = rawurldecode($refer);
}
$simpleHeader = PassportModel::getSimpleHeader();
//整合
... ... @@ -40,11 +30,43 @@ class ThirdloginController extends WebAction
$this->_view->display('index', $data);
}
/*
* 首次登录绑定流程-新会员
*/
public function noregistAction()
{
$mobile = trim($this->post('mobile'));
$data = array('mobile' => $mobile);
$sourceType = trim($this->post('sourceType'));
$openId = trim($this->post('openId'));
$area = trim($this->post('area'));
$simpleHeader = PassportModel::getSimpleHeader();
$data = array(
'thirdLogin' => true,
'simpleHeader' => $simpleHeader,
'mobile' => $mobile,
'sourceType' => $sourceType,
'openId' => $openId,
'area' => $area
);
$this->_view->display('noregist', $data);
}
/*
* 绑定成功
*
*/
public function bindSuccessAction()
{
$simpleHeader = PassportModel::getSimpleHeader();
$data = array(
'thirdLogin' => true,
'simpleHeader' => $simpleHeader,
'goShopping' => SITE_MAIN,
);
$this->_view->display(' bindsuccess', $data);
}
}
... ...
<?php
<?php
use Action\WebAction;
use LibModels\Web\Product\FavoriteData;
use Product\BrandsModel;
use product\HotrankModel;
class IndexController extends WebAction
{
/**
* 品牌首页
*/
* 品牌首页
*/
public function brandAction()
{
//品牌域名,没有获取到品牌域名的跳转首页
$domain = $this->param('named');
if (empty($domain)) {
$this->go(SITE_MAIN);
}
}
//根据品牌域名获取品牌id(同时判断品牌域名是否有效),无效跳转首页
$type = 1;
$result = BrandsModel::getBrandByDomain($domain, $type);
if (!$result) {
$this->go(SITE_MAIN);
}
//获取uid
$uid = $this->getUid();
//传品牌ID参数
$condition = array();
$condition['brand'] = isset($result['brandId']) ? $result['brandId'] : '';
//品牌系列参数
$condition['folder_id'] = $this->get('folder_id');
//$options参数数组
$options = array();
$options['brandName'] = $domain;
... ... @@ -46,10 +47,10 @@ class IndexController extends WebAction
$options['reviewNum'] = 6;
$options['controller'] = 'Index';
$options['action'] = 'brand';
//调用模型获得数据
$data = BrandsModel::getBrandSearchData($condition, $options);
$data = array(
//初始化js
'searchListPage' => true,
... ... @@ -60,9 +61,9 @@ class IndexController extends WebAction
$this->setDescription('潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜');
$this->setWebNavHeader();
//渲染模板
$this->_view->display('list',$data);
$this->_view->display('list', $data);
}
//品牌介绍页
public function aboutAction()
{
... ... @@ -70,21 +71,21 @@ class IndexController extends WebAction
$domain = $this->param('named');
if (empty($domain)) {
$this->go(SITE_MAIN);
}
}
$uid = $this->getUid();
//根据品牌域名获取品牌id(同时判断品牌域名是否有效),无效跳转首页TODO
$type = 2;
$result = BrandsModel::getBrandByDomain($domain, $type);
if (!$result) {
$this->go(SITE_MAIN);
}
//品牌ID参数
$condition = array();
$condition['brand'] = isset($result['brandId']) ? $result['brandId'] : '';
//$options参数数组
$options = array();
$options['brandName'] = $domain;
... ... @@ -96,18 +97,18 @@ class IndexController extends WebAction
$options['action'] = 'brand';
//调用模型获得数据
$data = BrandsModel::getBrandIntro($condition, $options);
$data = array(
//初始化js
'searchListPage' => true,
'list' => $data
);
$this->setWebNavHeader();
//渲染模板
$this->_view->display('list',$data);
$this->_view->display('list', $data);
}
//收藏品牌
public function favoriteBrandAction()
{
... ... @@ -115,17 +116,17 @@ class IndexController extends WebAction
return;
}
$result = array(
'code' => '400',
'code' => 400,
'message' => 'operation failed'
);
);
$uid = $this->getUid();
$brandId = $this->post('brandId');
do{
do {
if (!$uid) {
$result = array(
'code' => '403',
'code' => 403,
'message' => 'uid is null'
);
);
break;
}
if ($uid && $brandId) {
... ... @@ -133,46 +134,49 @@ class IndexController extends WebAction
$result = FavoriteData::changeFavoriteBrand($uid, $brandId);
break;
}
}while(false);
}
while (false);
$this->echoJson($result);
}
/**
/**
* 热销排行
*/
public function hotrankAction()
public function hotrankAction()
{
//获取频道
$channel = HotrankModel::getChannelResource();
$this->setWebNavHeader($channel['channel']);
$page = $this->get('page',1);
$sort = $this->get('sid',1);
$data = array( 'hotrankPage' => true,
'footerTop'=> true,
'hotrank' => HotrankModel::getHotrankResource($channel, $sort, $page)
);
$this->_view->display('hotrank', $data);
$page = $this->get('page', 1);
$sort = $this->get('sid', 1);
$data = array('hotrankPage' => true,
'footerTop' => true,
'hotrank' => HotrankModel::getHotrankResource($channel, $sort, $page)
);
$this->_view->display('hotrank', $data);
}
/*
* 一周热卖加载更多
*/
public function getdataAction()
{
$page = $this->get('page',1);
$page = $this->get('page', 1);
//加载到100个以后停止
if($page > 2)
{
echo json_encode(array('code'=>201,'data'=>''));
if ($page > 2) {
echo json_encode(array('code' => 201, 'data' => ''));
exit;
}
$sid = $this->get('sid',1);
$sid = $this->get('sid', 1);
//获取频道资源
$channel = HotrankModel::getChannelResource();
//获取一周热卖资源
$data = HotrankModel::getListData($channel, $sid, $page);
$data = HotrankModel::getListData($channel, $sid, $page);
echo json_encode($data);
exit;
exit;
}
}
\ No newline at end of file
}
... ...
... ... @@ -158,7 +158,7 @@ class ListController extends WebAction
do {
if (!$uid) {
$result = array(
'code' => '403',
'code' => 403,
'message' => 'uid is null'
);
break;
... ...
... ... @@ -56,4 +56,35 @@ class SearchController extends WebAction
$this->echoJson($size);
}
}
/**
* 搜索错误页
*/
public function errorAction()
{
$keyword = $this->get('query');
$data = array(
//初始化js
'searchListPage' => true,
'search' => array(
'keyWord' => $keyword,
'searchActionUrl' => 'http:://search.yohobuy.com',
'latestWalk' => 7,
'pathNav' => Array(
'0'=>array(
'href' => '/',
'name' => '首页'
),
'1'=>array(
'name' => '搜索“<span id="nav_keyword">'.$keyword.'</span>”共<span id="nav_keyword_count">0</span>个结果'
)
)
)
);
$this->setTitle('潮流商品搜索 | YOHO!有货');
$this->setKeywords('Yoho! 有货,潮流,时尚,流行,购物,B2C,正品,购物网站,网上购物,货到付款,品牌服饰,男士护肤,黑框眼镜,匡威,板鞋,i.t,izzue,5cm,eastpak,vans,lylescott,g-shock,new balance,lacoste,melissa,casio,卡西欧手表,舒雅,jasonwood,odm,AAAA,香港购物,日本潮流');
$this->setDescription('潮流商品搜索,上衣,衬衫,TEE,卫衣,冲锋衣,风衣,羽绒服,裤子,休闲鞋,板鞋,配饰,复古眼镜');
$this->setWebNavHeader();
$this->_view->display('search', $data);
}
}
\ No newline at end of file
... ...
... ... @@ -32,4 +32,4 @@ routes.brandabout.type = "rewrite"
routes.brandabout.match = "/about"
routes.brandabout.route.module = Product
routes.brandabout.route.controller = Index
routes.brandabout.route.action = brandIntro
\ No newline at end of file
routes.brandabout.route.action = about
\ No newline at end of file
... ...