Browse Source

购物车订单接口优化

master
Lemon 5 years ago
parent
commit
a1797892fb
  1. 76
      app/Controller/v3/OnlineOrderController.php
  2. 6
      app/Controller/v3/ShopCartController.php

76
app/Controller/v3/OnlineOrderController.php

@ -12,16 +12,11 @@ use App\Service\v3\Interfaces\UserBindTelServiceInterface;
use App\Service\v3\Interfaces\AppointmentTimeServiceInterface;
class OnlineOrderController extends BaseController
{
/**
* @Inject
* @var OnlineOrderServiceInterface
*/
protected $order;
/**
* @Inject
* @var UserBindTelServiceInterface
*/
protected $userBindTel;
protected $userBindTelService;
/**
* @Inject
* @var CouponServiceInterface
@ -45,10 +40,10 @@ class OnlineOrderController extends BaseController
{
$params = $this->request->all();
//判断用户有没有绑定手机
$telExists = $this->userBindTel->check($params['user_id']);
if(!$telExists){
throw new ErrorCodeException(ErrorCode::NOT_BIND_TEL_ERROR);
}
// $telExists = $this->userBindTelService->check($params['user_id']);
// if(!$telExists){
// throw new ErrorCodeException(ErrorCode::NOT_BIND_TEL_ERROR);
// }
//获取用户收货地址
$res['address'] = [
'address' => '南宁市良庆区五象海尔·青啤联合广场',
@ -69,38 +64,47 @@ class OnlineOrderController extends BaseController
];
//
$res['store_list'] = [
'50' => [
[
'store_nmae' => '五金杂货铺',
'goods_list' => [
'id' => 3765,
'goods_id' => 836,
'name' => '扳手',
'num' => 2,
'price' => '50.00',
'total' => '100.00'
]
'price' => '100.00',
'note' => '多放辣椒',
'store_id' => 66,
'goods_list' =>
[
[
'id' => 3971,
'goods_id' => 1301,
'name' => '半边手撕鸡',
'num' => 4,
'price' => '90.00',
'total' => '360.00'
]
]
],
'99' => [
[
'store_nmae' => '回味手撕鸡J009',
'note' => '手撕鸡加辣',
'store_price' => '720.00',
'store_id' => 123,
'goods_list' =>
[
[
'id' => 3971,
'goods_id' => 1301,
'name' => '半边手撕鸡',
'num' => 4,
'price' => '90.00',
'total' => '360.00'
],
[
'id' => 3971,
'goods_id' => 1301,
'name' => '半边手撕鸡',
'num' => 4,
'price' => '90.00',
'total' => '360.00'
[
'id' => 3971,
'goods_id' => 1301,
'name' => '半边手撕鸡',
'num' => 4,
'price' => '90.00',
'total' => '360.00'
],
[
'id' => 3971,
'goods_id' => 1301,
'name' => '半边手撕鸡',
'num' => 4,
'price' => '90.00',
'total' => '360.00'
]
]
]
],
];
//获取用户优惠券

6
app/Controller/v3/ShopCartController.php

@ -12,13 +12,13 @@ class ShopCartController extends BaseController
* @Inject
* @var ShopCartServiceInterface
*/
protected $shopCart;
protected $shopCartService;
public function detail()
{
//获取购物车商品信息
$res['store_goood_lists'] = $this->shopCart->detail();
$res['store_goood_lists'] = $this->shopCartService->detail();
//获取购物车失效商品信息
$res['store_invalid_goood_lists'] = $this->shopCart->undo();
$res['store_invalid_goood_lists'] = $this->shopCartService->undo();
//计算购物车价格
$res['total'] = '820.00';
return $this->success($res);

Loading…
Cancel
Save