Authored by Rock Zhang

修改newsale数据处理逻辑

... ... @@ -63,10 +63,10 @@
<div id="retrive-pwd-mask" class="mask"></div>
<ul id="retrive-pwd-ways" class="retrive-pwd-ways">
<li>
<a href=/phoneback.html>通过手机找回密码</a>
<a href=/passport/back/mobile>通过手机找回密码</a>
</li>
<li>
<a href=/emailback.html>通过邮箱找回密码</a>
<a href=/passport/back/email>通过邮箱找回密码</a>
</li>
<li id="cancel-retrive">
取消
... ...
... ... @@ -62,7 +62,8 @@ class BackData
$param['re-input'] = $pwd;
$param['code'] = $code;
return Yohobuy::post(Yohobuy::YOHOBUY_URL.'passport/back/update', $param);
// 默认返回的不是json类型数据,是html
return Yohobuy::post(Yohobuy::YOHOBUY_URL.'passport/back/update', $param, true);
}
... ...
... ... @@ -18,26 +18,59 @@ class NewSaleProcess
public static function newSaleData($focus, $products)
{
$result = array(
'headerBanner' => self::bannerData($focus)
'headerBanner' => self::bannerData($focus),
'goodsContainer' => array()
);
$list = array('list'=>array());
foreach($products as $single)
{
// 处理Tabs
$noTab = true;
if(isset($single['tabs']) && $noTab)
{
$list['tabs'] = array();
foreach ($single['tabs'] as $one)
$result['tabs'] = array();
foreach ($single['tabs'] as $key => $one)
{
$list['tabs'][] = $one;
$tabItem = array();
$tabItem['title'] = $one;
if($key === 1)
{
$tabItem['focus'] = true;
}
$result['tabs'][] = $tabItem;
}
$noTab = false;
}
$list['list'][] = $single['product_list'];
// 处理商品
$productsLi = array('goods'=>array());
if(isset($single['product_list']))
{
foreach ($single['product_list'] as $value)
{
$oneProduct = array();
$oneProduct['id'] = $value['product_skn'];
$oneProduct['thumb'] = Helpers::getImageUrl($value['default_images'], 290, 388, 1);
$oneProduct['name'] = $value['product_name'];
$oneProduct['price'] = $value['market_price'];
$oneProduct['salePrice'] = $value['sales_price'];
$oneProduct['isSale'] = ($value['is_discount'] === 'N' ? false : true);
$oneProduct['isFew'] = ($value['is_soon_sold_out'] === 'N' ? false : true);
$oneProduct['isNew'] = ($value['is_new'] === 'N' ? false : true);
$oneProduct['url'] = $value['product_skn'];
$productsLi['goods'][] = $oneProduct;
}
}
// 对于第一个productsLi添加show字段
if(count($result['goodsContainer']) === 0)
{
$productsLi['show'] = true;
}
$result['goodsContainer'][] = $productsLi;
}
$result['listNav'] = $list;
return $result;
}
... ...
... ... @@ -50,7 +50,7 @@ $btnNext.on('touchstart', function() {
},
success: function(data) {
if (data.code === 200) {
location.href = '/passport/back/code';
location.href = data.data;
} else {
showErrTip(data.message);
}
... ...
... ... @@ -62,8 +62,8 @@ class BackController extends AbstractAction
{
$email = $this->get('email', '');
// 获取到邮箱域名
$pattern = "/^([0-9A-Za-z\\-_\\.]+)@([0-9a-z]+\\.[a-z]{2,3}(\\.[a-z]{2})?)$/i";
$domain_name = 'http://mail.'.preg_replace( $pattern ,"$2", $email );
list($name, $domain) = explode('@', $email);
$domain_name = 'http://' . (($domain == 'gmail.com') ? 'mail.google.com' : 'mail.' . $domain);
$data = array(
'backUrl' => '/passport/back/email',
... ... @@ -92,7 +92,14 @@ class BackController extends AbstractAction
$data = BackData::modifyPasswordByEmail($pwd, $code);
$this->echoJson($data);// 前端不需要判断结果
$result = array('code'=>200);
if(strpos($data, 'history.back') !== false)
{
$result['code'] = 400;
$result['message'] = '修改失败';
}
$this->echoJson($result);// 前端不需要判断结果
}
}
... ... @@ -131,7 +138,7 @@ class BackController extends AbstractAction
'isPassportPage' => true,
'backMobile' => true,
'countrys' => $areas,
'countryCode' => '+86'
'areaCode' => '+86'
);
$this->_view->assign('title', 'YOHO!有货');
... ...
... ... @@ -29,8 +29,8 @@ class LoginController extends AbstractAction
'weiboLoginUrl' => '/passport/login/sina', // 注册的URL链接
'qqLoginUrl' => '/passport/login/qq', // 注册的URL链接
'interationalUrl' => '/login.html', // 国际号登录的URL链接
'phoneRetriveUrl' => '/phoneback.html', // 通过手机号找回密码的URL链接
'emailRetriveUrl' => '/emailback.html', // 通过邮箱找回密码的URL链接
'phoneRetriveUrl' => '/passport/back/mobile', // 通过手机号找回密码的URL链接
'emailRetriveUrl' => '/passport/back/email', // 通过邮箱找回密码的URL链接
);
// 生成HTML(signin.html)
... ...
... ... @@ -2,7 +2,7 @@
use Action\AbstractAction;
use LibModels\wap\Product\NewsaleData as Newsale;
use Plugin\Helpers;
use Plugin\DataProcess\NewSaleProcess;
/**
* 新品到着
*/
... ... @@ -10,7 +10,13 @@ class NewsaleController extends AbstractAction
{
public function indexAction()
{
/*$this->_view->assign('title', '新品到着');
$data = array(
'newArrival' => true,
'header' => array(
'title' => '新品到着'
)
);
// 新品到着顶部焦点图
$focusData = Newsale::getNewsaleFocus('a7989369aa86681c678bc40f171b8f1d');
... ... @@ -18,22 +24,18 @@ class NewsaleController extends AbstractAction
$focus = array();
if($focusData['code'] == 200)
{
foreach ($focusData['data'] as $single)
{
foreach ($single['data'] as $val) {
$val['src'] = Helpers::getImageUrl($val['src'], 375, 667, 1);
$focus[] = $val;
}
}
$focus = $focusData['data'];
}
// 批量获取新品到着商品数据
$products = Newsale::getNewProducts('1,3', 1, 60);
var_dump($focus);
// 添加商品数据
$data += NewSaleProcess::newSaleData($focus, $products);
$this->_view->display('new', compact('focus', 'products'));*/
/*echo '<pre>';
print_r($data);exit;*/
$data = array(
/*$data = array(
'headerBanner' => array(
'list' => array(
array(
... ... @@ -220,7 +222,7 @@ class NewsaleController extends AbstractAction
)
)
);
);*/
$this->_view->assign('title', '新品到着');
$this->_view->display('new', $data);
... ... @@ -254,11 +256,13 @@ class NewsaleController extends AbstractAction
}
}
/**
* 折扣专区
*/
public function discountAction()
{
$data = array(
/*$data = array(
'header' => array(
'title' => 'SALE'
),
... ... @@ -315,9 +319,14 @@ class NewsaleController extends AbstractAction
)
)
)
);
);*/
/*$this->_view->assign('title', '折扣专区');
$data = array(
'discount' => true,
'header' => array(
'title' => 'SALE'
)
);
// 折扣专区顶部焦点图
$focusData = Newsale::getNewsaleFocus('e9c9be32d72e2906d404a72ee24cb523');
... ... @@ -325,20 +334,28 @@ class NewsaleController extends AbstractAction
$focus = array();
if($focusData['code'] == 200)
{
foreach ($focusData['data'] as $single)
{
foreach ($single['data'] as $val) {
$val['src'] = Helpers::getImageUrl($val['src'], 375, 667, 1);
$focus[] = $val;
}
}
$focus = $focusData['data'];
}
// 折扣专区商品数据
$products = Newsale::getNewProducts('1,3', 1, 60);
var_dump($products);
$products = Newsale::getSaleProducts('1,3', 1);
// 更新tabs
$tabs = array();
foreach (array_keys($products) as $key => $value) {
$tabItem = array();
$tabItem['title'] = $value;
if($key === 0)
{
$tabItem['focus'] = true;
}
$tabs[] = $tabItem;
}
$data += array('tabs' => $tabs);
// 添加商品数据
$data += NewSaleProcess::newSaleData($focus, $products);
$this->_view->display('new', compact('focus', 'products'));*/
echo '<pre>';
print_r($data);exit;
$this->_view->assign('title', '折扣专区');
$this->_view->display('sale', $data);
... ...