|
@@ -7,7 +7,7 @@ use WebPlugin\UdpLog; |
|
@@ -7,7 +7,7 @@ use WebPlugin\UdpLog; |
7
|
|
7
|
|
8
|
/**
|
8
|
/**
|
9
|
* 购物车相关的控制器
|
9
|
* 购物车相关的控制器
|
10
|
- *
|
10
|
+ *
|
11
|
* @name IndexController
|
11
|
* @name IndexController
|
12
|
* @package Cart
|
12
|
* @package Cart
|
13
|
* @copyright yoho.inc
|
13
|
* @copyright yoho.inc
|
|
@@ -24,13 +24,13 @@ class IndexController extends WebAction |
|
@@ -24,13 +24,13 @@ class IndexController extends WebAction |
24
|
{
|
24
|
{
|
25
|
$uid = $this->getUid(false);
|
25
|
$uid = $this->getUid(false);
|
26
|
$shoppingKey = Helpers::getShoppingKeyByCookie();
|
26
|
$shoppingKey = Helpers::getShoppingKeyByCookie();
|
27
|
-
|
27
|
+
|
28
|
// 显示一次并清除已删除的COOKIE记录
|
28
|
// 显示一次并清除已删除的COOKIE记录
|
29
|
$cartDelList = $this->getCookie('cart-del-list');
|
29
|
$cartDelList = $this->getCookie('cart-del-list');
|
30
|
if (!empty($cartDelList)) {
|
30
|
if (!empty($cartDelList)) {
|
31
|
$this->setCookie('cart-del-list', '');
|
31
|
$this->setCookie('cart-del-list', '');
|
32
|
}
|
32
|
}
|
33
|
-
|
33
|
+
|
34
|
$this->setTitle('购物车', true, ' | ');
|
34
|
$this->setTitle('购物车', true, ' | ');
|
35
|
$this->setSimpleHeader();
|
35
|
$this->setSimpleHeader();
|
36
|
$this->_view->display('cart', array(
|
36
|
$this->_view->display('cart', array(
|
|
@@ -39,10 +39,10 @@ class IndexController extends WebAction |
|
@@ -39,10 +39,10 @@ class IndexController extends WebAction |
39
|
'uid' => $uid ? $uid : '',
|
39
|
'uid' => $uid ? $uid : '',
|
40
|
));
|
40
|
));
|
41
|
}
|
41
|
}
|
42
|
-
|
42
|
+
|
43
|
/**
|
43
|
/**
|
44
|
* 购物车商品选择与取消
|
44
|
* 购物车商品选择与取消
|
45
|
- *
|
45
|
+ *
|
46
|
* @param string skuList 商品sku列表,json格式,如{"744403":1,"777777":3}
|
46
|
* @param string skuList 商品sku列表,json格式,如{"744403":1,"777777":3}
|
47
|
* @param bool hasPromotion 标识是不是有promotion_id参数, 后端会去调用不同的接口
|
47
|
* @param bool hasPromotion 标识是不是有promotion_id参数, 后端会去调用不同的接口
|
48
|
* @return json
|
48
|
* @return json
|
|
@@ -61,10 +61,10 @@ class IndexController extends WebAction |
|
@@ -61,10 +61,10 @@ class IndexController extends WebAction |
61
|
|
61
|
|
62
|
$this->echoJson($result);
|
62
|
$this->echoJson($result);
|
63
|
}
|
63
|
}
|
64
|
-
|
64
|
+
|
65
|
/**
|
65
|
/**
|
66
|
* 修改购物车商品数量
|
66
|
* 修改购物车商品数量
|
67
|
- *
|
67
|
+ *
|
68
|
* @param int sku 商品到尺码的编吗
|
68
|
* @param int sku 商品到尺码的编吗
|
69
|
* @param int increaseNum 增加1
|
69
|
* @param int increaseNum 增加1
|
70
|
* @param int decreaseNum 减少1
|
70
|
* @param int decreaseNum 减少1
|
|
@@ -76,12 +76,12 @@ class IndexController extends WebAction |
|
@@ -76,12 +76,12 @@ class IndexController extends WebAction |
76
|
|
76
|
|
77
|
if ($this->isAjax()) {
|
77
|
if ($this->isAjax()) {
|
78
|
$shoppingKey = Helpers::getShoppingKeyByCookie();
|
78
|
$shoppingKey = Helpers::getShoppingKeyByCookie();
|
79
|
-
|
79
|
+
|
80
|
$uid = $this->getUid(false);
|
80
|
$uid = $this->getUid(false);
|
81
|
$sku = $this->post('sku', 0);
|
81
|
$sku = $this->post('sku', 0);
|
82
|
$increaseNum = $this->post('increaseNum', null);
|
82
|
$increaseNum = $this->post('increaseNum', null);
|
83
|
$decreaseNum = $this->post('decreaseNum', null);
|
83
|
$decreaseNum = $this->post('decreaseNum', null);
|
84
|
-
|
84
|
+
|
85
|
$result = CartModel::modifyProductNum($uid, $sku, $increaseNum, $decreaseNum, $shoppingKey);
|
85
|
$result = CartModel::modifyProductNum($uid, $sku, $increaseNum, $decreaseNum, $shoppingKey);
|
86
|
if (!empty($result['code']) && $result['code'] == 200) {
|
86
|
if (!empty($result['code']) && $result['code'] == 200) {
|
87
|
$this->setShoppingCookie($uid);
|
87
|
$this->setShoppingCookie($uid);
|
|
@@ -90,10 +90,10 @@ class IndexController extends WebAction |
|
@@ -90,10 +90,10 @@ class IndexController extends WebAction |
90
|
|
90
|
|
91
|
$this->echoJson($result);
|
91
|
$this->echoJson($result);
|
92
|
}
|
92
|
}
|
93
|
-
|
93
|
+
|
94
|
/**
|
94
|
/**
|
95
|
* 移出购物车
|
95
|
* 移出购物车
|
96
|
- *
|
96
|
+ *
|
97
|
* @param string skuList 商品sku列表,json格式,如[{"product_sku":1047193,"buy_number":1,"promotion_id":0}]
|
97
|
* @param string skuList 商品sku列表,json格式,如[{"product_sku":1047193,"buy_number":1,"promotion_id":0}]
|
98
|
* @param bool hasPromotion 标识是不是有promotion_id参数, 后端会去调用不同的接口
|
98
|
* @param bool hasPromotion 标识是不是有promotion_id参数, 后端会去调用不同的接口
|
99
|
* @return json
|
99
|
* @return json
|
|
@@ -112,15 +112,15 @@ class IndexController extends WebAction |
|
@@ -112,15 +112,15 @@ class IndexController extends WebAction |
112
|
$this->setShoppingCookie($uid);
|
112
|
$this->setShoppingCookie($uid);
|
113
|
}
|
113
|
}
|
114
|
}
|
114
|
}
|
115
|
-
|
115
|
+
|
116
|
$this->echoJson($result);
|
116
|
$this->echoJson($result);
|
117
|
}
|
117
|
}
|
118
|
|
118
|
|
119
|
/**
|
119
|
/**
|
120
|
* 移入收藏夹
|
120
|
* 移入收藏夹
|
121
|
- *
|
121
|
+ *
|
122
|
* 支持批量移入收藏夹
|
122
|
* 支持批量移入收藏夹
|
123
|
- *
|
123
|
+ *
|
124
|
* @param string 商品sku列表,json格式,如{"744403":1,"777777":3}
|
124
|
* @param string 商品sku列表,json格式,如{"744403":1,"777777":3}
|
125
|
* @param bool hasPromotion 标识是不是有promotion_id参数, 后端会去调用不同的接口
|
125
|
* @param bool hasPromotion 标识是不是有promotion_id参数, 后端会去调用不同的接口
|
126
|
* @return json
|
126
|
* @return json
|
|
@@ -141,32 +141,32 @@ class IndexController extends WebAction |
|
@@ -141,32 +141,32 @@ class IndexController extends WebAction |
141
|
|
141
|
|
142
|
$this->echoJson($result);
|
142
|
$this->echoJson($result);
|
143
|
}
|
143
|
}
|
144
|
-
|
144
|
+
|
145
|
/**
|
145
|
/**
|
146
|
* 检查是否收藏
|
146
|
* 检查是否收藏
|
147
|
- *
|
147
|
+ *
|
148
|
* @param string sknList 商品productId列表,如["123123","123412"]
|
148
|
* @param string sknList 商品productId列表,如["123123","123412"]
|
149
|
*/
|
149
|
*/
|
150
|
public function checkFavAction()
|
150
|
public function checkFavAction()
|
151
|
{
|
151
|
{
|
152
|
$result = array('code' => 200, 'message' => '是否收藏', 'data' => array());
|
152
|
$result = array('code' => 200, 'message' => '是否收藏', 'data' => array());
|
153
|
-
|
153
|
+
|
154
|
if ($this->isAjax()) {
|
154
|
if ($this->isAjax()) {
|
155
|
$uid = $this->getUid(false);
|
155
|
$uid = $this->getUid(false);
|
156
|
$pidList = $this->post('pidList', '');
|
156
|
$pidList = $this->post('pidList', '');
|
157
|
$result['data'] = CartModel::checkUserIsFav($uid, $pidList);
|
157
|
$result['data'] = CartModel::checkUserIsFav($uid, $pidList);
|
158
|
}
|
158
|
}
|
159
|
-
|
159
|
+
|
160
|
$this->echoJson($result);
|
160
|
$this->echoJson($result);
|
161
|
}
|
161
|
}
|
162
|
-
|
162
|
+
|
163
|
/**
|
163
|
/**
|
164
|
* 凑单商品异步请求
|
164
|
* 凑单商品异步请求
|
165
|
*/
|
165
|
*/
|
166
|
public function getTogetherProductAction()
|
166
|
public function getTogetherProductAction()
|
167
|
{
|
167
|
{
|
168
|
- $result = array('code' => 200, 'data' => array(), 'message' => '凑单商品');
|
|
|
169
|
-
|
168
|
+ $result = array('code' => 200, 'data' => array(), 'message' => '凑单商品');
|
|
|
169
|
+
|
170
|
if ($this->isAjax()) {
|
170
|
if ($this->isAjax()) {
|
171
|
$page = $this->get('page', 1);
|
171
|
$page = $this->get('page', 1);
|
172
|
$result = CartModel::getTogetherProduct($page);
|
172
|
$result = CartModel::getTogetherProduct($page);
|
|
@@ -181,15 +181,15 @@ class IndexController extends WebAction |
|
@@ -181,15 +181,15 @@ class IndexController extends WebAction |
181
|
public function getHistroyProductAction()
|
181
|
public function getHistroyProductAction()
|
182
|
{
|
182
|
{
|
183
|
$result = array('code' => 200, 'data' => array(), 'message' => '浏览记录');
|
183
|
$result = array('code' => 200, 'data' => array(), 'message' => '浏览记录');
|
184
|
-
|
184
|
+
|
185
|
// 按照产品把明扬的指示,去掉最近浏览记录
|
185
|
// 按照产品把明扬的指示,去掉最近浏览记录
|
186
|
$this->echoJson($result); exit();
|
186
|
$this->echoJson($result); exit();
|
187
|
-
|
187
|
+
|
188
|
do {
|
188
|
do {
|
189
|
if (!$this->isAjax()) {
|
189
|
if (!$this->isAjax()) {
|
190
|
break;
|
190
|
break;
|
191
|
}
|
191
|
}
|
192
|
-
|
192
|
+
|
193
|
$page = $this->get('page', 1);
|
193
|
$page = $this->get('page', 1);
|
194
|
// $uid = $this->getUid(false);
|
194
|
// $uid = $this->getUid(false);
|
195
|
// if ($uid) {
|
195
|
// if ($uid) {
|
|
@@ -197,7 +197,7 @@ class IndexController extends WebAction |
|
@@ -197,7 +197,7 @@ class IndexController extends WebAction |
197
|
// $result = CartModel::getBrowseProduct($uid, $udid, $page);
|
197
|
// $result = CartModel::getBrowseProduct($uid, $udid, $page);
|
198
|
// break;
|
198
|
// break;
|
199
|
// }
|
199
|
// }
|
200
|
-
|
200
|
+
|
201
|
$sknList = $this->getCookie('_browseskn');
|
201
|
$sknList = $this->getCookie('_browseskn');
|
202
|
if (empty($sknList)) {
|
202
|
if (empty($sknList)) {
|
203
|
break;
|
203
|
break;
|
|
@@ -209,7 +209,7 @@ class IndexController extends WebAction |
|
@@ -209,7 +209,7 @@ class IndexController extends WebAction |
209
|
|
209
|
|
210
|
$this->echoJson($result);
|
210
|
$this->echoJson($result);
|
211
|
}
|
211
|
}
|
212
|
-
|
212
|
+
|
213
|
/**
|
213
|
/**
|
214
|
* 确认订单
|
214
|
* 确认订单
|
215
|
*/
|
215
|
*/
|
|
@@ -217,67 +217,67 @@ class IndexController extends WebAction |
|
@@ -217,67 +217,67 @@ class IndexController extends WebAction |
217
|
{
|
217
|
{
|
218
|
$type = $this->get('type', 1);
|
218
|
$type = $this->get('type', 1);
|
219
|
$refer = Helpers::url('/cart/index/orderEnsure', array('type' => $type));
|
219
|
$refer = Helpers::url('/cart/index/orderEnsure', array('type' => $type));
|
220
|
-
|
220
|
+
|
221
|
// 审判用户是否已登录
|
221
|
// 审判用户是否已登录
|
222
|
$this->auditJumpLogin(false, $refer);
|
222
|
$this->auditJumpLogin(false, $refer);
|
223
|
-
|
223
|
+
|
224
|
$this->setTitle('填写订单', true, ' | ');
|
224
|
$this->setTitle('填写订单', true, ' | ');
|
225
|
$this->setSimpleHeader();
|
225
|
$this->setSimpleHeader();
|
226
|
-
|
226
|
+
|
227
|
$cartType = ($type == 2) ? 'advance' : 'ordinary';
|
227
|
$cartType = ($type == 2) ? 'advance' : 'ordinary';
|
228
|
$isAdvanceCart = ($type == 2) ? true : false;
|
228
|
$isAdvanceCart = ($type == 2) ? true : false;
|
229
|
$uid = $this->getUid(false);
|
229
|
$uid = $this->getUid(false);
|
230
|
-
|
230
|
+
|
231
|
$orderEnsure = CartModel::cartPay($uid, $cartType, $isAdvanceCart);
|
231
|
$orderEnsure = CartModel::cartPay($uid, $cartType, $isAdvanceCart);
|
232
|
if (empty($orderEnsure)) {
|
232
|
if (empty($orderEnsure)) {
|
233
|
$this->go(Helpers::url('/shopping/cart'));
|
233
|
$this->go(Helpers::url('/shopping/cart'));
|
234
|
}
|
234
|
}
|
235
|
|
235
|
|
236
|
$this->_view->display('order-ensure', array(
|
236
|
$this->_view->display('order-ensure', array(
|
237
|
- 'orderEnsurePage' => true,
|
237
|
+ 'orderEnsurePage' => true,
|
238
|
'orderEnsure' => $orderEnsure,
|
238
|
'orderEnsure' => $orderEnsure,
|
239
|
));
|
239
|
));
|
240
|
}
|
240
|
}
|
241
|
-
|
241
|
+
|
242
|
/**
|
242
|
/**
|
243
|
* 异步获取地址信息
|
243
|
* 异步获取地址信息
|
244
|
- *
|
244
|
+ *
|
245
|
* @return json
|
245
|
* @return json
|
246
|
*/
|
246
|
*/
|
247
|
public function getAddressAction()
|
247
|
public function getAddressAction()
|
248
|
{
|
248
|
{
|
249
|
$result = array('code' => 200, 'data' => array(), 'message' => '地址信息');
|
249
|
$result = array('code' => 200, 'data' => array(), 'message' => '地址信息');
|
250
|
-
|
250
|
+
|
251
|
if ($this->isAjax()) {
|
251
|
if ($this->isAjax()) {
|
252
|
$uid = $this->getUid(false);
|
252
|
$uid = $this->getUid(false);
|
253
|
$result['data'] = CartModel::userAddressList($uid);
|
253
|
$result['data'] = CartModel::userAddressList($uid);
|
254
|
}
|
254
|
}
|
255
|
-
|
255
|
+
|
256
|
$this->echoJson($result);
|
256
|
$this->echoJson($result);
|
257
|
}
|
257
|
}
|
258
|
-
|
258
|
+
|
259
|
/**
|
259
|
/**
|
260
|
* 设置为默认的地址
|
260
|
* 设置为默认的地址
|
261
|
- *
|
261
|
+ *
|
262
|
* @param int id 地址ID
|
262
|
* @param int id 地址ID
|
263
|
* @return json
|
263
|
* @return json
|
264
|
*/
|
264
|
*/
|
265
|
public function setDefaultAddressAction()
|
265
|
public function setDefaultAddressAction()
|
266
|
{
|
266
|
{
|
267
|
$result = array();
|
267
|
$result = array();
|
268
|
-
|
268
|
+
|
269
|
if ($this->isAjax()) {
|
269
|
if ($this->isAjax()) {
|
270
|
$uid = $this->getUid(false);
|
270
|
$uid = $this->getUid(false);
|
271
|
$addressId = $this->post('id');
|
271
|
$addressId = $this->post('id');
|
272
|
$result = CartModel::setDefaultAddress($uid, $addressId);
|
272
|
$result = CartModel::setDefaultAddress($uid, $addressId);
|
273
|
}
|
273
|
}
|
274
|
-
|
274
|
+
|
275
|
$this->echoJson($result);
|
275
|
$this->echoJson($result);
|
276
|
}
|
276
|
}
|
277
|
-
|
277
|
+
|
278
|
/**
|
278
|
/**
|
279
|
* 保存地址信息
|
279
|
* 保存地址信息
|
280
|
- *
|
280
|
+ *
|
281
|
* @param int $id 地址ID ,当修改操作的时候需要传,添加时候不需要传
|
281
|
* @param int $id 地址ID ,当修改操作的时候需要传,添加时候不需要传
|
282
|
* @param string $address 地址信息
|
282
|
* @param string $address 地址信息
|
283
|
* @param int $areaCode 城市码
|
283
|
* @param int $areaCode 城市码
|
|
@@ -292,7 +292,7 @@ class IndexController extends WebAction |
|
@@ -292,7 +292,7 @@ class IndexController extends WebAction |
292
|
public function saveAddressAction()
|
292
|
public function saveAddressAction()
|
293
|
{
|
293
|
{
|
294
|
$result = array();
|
294
|
$result = array();
|
295
|
-
|
295
|
+
|
296
|
if ($this->isAjax()) {
|
296
|
if ($this->isAjax()) {
|
297
|
$uid = $this->getUid(false);
|
297
|
$uid = $this->getUid(false);
|
298
|
$id = $this->post('id', null);
|
298
|
$id = $this->post('id', null);
|
|
@@ -312,38 +312,38 @@ class IndexController extends WebAction |
|
@@ -312,38 +312,38 @@ class IndexController extends WebAction |
312
|
}
|
312
|
}
|
313
|
}
|
313
|
}
|
314
|
}
|
314
|
}
|
315
|
-
|
315
|
+
|
316
|
$this->echoJson($result);
|
316
|
$this->echoJson($result);
|
317
|
}
|
317
|
}
|
318
|
-
|
318
|
+
|
319
|
/**
|
319
|
/**
|
320
|
* 删除地址
|
320
|
* 删除地址
|
321
|
- *
|
321
|
+ *
|
322
|
* @param int id 地址ID
|
322
|
* @param int id 地址ID
|
323
|
*/
|
323
|
*/
|
324
|
public function delAddressAction()
|
324
|
public function delAddressAction()
|
325
|
{
|
325
|
{
|
326
|
$result = array();
|
326
|
$result = array();
|
327
|
-
|
327
|
+
|
328
|
if ($this->isAjax()) {
|
328
|
if ($this->isAjax()) {
|
329
|
$uid = $this->getUid(false);
|
329
|
$uid = $this->getUid(false);
|
330
|
$addressId = $this->post('id');
|
330
|
$addressId = $this->post('id');
|
331
|
$result = CartModel::delAddress($uid, $addressId);
|
331
|
$result = CartModel::delAddress($uid, $addressId);
|
332
|
}
|
332
|
}
|
333
|
-
|
333
|
+
|
334
|
$this->echoJson($result);
|
334
|
$this->echoJson($result);
|
335
|
}
|
335
|
}
|
336
|
-
|
336
|
+
|
337
|
/**
|
337
|
/**
|
338
|
* 获取省市区县信息列表
|
338
|
* 获取省市区县信息列表
|
339
|
- *
|
339
|
+ *
|
340
|
* @param int id
|
340
|
* @param int id
|
341
|
* @return json
|
341
|
* @return json
|
342
|
*/
|
342
|
*/
|
343
|
public function getAreaListAction()
|
343
|
public function getAreaListAction()
|
344
|
{
|
344
|
{
|
345
|
$result = array('code' => 200, 'message' => '地区信息', 'data' => array());
|
345
|
$result = array('code' => 200, 'message' => '地区信息', 'data' => array());
|
346
|
-
|
346
|
+
|
347
|
if ($this->isAjax()) {
|
347
|
if ($this->isAjax()) {
|
348
|
$id = $this->get('id', 0);
|
348
|
$id = $this->get('id', 0);
|
349
|
$result['data'] = CartModel::getAreaList($id);
|
349
|
$result['data'] = CartModel::getAreaList($id);
|
|
@@ -351,16 +351,16 @@ class IndexController extends WebAction |
|
@@ -351,16 +351,16 @@ class IndexController extends WebAction |
351
|
|
351
|
|
352
|
$this->echoJson($result);
|
352
|
$this->echoJson($result);
|
353
|
}
|
353
|
}
|
354
|
-
|
354
|
+
|
355
|
/**
|
355
|
/**
|
356
|
* 获取优惠券列表
|
356
|
* 获取优惠券列表
|
357
|
- *
|
357
|
+ *
|
358
|
* @return json
|
358
|
* @return json
|
359
|
*/
|
359
|
*/
|
360
|
public function getCouponListAction()
|
360
|
public function getCouponListAction()
|
361
|
{
|
361
|
{
|
362
|
$result = array('code' => 200, 'message' => '优惠券信息', 'data' => array());
|
362
|
$result = array('code' => 200, 'message' => '优惠券信息', 'data' => array());
|
363
|
-
|
363
|
+
|
364
|
if ($this->isAjax()) {
|
364
|
if ($this->isAjax()) {
|
365
|
$uid = $this->getUid(false);
|
365
|
$uid = $this->getUid(false);
|
366
|
$result['data'] = CartModel::getCouponList($uid);
|
366
|
$result['data'] = CartModel::getCouponList($uid);
|
|
@@ -368,10 +368,10 @@ class IndexController extends WebAction |
|
@@ -368,10 +368,10 @@ class IndexController extends WebAction |
368
|
|
368
|
|
369
|
$this->echoJson($result);
|
369
|
$this->echoJson($result);
|
370
|
}
|
370
|
}
|
371
|
-
|
371
|
+
|
372
|
/**
|
372
|
/**
|
373
|
* 购物车选择改变字段,重新运算订单数据
|
373
|
* 购物车选择改变字段,重新运算订单数据
|
374
|
- *
|
374
|
+ *
|
375
|
* @param string $cartType 购物车类型,ordinary表示普通, advance表示预售
|
375
|
* @param string $cartType 购物车类型,ordinary表示普通, advance表示预售
|
376
|
* @param int $deliveryWay 配送方式,1表示普通快递,2表示顺丰速运
|
376
|
* @param int $deliveryWay 配送方式,1表示普通快递,2表示顺丰速运
|
377
|
* @param int $paymentType 支付方式,1表示在线支付,2表示货到付款
|
377
|
* @param int $paymentType 支付方式,1表示在线支付,2表示货到付款
|
|
@@ -390,17 +390,18 @@ class IndexController extends WebAction |
|
@@ -390,17 +390,18 @@ class IndexController extends WebAction |
390
|
$paymentType = $this->post('paymentType', 1);
|
390
|
$paymentType = $this->post('paymentType', 1);
|
391
|
$couponCode = $this->post('couponCode', null);
|
391
|
$couponCode = $this->post('couponCode', null);
|
392
|
$yohoCoin = $this->post('yohoCoin', null);
|
392
|
$yohoCoin = $this->post('yohoCoin', null);
|
|
|
393
|
+ $promotionCode = $this->post('promotionCode', null);
|
393
|
$redEnvelopes = $this->post('redEnvelopes', null);
|
394
|
$redEnvelopes = $this->post('redEnvelopes', null);
|
394
|
$uid = $this->getUid(false);
|
395
|
$uid = $this->getUid(false);
|
395
|
- $result = CartModel::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin, $redEnvelopes);
|
396
|
+ $result = CartModel::orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $promotionCode, $yohoCoin, $redEnvelopes);
|
396
|
}
|
397
|
}
|
397
|
|
398
|
|
398
|
$this->echoJson($result);
|
399
|
$this->echoJson($result);
|
399
|
}
|
400
|
}
|
400
|
-
|
401
|
+
|
401
|
/**
|
402
|
/**
|
402
|
* 确认结算订单
|
403
|
* 确认结算订单
|
403
|
- *
|
404
|
+ *
|
404
|
* @param int $addressId 地址ID
|
405
|
* @param int $addressId 地址ID
|
405
|
* @param int $cartType 购物车类型ID
|
406
|
* @param int $cartType 购物车类型ID
|
406
|
* @param int $deliveryTimeId 寄送时间ID
|
407
|
* @param int $deliveryTimeId 寄送时间ID
|
|
@@ -426,43 +427,44 @@ class IndexController extends WebAction |
|
@@ -426,43 +427,44 @@ class IndexController extends WebAction |
426
|
if (!$this->isAjax()) {
|
427
|
if (!$this->isAjax()) {
|
427
|
break;
|
428
|
break;
|
428
|
}
|
429
|
}
|
429
|
-
|
430
|
+
|
430
|
// 判断用户是否登录
|
431
|
// 判断用户是否登录
|
431
|
$uid = $this->getUid(false);
|
432
|
$uid = $this->getUid(false);
|
432
|
if (!$uid) {
|
433
|
if (!$uid) {
|
433
|
$result['message'] = '请先登录';
|
434
|
$result['message'] = '请先登录';
|
434
|
break;
|
435
|
break;
|
435
|
}
|
436
|
}
|
436
|
-
|
437
|
+
|
437
|
$addressId = $this->post('addressId', null);
|
438
|
$addressId = $this->post('addressId', null);
|
438
|
$cartType = $this->post('cartType', 'ordinary'); // 默认普通购物车
|
439
|
$cartType = $this->post('cartType', 'ordinary'); // 默认普通购物车
|
439
|
$deliveryTimeId = $this->post('deliveryTimeId', 1); // 默认只工作日配送
|
440
|
$deliveryTimeId = $this->post('deliveryTimeId', 1); // 默认只工作日配送
|
440
|
$deliveryWayId = $this->post('deliveryWayId', 1); // 默认普通快递
|
441
|
$deliveryWayId = $this->post('deliveryWayId', 1); // 默认普通快递
|
441
|
$invoiceTitle = $this->post('invoiceTitle', null); // 发票抬头
|
442
|
$invoiceTitle = $this->post('invoiceTitle', null); // 发票抬头
|
442
|
- $invoiceId = $this->post('invoiceId', null); // 发票类型
|
443
|
+ $invoiceId = $this->post('invoiceId', null); // 发票类型
|
443
|
$paymentId = $this->post('paymentId', 15); // 支付ID
|
444
|
$paymentId = $this->post('paymentId', 15); // 支付ID
|
444
|
$paymentType = $this->post('paymentType', 1); // 默认在线支付
|
445
|
$paymentType = $this->post('paymentType', 1); // 默认在线支付
|
445
|
$remark = $this->post('remark', ''); // 备注信息
|
446
|
$remark = $this->post('remark', ''); // 备注信息
|
446
|
- $couponCode = $this->post('couponCode', null); // 优惠码
|
447
|
+ $couponCode = $this->post('couponCode', null); // 优惠券
|
|
|
448
|
+ $promotionCode = $this->post('promotionCode', null); // 优惠码
|
447
|
$yohoCoin = $this->post('yohoCoin', 1); // YOHO币
|
449
|
$yohoCoin = $this->post('yohoCoin', 1); // YOHO币
|
448
|
$isPreContact = $this->post('isPreContact', false); // 送货前是否联系
|
450
|
$isPreContact = $this->post('isPreContact', false); // 送货前是否联系
|
449
|
$isPrintPrice = $this->post('isPrintPrice', true); // 是否打印价格
|
451
|
$isPrintPrice = $this->post('isPrintPrice', true); // 是否打印价格
|
450
|
$redEnvelopes = $this->post('redEnvelopes', null);
|
452
|
$redEnvelopes = $this->post('redEnvelopes', null);
|
451
|
-
|
453
|
+
|
452
|
// 调用下单接口
|
454
|
// 调用下单接口
|
453
|
- $result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTimeId, $deliveryWayId, $invoiceTitle, $invoiceId,
|
|
|
454
|
- $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $isPreContact, $isPrintPrice, $redEnvelopes);
|
455
|
+ $result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTimeId, $deliveryWayId, $invoiceTitle, $invoiceId,
|
|
|
456
|
+ $paymentId, $paymentType, $remark, $couponCode, $promotionCode, $yohoCoin, $isPreContact, $isPrintPrice, $redEnvelopes);
|
455
|
// 判断是否下单成功
|
457
|
// 判断是否下单成功
|
456
|
if (empty($result['data']['order_code'])) {
|
458
|
if (empty($result['data']['order_code'])) {
|
457
|
UdpLog::info('【结算信息】判断是否下单成功','order_code'.$result['data']['order_code']);
|
459
|
UdpLog::info('【结算信息】判断是否下单成功','order_code'.$result['data']['order_code']);
|
458
|
break;
|
460
|
break;
|
459
|
}
|
461
|
}
|
460
|
-
|
462
|
+
|
461
|
// 跳转到支付的URL链接
|
463
|
// 跳转到支付的URL链接
|
462
|
$result['data']['payUrl'] = Helpers::url('/shopping/pay', array('ordercode' => $result['data']['order_code']));
|
464
|
$result['data']['payUrl'] = Helpers::url('/shopping/pay', array('ordercode' => $result['data']['order_code']));
|
463
|
}
|
465
|
}
|
464
|
while (false);
|
466
|
while (false);
|
465
|
-
|
467
|
+
|
466
|
// $result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin);
|
468
|
// $result = CartModel::orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin);
|
467
|
//
|
469
|
//
|
468
|
// 记录下单异常的数据
|
470
|
// 记录下单异常的数据
|
|
@@ -487,10 +489,10 @@ class IndexController extends WebAction |
|
@@ -487,10 +489,10 @@ class IndexController extends WebAction |
487
|
// // do nothing
|
489
|
// // do nothing
|
488
|
// }
|
490
|
// }
|
489
|
// }
|
491
|
// }
|
490
|
-
|
492
|
+
|
491
|
$this->echoJson($result);
|
493
|
$this->echoJson($result);
|
492
|
}
|
494
|
}
|
493
|
-
|
495
|
+
|
494
|
/**
|
496
|
/**
|
495
|
* 加入购物车
|
497
|
* 加入购物车
|
496
|
*
|
498
|
*
|
|
@@ -534,12 +536,12 @@ class IndexController extends WebAction |
|
@@ -534,12 +536,12 @@ class IndexController extends WebAction |
534
|
|
536
|
|
535
|
$this->echoJson($result);
|
537
|
$this->echoJson($result);
|
536
|
}
|
538
|
}
|
537
|
-
|
539
|
+
|
538
|
/**
|
540
|
/**
|
539
|
* 获取商品信息
|
541
|
* 获取商品信息
|
540
|
*/
|
542
|
*/
|
541
|
public function getProductInfoAction()
|
543
|
public function getProductInfoAction()
|
542
|
- {
|
544
|
+ {
|
543
|
$productId = $this->get('productId');
|
545
|
$productId = $this->get('productId');
|
544
|
$uid = $this->getUid();
|
546
|
$uid = $this->getUid();
|
545
|
$vipLevel = -1;
|
547
|
$vipLevel = -1;
|
|
@@ -552,10 +554,10 @@ class IndexController extends WebAction |
|
@@ -552,10 +554,10 @@ class IndexController extends WebAction |
552
|
}
|
554
|
}
|
553
|
$this->_view->display('goods-detail', $data);
|
555
|
$this->_view->display('goods-detail', $data);
|
554
|
}
|
556
|
}
|
555
|
-
|
557
|
+
|
556
|
/**
|
558
|
/**
|
557
|
* 获取购物车商品总数
|
559
|
* 获取购物车商品总数
|
558
|
- *
|
560
|
+ *
|
559
|
* @return jsonp
|
561
|
* @return jsonp
|
560
|
*/
|
562
|
*/
|
561
|
public function countAction()
|
563
|
public function countAction()
|
|
@@ -564,10 +566,10 @@ class IndexController extends WebAction |
|
@@ -564,10 +566,10 @@ class IndexController extends WebAction |
564
|
$uid = $this->getUid(false);
|
566
|
$uid = $this->getUid(false);
|
565
|
$shoppingKey = Helpers::getShoppingKeyByCookie();
|
567
|
$shoppingKey = Helpers::getShoppingKeyByCookie();
|
566
|
$result = CartModel::getCartCount($uid, $shoppingKey);
|
568
|
$result = CartModel::getCartCount($uid, $shoppingKey);
|
567
|
-
|
569
|
+
|
568
|
$this->helpJsonCallbackResult($callback, 200, '总数', $result);
|
570
|
$this->helpJsonCallbackResult($callback, 200, '总数', $result);
|
569
|
}
|
571
|
}
|
570
|
-
|
572
|
+
|
571
|
/**
|
573
|
/**
|
572
|
* 设置购物车COOKIE信息
|
574
|
* 设置购物车COOKIE信息
|
573
|
*/
|
575
|
*/
|
|
@@ -585,5 +587,5 @@ class IndexController extends WebAction |
|
@@ -585,5 +587,5 @@ class IndexController extends WebAction |
585
|
)));
|
587
|
)));
|
586
|
}
|
588
|
}
|
587
|
}
|
589
|
}
|
588
|
-
|
|
|
589
|
-} |
|
|
|
|
590
|
+
|
|
|
591
|
+} |