Showing
1 changed file
with
34 additions
and
0 deletions
@@ -362,4 +362,38 @@ class OrdersController extends WebAction | @@ -362,4 +362,38 @@ class OrdersController extends WebAction | ||
362 | $this->echoJson($result); | 362 | $this->echoJson($result); |
363 | } | 363 | } |
364 | 364 | ||
365 | + /** | ||
366 | + * 我的订单——再次购买 | ||
367 | + */ | ||
368 | + public function reAddAction() | ||
369 | + { | ||
370 | + $result = array('code' => 401, 'message' => '商品加入购物车失败', 'data' => ''); | ||
371 | + | ||
372 | + do { | ||
373 | + /* 判断是不是AJAX请求 */ | ||
374 | + if (!$this->isAjax()) { | ||
375 | + break; | ||
376 | + } | ||
377 | + //获取相关参数 | ||
378 | + $uid = $this->getUid(true); | ||
379 | + $orderCode = $this->post('orderCode', ''); | ||
380 | + if (!$uid || !$orderCode) { | ||
381 | + $result = array('code' => 400, 'message' => '缺失参数', 'data' => ''); | ||
382 | + break; | ||
383 | + } | ||
384 | + $reAddData = OrderData::reAddData($uid, $orderCode); | ||
385 | + if(!isset($reAddData['code']) || $reAddData['code'] != 200){ | ||
386 | + break; | ||
387 | + } | ||
388 | + $result = array('code' => 200, 'message' => '商品已重新加入购物车', 'data' => $reAddData['data']); | ||
389 | + | ||
390 | + if (!isset($result['code'])) { | ||
391 | + break; | ||
392 | + } | ||
393 | + } | ||
394 | + while (false); | ||
395 | + | ||
396 | + $this->echoJson($result); | ||
397 | + } | ||
398 | + | ||
365 | } | 399 | } |
-
Please register or login to post a comment