Authored by xuqi

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

Showing 39 changed files with 1575 additions and 739 deletions
... ... @@ -317,7 +317,7 @@ class AbstractAction extends Controller_Abstract
}
}
/**
/**
* 获取当前登录的用户ID
*
* @param bool $useSession (true:从服务端session中检查, false:从客户端cookie中检查)
... ... @@ -329,10 +329,11 @@ class AbstractAction extends Controller_Abstract
if (!$this->_useSession) {
$useSession = false;
}
$useSession = false;
//$useSession = false;
if (!$this->_uid) {
$cookie = $this->getCookie('_UID');
// 兼容老的
if (!empty($cookie)) {
$cookieList = explode('::', $cookie);
if (isset($cookieList[1]) && is_numeric($cookieList[1])) {
... ... @@ -351,11 +352,18 @@ class AbstractAction extends Controller_Abstract
$this->_usession = $cookieList[3];
$this->_vip = $cookieList[2];
}
}
// 新的, 如果老站没有同步成功,再尝试从SESSION获取
elseif ($useSession) {
$uid = $this->getSession('_LOGIN_UID');
if (!empty($uid)) {
$this->_uid = $uid;
}
}
}
return $this->_uid;
}
/**
* 获取客户端唯一标识
*
... ...
... ... @@ -67,7 +67,7 @@ class WebAction extends Controller_Abstract
case 'develop': // 开发
default:
$this->_view->assign('devEnv', true);
$this->_useSession = false;
$this->_useSession = true;
break;
}
}
... ... @@ -333,9 +333,11 @@ class WebAction extends Controller_Abstract
if (!$this->_useSession) {
$useSession = false;
}
//$useSession = false;
if (!$this->_uid) {
$cookie = $this->getCookie('_UID');
// 兼容老的
if (!empty($cookie)) {
$cookieList = explode('::', $cookie);
if (isset($cookieList[1]) && is_numeric($cookieList[1])) {
... ... @@ -354,6 +356,13 @@ class WebAction extends Controller_Abstract
$this->_usession = $cookieList[3];
$this->_vip = $cookieList[2];
}
}
// 新的, 如果老站没有同步成功,再尝试从SESSION获取
elseif ($useSession) {
$uid = $this->getSession('_LOGIN_UID');
if (!empty($uid)) {
$this->_uid = $uid;
}
}
}
return $this->_uid;
... ...
... ... @@ -34,7 +34,7 @@ class BrandData
// 构建必传参数
$param = Yohobuy::param();
$param['brand_id'] = $brandId;
$param['uid'] = '10267443';
$param['uid'] = $uid;
$param['method'] = 'app.brand.getBrandIntro';
$param['client_secret'] = Sign::getSign($param);
... ...
<?php
namespace LibModels\Web\Product;
use Api\Yohobuy;
/**
* sale操作类
* @name SaleData
* @package
* @copyright yoho.inc
* @version 1.0 (2016-01-07)
* @author
*/
class SaleData
{
const URL_SALE_SPECIAL = '/operating/service/v1/special';
/**
* 获取专区信息
* @param $specialId 专区ID
*/
public static function getSpecial($specialsaleId) {
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_SALE_SPECIAL, 'getOneSpecial', array($specialsaleId));
}
}
... ...
... ... @@ -4,6 +4,7 @@ namespace LibModels\Web\Product;
use Api\Yohobuy;
class SearchData extends \LibModels\Wap\Product\SearchData
{
public static $shops_url = 'http://101.200.31.165/yohosearch/shops.json';
/**
* 获取搜索的服务地址
*
... ... @@ -129,6 +130,16 @@ class SearchData extends \LibModels\Wap\Product\SearchData
}
/**
* 搜索品牌店铺信息
* @param array $params 参数
* @return array
*/
public static function getShop(array $params)
{
return Yohobuy::get(self::$shops_url,$params);
}
/**
* 获取最近浏览记录
* @param int $limit
* @return json
... ...
... ... @@ -208,7 +208,7 @@ class FloorProcess
foreach ($data['list'] as &$one) {
if (isset($one['url'])) {
$one['url'] = Helpers::getFilterUrl($one['url']);
// isset(self::$channel[$type]) && $one['url'] .= '?gender=' . self::$channel[$type];
isset(self::$channel[$type]) && $one['url'] .= '?gender=' . self::$channel[$type];
}
$one['img'] = Helpers::getImageUrl($one['src'], 158, 174);
unset($one['src']);
... ...
... ... @@ -2,6 +2,7 @@
namespace Plugin;
use Plugin\Paging;
use LibModels\Web\Product\BrandData;
/**
* 搜索辅助类
*/
... ... @@ -12,6 +13,7 @@ class HelperSearch
*/
public static $params = array();
public static $options = array();
//当前页
public static $page = 1;
... ... @@ -26,13 +28,13 @@ class HelperSearch
*/
public static $listnav = array();
//设置导航
private static function setListNav($option = array())
private static function setListNav()
{
$options = self::$options;
$cookieChannel = isset($_COOKIE['_Channel']) ? $_COOKIE['_Channel'] : 'boys';
if (isset($option['brandName']) && !empty($option['brandName'])) {
$initNav = $option['brandName'];
if (isset($options['brandName']) && !empty($options['brandName'])) {
$initNav = $options['brandName'];
}else{
$initNav = '列表';
}
... ... @@ -55,6 +57,7 @@ class HelperSearch
{
$result = array();
self::$params = $_GET;
self::$options = $options;
unset(self::$params['/']);
unset(self::$params['page']);
unset(self::$params['/sale']);
... ... @@ -71,12 +74,11 @@ class HelperSearch
$result['filters']['checkedConditions']['clearUrl'] = self::current();
//频道
$result['filters']['channel'] = self::gender($filter);
//分类
$result['filters']['sort'] = array();
//品牌
$result['filters']['brand'] = self::brand($filter, $options);
$result['filters']['brand'] = self::brand($filter);
//价格
$result['filters']['price'] = self::price($filter);
$result['filters']['customPrice'] = self::customPrice($filter);
//颜色
$result['filters']['color'] = self::color($filter);
//尺寸
... ... @@ -99,8 +101,10 @@ class HelperSearch
$result['opts']['pageCount'] = $data['data']['page_total'];
$result['opts']['nextHref'] = ($next = self::next($data['data']['page_total'],$data['data']['filter'])) ? $next['href'] : '';
$result['hasNextPage'] = self::next($data['data']['page_total']);
//分类
$result['leftContent'][]['allSort'] = isset($filter['group_sort']) ? self::groupSort($filter['group_sort'], $options) : array();
//分类条件
$result['filters']['sort'] = isset($filter['group_sort']) ? self::searchSort($filter['group_sort']) : array();
//左侧分类分类
$result['leftContent'][]['allSort'] = isset($filter['group_sort']) ? self::groupSort($filter['group_sort']) : array();
//一周新品上架
$result['leftContent'][]['newSales'] = isset($filter['recent']) ? self::recentShelve($filter['recent']) : array();
//全部折扣
... ... @@ -111,6 +115,9 @@ class HelperSearch
$result['pager'] = self::pager($result['totalCount'],$options['viewNum']);
//选中条件
$result['filters']['checkedConditions']['conditions'] = self::getSelected();
if (isset($options['controller']) && $options['controller'] == 'Search') {
self::setSearchNav($data['data']['total']);
}
$result['pathNav'] = self::$listnav;
return $result;
}
... ... @@ -152,7 +159,9 @@ class HelperSearch
'salePrice' => $val['sales_price'],
'marketPrice' => $val['market_price'],
'isFew' => $isFew,
'skn' => $val['product_skn']
'skn' => $val['product_skn'],
'showColBtn' => true,
'coled' => true
);
}
return $goods;
... ... @@ -181,6 +190,9 @@ class HelperSearch
'name' => $pval['standard_name'],
'href' => self::buildUrl($tmpParams)
);
if (self::checkSearch('parameter_' . $val['standard_id'])) {
return array();
}
}
$sub[] = array(
'name' => $pval['standard_name'],
... ... @@ -220,6 +232,10 @@ class HelperSearch
'href' => self::buildUrl($params)
);
}
if (self::checkSearch('gender')) {
return array();
}
$result = array();
foreach ($filter['gender'] as $key => $val) {
$result[] = array(
... ... @@ -235,14 +251,18 @@ class HelperSearch
/**
* 组织搜索列表页面的左侧分类
* @param array $sort
* @param array $option
* @return array
*/
public static function groupSort($sort, $option = array())
public static function groupSort($sort)
{
$options = self::$options;
if (isset($options['controller']) && $options['controller'] != 'Search') {
return array();
}
//设置导航
self::setListNav($option);
self::setListNav($options);
$params = self::$params;
$result = array(
'all' => array(
... ... @@ -282,16 +302,48 @@ class HelperSearch
}
}
$result['list'] = $sortList;
return $result;
}
public static function searchSort($sort)
{
$result = array();
$options = self::$options;
if (!isset($options['controller']) || $options['controller'] != 'Search') {
return $result;
}
$params = self::$params;
foreach ($sort as $key => $val) {
$result[$key]['id'] = $val['sort_id'];
$result[$key]['name'] = $val['sort_name'];
if (isset($val['sub']) && !empty($val['sub'])) {
foreach ($val['sub'] as $k => $v) {
$result[$key]['sub'][$k]['href'] = self::buildUrl(array('msort' => $val['sort_id'], 'misort' => $v['sort_id']));
$result[$key]['sub'][$k]['name'] = $v['sort_name'];
if (isset($params['misort']) && $params['misort'] == $v['sort_id']) {
unset($params['misort']);
self::$selected['sort'] = array(
'name' => $v['sort_name'],
'href' => self::buildUrl()
);
}
}
}
}
if (self::checkSearch('msrot') || self::checkSearch('misort')) {
return array();
}
return $result;
}
/**
* 品牌,可以多选
* @param array $filter
* @param array $options
* @return array
*/
public static function brand($filter, $options = array()) {
public static function brand($filter) {
$options = self::$options;
//品牌列表返回空
if (isset($options['brandName'])) {
return array();
... ... @@ -299,11 +351,15 @@ class HelperSearch
$result = array(
'default' => array() ,
'brandIndex' => array(
'0~9',
'A~G',
'H~N',
'O~T',
'U~Z') ,
array(
'index' => 'all',
'name' => '全部'
),
array(
'index' => '0-9',
'name' => '0 ~ 9'
)
),
'brandsShow' => array()
);
$params = self::$params;
... ... @@ -329,12 +385,18 @@ class HelperSearch
)));
}
$this_brand = array(
'brand_id' => $v['id'],
'name' => $v['brand_name'],
'alif' => $v['brand_alif'],
'id' => $v['id'],
'href' => $url,
'name' => $v['brand_name'],
'key' => $v['brand_name'],
'active' => in_array($v['id'], $brandIds) ? true : false
);
if (is_numeric($v['brand_alif'])) {
$this_brand['index'] = '0-9';
}
else {
$this_brand['index'] = strtolower($v['brand_alif']);
}
//默认品牌
if (count($result['default']) < 10) {
$result['default'][] = $this_brand;
... ... @@ -355,9 +417,16 @@ class HelperSearch
'href' => self::buildUrl($params)
);
}
//品牌列表排序
ksort($brandList);
//品牌列表排序, 添加品牌索引
$index_key = array();
foreach ($brandList as $key => $val) {
if ($key && !in_array($key, $index_key)) {
$index['index'] = strtolower(($key));
$index['name'] = $key;
$result['brandIndex'][] = $index;
$index_key[] = $index;
}
if (is_array($val)) {
foreach ($val as $v) {
$result['brandsShow'][] = $v;
... ... @@ -366,6 +435,10 @@ class HelperSearch
}
unset($brandList);
}
//搜索页已选中,返回空
if (self::checkSearch('brand')) {
return array();
}
return $result;
}
/**
... ... @@ -390,6 +463,7 @@ class HelperSearch
'href' => self::buildUrl($params)
);
}
$result[] = array(
'name' => $v['size_name'],
'href' => self::buildUrl(array_merge($params, array(
... ... @@ -397,6 +471,9 @@ class HelperSearch
))) ,
);
}
if (self::checkSearch('size')) {
return array();
}
}
return $result;
}
... ... @@ -431,6 +508,9 @@ class HelperSearch
))) ,
);
}
if (self::checkSearch('color')) {
return array();
}
return $result;
}
... ... @@ -452,6 +532,18 @@ class HelperSearch
'name' => $filter['price'][$priceId],
'href' => self::buildUrl($params)
);
}else{
$price = explode(',', $priceId);
if (count($price) == 2) {
self::$selected['price'] = array(
'name' => self::$params['price'] == '2000,99999' ? '¥2000以上' : '¥' . (int)$price[0] . '-' . (int)$price[1],
'href' => self::buildurl($params)
);
}
}
if (self::checkSearch('price')) {
return array();
}
//返回价格条件
foreach ($filter['price'] as $key => $val) {
... ... @@ -467,6 +559,27 @@ class HelperSearch
}
/**
* 获取自定义价格要提交的地址
*/
public static function customPrice($filter) {
$params = self::$params;
$result = array(
'min' => '',
'max' => ''
);
$priceId = isset($params['price']) && !empty(self::$params['price']) ? self::$params['price'] : '';
if (isset($params['price']) && !isset($filter['price'][$priceId]) ) {
$price = explode(',', $params['price']);
unset($params['price']);
$result = array(
'min' => $price[0],
'max' => $price[1]
);
}
return $result;
}
/**
* 风格,可以多选
* @param array $filter
* @return array
... ... @@ -514,6 +627,10 @@ class HelperSearch
'href' => $url,
);
}
//搜索页已选中,返回空
if (self::checkSearch('style')) {
return array();
}
$data[0] = array(
'attr' => 'style',
'name' => '风格',
... ... @@ -900,9 +1017,99 @@ class HelperSearch
}
return $result;
}
//分页
/**
* 分页
* @param $total
* @param $viewNum
* @return mixed
*/
public static function pager($total,$viewNum){
$Paging = new Paging('Yoho');
return $Paging->setTotal($total)->setSize($viewNum)->view(0);
}
//组织静态资源数据格式
public static function formatNodeContent($code){
$nodeContent = BrandData::getByNodeContent($code);
if (isset($nodeContent['code']) && $nodeContent['code'] === 200) {
$result = array();
$string = $nodeContent['data'];
$hrefPatten="/<a href=[\'\"]?([^\'\" ]+).*?>/";
preg_match_all($hrefPatten, $string, $href);
$pattern = "/[img|IMG].*?src=['|\"](.*?(?:[.gif|.jpg]))['|\"].*?[\/]?>/";
preg_match_all($pattern,$string,$img);
foreach($href[1] as $key=>$vo){
$result[$key]['href'] = $vo;
$result[$key]['src'] = $img[1][$key];
}
return $result;
}
}
/**
* 组织品牌店铺信息
*/
public static function shop($shop)
{
$url = Helpers::url('','',$shop['brand_domain']);
$shopEntry = array();
$sort = array();
foreach ($shop['sort'] as $msort) {
if (!isset($msort['sub']) || empty($msort['sub'])) {
continue;
}
foreach ($msort['sub'] as $mkey=>$misort) {
if (count($sort) >= 10) {
break 2;
}
$sortInfo['href'] = $url.'/?msort=' . $msort['sort_id'] . '&misort=' . $misort['sort_id'];
$sortInfo['name'] = $misort['sort_name'];
$sort[] = $sortInfo;
}
}
$shopEntry['home'] = $url;
$shopEntry['logo'] = Images::getSourceUrl($shop['brand_ico'],'brandLogo');
$shopEntry['shopName'] = $shop['brand_name'];
$shopEntry['sort'] = $sort;
return $shopEntry;
}
public static function checkSearch($param)
{
if (isset(self::$params[$param]) && isset(self::$options['controller']) && self::$options['controller'] == 'Search') {
return true;
}
}
/**
* 设置搜索页导航
* @param $total
*/
public static function setSearchNav($total)
{
self::$listnav[0] = array(
'href' => '/',
'name' => '首页'
);
$param = self::$params;
$options = self::$options;
if (isset($options['controller']) && $options['controller'] == 'Search' && isset($param['query'])) {
self::$listnav[1] = array(
'href' => '',
'name' => "".$param['query']." ".$total."个结果"
);
}else{
self::$listnav[1] = array(
'href' => '',
'name' => '所有商品'
);
}
}
}
... ...
... ... @@ -189,8 +189,8 @@ class Helpers
* @return float|string 转换之后的价格
*/
public static function transPrice($price)
{
return (!empty($price) && !is_float($price)) ? $price . '.00' : number_format($price, 2, '.', '');
{
return !empty($price) ? number_format($price, 2, '.', '') : 0;
}
/**
... ... @@ -566,8 +566,8 @@ class Helpers
$arr[$key]['appearDate'] = $vo['expect_arrival_time'];
}
// 商品链接
if ($haveLink && isset($vo['product_id'])) {
$arr[$key]['link'] = self::url('/product/pro_' . $vo['product_id'] . '_' . $vo['goods_id'] . '/' . $vo['cn_alphabet'] . '.html');
if ($haveLink && isset($vo['product_skn'])) {
$arr[$key]['link'] = self::url('/product/show_' . $vo['product_skn'] . '.html');
}
// 累计购买数
$count += intval($vo['buy_number']);
... ... @@ -576,52 +576,70 @@ class Helpers
return $arr;
}
/**
/**
* 格式化购物车商品
*
* @param array $cartGoods 购物车商品列表
* @param boolean $isValid 是否是可用商品(非失效商品),默认是
* @param bool $isAdvanceCart 是否是预售购物车(和上市期有关)
* @return array 处理之后的购物车商品数据
*/
public static function formatCartGoods($cartGoods)
public static function formatCartGoods($cartGoods, $isAdvanceCart, $isValid = true)
{
$arr = array();
$oneGoods = array();
foreach ($cartGoods as $key => $value) {
$oneGoods['id'] = $value['product_sku'];
$oneGoods['skn'] = $value['product_skn'];
$oneGoods['name'] = $value['product_name'];
$oneGoods['thumb'] = !empty($value['goods_images']) ? Images::getImageUrl($value['goods_images'], 120, 120) : '';
$oneGoods['color'] = $value['color_name'];
$oneGoods['size'] = $value['size_name'];
$oneGoods['price'] = self::transPrice($value['sales_price']);
$oneGoods['count'] = $value['buy_number'];
$oneGoods['lowStocks'] = ($value['buy_number'] < $value['storage_number']);
//gift=>是否赠品,advanceBuy=>是否加价购,soldOut=>失效商品;
if (!isset($value['goods_type'])) {
$oneGoods['isSoldOut'] = true;
} elseif ($value['goods_type'] == 'gift' && !isset($value['isAdvanceBuy'])) {
$oneGoods['isGift'] = true;
} elseif ($value['goods_type'] == 'price_gift') {
$oneGoods['isAdvanceBuy'] = true;
}
// 上市期
if (!empty($value['expect_arrival_time'])) {
$oneGoods['appearDate'] = $value['expect_arrival_time'];
}
// 商品链接
if (isset($value['cn_alphabet']) ) {
$oneGoods['url'] = self::url('/product/pro_' . $value['product_id'] . '_' . $value['goods_id'] . '/' . $value['cn_alphabet'] . '.html');
}
$arr[$key] = $oneGoods;
}
$oneGoods = array();
foreach ($cartGoods as $key => $value) {
$oneGoods = array();
$oneGoods['id'] = $value['product_sku'];
$oneGoods['skn'] = $value['product_skn'];
$oneGoods['name'] = $value['product_name'];
$oneGoods['thumb'] = !empty($value['goods_images']) ? Images::getImageUrl($value['goods_images'], 120, 160) : '';
$oneGoods['color'] = $value['color_name'];
$oneGoods['size'] = $value['size_name'];
$oneGoods['checked'] = $value['selected'] === 'Y';
$oneGoods['price'] = self::transPrice($value['last_vip_price']);
$oneGoods['isVipPrice'] = $value['sales_price'] !== $value['last_vip_price'];
$oneGoods['count'] = $value['buy_number'];
if ($isValid) {
// 库存不足
$oneGoods['lowStocks'] = ($value['buy_number'] > $value['storage_number']);
} else { // 失效商品
$oneGoods['inValid'] = true;
}
//gift=>是否赠品,advanceBuy=>是否加价购,soldOut=>失效商品;
if (!isset($value['goods_type'])) {
$oneGoods['inValid'] = true;
} elseif ($value['goods_type'] == 'gift' && !isset($value['isAdvanceBuy'])) {
$oneGoods['isGift'] = true;
$oneGoods['salesPrice'] = self::transPrice($value['sales_price']);
$oneGoods['price'] = self::transPrice($value['last_price']);
} elseif ($value['goods_type'] == 'price_gift') {
$oneGoods['showCheckbox'] = true;
$oneGoods['isAdvanceBuy'] = true;
$oneGoods['salesPrice'] = self::transPrice($value['sales_price']);
$oneGoods['price'] = self::transPrice($value['last_price']);
} else {
$oneGoods['showCheckbox'] = true;
}
// 上市期
if ($isAdvanceCart && !empty($value['expect_arrival_time'])) {
$oneGoods['appearDate'] = $value['expect_arrival_time'];
}
// 商品链接
$oneGoods['link'] = self::url('/product/show_' . $value['product_skn'] . '.html');
$arr[$key] = $oneGoods;
}
return $arr;
}
/**
* 格式化加价购商品
* 格式化加价购和赠品商品
*
* @param array $advanceGoods 加价购商品列表
* @param int $count 计商品件数
... ... @@ -631,33 +649,38 @@ class Helpers
{
$arr = array();
$gift = array();
$oneGoods = array();
foreach ($advanceGoods as $value) {
$gift = array();
$gift['promotionTitle'] = $value['promotion_title'];
foreach ($value['goods_list'] as $single) {
$oneGoods['id'] = $single['product_skn'];
$oneGoods['name'] = $single['product_name'];
$oneGoods['thumb'] = !empty($single['goods_images']) ? Images::getImageUrl($single['goods_images'], 120, 120) : '';
$oneGoods['appearDate'] = '12月'; // 目前app接口没有返回该数据
$oneGoods['price'] = $single['last_price'];
$oneGoods['marketPrice'] = $single['market_price'];
$oneGoods['count'] = $single['storage_number'];
$gift['goods'][] = $oneGoods;
}
$gift = array();
$oneGoods = array();
$number = 0;
foreach ($advanceGoods as $value) {
$gift = array();
$gift['promotionId'] = $value['promotion_id'];
$gift['promotionTitle'] = $value['promotion_title'];
$number = 0;
foreach ($value['goods_list'] as $single) {
$oneGoods = array();
$oneGoods['id'] = $single['product_skn'];
$oneGoods['name'] = $single['product_name'];
$oneGoods['thumb'] = !empty($single['goods_images']) ? Images::getImageUrl($single['goods_images'], 120, 160) : '';
$oneGoods['price'] = self::transPrice($single['last_price']);
$oneGoods['marketPrice'] = self::transPrice($single['market_price']);
$oneGoods['count'] = $single['storage_number'];
$gift['goods'][] = $oneGoods;
$number ++;
}
$arr[] = $gift;
$arr[] = $gift;
// 计算加价购商品数目
$count += count($value['goods_list']);
}
// 计算加价购商品数目
//$count += count($value['goods_list']);
$count += $number;
}
return $arr;
}
/**
* 订单状态,按订单支付类型和订单状态
* @var array
... ... @@ -783,13 +806,13 @@ class Helpers
* @return string
*/
public static function getClientIp()
{
$ip = '0.0.0.0';
if (isset($_SERVER['HTTP_CLIENT_IP']) && $_SERVER['HTTP_CLIENT_IP'] != '')
$ip = $_SERVER['HTTP_CLIENT_IP'];
elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR'] != '')
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
elseif (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] != '')
{
$ip = '0.0.0.0';
if (isset($_SERVER['HTTP_CLIENT_IP']) && $_SERVER['HTTP_CLIENT_IP'] != '')
$ip = $_SERVER['HTTP_CLIENT_IP'];
elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR'] != '')
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
elseif (isset($_SERVER['REMOTE_ADDR']) && $_SERVER['REMOTE_ADDR'] != '')
$ip = $_SERVER['REMOTE_ADDR'];
return $ip;
}
... ...
... ... @@ -38,35 +38,36 @@ class AlipayNotify {
* @return 验证结果
*/
function verifyNotify(){
if (empty($_POST)) { //判断POST来的数组是否为空
return false;
} else {
//生成签名结果
$isSign = $this->getSignVeryfy($_POST, $_POST["sign"]);
//获取支付宝远程服务器ATN结果(验证是否是支付宝发来的消息)
$responseTxt = 'true';
if (! empty($_POST["notify_id"])) {$responseTxt = $this->getResponse($_POST["notify_id"]);}
//写日志记录
//if ($isSign) {
// $isSignStr = 'true';
//}
//else {
// $isSignStr = 'false';
//}
//$log_text = "responseTxt=".$responseTxt."\n notify_url_log:isSign=".$isSignStr.",";
//$log_text = $log_text.createLinkString($_POST);
//logResult($log_text);
//验证
//$responsetTxt的结果不是true,与服务器设置问题、合作身份者ID、notify_id一分钟失效有关
//isSign的结果不是true,与安全校验码、请求时的参数格式(如:带自定义参数等)、编码格式有关
if (preg_match("/true$/i",$responseTxt) && $isSign) {
return true;
} else {
return false;
}
}
if (empty($_POST)) { //判断POST来的数组是否为空
return false;
} else {
//生成签名结果
$isSign = $this->getSignVeryfy($_POST, $_POST["sign"]);
//获取支付宝远程服务器ATN结果(验证是否是支付宝发来的消息)
$responseTxt = 'true';
if (!empty($_POST["notify_id"])) {
$responseTxt = $this->getResponse($_POST["notify_id"]);
}
//写日志记录
//if ($isSign) {
// $isSignStr = 'true';
//}
//else {
// $isSignStr = 'false';
//}
//$log_text = "responseTxt=".$responseTxt."\n notify_url_log:isSign=".$isSignStr.",";
//$log_text = $log_text.createLinkString($_POST);
//logResult($log_text);
//验证
//$responsetTxt的结果不是true,与服务器设置问题、合作身份者ID、notify_id一分钟失效有关
//isSign的结果不是true,与安全校验码、请求时的参数格式(如:带自定义参数等)、编码格式有关
if (preg_match("/true$/i", $responseTxt) && $isSign) {
return true;
} else {
return false;
}
}
}
/**
... ... @@ -74,36 +75,36 @@ class AlipayNotify {
* @return 验证结果
*/
function verifyReturn(){
if(empty($_GET)) {//判断POST来的数组是否为空
return false;
}
else {
//生成签名结果
$isSign = $this->getSignVeryfy($_GET, $_GET["sign"]);
//获取支付宝远程服务器ATN结果(验证是否是支付宝发来的消息)
$responseTxt = 'true';
if (! empty($_GET["notify_id"])) {$responseTxt = $this->getResponse($_GET["notify_id"]);}
//写日志记录
//if ($isSign) {
// $isSignStr = 'true';
//}
//else {
// $isSignStr = 'false';
//}
//$log_text = "responseTxt=".$responseTxt."\n return_url_log:isSign=".$isSignStr.",";
//$log_text = $log_text.createLinkString($_GET);
//logResult($log_text);
//验证
//$responsetTxt的结果不是true,与服务器设置问题、合作身份者ID、notify_id一分钟失效有关
//isSign的结果不是true,与安全校验码、请求时的参数格式(如:带自定义参数等)、编码格式有关
if (preg_match("/true$/i",$responseTxt) && $isSign) {
return true;
} else {
return false;
}
}
if (empty($_GET)) {//判断POST来的数组是否为空
return false;
} else {
//生成签名结果
$isSign = $this->getSignVeryfy($_GET, $_GET["sign"]);
//获取支付宝远程服务器ATN结果(验证是否是支付宝发来的消息)
$responseTxt = 'true';
if (!empty($_GET["notify_id"])) {
$responseTxt = $this->getResponse($_GET["notify_id"]);
}
//写日志记录
//if ($isSign) {
// $isSignStr = 'true';
//}
//else {
// $isSignStr = 'false';
//}
//$log_text = "responseTxt=".$responseTxt."\n return_url_log:isSign=".$isSignStr.",";
//$log_text = $log_text.createLinkString($_GET);
//logResult($log_text);
//验证
//$responsetTxt的结果不是true,与服务器设置问题、合作身份者ID、notify_id一分钟失效有关
//isSign的结果不是true,与安全校验码、请求时的参数格式(如:带自定义参数等)、编码格式有关
if (preg_match("/true$/i", $responseTxt) && $isSign) {
return true;
} else {
return false;
}
}
}
/**
... ...
... ... @@ -55,7 +55,7 @@ class Call extends Factory
try
{
$token = $this->renn->getTokenFromTokenEndpoint('code', $keys, TokenType::Bearer);
$token = $this->renn->getTokenFromTokenEndpoint('code', $keys, \TokenType::Bearer);
// 返回数组格式的信息
$token = $this->renn->getTokens();
... ... @@ -84,7 +84,7 @@ class Call extends Factory
{
if (is_array($token))
{
$token = new AccessToken(isset($token['type']) ? $token['type'] : TokenType::Bearer, $token['accessToken'], isset($token['refreshToken']) ? $token['refreshToken'] : null, isset($token['macKey']) ? $token['macKey'] : null, isset($token['macAlgorithm']) ? $token['macAlgorithm'] : null);
$token = new \AccessToken(isset($token['token_type']) ? $token['token_type'] : \TokenType::Bearer, $token['access_token'], isset($token['refresh_token']) ? $token['refresh_token'] : null, isset($token['macKey']) ? $token['macKey'] : null, isset($token['macAlgorithm']) ? $token['macAlgorithm'] : null);
}
// 获得保存的token
$this->renn->authWithToken($token);
... ... @@ -130,7 +130,7 @@ class Call extends Factory
{
if (is_array($token))
{
$token = new AccessToken(isset($token['type']) ? $token['type'] : TokenType::Bearer, $token['accessToken'], isset($token['refreshToken']) ? $token['refreshToken'] : null, isset($token['macKey']) ? $token['macKey'] : null, isset($token['macAlgorithm']) ? $token['macAlgorithm'] : null);
$token = new \AccessToken(isset($token['type']) ? $token['type'] : \TokenType::Bearer, $token['accessToken'], isset($token['refreshToken']) ? $token['refreshToken'] : null, isset($token['macKey']) ? $token['macKey'] : null, isset($token['macAlgorithm']) ? $token['macAlgorithm'] : null);
}
// 获得保存的token
$this->renn->authWithToken($token);
... ... @@ -178,7 +178,7 @@ class Call extends Factory
{
if (is_array($token))
{
$token = new AccessToken(isset($token['type']) ? $token['type'] : TokenType::Bearer, $token['accessToken'], isset($token['refreshToken']) ? $token['refreshToken'] : null, isset($token['macKey']) ? $token['macKey'] : null, isset($token['macAlgorithm']) ? $token['macAlgorithm'] : null);
$token = new \AccessToken(isset($token['type']) ? $token['type'] : \TokenType::Bearer, $token['accessToken'], isset($token['refreshToken']) ? $token['refreshToken'] : null, isset($token['macKey']) ? $token['macKey'] : null, isset($token['macAlgorithm']) ? $token['macAlgorithm'] : null);
}
// 获得保存的token
$this->renn->authWithToken($token);
... ...
... ... @@ -191,7 +191,7 @@ function reMarginFooter(fixedElement) {
a.async = 1;
a.src = j;
m.parentNode.insertBefore(a, m);
})(window, document, 'script', 'http://cdn.yoho.cn/yas-jssdk/1.0.13.6.3/yas.js', '_yas');
})(window, document, 'script', 'http://cdn.yoho.cn/yas-jssdk/1.0.14/yas-debug.js', '_yas');
(function() {
var uid = getUid();
... ... @@ -201,7 +201,7 @@ function reMarginFooter(fixedElement) {
window._ozuid = uid;//暴露ozuid
if (window._yas) {
window._yas(1 * new Date(), '1.0.13.6.3', 'yohobuy_m', uid, '', '');
window._yas(1 * new Date(), '1.0.14', 'yohobuy_m', uid, '', '');
}
}());
... ...
... ... @@ -238,16 +238,16 @@ function search(opt) {
if (window._yas) {
switch (navType) {
case 'newest':
window._yas(1 * new Date(), '1.0.13.6.3', 'yohobuy_m', window._ozuid,
'', '.new-goods .good-info .good-detail-img .good-thumb');
window._yas(1 * new Date(), '1.0.14', 'yohobuy_m', window._ozuid,
'', $('.new-goods .good-info .good-detail-img .good-thumb'));
break;
case 'price':
window._yas(1 * new Date(), '1.0.13.6.3', 'yohobuy_m', window._ozuid,
'', '.price-goods .good-info .good-detail-img .good-thumb');
window._yas(1 * new Date(), '1.0.14', 'yohobuy_m', window._ozuid,
'', $('.price-goods .good-info .good-detail-img .good-thumb'));
break;
case 'discount':
window._yas(1 * new Date(), '1.0.13.6.3', 'yohobuy_m', window._ozuid,
'', '.discount-goods .good-info .good-detail-img .good-thumb');
window._yas(1 * new Date(), '1.0.14', 'yohobuy_m', window._ozuid,
'', $('.discount-goods .good-info .good-detail-img .good-thumb'));
break;
}
}
... ...
... ... @@ -8,8 +8,8 @@
<li class="head-title">验证身份</li>
<li class="po-re">
<label class="pn-label">手机号码</label>
<span class="country-code">+86</span>
<span class="phone-num">18115624066</span>
<span class="country-code">+{{area}}</span>
<span class="phone-num">{{phoneNum}}</span>
</li>
<li class="po-re">
<input id="captcha" class="input va captcha" type="text" name="captcha">
... ... @@ -21,8 +21,8 @@
</span>
</li>
<li>
<input name="area" id="area" type="hidden" value="86">
<input name="mobile" id="mobile" type="hidden" value="18115624066">
<input name="area" id="area" type="hidden" value="{{area}}">
<input name="mobile" id="mobile" type="hidden" value="{{phoneNum}}">
<input name="captchaPic" id="captchaPic" type="hidden" value="g7ce">
<input name="refer" id="refer" type="hidden" value="">
<input id="next-step" class="btn next-step disable" type="submit" value="下一步" disabled="">
... ...
... ... @@ -34,31 +34,7 @@
{{> product/left-content}}
</div>
<div class="list-right pull-right">
{{# shopEntry}}
<div class="shop-entry clearfix">
<a class="pull-left" href="{{home}}">
<img class="logo" src="{{logo}}">
</a>
<div class="name pull-left">
<a class="shop-name" href="{{home}}">{{shopName}}</a>
<p class="sorts">
{{#each sort}}
<a href="{{href}}">{{name}}</a>
{{#unless @last}}
/
{{/unless}}
{{/each}}
</p>
</div>
<a class="entry-btn pull-right" href="{{home}}">
进入品牌店铺
<span class="iconfont">&#xe601;</span>
</a>
</div>
{{/ shopEntry}}
{{> product/shop-entry}}
{{> product/standard-content}}
... ... @@ -68,4 +44,4 @@
</div>
{{/ list}}
</div>
{{> layout/footer}}
\ No newline at end of file
{{> layout/footer}}
... ...
... ... @@ -3,9 +3,11 @@
{{# search}}
{{> layout/path-nav}}
{{> product/shop-entry}}
{{> product/standard-content}}
{{> product/latest-walk}}
{{/ search}}
</div>
{{> layout/footer}}
\ No newline at end of file
{{> layout/footer}}
... ...
{{> layout/header}}
<div class="new-sale-page product-page yoho-page">
{{# newSale}}
{{# saleBanner}}
<div class="banner-img" style="height: {{bannerHeight}}px;background:url({{img}}) no-repeat top center;"></div>
{{/ saleBanner}}
<div class="center-content clearfix">
{{> layout/path-nav}}
{{# saleTitle}}
<div class="header-title">
{{name}}
<p class="line-through"></p>
<p class="count-wrap">
<span class="count">共{{count}}个结果</span>
</p>
</div>
{{/ saleTitle}}
<div class="list-left pull-left">
{{> product/left-content}}
</div>
<div class="list-right pull-right">
{{# newMain}}
<div class="new-banner">
<a href="{{bannerHref}}">
<img src="{{banner}}">
</a>
</div>
<div class="new-brands clearfix">
<span class="iconfont pre">&#xe607;</span>
<div class="brands-wrap">
<ul class="brands">
{{# brands}}
<li>
<a href="{{href}}">
<img src="{{logo}}">
</a>
</li>
{{/ brands}}
</ul>
</div>
<span class="iconfont next">&#xe608;</span>
</div>
<div class="new-floor-title">
<span class="date">{{date}}</span>
<span class="title">{{title}}</span>
</div>
{{/ newMain}}
{{> product/standard-content}}
</div>
</div>
{{/ newSale}}
</div>
{{> layout/footer}}
\ No newline at end of file
... ...
{{> layout/header}}
<div class="product-search-page product-page yoho-page center-content">
{{# search}}
{{> layout/path-nav}}
{{> product/shop-entry}}
{{> product/standard-content}}
{{> product/latest-walk}}
{{/ search}}
</div>
{{> layout/footer}}
... ...
... ... @@ -12,7 +12,18 @@
<!-- [if (gte IE 6)&(lte IE 8)>
<script src="http://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" href="http://webstatic.dev.yohobuy.com/css/index.css">
{{#if rlsEnv}}
<link rel="stylesheet" href="http://cdn.yoho.cn/yohobuy/{{version}}/index.css">
{{/if}}
{{#if preEnv}}
<link rel="stylesheet" href="http://cdn.yoho.cn/yohobuy/{{version}}/index.css">
{{/if}}
{{#if testEnv}}
<link rel="stylesheet" href="http://static.buy.test.yoho.cn/dist/yohobuy/{{version}}/index.css">
{{/if}}
{{#if devEnv}}
<link rel="stylesheet" href="http://webstatic.dev.yohobuy.com/css/index.css">
{{/if}}
</head>
<body>
{{# simpleHeader}}
... ...
{{# shopEntry}}
<div class="shop-entry clearfix">
<a class="pull-left" href="{{home}}">
<img class="logo" src="{{logo}}">
</a>
<div class="name pull-left">
<a class="shop-name" href="{{home}}">{{shopName}}</a>
<p class="sorts">
{{#each sort}}
<a href="{{href}}">{{name}}</a>
{{#unless @last}}
/
{{/unless}}
{{/each}}
</p>
</div>
<a class="entry-btn pull-right" href="{{home}}">
进入品牌店铺
<span class="iconfont">&#xe601;</span>
</a>
</div>
{{/ shopEntry}}
... ...
... ... @@ -3990,14 +3990,30 @@ validateResult = [
];
//手机号ajax校验
function phoneAjaxFn(callback) {
$.ajax({
url: '/passport/register/checkmobile',
type: 'POST',
data: {
function phoneAjaxFn(page, callback) {
var url,
data;
if (page === 'reg') {
url = '/passport/register/checkmobile';
data = {
mobile: $pn.val(),
area: $region.text().split('+')[1]
}
};
} else if (page === 'third') {
url = '/passport/autouserinfo/bindCheck';
data = {
mobile: $pn.val(),
area: $region.text().split('+')[1],
openId: 1,
sourceType: 'QQ'
};
}
$.ajax({
url: url,
type: 'POST',
data: data
}).then(function(data) {
switch (data.code) {
case 200:
... ... @@ -4015,10 +4031,17 @@ function phoneAjaxFn(callback) {
}
//图形验证码ajax校验
function picCaptchaAjaxFn(callback) {
function picCaptchaAjaxFn(page, callback) {
var url;
if (page === 'reg') {
url = '/passport/register/piccaptcha';
} else if (page === 'third') {
url = '/passport/autouserinfo/checkPicCode';
}
$.ajax({
type: 'POST',
url: '/passport/register/piccaptcha',
url: url,
data: {
code: $ca.val(),
mobile: $pn.val(),
... ... @@ -4030,7 +4053,7 @@ function picCaptchaAjaxFn(callback) {
validateResult[1].message = '';
validateResult[1].status = true;
break;
case 404:
case 400:
validateResult[1].message = '图形验证码错误';
validateResult[1].status = false;
break;
... ... @@ -4040,10 +4063,17 @@ function picCaptchaAjaxFn(callback) {
}
//短信验证码ajax校验
function msgCaptchaAjaxFn(callback) {
function msgCaptchaAjaxFn(page, callback) {
var url;
if (page === 'reg') {
url = '/passport/register/msgcaptcha';
} else if (page === 'third') {
url = '/passport/autouserinfo/checkBindMsg';
}
$.ajax({
type: 'POST',
url: '/passport/register/msgcaptcha',
url: url,
data: {
code: $ca.val(),
mobile: $pn.val(),
... ... @@ -4055,7 +4085,7 @@ function msgCaptchaAjaxFn(callback) {
validateResult[2].message = '';
validateResult[2].status = true;
break;
case 404:
case 400:
validateResult[2].message = '短信验证码错误';
validateResult[2].status = false;
break;
... ... @@ -4066,7 +4096,7 @@ function msgCaptchaAjaxFn(callback) {
}
// 验证
function validateRule($element, callback) {
function validateRule(page, $element, callback) {
var val = $.trim($element.val()),
regionCode;
... ... @@ -4088,7 +4118,7 @@ function validateRule($element, callback) {
callback();
} else {
phoneAjaxFn(callback);
phoneAjaxFn(page, callback);
}
//图形验证码校验
... ... @@ -4107,7 +4137,7 @@ function validateRule($element, callback) {
// 并且手机号正确
if (validateResult[0].status) {
picCaptchaAjaxFn(callback);
picCaptchaAjaxFn(page, callback);
} else {
validateResult[1].message = '图形验证码错误';
validateResult[1].status = false;
... ... @@ -4133,7 +4163,7 @@ function validateRule($element, callback) {
// 并且图形验证码正确
if (validateResult[1].status) {
msgCaptchaAjaxFn(callback);
msgCaptchaAjaxFn(page, callback);
} else {
validateResult[2].message = '短信验证码错误';
validateResult[2].status = false;
... ... @@ -4286,143 +4316,172 @@ function pwdFn($obj) {
// 失去焦点时开始校验
// Tips: 不可以在获得焦点的时候验证,获得焦点和失去焦点的间隔太小,如果中间存在ajax校验的话会出现问题
$registerPage.find('.va').keyup(function() {
// ( ▼-▼ )注册页和信息完善页面接口不同
exports.init = function(page) {
$registerPage.find('.va').keyup(function() {
var j,
statusLen = 0,
vLen = validateResult.length,
$that = $(this);
var j,
statusLen = 0,
vLen = validateResult.length,
$that = $(this);
validateRule($(this), function() {
showErrTip(); // 显示错误提示
showBorder(); // 显示红色边框
validateRule(page, $(this), function() {
showErrTip(); // 显示错误提示
showBorder(); // 显示红色边框
// 如果validateResult中有4个status为true表示验证通过
for (j = 0; j < vLen; j++) {
// 如果validateResult中有4个status为true表示验证通过
for (j = 0; j < vLen; j++) {
if (validateResult[j].status) {
if (validateResult[j].status) {
statusLen++;
}
}
if (statusLen === 4 && $('#agree-terms').is(':checked')) {
$registerBtn.removeClass('disable').removeAttr('disabled');
} else {
$registerBtn.addClass('disable').attr('disabled', 'true');
}
statusLen++;
}
// 图形验证通过时,发送短信按钮可点击
if (validateResult[1].status) {
$sendCaptcha.removeClass('disable');
} else {
$sendCaptcha.addClass('disable');
}
}
//图形验证通过时,发送短信按钮可点击 end
if (statusLen === 4 && $('#agree-terms').is(':checked')) {
$registerBtn.removeClass('disable').removeAttr('disabled');
} else {
$registerBtn.addClass('disable').attr('disabled', 'true');
}
});
// 图形验证通过时,发送短信按钮可点击
if (validateResult[1].status) {
$sendCaptcha.removeClass('disable');
} else {
$sendCaptcha.addClass('disable');
}
// 如果是密码则校验强度
if (($that).hasClass('pwd')) {
pwdFn($that);
}
//图形验证通过时,发送短信按钮可点击 end
}).blur(function() {
});
/*validateRule($(this), function() {
showErrTip();
showBorder(); // 显示红色边框
});*/
});
// 如果是密码则校验强度
if (($that).hasClass('pwd')) {
pwdFn($that);
}
$regionSelect.change(function() {
}).blur(function() {
$region.text('+' + $('#region').val());
/*validateRule($(this), function() {
showErrTip();
showBorder(); // 显示红色边框
});*/
});
validateRule($pn, showErrTip); //验证
});
$regionSelect.change(function() {
// 点击发送验证码
$sendCaptcha.click(function() {
var timeResidue = 10,
t;
$region.text('+' + $('#region').val());
if ($(this).hasClass('disable')) {
return;
}
validateRule(page, $pn, showErrTip); //验证
});
//todo ajax
// 点击发送验证码
$sendCaptcha.click(function() {
var timeResidue = 20,
t,
url;
t = setInterval(function() {
if (timeResidue <= 0) {
$sendCaptcha.removeClass('disable').val('获取短信验证码');
clearInterval(t);
if ($(this).hasClass('disable')) {
return;
}
$sendCaptcha.addClass('disable').val(timeResidue-- + '秒可重新发送');
}, 1000);
});
//form表单提交
$registerBtn.click(function() {
if ($(this).hasClass('disable')) {
return;
} else {
if (page === 'reg') {
url = '/passport/register/sendBindMsg';
} else if (page === 'third') {
url = '/passport/autouserinfo/sendBindMsg';
}
//ajax提交
//todo ajax 发送验证码
$.ajax({
type: 'POST',
url: '/passport/register/mobileregister',
url: url,
data: {
area: $region.text().split('+')[1],
mobile: $pn.val(),
captcha: $ca.val(),
code: $mc.val(),
password: $pwd.val()
code: $ca.val()
}
}).then(function(data) {
if (data.code === 200) {
t = setInterval(function() {
if (timeResidue <= 0) {
$sendCaptcha.removeClass('disable').val('获取短信验证码');
clearInterval(t);
return;
}
$sendCaptcha.addClass('disable').val(timeResidue-- + '秒可重新发送');
}, 1000);
}
});
});
//ajax表单提交
$registerBtn.click(function() {
var time = 0,
t,
refer = data.href;
var url;
t = setTimeout(function() {
time++;
}, 1000);
if (page === 'reg') {
url = '/passport/register/mobileregister';
} else if (page === 'third') {
url = '/passport/autouserinfo/bindMobile';
}
if ($(this).hasClass('disable')) {
return;
} else {
//ajax提交
$.ajax({
type: 'POST',
url: '/passport/register/mobileregister',
url: url,
data: {
session: data.session
area: $region.text().split('+')[1],
mobile: $pn.val(),
captcha: $ca.val(),
code: $mc.val(),
password: $pwd.val()
}
}).then(function(data) {
if (data.code === 200 && t < 3) {
var time = 0,
t,
refer = data.href;
t = setTimeout(function() {
time++;
}, 1000);
$.ajax({
type: 'POST',
url: '/passport/register/mobileregister',
data: {
session: data.session
}
}).then(function(data) {
if (data.code === 200 && t < 3) {
clearInterval(t);
location.href = refer;
}
});
if (t >= 3) {
clearInterval(t);
location.href = refer;
}
});
if (t >= 3) {
clearInterval(t);
location.href = refer;
}
});
}
});
});
}
});
$('.change-captcha').click(function() {
var time = new Date(),
$captchaImg = $('.captcha-img'),
captchaImgSrc = $captchaImg.attr('src').split('?')[0];
$('.change-captcha').click(function() {
var time = new Date(),
$captchaImg = $('.captcha-img'),
captchaImgSrc = $captchaImg.attr('src').split('?')[0];
$captchaImg.attr('src', captchaImgSrc + '?t=' + time.getTime());
});
$captchaImg.attr('src', captchaImgSrc + '?t=' + time.getTime());
});
};
});
define("js/passport/mail-phone-regx", [], function(require, exports, module){
/**
... ... @@ -4795,265 +4854,290 @@ $('#find-btn').click(function(e) {
});
});
define("js/passport/login", ["jquery","jquery.placeholder"], function(require, exports, module){
/**
* 登录
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/12/11
*/
var $ = require("jquery");
var mailPostfix = {
num: ['qq.com', '163.com', '126.com', 'sina.com', 'gmail.com', 'sohu.com', 'hotmail.com', '139.com', '189.com'],
other: ['gmail.com', 'qq.com', '163.com', '126.com', 'sina.com', 'sohu.com', 'hotmail.com', '139.com', '189.com']
};
var $account = $('#account'),
$password = $('#password');
var $accountTip = $account.siblings('.err-tip'),
$passwordTip = $password.siblings('.err-tip'),
$capsLock = $('#caps-lock');
var $countryCodeHide = $('#country-code-hide'),
$countryCodeEm = $('#country-code > em'),
$countryList = $('#country-list');
var $emailAutoComplete = $('#email-autocomplete');
var mailPhoneRegx = require("js/passport/mail-phone-regx");
//checkbox status unicode
var checkbox = {
checked: '&#xe612;',
unchecked: '&#xe613;'
};
var emailAcTime;
require("jquery.placeholder");
//验证账户名
function validateAccount() {
var pass = false,
account = $.trim($account.val()),
err;
if (account !== '') {
if (/^[0-9]+$/.test(account)) {
//如果是纯数字,则作为手机号码处理
if (mailPhoneRegx.phoneRegx['+' + $countryCodeHide.val()].test(account)) {
pass = true;
} else {
pass = false;
err = '手机号码不正确,请重新输入';
}
} else {
if (mailPhoneRegx.emailRegx.test(account)) {
pass = true;
} else {
pass = false;
err = '邮箱格式不正确,请重新输入';
}
}
} else {
err = '请输入账户名';
}
if (pass) {
$accountTip.addClass('hide');
$account.removeClass('error');
} else {
$accountTip.removeClass('hide').children('em').text(err);
$account.addClass('error');
}
return pass;
}
//验证密码
function validatePassword() {
var pass = false,
password = $.trim($password.val()),
err;
if (password !== '') {
if (password.length < 6) {
err = '请输入长度为6-20字符的密码';
} else {
pass = true;
}
} else {
err = '请输入密码';
}
if (pass) {
$passwordTip.addClass('hide');
$password.removeClass('error');
} else {
$passwordTip.removeClass('hide').children('em').text(err);
$password.addClass('error');
}
}
//验证
function validate() {
var pass = true,
account = $.trim($account.val()),
password = $.trim($password.val());
if (account !== '') {
pass = validateAccount() && validatePassword();
} else {
pass = false;
$account.addClass('error');
if (password === '') {
//账户名和密码都为空的情况下点击登陆,只在账户输入框后显示错误提示
$accountTip.addClass('both-error').removeClass('hide').children('em').text('请输入账户名和密码');
$passwordTip.addClass('hide');
$password.addClass('error');
} else {
$accountTip.removeClass('hide').children('em').text('请输入账户名');
}
}
return pass;
}
$('[placeholder]').placeholder();
//展开地区列表
$('#country-code').on('click', function() {
if ($countryList.css('display') === 'none') {
$countryList.slideDown();
}
});
//选中地区列表项
$countryList.on('click', 'li', function() {
var $this = $(this),
cc = $this.data('cc');
$countryCodeEm.html($this.html());
$countryCodeHide.val(cc);
$countryList.slideUp();
});
//点击其他区域,收起区域列表
$(document).on('click', function(e) {
if ($(e.target).closest('#country-code').length > 0) {
return;
}
if ($countryList.css('display') === 'block') {
$countryList.slideUp();
}
});
//邮箱
$account.on('keyup', function() {
var account = $.trim($(this).val()),
html = '',
accountMatch,
matchStr,
postfix,
i;
//输入@时自动补全邮箱后缀
//此处>0非错误,用于避免输入的第一个字符为@被识别为邮箱
if (account.indexOf('@') > 0) {
accountMatch = account.match(/^[0-9]+@(.*)/);
if (accountMatch) {
//数字邮箱补全
postfix = mailPostfix.num;
} else {
postfix = mailPostfix.other;
}
matchStr = accountMatch[1];
for (i = 0; i < postfix.length; i++) {
if (postfix[i].indexOf(matchStr) > -1) {
html += '<li>' + account.slice(0, account.indexOf('@')) + '@' + postfix[i] + '</li>';
}
}
if (html !== '') {
$emailAutoComplete.html(html).removeClass('hide');
} else {
//隐藏autocomplete
$emailAutoComplete.html('').addClass('hide');
}
}
}).on('blur', function() {
emailAcTime = setTimeout(function() {
$emailAutoComplete.addClass('hide');
//验证
validateAccount();
}, 200);
});
//密码
$password.on('blur', function() {
validatePassword();
}).on('keypress', function(e) {
var code = e.which,
isShift = e.shiftKey || (code === 16) || false;
//CapsLock检测
if ((!isShift && (code >= 65 && code <= 90)) ||
(isShift && (code >= 97 && code <= 122))) {
$capsLock.removeClass('hide');
return;
}
$capsLock.addClass('hide');
});
//邮箱自动完成列表项点击
$emailAutoComplete.on('click', 'li', function() {
clearTimeout(emailAcTime); //清空默认关闭
$account.val($(this).text()).focus();
$emailAutoComplete.addClass('hide');
});
//记住登录状态
$('.remeber-me').on('click', function() {
var $this = $(this);
$this.toggleClass('checked');
if ($this.hasClass('checked')) {
$this.children('i').html(checkbox.checked);
} else {
$this.children('i').html(checkbox.unchecked);
}
});
//focus到输入框则隐藏错误提示和样式
$('.va').on('focus', function() {
var $this = $(this);
$this.removeClass('error');
$this.siblings('.err-tip').addClass('hide');
});
//登录
$('#login-btn').on('click', function() {
var pass = validate();
if (pass) {
$('#login-form').submit();
}
/**
* 登录
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/12/11
*/
var $ = require("jquery");
var mailPostfix = {
num: ['qq.com', '163.com', '126.com', 'sina.com', 'gmail.com', 'sohu.com', 'hotmail.com', '139.com', '189.com'],
other: ['gmail.com', 'qq.com', '163.com', '126.com', 'sina.com', 'sohu.com', 'hotmail.com', '139.com', '189.com']
};
var $account = $('#account'),
$password = $('#password');
var $accountTip = $account.siblings('.err-tip'),
$passwordTip = $password.siblings('.err-tip'),
$capsLock = $('#caps-lock');
var $countryCodeHide = $('#country-code-hide'),
$countryCodeEm = $('#country-code > em'),
$countryList = $('#country-list');
var $emailAutoComplete = $('#email-autocomplete');
var mailPhoneRegx = require("js/passport/mail-phone-regx");
//checkbox status unicode
var checkbox = {
checked: '&#xe612;',
unchecked: '&#xe613;'
};
var authing = false;
var emailAcTime;
require("jquery.placeholder");
//验证账户名
function validateAccount() {
var pass = false,
account = $.trim($account.val()),
err;
if (account !== '') {
if (/^[0-9]+$/.test(account)) {
//如果是纯数字,则作为手机号码处理
if (mailPhoneRegx.phoneRegx[$countryCodeHide.val()].test(account)) {
pass = true;
} else {
pass = false;
err = '手机号码不正确,请重新输入';
}
} else {
if (mailPhoneRegx.emailRegx.test(account)) {
pass = true;
} else {
pass = false;
err = '邮箱格式不正确,请重新输入';
}
}
} else {
err = '请输入账户名';
}
if (pass) {
$accountTip.addClass('hide');
$account.removeClass('error');
} else {
$accountTip.removeClass('hide').children('em').text(err);
$account.addClass('error');
}
return pass;
}
//验证密码
function validatePassword() {
var pass = false,
password = $.trim($password.val()),
err;
if (password !== '') {
if (password.length < 6) {
err = '请输入长度为6-20字符的密码';
} else {
pass = true;
}
} else {
err = '请输入密码';
}
if (pass) {
$passwordTip.addClass('hide');
$password.removeClass('error');
} else {
$passwordTip.removeClass('hide').children('em').text(err);
$password.addClass('error');
}
return pass;
}
//验证
function validate() {
var pass = true,
account = $.trim($account.val()),
password = $.trim($password.val());
if (account !== '') {
pass = validateAccount() && validatePassword();
} else {
pass = false;
$account.addClass('error');
if (password === '') {
//账户名和密码都为空的情况下点击登陆,只在账户输入框后显示错误提示
$accountTip.addClass('both-error').removeClass('hide').children('em').text('请输入账户名和密码');
$passwordTip.addClass('hide');
$password.addClass('error');
} else {
$accountTip.removeClass('hide').children('em').text('请输入账户名');
}
}
return pass;
}
$('[placeholder]').placeholder();
//展开地区列表
$('#country-code').on('click', function() {
if ($countryList.css('display') === 'none') {
$countryList.slideDown();
}
});
//选中地区列表项
$countryList.on('click', 'li', function() {
var $this = $(this),
cc = $this.data('cc');
$countryCodeEm.html($this.html());
$countryCodeHide.val(cc);
$countryList.slideUp();
});
//点击其他区域,收起区域列表
$(document).on('click', function(e) {
if ($(e.target).closest('#country-code').length > 0) {
return;
}
if ($countryList.css('display') === 'block') {
$countryList.slideUp();
}
});
//邮箱
$account.on('keyup', function() {
var account = $.trim($(this).val()),
html = '',
accountMatch,
matchStr,
postfix,
i;
//输入@时自动补全邮箱后缀
//此处>0非错误,用于避免输入的第一个字符为@被识别为邮箱
if (account.indexOf('@') > 0) {
accountMatch = account.match(/^[0-9]+@(.*)/);
if (accountMatch) {
//数字邮箱补全
postfix = mailPostfix.num;
} else {
postfix = mailPostfix.other;
}
matchStr = accountMatch[1];
for (i = 0; i < postfix.length; i++) {
if (postfix[i].indexOf(matchStr) > -1) {
html += '<li>' + account.slice(0, account.indexOf('@')) + '@' + postfix[i] + '</li>';
}
}
if (html !== '') {
$emailAutoComplete.html(html).removeClass('hide');
} else {
//隐藏autocomplete
$emailAutoComplete.html('').addClass('hide');
}
}
}).on('blur', function() {
emailAcTime = setTimeout(function() {
$emailAutoComplete.addClass('hide');
//验证
validateAccount();
}, 200);
});
//密码
$password.on('blur', function() {
validatePassword();
}).on('keypress', function(e) {
var code = e.which,
isShift = e.shiftKey || (code === 16) || false;
//CapsLock检测
if ((!isShift && (code >= 65 && code <= 90)) ||
(isShift && (code >= 97 && code <= 122))) {
$capsLock.removeClass('hide');
return;
}
$capsLock.addClass('hide');
});
//邮箱自动完成列表项点击
$emailAutoComplete.on('click', 'li', function() {
clearTimeout(emailAcTime); //清空默认关闭
$account.val($(this).text()).focus();
$emailAutoComplete.addClass('hide');
});
//记住登录状态
$('.remeber-me').on('click', function() {
var $this = $(this);
$this.toggleClass('checked');
if ($this.hasClass('checked')) {
$this.children('i').html(checkbox.checked);
} else {
$this.children('i').html(checkbox.unchecked);
}
});
//focus到输入框则隐藏错误提示和样式
$('.va').on('focus', function() {
var $this = $(this);
$this.removeClass('error');
$this.siblings('.err-tip').addClass('hide');
});
//登录
$('#login-btn').on('click', function() {
var pass = validate();
if (pass && authing === false) {
authing = true;
$.ajax({
url: '/passport/login/auth',
type: 'POST',
data: {
areaCode: $countryCodeHide.val().replace('+', ''),
account: $.trim($account.val()),
password: $.trim($password.val())
},
success: function(data) {
if (data.code === 400) {
$passwordTip.removeClass('hide').children('em').text(data.message);
$password.addClass('error');
return;
} else {
location.href = data.data.href;
}
},
complete: function() {
authing = false;
}
});
}
});
});
define("js/passport/reset", ["jquery","jquery.placeholder"], function(require, exports, module){
... ...
This diff could not be displayed because it is too large.
... ... @@ -136,9 +136,10 @@ function picCaptchaAjaxFn(page, callback) {
type: 'POST',
url: url,
data: {
code: $ca.val(),
mobile: $pn.val(),
area: $region.text().split('+')[1]
code: $ca.val()
//mobile: $pn.val(),
//area: $region.text().split('+')[1]
}
}).then(function(data) {
switch (data.code) {
... ... @@ -530,7 +531,7 @@ exports.init = function(page) {
data: {
area: $region.text().split('+')[1],
mobile: $pn.val(),
captcha: $ca.val(),
verifyCode: $ca.val(),
code: $mc.val(),
password: $pwd.val()
}
... ... @@ -538,29 +539,35 @@ exports.init = function(page) {
var time = 0,
t,
refer = data.href;
refer;
t = setTimeout(function() {
time++;
}, 1000);
if (data.code === 200) {
$.ajax({
type: 'POST',
url: '/passport/register/mobileregister',
data: {
session: data.session
}
}).then(function(data) {
refer = data.data.href;
t = setTimeout(function() {
time++;
}, 1000);
$.ajax({
type: 'GET',
url: data.data.session
}).then(function(data) {
if (data.code === 200 && t < 3) {
clearInterval(t);
location.href = refer;
}
});
if (data.code === 200 && t < 3) {
if (t >= 3) {
clearInterval(t);
location.href = refer;
}
});
} else {
if (t >= 3) {
clearInterval(t);
location.href = refer;
//todo
console.log('网络超时~');
}
});
... ...
... ... @@ -149,66 +149,5 @@
}
}
.shop-entry {
position: relative;
background: #f5f7f6;
border: 1px solid #eaeceb;
padding: 12px 15px;
margin-bottom: 10px;
.logo {
width: 80px;
height: 50px;
}
.name {
margin-left: 10px;
}
.shop-name {
font-size: 16px;
color: #222;
line-height: 26px;
}
.sorts {
color: #999;
font-size: 12px;
line-height: 18px;
a {
color: #999;
}
}
.entry-btn {
position: absolute;
right: 15px;
top: 50%;
width: 110px;
height: 32px;
line-height: 32px;
margin-top: -16px;
background: #222;
text-align: center;
color: #fff;
font-size: 12px;
.iconfont {
font-size: 12px;
}
}
}
.goods-container {
height: auto;
padding: 25px 0 0 0;
position: relative;
width: 970px + 10px;//每列增加右边距
.good-info {
width: 235px;
}
}
}
\ No newline at end of file
@import "shop-entry";
}
... ...
... ... @@ -13,6 +13,8 @@
position: relative;
width: 1150px + 10px;//每列增加右边距
}
@import "shop-entry";
}
... ... @@ -40,4 +42,4 @@
}
}
}
}
\ No newline at end of file
}
... ...
.shop-entry {
position: relative;
background: #f5f7f6;
border: 1px solid #eaeceb;
padding: 12px 15px;
margin-bottom: 10px;
.logo {
width: 80px;
height: 50px;
}
.name {
margin-left: 10px;
}
.shop-name {
font-size: 16px;
color: #222;
line-height: 26px;
}
.sorts {
color: #999;
font-size: 12px;
line-height: 18px;
a {
color: #999;
}
}
.entry-btn {
position: absolute;
right: 15px;
top: 50%;
width: 110px;
height: 32px;
line-height: 32px;
margin-top: -16px;
background: #222;
text-align: center;
color: #fff;
font-size: 12px;
.iconfont {
font-size: 12px;
}
}
}
.goods-container {
height: auto;
padding: 25px 0 0 0;
position: relative;
width: 970px + 10px;//每列增加右边距
.good-info {
width: 235px;
}
}
... ...
... ... @@ -28,7 +28,7 @@ class HomeModel
/* 女生楼层资源的位置码 */
const CODE_FLOOR_GIRLS = '189b6686065dbd6755dd6906cf03c002';
/* 潮童楼层资源的位置码 */
const CODE_FLOOR_KIDS = 'b8c1bff53d4ea60f978926d538620636'; // '66cad79d93e055ad6fc5c8744086066d';
const CODE_FLOOR_KIDS = '66cad79d93e055ad6fc5c8744086066d'; // 'b8c1bff53d4ea60f978926d538620636';
/* 创意生活楼层资源的位置码 */
const CODE_FLOOR_LIFESTYLE = '61cd852c6afcf60660196154f66a3a62';
... ...
... ... @@ -73,7 +73,7 @@ class Bootstrap extends Bootstrap_Abstract
$action = 'Index';
// 二级域名
if (2 === $level) {
if (3 === $level) {
$subDomain = strval($hostParts[0]);
switch (strtolower($subDomain)) {
case 'www': // 主站
... ...
... ... @@ -28,8 +28,7 @@ class BrandsModel {
* @param $options array
* @return array
*/
public static function getBrandSearchData($condition, $options, $domain, $uid, $brandId) {
public static function getBrandSearchData($condition, $options, $domain, $uid, $brandId,$node) {
// 调用商品搜索接口
$data = SearchData::searchElasticByCondition($condition);
... ... @@ -68,9 +67,16 @@ class BrandsModel {
//获取品牌系列数据
$adNav = self::getAdNav($condition['brand']);
$data['list']['leftContent'][] = array('picLink' => $adNav);
//获取静态内容(20141219-100447)
if($node){
$nodeContent = HelperSearch::formatNodeContent($node);
$data['list']['leftContent'][]['picLink']['list'] = $nodeContent;
}
return $data;
}
/**
* 获取品牌首页banner条
... ... @@ -89,52 +95,29 @@ class BrandsModel {
$bannerImg = Helpers::getImageUrl($bannerImg['data']['banner'], '', 150);
}
// 根据品牌Id获取品牌(简介)、收藏
if (isset($uid)) {
$intro = BrandData::getBrandIntro($brandId, $uid);
}
$intro = BrandData::getBrandIntro($brandId, $uid);
$is_favorite = false;
$logo = false;
$shopName = false;
do {
if (!isset($intro['data'])) {
break;
}
if(isset($intro['data'])){
// 获取是否收藏
if ($intro['data']['is_favorite'] == 'Y') {
$is_favorite = true;
} elseif ($intro['data']['is_favorite'] == 'N') {
$is_favorite = false;
}
// 获取品牌logo
$logo = Helpers::getImageUrl($intro['data']['brand_ico'], 80, 50);
// 获取品牌名
self::$shopName = $intro['data']['brand_name'];
} while (false);
self::$shopName = $intro['data']['brand_name'];
}
// 返回banner数据
return array(
'brandBanner' => array(
'bannerHeight' => '150',
'coled' => $is_favorite,
'banner' => $bannerImg
),
'shopEntry' => array(
'home' => self::$home,
'logo' => $logo,
'shopName' => self::$shopName,
'sort' => array(
array(
'href' => '',
'name' => 'T恤'
),
array(
'href' => '',
'name' => '卫衣'
)
)
)
);
'brandBanner' => array(
'bannerHeight' => '150',
'coled' => $is_favorite,
'banner' => $bannerImg
)
);
}
//获取品牌系列数据
... ... @@ -148,6 +131,8 @@ class BrandsModel {
$result['list'][$key]['src'] = $value['brand_sort_ico'];
}
}
$result['picTitle'] = '经典系列';
return $result;
}
... ...
<?php
namespace Product;
use LibModels\Wap\Product\SearchData;
use LibModels\Web\Product\SearchData as WebProduct;
use Plugin\HelperSearch;
use Plugin\Images;
/**
* sale首页模板数据模型
*
*/
class SaleModel
{
public static function getSaleSearchData($params, $options, $specialInfo)
{
$data = SearchData::searchElasticByCondition($params);
if (isset($data['code']) && $data['code'] === 200) {
//获取分类列表数据
$classes = WebProduct::getClassesData();
if (isset($classes['code']) && $classes['code'] === 200) {
$data['data']['filter']['group_sort'] = $classes['data']['sort'];
}
//用户浏览记录
// 组织模板数据
$list = HelperSearch::getList($data, $options);
//删除面包屑导航数据
unset($list['pathNav']);
$data = array(
//初始化js
'productListPage' => true,
'newSale' => $list
);
} else {
$data = array();
}
//组织sale数据
if (isset($specialInfo['data']) && !empty($specialInfo['data']['banner_img'])) {
$banner = json_decode($specialInfo['data']['banner_img'], true);
foreach ($banner as $k => $v) {
$v['img'] = Images::getSourceUrl($v['img'], 'couponImg');
$specialInfo['data']['banner'][] = $v;
}
$special = $specialInfo['data'];
}
//Sale首页 banner数据
$data['newSale']['saleBanner']['bannerHeight'] = $special['banner'][0]['height'];
$data['newSale']['saleBanner']['img'] = $special['banner'][0]['img'];
$data['newSale']['saleTitle']['name'] = '全部商品';
$data['newSale']['saleTitle']['count'] = $data['newSale']['totalCount'];
//获取广告位数据
$nodeContent = HelperSearch::formatNodeContent($special['left_ad_code']);
$data['newSale']['leftContent'][]['picLink']['list'] = $nodeContent;
return $data;
}
}
... ...
... ... @@ -49,17 +49,38 @@ class SearchModel
//用户浏览记录
$result['data']['filter']['review'] = SearchData::getRecentReview();
// 组织模板数据
$list = HelperSearch::getList($result, $options);
$data = array(
//初始化js
'productListPage' => true,
'list' => $list
);
$data = HelperSearch::getList($result, $options);
}
return $data;
}
/**
* 搜索页面获取搜索数据
* @param $condition
* @param $options
* @return array
*/
public static function searchData($condition, $options){
$data = self::getSearchData($condition, $options);
//获取品牌店铺信息
if (isset($condition['query'])) {
$param['keyword'] = $condition['query'];
$result = SearchData::getShop($param);
if (isset($result['code']) && $result['code'] === 200 && isset($result['data']) && !empty($result['data'])) {
//调用品牌分类
$class['brand'] = $result['data']['id'];
$brandSort = SearchData::getClassesData($class);
$shop = $result['data'];
if (isset($brandSort['data']['sort']) && !empty($brandSort['data']['sort']))
$shop['sort'] = $brandSort['data']['sort'];
$shopEntry = HelperSearch::shop($shop);
}
}
$data['shopEntry'] = isset($shopEntry) ? $shopEntry : array();
return $data;
}
/**
* 根据product_sn查询产品图片信息
* @param $product_sn
* @param $options
... ...
... ... @@ -50,7 +50,7 @@ class AutouserinfoController extends AbstractAction
'actionUrl' => Helpers::url('/autouserinfo/bind'),
'region' => RegData::getAreasData(),
'location' => '+86',
'captchaUrl' => '/passport/images?t=1449799445',
'captchaUrl' => Helpers::url('/passport/images?t=' . time()),
'itemUrl' => Helpers::url('/help/?category_id=9'),
'referUrl' => $refer,
'skipUrl' => SITE_MAIN,
... ... @@ -71,7 +71,7 @@ class AutouserinfoController extends AbstractAction
public function userInfoAction()
{
//获取用户
$uid = $this->getUid(true);
$uid = $this->getUid(false);
$nickname = $this->get('nickname');
$openId = $this->get('openId');
$sourceType = $this->get('sourceType');
... ... @@ -113,9 +113,9 @@ class AutouserinfoController extends AbstractAction
break;
}
$phoneNum = trim($this->post('phoneNum'));
$phoneNum = trim($this->post('mobile'));
$openId = trim($this->post('openId'));
$areaCode = trim($this->post('areaCode', '86'));
$areaCode = trim($this->post('area', '86'));
$sourceType = trim($this->post('sourceType'));
... ... @@ -152,20 +152,20 @@ class AutouserinfoController extends AbstractAction
break;
}
$phoneNum = trim($this->post('phoneNum'));
$areaCode = trim($this->post('areaCode'));
$phoneNum = trim($this->post('mobile'));
$areaCode = trim($this->post('area'));
$verifyCode = trim($this->post('verifyCode'));
//校验手机号格式
if (!is_numeric($phoneNum) || !is_numeric($areaCode)) {
$data['code'] = 401;
$data['code'] = 400;
$data['message'] = '手机号码格式不正确';
break;
}
//检测验证码不正确
if (!PassportModel::verifyCode($verifyCode)) {
$data['code'] = 402;
$data['code'] = 400;
$data['message'] = '图形验证码不正确';
break;
}
... ... @@ -183,7 +183,6 @@ class AutouserinfoController extends AbstractAction
/*
* 校验图形验证码
*/
public function checkPicCodeAction()
{
$data = array('code' => 400, 'message' => '', 'data' => '');
... ... @@ -193,7 +192,7 @@ class AutouserinfoController extends AbstractAction
if (!$this->isAjax()) {
break;
}
$verifyCode = $phoneNum = trim($this->post('verifyCode'));
$verifyCode = trim($this->post('verifyCode'));
$picFlag = PassportModel::verifyCode($verifyCode);
if ($picFlag) {
$data = array('code' => 200, 'message' => '验证码正确', 'data' => '');
... ... @@ -220,8 +219,8 @@ class AutouserinfoController extends AbstractAction
break;
}
$phoneNum = trim($this->post('phoneNum'));
$areaCode = trim($this->post('areaCode'));
$phoneNum = trim($this->post('mobile'));
$areaCode = trim($this->post('area'));
$code = trim($this->post('code')); //短信验证码
//校验手机号格式
if (!is_numeric($phoneNum) || !is_numeric($areaCode)) {
... ... @@ -253,8 +252,8 @@ class AutouserinfoController extends AbstractAction
break;
}
$phoneNum = trim($this->post('phoneNum'));
$areaCode = trim($this->post('areaCode', '86'));
$phoneNum = trim($this->post('mobile'));
$areaCode = trim($this->post('area', '86'));
$openId = trim($this->post('openId'));
$sourceType = trim($this->post('sourceType'));
$code = trim($this->post('code')); //短信验证码
... ...
... ... @@ -55,6 +55,7 @@ class BackController extends WebAction
$mobile = $phoneNum;
$data = BackData::sendCodeToMobile($mobile);
$this->setSession('phoneNum', $phoneNum);
$this->setSession('area', $area);
if($data['code'] == 200) {
$this->redirect('verification');
}
... ... @@ -159,12 +160,20 @@ class BackController extends WebAction
* 手机验证
*/
public function verificationAction() {
$phoneNum = $this->getSession('phoneNum');
$area = $this->getSession('area');
// if(empty($phoneNum)) {
// $this->redirect('index');
// }
$banner = PassportModel::getLeftBanner(PassportModel::BACK_LFFT_BANNER_CODE);
$data = array(
'simpleHeader' => PassportModel::getSimpleHeader(false),
'vertificationPage' => true,
'verification' => array(
'coverHref' => '/passport',
'coverImg' => 'http://img12.static.yhbimg.com/yhb-img01/2015/12/01/07/020a0b6e7ff908d0c2bc4045b4fef42b9f.png?imageView/2/w/252/h/190',
'coverHref' => $banner['url'],
'coverImg' => $banner['img'],
'phoneNum' => $phoneNum,
'area' => $area,
'countrys' => array()
)
);
... ...
... ... @@ -73,15 +73,40 @@ class RegisterController extends WebAction
}
/**
* 校验并发送验证码
* 校验图形验证码
*
* @return json
*/
public function piccaptchaAction()
{
$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);
}
/**
* 发送短信验证码
*/
public function sendBindMsgAction(){
$mobile = trim($this->post('mobile'), ' ');
$area = intval(trim($this->post('area'), ' '));
$verifyCode = strtolower(trim($this->post('code'),' '));
$verifyCode = strtolower(trim($this->post('verifyCode'),' '));
$data = array('code' => 400, 'message' => '', 'data' => '');
do
{
... ... @@ -91,13 +116,14 @@ class RegisterController extends WebAction
}
/* 判断参数是否合法 */
if (!is_numeric($mobile) || !is_numeric($area)) {
$code = 400;
$data['code'] = 400;
$data['message'] = '手机号码格式不正确';
break;
}
//检测验证码不正确
if(!PassportModel::verifyCode($verifyCode)) {
$data['message'] = '验证码不正确';
$data['code'] = 400;
$data['message'] = '图形验证码不正确';
break;
}
//发送代码
... ... @@ -119,7 +145,32 @@ class RegisterController extends WebAction
public function msgcaptchaAction()
{
$this->echoJson(array('code'=>200));
$data = array('code' => 400, 'message' => '', 'data' => '');
do {
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
break;
}
$phoneNum = trim($this->post('mobile'));
$areaCode = trim($this->post('area'));
$code = trim($this->post('code')); //短信验证码
//校验手机号格式
if (!is_numeric($phoneNum) || !is_numeric($areaCode)) {
$data['code'] = 401;
$data['message'] = '手机号码格式不正确';
break;
}
$data = BindData::checkBindCode($areaCode, $phoneNum, $code);
if (!isset($data['code'])) {
break;
}
}
while (false);
$this->echoJson($data);
}
/**
... ... @@ -130,7 +181,7 @@ class RegisterController extends WebAction
{
$mobile = trim($this->post('mobile'), ' ');//mobile
$area = intval(trim($this->post('area'), ' '));//area
$verifyCode = strtolower(trim($this->post('captcha'),' '));//captcha
$verifyCode = strtolower(trim($this->post('verifyCode'),' '));//图形验证码
$code = trim($this->post('code'),'');//code
$password = $this->post('password');
$url = '/passport/register/index';
... ... @@ -156,18 +207,18 @@ class RegisterController extends WebAction
$data['message'] = '密码不正确';
break;
}
$effective_time = $this->getSession('effective_time');
if($effective_time < time() || empty($effective_time))
{
$data['message'] = '注册超时';
break;
}
/* 验证注册的标识码是否有效 */
$data = RegData::validMobileCode($area, $mobile, $code);
if (!isset($data['code']) || $data['code'] != 200) {
$data['message'] = '验证码错误';
break;
}
$effective_time = $this->getSession('effective_time');
if($effective_time < time() || empty($effective_time))
{
$data['message'] = '注册超时';
break;
}
/*手机注册*/
$data = RegData::regMobile($area, $mobile, $password);
if (!isset($data['code']) || $data['code'] != 200) {
... ...
<?php
use Action\WebAction;
use Product\BrandsModel;
use LibModels\Web\Product\BrandData;
class IndexController extends WebAction
{
... ... @@ -20,6 +19,7 @@ class IndexController extends WebAction
$brandInfo = BrandData::getBrandLogoByDomain($domain);
if(!empty($brandInfo['data']) && $brandInfo['code'] === 200){
$brandId = $brandInfo['data']['id'];
$node = isset($brandInfo['static_content_code']) ? $brandInfo['static_content_code'] : false;
}else{
$this->go(SITE_MAIN);
}
... ... @@ -54,6 +54,7 @@ class IndexController extends WebAction
}
//传品牌ID参数
$condition['brand'] = $brandId;
//获取性别数据
$gender = $this->get('gender') ? ($this->get('gender') == '2,3' ? 2 : 1) : (!isset($_COOKIE['_Gender']) ? '3' : ($_COOKIE['_Gender']=='2,3' ? 2 : 1));
$condition['gender'] = $gender;
... ... @@ -92,7 +93,7 @@ class IndexController extends WebAction
$params = $condition + $_GET;
$params = array_filter($params);
$data = Product\BrandsModel::getBrandSearchData($params,$options,$domain,$uid,$brandId);
$data = Product\BrandsModel::getBrandSearchData($params,$options,$domain,$uid,$brandId,$node);
$cate = array('boys','girls','kids','lifestyle');
$this->setWebNavHeader($cate[$gender-1]);
//渲染模板
... ...
... ... @@ -858,17 +858,29 @@ class Index1Controller extends AbstractAction
),
array(
'picLink' => array(
'title' => 'AAAA',
'list' => array(
array(
'href' => 'http://adidas.yohobuy.com/?folder=1366',
'src' => 'http://img12.static.yhbimg.com/brandBanner/2015/02/04/06/0216e9a4c1c1edb0c8fe6b4347cc5a8035.jpg'
),
array(
'href' => 'http://adidas.yohobuy.com/?folder=1366',
'src' => 'http://img12.static.yhbimg.com/brandBanner/2015/02/04/06/0216e9a4c1c1edb0c8fe6b4347cc5a8035.jpg'
array(
'title' => 'AAAA',
'list' => array(
array(
'href' => 'http://adidas.yohobuy.com/?folder=1366',
'src' => 'http://img12.static.yhbimg.com/brandBanner/2015/02/04/06/0216e9a4c1c1edb0c8fe6b4347cc5a8035.jpg'
),
array(
'href' => 'http://adidas.yohobuy.com/?folder=1366',
'src' => 'http://img12.static.yhbimg.com/brandBanner/2015/02/04/06/0216e9a4c1c1edb0c8fe6b4347cc5a8035.jpg'
)
)
),
array(
array(
'href' => 'http://adidas.yohobuy.com/?folder=1366',
'src' => 'http://img12.static.yhbimg.com/brandBanner/2015/02/04/06/0216e9a4c1c1edb0c8fe6b4347cc5a8035.jpg'
),
array(
'href' => 'http://adidas.yohobuy.com/?folder=1366',
'src' => 'http://img12.static.yhbimg.com/brandBanner/2015/02/04/06/0216e9a4c1c1edb0c8fe6b4347cc5a8035.jpg'
)
)
)
)
),
array(
... ...
... ... @@ -90,7 +90,12 @@ class ListController extends WebAction
$params = array_filter($params);
//每页记录数减1,下一页占位
$params['viewNum'] = $params['viewNum'] - 1;
$data = SearchModel::getSearchData($params,$options);
$list = SearchModel::getSearchData($params,$options);
$data = array(
//初始化js
'productListPage' => true,
'list' => $list
);
$cate = array('boys','girls','kids','lifestyle');
$this->setWebNavHeader($cate[$gender-1]);
$this->_view->display('list', $data);
... ...
<?php
use Action\WebAction;
use LibModels\Web\Product\SaleData;
/**
* sale页
*
*/
class SaleController extends WebAction
{
public function indexAction()
{
//获取专区ID
$specialsaleId = $this->get('specialsale_id');
$specialInfo = SaleData::getSpecial($specialsaleId);
if(isset($specialInfo['data'])) {
$special = $specialInfo['data'];
} else {
$special = array();
}
//获取促销ID
$promotion = $this->get('promotion');
//专区ID和促销ID都为空时,跳转到主页
if (empty($specialsaleId) && empty($promotion)) {
$this->go(SITE_MAIN);
}
/* 过滤请求参数 */
$condition = array();
$condition = filter_input_array(INPUT_GET, array(
//'query' => FILTER_SANITIZE_STRING,
'sort' => FILTER_VALIDATE_INT,
'msort' => FILTER_VALIDATE_INT,
'misort' => FILTER_VALIDATE_INT,
'color' => FILTER_VALIDATE_INT,
'size' => FILTER_VALIDATE_INT,
'style' => FILTER_DEFAULT,
'price' => FILTER_DEFAULT,
'gender' => FILTER_DEFAULT,
'p_d' => FILTER_DEFAULT,
'shelve_time' => FILTER_DEFAULT,
'isNew' => FILTER_DEFAULT,
'specialoffer' => FILTER_DEFAULT,
'limited' => FILTER_DEFAULT,
'order' => FILTER_DEFAULT,
'viewNum' => FILTER_VALIDATE_INT,
'rowNum' => FILTER_VALIDATE_INT,
'page' => FILTER_VALIDATE_INT,), false);
//字符转码
if (!empty($condition)) {
foreach ($condition as &$value) {
$value = rawurldecode($value);
}
}
//传品牌ID参数
if(!empty($special['brand_id'])){
$condition['brand'] = $special['brand_id'];
}
//传促销id
if(!empty($special['ispromotion'])){
$condition['promotion'] = $special['ispromotion'];
}else{
$condition['promotion'] = $promotion;
}
//获取性别数据
$gender = $this->get('gender') ? ($this->get('gender') == '2,3' ? 2 : 1) : (!isset($_COOKIE['_Gender']) ? '3' : ($_COOKIE['_Gender'] == '2,3' ? 2 : 1));
$condition['gender'] = $gender;
//每页显示商品数
if (!isset($condition['viewNum']) || empty($condition['viewNum'])) {
$condition['viewNum'] = 59;
}
$view_num_arr = array(60, 100, 200);
if (!in_array($condition['viewNum'], $view_num_arr)) {
$condition['viewNum'] = 59;
}
//每行显示的商品数量
if (!isset($condition['rowNum']) || empty($condition['rowNum'])) {
$condition['rowNum'] = 5;
}
if ($condition['rowNum'] == 6) {
$imgSize = array(195, 260);
$minImgSize = array(50, 67);
} else {
$condition['rowNum'] = 5;
$imgSize = array(235, 314);
$minImgSize = array(60, 80);
}
//搜索词
//$query = $this->get('query');
$condition['needFilter'] = 1;
$options = array(
'imgSize' => $imgSize,
'minImgSize' => $minImgSize,
'gender' => $gender,
'needPd' => 'Y',
'rowNum' => $condition['rowNum'],
'viewNum' => $condition['viewNum'] - 1,
'specialsale_id' => 'Y'
);
$params = $condition + $_GET;
$params['attribute_not'] = 2;
$params = array_filter($params);
$data = Product\SaleModel::getSaleSearchData($params, $options, $specialInfo);
$cate = array('boys', 'girls', 'kids', 'lifestyle');
$this->setWebNavHeader($cate[$gender - 1]);
//渲染模板
$this->_view->display('new-sale', $data);
}
}
... ...
<?php
use Action\WebAction;
use Product\SearchModel;
class SearchController extends WebAction
{
public function indexAction()
{
/* 过滤请求参数 */
$condition = filter_input_array(INPUT_GET, array(
'query' => FILTER_SANITIZE_STRING,
'brand' => FILTER_VALIDATE_INT,
'sort' => FILTER_VALIDATE_INT,
'msort' => FILTER_VALIDATE_INT,
'misort' => FILTER_VALIDATE_INT,
'color' => FILTER_VALIDATE_INT,
'size' => FILTER_DEFAULT,
'style' => FILTER_DEFAULT,
'price' => FILTER_DEFAULT,
'gender' => FILTER_DEFAULT,
'p_d' => FILTER_DEFAULT,
'shelve_time' => FILTER_DEFAULT,
'isNew' => FILTER_DEFAULT,
'specialoffer' => FILTER_DEFAULT,
'limited' => FILTER_DEFAULT,
'order' => FILTER_DEFAULT,
'viewNum' => FILTER_VALIDATE_INT,
'rowNum' => FILTER_VALIDATE_INT,
'page' => FILTER_VALIDATE_INT), false);
//字符转码
foreach($condition as $key => $val){
$condition[$key] = rawurldecode($val);
}
//性別(频道)
$gender_cookie = !isset($_COOKIE['_Gender']) ? '3' : ($_COOKIE['_Gender']=='2,3' ? 2 : 1);
$gender = $this->get('gender') ? ($this->get('gender') == '2,3' ? 2 : 1) : $gender_cookie ;
$condition['gender'] = $gender;
//每页显示商品数
if(!isset($condition['viewNum']) || empty($condition['viewNum'])){
$condition['viewNum'] =60;
}
$view_num_arr = array(60, 100, 200);
if (!in_array($condition['viewNum'], $view_num_arr)) {
$condition['viewNum'] = 60;
}
//每行显示的商品数量
if(!isset($condition['rowNum']) || empty($condition['rowNum'])){
$condition['rowNum'] =5;
}
if ($condition['rowNum'] == 6) {
$imgSize = array(195, 260);
$minImgSize = array(50, 67);
} else {
$condition['rowNum'] = 5;
$imgSize = array(235, 314);
$minImgSize = array(60, 80);
}
//自定义搜索价格
if (isset($condition['price']) && !empty($condition['price'])) {
$price = explode(',', $condition['price']);
if (!$price[0]) {
$price[0] = 0;
}
if ($price[1]) {
$price[1] = 99999;
}
$condition['price'] = implode(',', $price);
}
//返回搜索条件
$condition['needFilter'] = 1;
//过滤赠品
$condition['attribute_not'] = 2;
/*sale*/
//默认排序
if (!isset($condition['order']) || empty($condition['order'])) {
$condition['order'] = 's_n_desc';
}
if (!isset($condition['p_d']) || empty($condition['p_d'])) {
$condition['p_d'] = '0,0.9';
}
$options = array(
'imgSize' => $imgSize,
'minImgSize' => $minImgSize,
'rowNum' =>$condition['rowNum'],
'viewNum' =>$condition['viewNum'],
);
$params = $condition + $_GET;
$params = array_filter($params);
//每页记录数减1,下一页占位
$params['viewNum'] = $params['viewNum'] - 1;
$options['controller'] = $this->_request->controller;
$searchData = SearchModel::searchData($params,$options);
$cate = array('boys','girls','kids','lifestyle');
$this->setWebNavHeader($cate[$gender-1]);
$data = array(
//初始化js
'searchListPage' => true,
'search' => $searchData
);
$this->_view->display('search', $data);
}
}
\ No newline at end of file
... ...