Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYWAP
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
郭成尧
8 years ago
Commit
f84f423c2d2fe7b72b06ee3bf02bcdcbeb9622ec
1 parent
d912ea30
order-ensure-ok
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
26 deletions
library/LibModels/Wap/Home/CartData.php
static/js/cart/order-ensure.js
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
yohobuy/m.yohobuy.com/application/modules/Cart/controllers/Index.php
library/LibModels/Wap/Home/CartData.php
View file @
f84f423
...
...
@@ -374,9 +374,10 @@ class CartData
* @param string $skuList 购买限购商品时需要传递的参数
* @param string $qhyUnion 友盟有关信息
* @param string|null $userAgent 联盟过来用户下单时需要的User-Agent信息
* @param $times
* @return array 接口返回的数据
*/
public
static
function
orderSub
(
$uid
,
$addressId
,
$cartType
,
$deliveryTime
,
$deliveryWay
,
$invoices
,
$paymentId
,
$paymentType
,
$remark
,
$couponCode
,
$yohoCoin
,
$skuList
,
$qhyUnion
,
$userAgent
)
public
static
function
orderSub
(
$uid
,
$addressId
,
$cartType
,
$deliveryTime
,
$deliveryWay
,
$invoices
,
$paymentId
,
$paymentType
,
$remark
,
$couponCode
,
$yohoCoin
,
$skuList
,
$qhyUnion
,
$userAgent
,
$times
)
{
$param
=
Yohobuy
::
param
();
$param
[
'debug'
]
=
'Y'
;
...
...
@@ -391,6 +392,13 @@ class CartData
$param
[
'delivery_time'
]
=
$deliveryTime
;
$param
[
'delivery_way'
]
=
$deliveryWay
;
/* tar add 161130 结算优化 */
if
(
$times
===
2
)
{
$param
[
'is_continue_buy'
]
=
'Y'
;
}
else
{
$param
[
'is_continue_buy'
]
=
'N'
;
}
if
(
!
empty
(
$invoices
[
'invoices_type_id'
]))
{
//发票内容id--图书:1
$param
[
'invoice_content'
]
=
$invoices
[
'invoices_type_id'
];
...
...
@@ -430,6 +438,23 @@ class CartData
$param
[
'uid'
]
=
$uid
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
/* TODO TAR DELETE!!! */
// return array(
// 'code' => 200,
// 'data' => array(
// 'activityAmount' => 0,
// 'hintInfo' => array(
// 'lastLine' => '继续结算剩余商品',
// 'prefix' => '',
// 'suffix' => '已被抢光',
// 'productName' => 'Life.After Life 字母印花织带休闲裤【吴亦凡亲身试着】'
// ),
// 'isOpenTicket' => 'N',
// 'is_hint' => 'Y',
// 'offline_submit_goods' => array(),
// 'shippingCost' => 0
// )
// );
return
Yohobuy
::
get
(
API_URL
,
$param
,
false
,
false
,
5
,
$userAgent
);
}
...
...
static/js/cart/order-ensure.js
View file @
f84f423
...
...
@@ -331,7 +331,7 @@ function submitOrder(times) {
window
.
setCookie
(
'order-info'
,
''
);
window
.
location
.
href
=
url
;
}
else
if
(
res
.
code
===
409
)
{
richTip
.
show
(
res
.
m
sg
,
res
.
bt
ns
);
richTip
.
show
(
res
.
m
essage
,
res
.
butto
ns
);
}
else
if
(
res
.
message
)
{
tip
.
show
(
res
.
message
);
}
...
...
yohobuy/m.yohobuy.com/application/models/Index/Cart.php
View file @
f84f423
...
...
@@ -798,9 +798,10 @@ class CartModel
* @param string
$skuList
购买限购商品时需要传递的参数
* @param string
$qhyUnio
友盟有关信息
* @param string|null
$userAgent
联盟过来用户下单时需要的User-Agent信息
* @param int
$times
* @return array 接口返回的数据
*/
public static function orderSub(
$uid
,
$addressId
,
$cartType
,
$deliveryTime
,
$deliveryWay
,
$invoices
,
$paymentId
,
$paymentType
,
$remark
,
$couponCode
,
$yohoCoin
,
$skuList
,
$qhyUnio
= '',
$userAgent
= null)
public static function orderSub(
$uid
,
$addressId
,
$cartType
,
$deliveryTime
,
$deliveryWay
,
$invoices
,
$paymentId
,
$paymentType
,
$remark
,
$couponCode
,
$yohoCoin
,
$skuList
,
$qhyUnio
= '',
$userAgent
= null
,
$times
= 1
)
{
$result
= array('code' => 400, 'message' => '出错啦');
...
...
@@ -816,11 +817,33 @@ class CartModel
UdpLog::info('【结算信息】配送方式参数校验','deliveryWay为空');
$result['code']
= 403;
$result['message']
= '请选择配送方式';
}
else {
$orderSubRes
= CartData::orderSub(
$uid
,
$addressId
,
$cartType
,
$deliveryTime
,
$deliveryWay
,
$invoices
,
$paymentId
,
$paymentType
,
$remark
,
$couponCode
,
$yohoCoin
,
$skuList
,
$qhyUnio
,
$userAgent
);
} else {
$orderSubRes
= CartData::orderSub(
$uid
,
$addressId
,
$cartType
,
$deliveryTime
,
$deliveryWay
,
$invoices
,
$paymentId
,
$paymentType
,
$remark
,
$couponCode
,
$yohoCoin
,
$skuList
,
$qhyUnio
,
$userAgent
,
$times
);
UdpLog::info('【结算信息】接口返回','orderSubRes'.json_encode(
$orderSubRes
));
if (
$orderSubRes
&& isset(
$orderSubRes['code']
)) {
if (isset(
$orderSubRes['data']
)
&& isset(
$orderSubRes['data']['is_hint']
)
&&
$orderSubRes['data']['is_hint']
=== 'Y') {
$result['code']
= 409;
if (isset(
$orderSubRes['data']['hintInfo']
)) {
$result['message']
= array(
$orderSubRes['data']['hintInfo']['productName']
.
$orderSubRes['data']['hintInfo']['suffix']
,
$orderSubRes['data']['hintInfo']['lastLine']
);
}
$result['buttons']
= array(
array(
'href' => Helpers::url('/cart/index'),
'text' => '重新选择商品',
),
array(
'text' => '继续结算',
'class' => 'order-tip-btnred'
));
} else if (
$orderSubRes
&& isset(
$orderSubRes['code']
)) {
$result
=
$orderSubRes
;
}
}
...
...
yohobuy/m.yohobuy.com/application/modules/Cart/controllers/Index.php
View file @
f84f423
...
...
@@ -624,22 +624,6 @@ class IndexController extends AbstractAction
*/
public
function
orderSubAction
()
{
/* TODO TAR DELETE THIS !!! */
// $this->echoJson(array(
// 'code' => 409,
// 'msg' => array('XXX 商品已被抢光,', '继续结算剩余商品。'),
// 'btns' => array(
// // array(
// // 'href' => '/',
// // 'text' => '重新选择商品',
// // 'color' => '',
// // ),
// array(
// 'href' => '',
// 'text' => '知道了',
// 'class' => 'order-tip-btnred'
// )),
// ));exit;
if
(
$this
->
isAjax
())
{
$uid
=
$this
->
getUid
(
true
);
$addressId
=
$this
->
post
(
'addressId'
,
null
);
...
...
@@ -654,6 +638,8 @@ class IndexController extends AbstractAction
$yohoCoin
=
$this
->
post
(
'yohoCoin'
,
1
);
$skuList
=
$this
->
post
(
'skuList'
,
''
);
$cookieData
=
$this
->
getCookie
(
'order-info'
,
null
);
//获取电子发票信息
$times
=
$this
->
post
(
'times'
,
1
);
//电子发票信息数组
$invoices
=
array
();
if
(
!
empty
(
$cookieData
))
{
...
...
@@ -692,7 +678,7 @@ class IndexController extends AbstractAction
/* 模拟APP的User-Agent */
$userAgent
=
isset
(
$unionInfo
[
'client_id'
])
?
'YOHO!Buy/3.8.2.259(Model/PC;Channel/'
.
$unionInfo
[
'client_id'
]
.
';uid/'
.
$uid
.
')'
:
null
;
}
$result
=
CartModel
::
orderSub
(
$uid
,
$addressId
,
$cartType
,
$deliveryTime
,
$deliveryWay
,
$invoices
,
$paymentId
,
$paymentType
,
$remark
,
$couponCode
,
$yohoCoin
,
$skuList
,
$unionKey
,
$userAgent
);
$result
=
CartModel
::
orderSub
(
$uid
,
$addressId
,
$cartType
,
$deliveryTime
,
$deliveryWay
,
$invoices
,
$paymentId
,
$paymentType
,
$remark
,
$couponCode
,
$yohoCoin
,
$skuList
,
$unionKey
,
$userAgent
,
$times
);
$result
[
'data'
][
'unionCookie'
]
=
$unionInfo
;
...
...
@@ -703,8 +689,8 @@ class IndexController extends AbstractAction
.
',paymentId:'
.
$paymentId
.
',paymentType:'
.
$paymentType
.
',remark:'
.
$remark
.
',couponCode:'
.
$couponCode
.
"
\n
"
;
error_log
(
$message
,
3
,
'/Data/logs/php/h5_error/order.'
.
date
(
'Ym'
)
.
'.log'
);
UdpLog
::
info
(
'【下单】下单异常数据'
,
'message:'
.
$message
,
'返回:'
.
json_encode
(
$result
));
}
// 返回数据
else
{
}
else
{
// 返回数据
// 提交成功清除Cookie
$this
->
setCookie
(
'order-info'
,
null
);
...
...
Please
register
or
login
to post a comment