Authored by 周少峰

Merge branch 'release/4.8' of http://git.yoho.cn/fe/yohobuypc into release/4.8

... ... @@ -22,21 +22,21 @@ class Yohobuy
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
//java API
// const API_URL = 'http://api.yoho.yohoops.org/';//
// const API_URL2 = 'http://api.yoho.yohoops.org/';//
// const SERVICE_URL = 'http://service.yoho.yohoops.org/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
// const API_OLD = 'http://api2.open.yohobuy.com/';
// 支付回调地址
// const SERVICE_NOTIFY = 'http://service.yoho.cn/';
// const API_URL = 'http://api.yoho.yohoops.org/';//
// const API_URL2 = 'http://api.yoho.yohoops.org/';//
// const SERVICE_URL = 'http://service.yoho.yohoops.org/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
// const API_OLD = 'http://api2.open.yohobuy.com/';
// 支付回调地址
// const SERVICE_NOTIFY = 'http://service.yoho.cn/';
// 测试环境 */
const API_URL = 'http://testapi.yoho.cn:28078/'; // 'http://192.168.102.205:8080/gateway/'
const SERVICE_URL = 'http://testservice.yoho.cn:28077/';
const YOHOBUY_URL = 'http://www.yohobuy.com/';
const API_OLD = 'http://test2.open.yohobuy.com/';
// 支付回调地址
const SERVICE_NOTIFY = 'http://testservice.yoho.cn:28077/';
const API_URL = 'http://testapi.yoho.cn:28078/'; // http://testapi.yoho.cn:28078/ http://devapi.yoho.cn:58078/
const SERVICE_URL = 'http://testservice.yoho.cn:28077/'; // http://testservice.yoho.cn:28077/ http://devservice.yoho.cn:58077/
const YOHOBUY_URL = 'http://www.yohobuy.com/';
const API_OLD = 'http://test2.open.yohobuy.com/';
// 支付回调地址
const SERVICE_NOTIFY = 'http://testservice.yoho.cn:28077/';
/* 预览环境 */
// const API_URL = 'http://preapi.yoho.cn/';
... ... @@ -44,13 +44,13 @@ class Yohobuy
// const SERVICE_URL = 'http://preservice.yoho.cn/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
// const API_OLD = 'http://api2.open.yohobuy.com/';
/**
* 登录老接口Api配置
*/
const API_LOGIN_URL = 'http://api.open.yohobuy.com';
const API_LOGIN_URL_TEST = 'http://test.open.yohobuy.com';
/**
* 私钥列表
*
... ... @@ -63,7 +63,7 @@ class Yohobuy
'web' => '0ed29744ed318fd28d2c07985d3ba633',
'h5' => 'fd4ad5fcfa0de589ef238c0e7331b585',
);
/**
... ... @@ -77,7 +77,7 @@ class Yohobuy
else {
return 'web';
}
// // 苹果设备
// if (strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone')) {
// return 'iphone';
... ... @@ -187,7 +187,7 @@ class Yohobuy
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if ($useGzip) {
if ($useGzip) {
curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
}
if (!empty($userAgent)) {
... ... @@ -230,7 +230,7 @@ class Yohobuy
public static function post($url, $data = array(), $returnJson = false, $timeout = 10, $header = array(), $cookie = array())
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
if (!empty($header)) {
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
... ... @@ -352,7 +352,7 @@ class Yohobuy
continue;
}
$result[$name] = $response['data'];
}
}
else {
$result[$name] = $response;
}
... ... @@ -496,7 +496,7 @@ class Yohobuy
return $result;
}
/**
* 获取用户User-Agent
* @return bool
... ... @@ -508,7 +508,7 @@ class Yohobuy
}
return $_SERVER['HTTP_USER_AGENT'];
}
/**
* 判断是否手机
* @return bool
... ...
... ... @@ -214,4 +214,20 @@ class OrderData
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/** 再次购买
* @param type $uid
* @param type $orderCode
* @return type
*/
public static function reAddData($uid, $orderCode)
{
$param = Yohobuy::param();
$param['method'] = 'app.Shopping.readd';
$param['uid'] = $uid;
$param['order_code'] = $orderCode;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
}
... ...
... ... @@ -28,7 +28,7 @@ class UserData
/**
* 根据email获取用户信息
*
*
* @param string $email
* @return array
*/
... ... @@ -149,7 +149,7 @@ class UserData
* 修改用户习惯信息
* @param array $params 需要修改的参数集合
* uid:用户ID
* shopping:购物习惯 字符串 1
* shopping:购物习惯 字符串 1
* dress:着装习惯 字符串 1,2
*/
public static function editUserHabitsInfo($params)
... ... @@ -217,13 +217,23 @@ class UserData
* 个人中心页面优选新品数据
*
* @param int $channel 频道,1代表男生,2代表女生,3代表潮童,4代表创意生活
* @param $uid 用户ID
* @param $udid 设备ID
* @param $rec_pos 位置码
* @param $limit 数量限制
* @return array 接口返回的数据
*/
public static function preference($channel)
public static function newPreference($channel, $uid, $udid, $rec_pos, $limit)
{
$param = Yohobuy::param();
$param['method'] = 'app.home.preference';
$param['method'] = 'app.home.newPreference';
$param['yh_channel'] = $channel;
if ($uid != 0 && $uid != null) {
$param['uid'] = $uid;
}
$param['udid'] = $udid;
$param['rec_pos'] = $rec_pos;
$param['limit'] = $limit;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
... ... @@ -453,7 +463,7 @@ class UserData
/**
* 获取省市区县的列表数据
*
*
* @param int $id ID
* @return array
*/
... ... @@ -492,8 +502,7 @@ class UserData
if (!empty($id)) { // 修改
$param['id'] = $id;
$param['method'] = 'app.address.update';
}
else { // 添加
} else { // 添加
$param['method'] = 'app.address.add';
}
... ...
... ... @@ -40,12 +40,3 @@ location ^~ /passport/autosign/wechat/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location ^~ /product/sale/ {
proxy_redirect off;
proxy_pass http://yohobuy-node;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
... ...
location ^~ /passport/autosign/wechat/ {
proxy_redirect off;
proxy_pass http://yohobuy-node;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location ^~ /passport/login/wechat/ {
proxy_redirect off;
proxy_pass http://yohobuy-node;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location = /product/index/getNodeContent {
proxy_redirect off;
proxy_pass http://yohobuy-node;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location ^~ /product/sale/ {
proxy_redirect off;
proxy_pass http://yohobuy-node;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
location ^~ /product/outlets/ {
proxy_redirect off;
proxy_pass http://yohobuy-node;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "gzip";
}
... ...
{{> layout/header}}
<div class="default-me-page me-page yoho-page clearfix">
{{# me}}
{{> home/path}}
{{> home/path}}
{{> home/navigation}}
{{> home/navigation}}
<div class="me-main">
{{# content}}
{{#if messages}}
<p class="message-tip">
消息提示:
{{# messages}}
<a href="{{href}}">{{name}}</a>
<b>({{count}})</b>
{{/ messages}}
<div class="me-main">
{{# content}}
{{#if messages}}
<p class="message-tip">
消息提示:
{{# messages}}
<a href="{{href}}">{{name}}</a>
<b>({{count}})</b>
{{/ messages}}
<span id="close-message" class="close iconfont">&#xe602;</span>
</p>
{{/if}}
<span id="close-message" class="close iconfont">&#xe602;</span>
</p>
{{/if}}
{{# latestOrders}}
<div class="latest-orders block">
<h2 class="title">
<a class="more-orders more" href="{{more}}">
更多订单
</a>
</h2>
{{> home/order-block}}
</div>
{{/ latestOrders}}
{{# latestOrders}}
<div class="latest-orders block">
<h2 class="title">
<a class="more-orders more" href="{{more}}">
更多订单
</a>
</h2>
{{> home/order-block}}
</div>
{{/ latestOrders}}
{{# favBrand}}
<div class="brands block">
<h2 class="title">
<a class="more-orders more" href="{{more}}">
更多品牌
</a>
</h2>
<ul class="clearfix">
{{# brands}}
<li>
<a href="{{href}}">
<img class="brand-logo" src="{{logo}}">
<span class="brand-name">{{name}}</span>
</a>
</li>
{{/ brands}}
</ul>
</div>
{{/ favBrand}}
{{# favBrand}}
<div class="brands block">
<h2 class="title">
<a class="more-orders more" href="{{more}}">
更多品牌
</a>
</h2>
<ul class="clearfix">
{{# brands}}
<li>
<a href="{{href}}">
<img class="brand-logo" src="{{logo}}">
<span class="brand-name">{{name}}</span>
</a>
</li>
{{/ brands}}
</ul>
</div>
{{/ favBrand}}
{{#if newArrival}}
<div class="new-arrival block">
<h2 class="title">
<p class="na-pager-wrap">
{{#if newArrival}}
<div class="new-arrival block">
<h2 class="title">
<p class="na-pager-wrap">
<span class="na-pager pre no-visible">
<i class="iconfont">&#xe622;</i>
</span>
<span class="na-pager next">
<i class="iconfont">&#xe621;</i>
</span>
</p>
</h2>
<ul class="clearfix">
{{# newArrival}}
<li>
<a href="{{href}}">
<img class="thumb" src="{{thumb}}">
<p class="name">{{name}}</p>
<span class="price">¥{{price}}</span>
</a>
</li>
{{/ newArrival}}
</ul>
</div>
{{/if}}
</p>
</h2>
<ul class="clearfix">
{{# newArrival}}
<li>
<a href="{{href}}">
<img class="thumb" src="{{thumb}}">
<p class="name">{{name}}</p>
<span class="price">¥{{price}}</span>
</a>
</li>
{{/ newArrival}}
</ul>
</div>
{{/if}}
{{{banner}}}
{{/ content}}
{{> home/help-us}}
</div>
{{/ content}}
</div>
<!--recommend-for-you-->
{{#if recommend}}
<div class="recommend block">
<h2 class="title">
<p class="na-pager-wrap">
<span class="rc-pager pre no-visible">
<i class="iconfont">&#xe622;</i>
</span>
<span class="rc-pager next">
<i class="iconfont">&#xe621;</i>
</span>
</p>
</h2>
<ul class="clearfix">
{{# recommend}}
<li>
<a href="{{href}}">
<img class="thumb" src="{{thumb}}">
<p class="name">{{name}}</p>
<span class="price">¥{{price}}</span>
</a>
</li>
{{/ recommend}}
</ul>
</div>
{{/if}}
<!--recommend-for-you-->
<div class="ho-btm">
{{{banner}}}
{{> home/help-us}}
</div>
{{/ me}}
</div>
{{> layout/footer}}
\ No newline at end of file
... ...
... ... @@ -112,16 +112,20 @@
{{#if cancelOrder}}
<span class="op-item cancel-order">取消订单</span>
{{^}}
{{#if confirmReceived}}
<span class="op-item confirm-received">确认收货</span>
{{#if reBuy}}
<span class="rebuy">再次购买</span>
{{^}}
<a class="op-item{{#if payNow}} pay-now{{/if}}" href="{{href}}" target="_blank">
{{#if payNow}}
立即付款
{{^}}
{{name}}
{{/if}}
</a>
{{#if confirmReceived}}
<span class="op-item confirm-received">确认收货</span>
{{^}}
<a class="op-item{{#if payNow}} pay-now{{/if}}" href="{{href}}" target="_blank">
{{#if payNow}}
立即付款
{{^}}
{{name}}
{{/if}}
</a>
{{/if}}
{{/if}}
{{/if}}
{{/if}}
... ...
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.
This diff could not be displayed because it is too large.

48.3 KB | W: | H:

48.3 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin

8.64 KB | W: | H:

8.64 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
... ... @@ -131,6 +131,19 @@ $cartnewSum.one('click', 'input[type="checkbox"]', function() {
choiceOut(dataJSON);
});
// 滚动到第一个选中的商品
function scrollToFirst() {
var $selected = $('.pay-wapper tbody tr').find('.cart-item-check:checked');
var top = 0;
if ($selected.length > 0) {
$selected = $selected.eq(0);
}
top = $selected.offset().top - 50;
$('html,body').scrollTop(top);
return false;
}
function isCheck(obj, className) {
selectArray = [];
dataJSON = {};
... ... @@ -191,8 +204,8 @@ function getTogetherProduct($obj, url, page) {
});
}
// 最近浏览
getTogetherProduct($histroy, '/cart/index/getHistroyProduct');
// 为你优选
getTogetherProduct($histroy, '/cart/index/getRecommendProduct');
// 凑单商品
getTogetherProduct($together, '/cart/index/getTogetherProduct');
... ... @@ -205,7 +218,7 @@ $together.on('click', '.pagenext, .pageprev', function() {
});
//凑单商品,历史商品商品折叠
//凑单商品,为你优选商品商品折叠
$shopCart.on('click', '.icon-minus, .icon-add', function() {
if ($(this).hasClass('icon-minus')) {
$(this).parents('.title').next('.main').hide();
... ... @@ -226,7 +239,7 @@ $histroy.on('click', '.pagenext, .pageprev', function() {
} else {
--pageNum > 0 || (pageNum = 1);
}
getTogetherProduct($histroy, '/cart/index/getHistroyProduct', {
getTogetherProduct($histroy, '/cart/index/getRecommendProduct', {
page: pageNum
});
... ... @@ -271,15 +284,16 @@ function productInfo(data) {
$('.detail-bigpic:not(.none) .bigpic:gt(0)').hide();
$('.showSizeBox:not(.none)').find('span').each(function() {
if ($(this).hasClass('null-atcivec')) {
$('.addcart').addClass('none');
$('.btn_sellout').removeClass('none');
} else {
$('.addcart').removeClass('none');
$('.btn_sellout').addClass('none');
return false;
}
});
if ($(this).hasClass('null-atcivec')) {
$('.addcart').addClass('none');
$('.btn_sellout').removeClass('none');
} else {
$('.addcart').removeClass('none');
$('.btn_sellout').addClass('none');
return false;
}
});
});
}
... ... @@ -304,7 +318,7 @@ $payWapper.on('click', '.cart-add-btn', function() {
});
});
//凑单商品,历史商品商品记录
//凑单商品,为你优选商品商品记录
$('.clearfix').on('click', '.btn_view_s', function() {
productId = $(this).data('id');
promotionId = $(this).parents('table').data('promotion');
... ... @@ -880,4 +894,6 @@ $payWapper.on('selectstart', function() {
});
$goodsDetail.on('selectstart', function() {
return false;
});
\ No newline at end of file
});
scrollToFirst();
\ No newline at end of file
... ...
... ... @@ -13,55 +13,92 @@ $('#close-message').click(function() {
$('.message-tip').slideUp(200);
});
/**
*
* @param self 点击的控件
* @param $ul 列表父
* @param page 总共页数
* @param itemWith 子元素宽
* @param curPage 当前页码
* @param num 一页商品数量
*/
function pageChange(self, $ul, page, itemWith, curPage, num) {
var $this = self,
left;
if ($this.hasClass('next')) {
//第2页显示前翻按钮
if (curPage === 2) {
$this.siblings().removeClass('no-visible');
}
//最后一页隐藏后翻按钮
if (curPage === page) {
$this.addClass('no-visible');
}
} else {
//倒数第2页显示后翻按钮
if (curPage === page - 1) {
$this.siblings().removeClass('no-visible');
}
//第1页隐藏前翻按钮
if (curPage === 1) {
$this.addClass('no-visible');
}
}
left = -num * (curPage - 1) * itemWith;
$ul.animate({
marginLeft: left
}, 400);
}
//新品上架
(function() {
var $naPager = $('.na-pager'),
$rcPager = $('.rc-pager'),
$naUl = $('.new-arrival ul'),
$rcUl = $('.recommend ul'),
naPage = Math.ceil($naUl.children('li').length / 5),
rcPage = Math.ceil($rcUl.children('li').length / 6),
naItemWith = $naUl.children('li:last-child').outerWidth(),
naCurPage = 1;
rcItemWith = $rcUl.children('li:last-child').outerWidth(),
naCurPage = 1,
rcCurPage = 1;
$naUl.width($naUl.width() * naPage);
$rcUl.width($rcUl.width() * rcPage);
//最新上架翻页
$naPager.click(function() {
var $this = $(this),
left;
if ($this.hasClass('next')) {
//后翻
++naCurPage;
//第2页显示前翻按钮
if (naCurPage === 2) {
$this.siblings().removeClass('no-visible');
}
var $this = $(this);
//最后一页隐藏后翻按钮
if (naCurPage === naPage) {
$this.addClass('no-visible');
if (naPage > 1) {
if ($this.hasClass('next')) {
++naCurPage;
} else {
--naCurPage;
}
} else {
pageChange($this, $naUl, naPage, naItemWith, naCurPage, 5);
}
});
//前翻
--naCurPage;
//为你推荐翻页
$rcPager.click(function() {
var $this = $(this);
//倒数第2页显示后翻按钮
if (naCurPage === naPage - 1) {
$this.siblings().removeClass('no-visible');
if (rcPage > 1) {
if ($this.hasClass('next')) {
++rcCurPage;
} else {
--rcCurPage;
}
//第1页隐藏前翻按钮
if (naCurPage === 1) {
$this.addClass('no-visible');
}
pageChange($this, $rcUl, rcPage, rcItemWith, rcCurPage, 6);
}
left = -5 * (naCurPage - 1) * naItemWith;
$naUl.animate({
marginLeft: left
}, 400);
});
}());
\ No newline at end of file
... ...
... ... @@ -180,8 +180,24 @@ $('.me-orders, .order-detail').on('click', '.cancel-order', function(e) {
active = editOrder($(this).closest('.order, .order-detail').data('id'))
active.show();
newAddress(0);
}).on('click', '.rebuy', function() {
var id = $(this).closest('.order, .order-detail').data('id');
buyAgain(id);
});
//再次购买
function buyAgain(id){
$.ajax({
type: 'post',
url: '/home/orders/reAdd',
data: {orderCode: id}
}).then(function(d) {
if (d.code === 200) {
location.href = '/shopping/cart';
} else {
new dialog.Alert(d.message).show();
}
})
}
// 地址操作
function newAddress(id) {
var code, codeId;
... ... @@ -403,7 +419,7 @@ function saveAddress(id) {
$.ajax({
type: 'post',
url: '/home/orders/modifyAddress',
url: '/home/orders/modifyAddress',
data: postData
}).then(function(d) {
if (d.code === 200) {
... ...
... ... @@ -81,7 +81,7 @@
}
}
.new-arrival {
.new-arrival,.recommend {
overflow: hidden;
.na-pager-wrap {
... ... @@ -144,6 +144,25 @@
}
}
.recommend {
margin-bottom: 10px;
ul {
width: 990px;
}
li {
width: 106px;
}
}
.ho-btm{
float: right;
width: 800px;
}
.banner {
display: block;
width: 800px;
... ... @@ -161,4 +180,8 @@
.new-arrival .title {
background-image: resolve(/home/new-arrival.png);
}
.recommend .title {
background-image: resolve(/home/recommend.png);
}
}
\ No newline at end of file
... ...
... ... @@ -139,6 +139,7 @@
.me-main {
float: left;
width: 800px;
min-height: 945px;
}
.me-pager {
... ...
... ... @@ -257,6 +257,16 @@
border-radius: 4px;
width: 68px;
}
.operation .rebuy{
display: inline-block;
box-sizing: border-box;
width: 68px;
height: 18px;
line-height: 18px;
border-radius: 5px;
text-align: center;
border: 1px solid #000;
}
}
}
... ...
... ... @@ -3,6 +3,7 @@
namespace Home;
use Home\UserModel;
use LibModels\Web\Home\UserData;
use LibModels\Web\Product\BrandData;
use WebPlugin\Helpers;
use WebPlugin\HelperHome;
... ... @@ -75,6 +76,25 @@ class IndexModel
}
/**
* @param $channel
* @param $uid
* @param $udid
* @param $recPos
* @param $limit
* @return array
*/
public static function preferenceData($channel, $uid, $udid, $recPos, $limit)
{
$response = UserData::newPreference($channel, $uid, $udid, $recPos, $limit);
if ($response['code'] === 200) {
return HelperHome::formatNew($response['data']['product_list']);
} else {
return array();
}
}
/**
* 底部banner
* @param string $code
* @return mixed
... ... @@ -82,7 +102,7 @@ class IndexModel
public static function getFooterBanner($code = '20110609-152143')
{
$banner = BrandData::getByNodeContent($code);
$banner = BrandData::getByNodeContent($code);
if (isset($banner['code']) && !empty($banner['data'])) {
return $banner['data'];
}
... ...
... ... @@ -578,6 +578,10 @@ class OrderModel
$exchangeUrl = Helpers::url('/home/returns/exchangeRequest', array('orderCode' => $orderCode));
//申请退货
$refundUrl = Helpers::url('/home/returns/refundrequest', array('orderCode' => $orderCode));
//再次购买
if ( $isCancel == 'Y') {
$operation[] = array( 'name' => '再次购买', 'reBuy' => true);
}
//立即付款
if ($payStatus == 'N' && $paymentType != 2 && $isCancel == 'N') {
$operation[] = array('payNow' => true, 'href' => $payUrl);
... ...
... ... @@ -16,7 +16,7 @@ use Configs\ChannelConfig;
/**
* 购物车相关的模板数据模型
*
*
* @name CartModel
* @package Shopping
* @copyright yoho.inc
... ... @@ -30,7 +30,7 @@ class CartModel
/**
* 获取我的购物车数据
*
*
* @param int $uid 当前登录用户ID
* @param string $shoppingKey 购物车在浏览器的唯一识别码
* @param mixed $cartDelList 删除的商品列表
... ... @@ -39,7 +39,7 @@ class CartModel
public static function myCartData($uid, $shoppingKey, $cartDelList)
{
$result = array();
// 存放分析用的数据
$analysisData = array('ipinyou' => '');
... ... @@ -59,7 +59,7 @@ class CartModel
$result['isEmpty'] = true;
$result['guangUrl'] = Helpers::url('', null, 'list');
$result['viewOrderUrl'] = Helpers::url('/home/orders', array('t' => time()));
UdpLog::info('【购物车】校验参数传递auth','uid:'.$uid.'shoppingKey:'.$shoppingKey);
UdpLog::info('【购物车】校验参数传递auth', 'uid:' . $uid . 'shoppingKey:' . $shoppingKey);
break;
}
... ... @@ -107,16 +107,14 @@ class CartModel
$result['productAllA'] = Helpers::transPrice($advanceCartData['shopping_cart_data']['last_order_amount']);
// 获赠YOHO币个数
$result['getYoho'] = $advanceCartData['shopping_cart_data']['gain_yoho_coin'];
}
// 普通的
} // 普通的
elseif ($ordinaryCount !== 0 && $advanceCount === 0) {
//$result['productAmmount'] = Helpers::transPrice($ordinaryCartData['shopping_cart_data']['order_amount']);
$result['productAmmount'] = self::genProductAmount($ordinaryCartData['shopping_cart_data']['promotion_formula_list'], $ordinaryCartData['shopping_cart_data']['order_amount']);
$result['activeSale'] = Helpers::transPrice($ordinaryCartData['shopping_cart_data']['discount_amount']);
$result['productAllA'] = Helpers::transPrice($ordinaryCartData['shopping_cart_data']['last_order_amount']);
$result['getYoho'] = $ordinaryCartData['shopping_cart_data']['gain_yoho_coin'];
}
// 所有的
} // 所有的
else {
$result['productAmmount'] = Helpers::transPrice($ordinaryCartData['shopping_cart_data']['order_amount'] + $advanceCartData['shopping_cart_data']['order_amount']);
$result['activeSale'] = Helpers::transPrice($ordinaryCartData['shopping_cart_data']['discount_amount'] + $advanceCartData['shopping_cart_data']['discount_amount']);
... ... @@ -185,8 +183,7 @@ class CartModel
// 普通的
if (!empty($ordinaryCartData['promotion_info'])) {
$result['salesPromotion'] = self::buildPromotionData($ordinaryCartData['promotion_info']);
}
// 预售的
} // 预售的
elseif (!empty($advanceCartData['promotion_info'])) {
//$result['salesPromotion'] = array_merge($result['salesPromotion'], self::buildPromotionData($advanceCartData['promotion_info']));
$result['salesPromotion'] = self::buildPromotionData($advanceCartData['promotion_info']);
... ... @@ -196,9 +193,9 @@ class CartModel
$advanceCartData = array();
$ordinaryCartData = array();
$cartData = array();
} while (false);
// 增加第三方分析用的数据
$result['ids'] = empty($analysisData['ids']) ? '' : implode(',', $analysisData['ids']);
$result['ipinyou'] = empty($analysisData['ipinyou']) ? '' : $analysisData['ipinyou'];
... ... @@ -227,8 +224,8 @@ class CartModel
$addCart = CartData::addToCart($productSku, $buyNumber, $goodsType, $isEdit, $promotionId, $uid, $shoppingKey);
if ($addCart && isset($addCart['code'])) {
$result = $addCart;
}else{
UdpLog::info('【购物车】校验参数传递auth','productSku:'.$productSku.'buyNumber:'.$buyNumber.'goodsType:'.$goodsType,'isEdit:'.$isEdit.'promotionId:'.$promotionId.'uid:'.$uid.'shoppingKey:'.$shoppingKey);
} else {
UdpLog::info('【购物车】校验参数传递auth', 'productSku:' . $productSku . 'buyNumber:' . $buyNumber . 'goodsType:' . $goodsType, 'isEdit:' . $isEdit . 'promotionId:' . $promotionId . 'uid:' . $uid . 'shoppingKey:' . $shoppingKey);
}
return $result;
... ... @@ -249,7 +246,7 @@ class CartModel
do {
if (empty($skuList)) {
UdpLog::info('【购物车】校验参数传递auth','skuList:'.$skuList);
UdpLog::info('【购物车】校验参数传递auth', 'skuList:' . $skuList);
break;
}
... ... @@ -257,8 +254,8 @@ class CartModel
if ($select && isset($select['code'])) {
$result['code'] = $select['code'];
$result['message'] = $select['message'];
}else{
UdpLog::info('【购物车】校验参数传递auth','uid:'.$uid.'skuList:'.$skuList.'shoppingKey:'.$shoppingKey.'hasPromotion:'.$hasPromotion);
} else {
UdpLog::info('【购物车】校验参数传递auth', 'uid:' . $uid . 'skuList:' . $skuList . 'shoppingKey:' . $shoppingKey . 'hasPromotion:' . $hasPromotion);
}
} while (false);
... ... @@ -281,7 +278,7 @@ class CartModel
do {
if (empty($skuList)) {
UdpLog::info('【购物车】校验参数传递auth','skuList:'.$skuList);
UdpLog::info('【购物车】校验参数传递auth', 'skuList:' . $skuList);
break;
}
... ... @@ -292,8 +289,8 @@ class CartModel
if (isset($remove['data']['goods_count'])) {
$result['total_goods_num'] = $remove['data']['goods_count'];
}
}else{
UdpLog::info('【购物车】校验参数传递auth','uid:'.$uid.'skuList:'.$skuList.'shoppingKey:'.$shoppingKey.'hasPromotion:'.$hasPromotion);
} else {
UdpLog::info('【购物车】校验参数传递auth', 'uid:' . $uid . 'skuList:' . $skuList . 'shoppingKey:' . $shoppingKey . 'hasPromotion:' . $hasPromotion);
}
} while (false);
... ... @@ -321,7 +318,7 @@ class CartModel
}
if (empty($skuList)) {
UdpLog::info('【购物车】校验参数传递auth','skuList:'.$skuList);
UdpLog::info('【购物车】校验参数传递auth', 'skuList:' . $skuList);
break;
}
... ... @@ -329,8 +326,8 @@ class CartModel
if ($add && isset($add['code'])) {
$result['code'] = $add['code'];
$result['message'] = $add['message'];
}else{
UdpLog::info('【购物车】校验参数传递auth','uid:'.$uid.'skuList:'.$skuList.'hasPromotion:'.$hasPromotion);
} else {
UdpLog::info('【购物车】校验参数传递auth', 'uid:' . $uid . 'skuList:' . $skuList . 'hasPromotion:' . $hasPromotion);
}
} while (false);
... ... @@ -353,7 +350,7 @@ class CartModel
do {
if (empty($sku)) {
UdpLog::info('【购物车】校验参数传递auth','sku:'.$sku);
UdpLog::info('【购物车】校验参数传递auth', 'sku:' . $sku);
break;
}
... ... @@ -361,8 +358,8 @@ class CartModel
if ($modify && isset($modify['code'])) {
$result['code'] = $modify['code'];
$result['message'] = $modify['message'];
}else{
UdpLog::info('【购物车】校验参数传递auth','uid:'.$uid.'sku:'.$sku,'increaseNum:'.$increaseNum.'decreaseNum:'.$decreaseNum.'shoppingKey:'.$shoppingKey);
} else {
UdpLog::info('【购物车】校验参数传递auth', 'uid:' . $uid . 'sku:' . $sku, 'increaseNum:' . $increaseNum . 'decreaseNum:' . $decreaseNum . 'shoppingKey:' . $shoppingKey);
}
} while (false);
... ... @@ -371,7 +368,7 @@ class CartModel
/**
* 获取凑单商品
*
*
* @param int $page 分页页码
* @return array
*/
... ... @@ -420,8 +417,115 @@ class CartModel
}
/**
* 获取为你优选商品 待处理
*
* @param $channel 频道
* @param $uid 用户id
* @param $udid 设备id
* @param int $page 分页页码
* @return array
* @internal param $rec_pos
* @internal param $limit
*/
public static function getRecommendProduct($channel, $uid, $udid, $page)
{
$result = array('code' => 200, 'message' => '', 'data' => array('header' => '为你优选', 'hasPrev' => false, 'hasNext' => false, 'item' => array()));
do {
if (!is_numeric($page)) {
break;
}
$channelNum = 1;
switch ($channel) {
case 'boys':
$channelNum = 1;
break;
case 'girls':
$channelNum = 2;
break;
case 'kids':
$channelNum = 3;
break;
case 'lifestyle':
$channelNum = 4;
break;
default:
break;
}
$together = UserData::newPreference($channelNum, $uid, $udid, '100003', 30);
if (empty($together['data']['product_list'])) {
break;
}
$result['data']['hasNext'] = true;
$result['data']['hasPrev'] = true;
$build = array();
$begin = 0;
$end = 0;
switch ($page) {
case 1:
$begin = 0;
$end = 5;
break;
case 2:
$begin = 6;
$end = 11;
break;
case 3:
$begin = 12;
$end = 17;
break;
case 4:
$begin = 18;
$end = 23;
break;
case 5:
$begin = 18;
$end = 23;
break;
case 6:
$begin = 24;
$end = 30;
break;
default:
$begin = 0;
$end = 5;
break;
}
foreach ($together['data']['product_list'] as $key => $value) {
if ($key >= $begin && $key <= $end) {
$build = array();
$build['id'] = $value['product_id'];
$build['skn'] = $value['product_skn'];
$build['href'] = Helpers::getUrlBySkc($value['product_id'], $value['goods_list'][0]['product_skc'], $value['cn_alphabet']);;
$build['title'] = $value['product_name'];
$build['img'] = Helpers::getImageUrl($value['default_images'], 100, 100);
$build['alt'] = $value['product_name'];
$build['price'] = $value['price']['sales_price'];
if ($value['price']['sales_price'] !== $value['price']['market_price']) {
$build['marketPrice'] = $value['price']['market_price'];
}
$result['data']['item'][] = $build;
}
}
// 当数据量不足6个时,判定为没有下一页
if ($page == 1 && !isset($result['data']['item'][5])) {
$result['data']['hasPrev'] = false;
$result['data']['hasNext'] = false;
}
} while (false);
return $result;
}
/**
* 获取最近浏览商品
*
*
* @param int $page 分页页码
* @return array
*/
... ... @@ -436,7 +540,7 @@ class CartModel
$browse = CartData::browseRecord($uid, $udid, $page, 6);
if (empty($browse['data']['product_list'])) {
UdpLog::info('【购物车】校验参数传递auth','uid:'.$uid.'udid'.$udid.'page'.$page);
UdpLog::info('【购物车】校验参数传递auth', 'uid:' . $uid . 'udid' . $udid . 'page' . $page);
break;
}
... ... @@ -476,7 +580,7 @@ class CartModel
/**
* 基于本地浏览器Cookie的指定浏览记录
*
*
* @param int $page 页码
* @param int $limit 限制数
* @return array
... ... @@ -595,8 +699,7 @@ class CartModel
if ($value['payment_type'] == 1 && $value['is_support'] === 'Y') {
$result['onlinePay']['checked'] = $isDefault ? true : false;
$result['onlinePay']['paymentId'] = $value['payment_id'];
}
// 货到付款
} // 货到付款
elseif ($value['payment_type'] == 2 && $value['is_support'] === 'Y') {
$result['deliveryPay']['checked'] = $isDefault ? true : false;
$result['deliveryPay']['paymentId'] = $value['payment_id'];
... ... @@ -609,9 +712,9 @@ class CartModel
}
}
// tar add 1605061351 货到付款提示信息处理
if(isset($pay['data']['payment_way'])){
if (isset($pay['data']['payment_way'])) {
foreach ($pay['data']['payment_way'] as $item) {
if($item['payment_type'] === 2){
if ($item['payment_type'] === 2) {
$result['paymentInCashInfo'] = $item['is_support_message'];
}
}
... ... @@ -780,8 +883,7 @@ class CartModel
//JIT拆单需求 package
$result['packages'] = self::getPackageInfo($pay['data']['shopping_cart_data']);
}
while (false);
} while (false);
return $result;
}
... ... @@ -799,17 +901,17 @@ class CartModel
if ($isMulti) {
$packageList = $cartInfo['package_list'];
foreach ($packageList as $pk => $pv) {
$pIndex = $pk+1;
$packages[$pk]['title'] = ($pv['supplier_id'] == 0) ? '包裹'.$pIndex.':总仓发货' : '包裹'.$pIndex.':异地调拨'; //仓库
$pIndex = $pk + 1;
$packages[$pk]['title'] = ($pv['supplier_id'] == 0) ? '包裹' . $pIndex . ':总仓发货' : '包裹' . $pIndex . ':异地调拨'; //仓库
$goodList = $pv['goods_list'];
foreach ($goodList as $glk => $glv) {
$packages[$pk]['goodlist'][$glk]['src'] = Images::getImageUrl($glv['goods_images'], 90, 90);
$tagInfo= isset(ChannelConfig::$orderTagArr[$glv['goods_type']])?ChannelConfig::$orderTagArr[$glv['goods_type']]:'';
$packages[$pk]['goodlist'][$glk]['goodsType'] =!empty($tagInfo['name'])?$tagInfo['name']:false;
$packages[$pk]['goodlist'][$glk]['classname'] =!empty($tagInfo['classname'])?$tagInfo['classname']:false;
$tagInfo = isset(ChannelConfig::$orderTagArr[$glv['goods_type']]) ? ChannelConfig::$orderTagArr[$glv['goods_type']] : '';
$packages[$pk]['goodlist'][$glk]['goodsType'] = !empty($tagInfo['name']) ? $tagInfo['name'] : false;
$packages[$pk]['goodlist'][$glk]['classname'] = !empty($tagInfo['classname']) ? $tagInfo['classname'] : false;
$packages[$pk]['goodlist'][$glk]['link'] = 'javascript:void(0)';
}
$packages[$pk]['fee'] = ($pv['shopping_cost']=='0.00')?false:$pv['shopping_cost'];
$packages[$pk]['fee'] = ($pv['shopping_cost'] == '0.00') ? false : $pv['shopping_cost'];
$packages[$pk]['orign'] = $pv['shopping_orig_cost'];
$packages[$pk]['count'] = $pv['shopping_cut_cost'];
}
... ... @@ -830,7 +932,7 @@ class CartModel
* @param int $redEnvelopes 红包
* @return array 接口返回的数据
*/
public static function orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode,$promotionCode,$yohoCoin, $redEnvelopes)
public static function orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $promotionCode, $yohoCoin, $redEnvelopes)
{
$result = array('code' => 400, 'message' => self::ERROR_400_MESSAGE, 'data' => array());
... ... @@ -838,7 +940,7 @@ class CartModel
if (!empty($yohoCoin)) {
$yohoCoin = intval($yohoCoin) / 100;
}
$compute = CartData::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode,$promotionCode,$yohoCoin, $redEnvelopes);
$compute = CartData::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $promotionCode, $yohoCoin, $redEnvelopes);
if ($compute && isset($compute['code'])) {
/* 商品价格明细 */
if (!empty($compute['data']['promotion_formula_list'])) {
... ... @@ -906,19 +1008,19 @@ class CartModel
do {
if (empty($addressId)) {
UdpLog::info('【结算信息】配送地址参数校验','addressId为空');
UdpLog::info('【结算信息】配送地址参数校验', 'addressId为空');
$result['code'] = 401;
$result['message'] = '配送地址不能为空';
break;
}
if (empty($deliveryTimeId)) {
UdpLog::info('【结算信息】配送时间参数校验','deliveryTime为空');
UdpLog::info('【结算信息】配送时间参数校验', 'deliveryTime为空');
$result['code'] = 402;
$result['message'] = '请选择配送时间';
break;
}
if (empty($deliveryWayId)) {
UdpLog::info('【结算信息】配送方式参数校验','deliveryWay为空');
UdpLog::info('【结算信息】配送方式参数校验', 'deliveryWay为空');
$result['code'] = 403;
$result['message'] = '请选择配送方式';
break;
... ... @@ -952,7 +1054,7 @@ class CartModel
/**
* 用户的收货地址列表
*
*
* @param int $uid 用户ID
* @return array
*/
... ... @@ -1003,7 +1105,7 @@ class CartModel
/**
* 设置默认的收货地址
*
*
* @param int $uid 用户ID
* @param int $addressId 地址ID
* @return array
... ... @@ -1021,7 +1123,7 @@ class CartModel
/**
* 删除收货地址
*
*
* @param int $uid 用户ID
* @param int $addressId 地址ID
* @return array
... ... @@ -1134,8 +1236,7 @@ class CartModel
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if (empty($result)) {
$result = Cache::get($key, 'slave');
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
} // 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else {
Cache::set($key, $result, 3600); // 缓存1小时
}
... ... @@ -1146,7 +1247,7 @@ class CartModel
/**
* 获取用户的优惠券列表
*
*
* @param int $uid 用户ID
* @param int $valid 控制是否返回已失效的券, 为true时不返回, false时返回
* @return array
... ... @@ -1163,7 +1264,7 @@ class CartModel
/* 调用接口, 获取优惠券 */
$couponList = CartData::getListCoupon($uid);
$build = array();
//不可用优惠券
if (isset($couponList['data']['unusable_coupons'])) {
foreach ($couponList['data']['unusable_coupons'] as $value) {
... ... @@ -1192,7 +1293,7 @@ class CartModel
/**
* 检查用户是否收藏这一批商品
*
*
* @param int $uid 用户ID
* @param array $skuList 商品SKU列表
* @return array
... ... @@ -1222,7 +1323,7 @@ class CartModel
/**
* 获取购物车总数
*
*
* @param int $uid 用户ID
* @param string $shoppingKey 客户端购物标识
* @return array
... ... @@ -1234,7 +1335,7 @@ class CartModel
/**
* 追加商品
*
*
* @param array $source
* @param array $data
* @param int $index
... ... @@ -1252,7 +1353,7 @@ class CartModel
/**
* 获取商品总价
*
*
* @param array $promotionList 短语信息
* @param int $default 默认值
* @return float
... ... @@ -1278,7 +1379,7 @@ class CartModel
/**
* 构建促销短语数据
*
*
* @param array $promotionInfo 促销信息
* @return array
*/
... ...
... ... @@ -176,6 +176,25 @@ class IndexController extends WebAction
}
/**
* 为你优选商品异步请求
*/
public function getRecommendProductAction()
{
$result = array('code' => 200, 'data' => array(), 'message' => '为你优选');
if ($this->isAjax()) {
$channel = Helpers::getChannelNameByCookie();
$uid = $this->getUid(false);
$udid = $uid . $this->getUdid();
$page = $this->get('page', 1);
$result = CartModel::getRecommendProduct($channel, $uid, $udid, $page);
}
$this->echoJson($result);
}
/**
* 最近浏览的商品异步请求
*/
public function getHistroyProductAction()
... ... @@ -183,7 +202,8 @@ class IndexController extends WebAction
$result = array('code' => 200, 'data' => array(), 'message' => '浏览记录');
// 按照产品把明扬的指示,去掉最近浏览记录
$this->echoJson($result); exit();
$this->echoJson($result);
exit();
do {
if (!$this->isAjax()) {
... ... @@ -204,8 +224,7 @@ class IndexController extends WebAction
}
$sknList = explode(',', rawurldecode($sknList));
$result = CartModel::getNamedBrowseProduct($page, 6, $sknList);
}
while (false);
} while (false);
$this->echoJson($result);
}
... ... @@ -458,14 +477,13 @@ class IndexController extends WebAction
$paymentId, $paymentType, $remark, $couponCode, $promotionCode, $yohoCoin, $isPreContact, $isPrintPrice, $redEnvelopes);
// 判断是否下单成功
if (empty($result['data']['order_code'])) {
UdpLog::info('【结算信息】判断是否下单成功','order_code'.$result['data']['order_code']);
UdpLog::info('【结算信息】判断是否下单成功', 'order_code' . $result['data']['order_code']);
break;
}
// 跳转到支付的URL链接
$result['data']['payUrl'] = Helpers::url('/shopping/pay', array('ordercode' => $result['data']['order_code']));
}
while (false);
} while (false);
$this->echoJson($result);
}
... ... @@ -523,10 +541,10 @@ class IndexController extends WebAction
$uid = $this->getUid();
$vipLevel = -1;
$data = array();
if(!empty($this->_vip)) {
if (!empty($this->_vip)) {
$vipLevel = Helpers::getVipLevel($this->_vip);
}
if(!empty($productId)) {
if (!empty($productId)) {
$data = Product\ItemModel::getCartProductInfo($productId, $uid, $vipLevel);
}
$this->_view->display('goods-detail', $data);
... ...
... ... @@ -31,9 +31,30 @@ class IndexController extends WebAction
'name' => '个人中心'
),
);
$leftNav = UserModel::getCenterLeftNav('',$uid);
$leftNav = UserModel::getCenterLeftNav('', $uid);
$data = IndexModel::homeData();
$udid = $uid . $this->getUdid();
$channelNum = 1;
switch ($channel) {
case 'boys':
$channelNum = 1;
break;
case 'girls':
$channelNum = 2;
break;
case 'kids':
$channelNum = 3;
break;
case 'lifestyle':
$channelNum = 4;
break;
default:
break;
}
// 为你优选 tar add 160701
$data['recommend'] = IndexModel::preferenceData($channelNum, $uid, $udid, '100004', 30);
//取消订单原因列表
$resons = OrderData::closeReasons();
$cancelReason = isset($resons['data']) ? $resons['data'] : '';
... ... @@ -54,10 +75,11 @@ class IndexController extends WebAction
'more' => '/brands',
'brands' => $data['brand']
),
'newArrival' => $data['new'],
'banner' => IndexModel::getFooterBanner()
'newArrival' => $data['new']
)
),
'recommend' => $data['recommend'], //待处理
'banner' => IndexModel::getFooterBanner(),
'helpUsUrl' => ''
);
$this->_view->display('index', array('meIndexPage' => true, 'me' => $data));
... ...
... ... @@ -274,5 +274,39 @@ class OrdersController extends WebAction
$this->echoJson($result);
}
/**
* 我的订单——再次购买
*/
public function reAddAction()
{
$result = array('code' => 401, 'message' => '商品加入购物车失败', 'data' => '');
do {
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
break;
}
//获取相关参数
$uid = $this->getUid(true);
$orderCode = $this->post('orderCode', '');
if (!$uid || !$orderCode) {
$result = array('code' => 400, 'message' => '缺失参数', 'data' => '');
break;
}
$reAddData = OrderData::reAddData($uid, $orderCode);
if(!isset($reAddData['code']) || $reAddData['code'] != 200){
break;
}
$result = array('code' => 200, 'message' => '商品已重新加入购物车', 'data' => $reAddData['data']);
if (!isset($result['code'])) {
break;
}
}
while (false);
$this->echoJson($result);
}
}
... ...