15 changed files with 190 additions and 22 deletions
-
6app/Controller/v3/ExampleController.php
-
3app/Controller/v3/GoodsController.php
-
8app/Controller/v3/OnlineOrderController.php
-
36app/Controller/v3/ShopCartController.php
-
10app/Controller/v3/UpdateShopCartController.php
-
2app/Service/v3/Implementations/AppointmentTimeService.php
-
2app/Service/v3/Implementations/OnlineOrderService.php
-
111app/Service/v3/Implementations/ShopCartService.php
-
6app/Service/v3/Implementations/UpdateShopCartService.php
-
2app/Service/v3/Interfaces/AppointmentTimeServiceInterface.php
-
2app/Service/v3/Interfaces/OnlineOrderServiceInterface.php
-
12app/Service/v3/Interfaces/ShopCartServiceInterface.php
-
4app/Service/v3/Interfaces/UpdateShopCartServiceInterface.php
-
1config/autoload/dependencies.php
-
7config/routes.php
@ -0,0 +1,36 @@ |
|||
<?php |
|||
|
|||
namespace App\Controller\v3; |
|||
|
|||
use App\Controller\BaseController; |
|||
use Hyperf\Di\Annotation\Inject; |
|||
use App\Service\v3\Interfaces\ShopCartServiceInterface; |
|||
|
|||
class ShopCartController extends BaseController |
|||
{ |
|||
/** |
|||
* @Inject |
|||
* @var ShopCartServiceInterface |
|||
*/ |
|||
protected $shopCart; |
|||
public function detail() |
|||
{ |
|||
//获取购物车商品信息
|
|||
$res['store_goood_lists'] = $this->shopCart->detail(); |
|||
//获取购物车失效商品信息
|
|||
$res['store_invalid_goood_lists'] = $this->shopCart->undo(); |
|||
//计算购物车价格
|
|||
$res['total'] = '820.00'; |
|||
return $this->success($res); |
|||
} |
|||
|
|||
public function check() |
|||
{ |
|||
|
|||
} |
|||
|
|||
public function undo() |
|||
{ |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,111 @@ |
|||
<?php |
|||
|
|||
namespace App\Service\v3\Implementations; |
|||
|
|||
use App\Service\v3\Interfaces\ShopCartServiceInterface; |
|||
|
|||
class ShopCartService implements ShopCartServiceInterface |
|||
{ |
|||
public function detail() |
|||
{ |
|||
$res = [ |
|||
[ |
|||
'store_nmae' => '五金杂货铺', |
|||
'price' => '100.00', |
|||
'note' => '多放辣椒', |
|||
'store_id' => 66, |
|||
'goods_list' => |
|||
[ |
|||
[ |
|||
'id' => 3971, |
|||
'goods_id' => 1301, |
|||
'name' => '半边手撕鸡', |
|||
'num' => 4, |
|||
'price' => '90.00', |
|||
'total' => '360.00' |
|||
] |
|||
] |
|||
], |
|||
[ |
|||
'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' |
|||
] |
|||
] |
|||
], |
|||
]; |
|||
return $res; |
|||
} |
|||
|
|||
public function check() |
|||
{ |
|||
// TODO: Implement check() method.
|
|||
} |
|||
|
|||
public function undo() |
|||
{ |
|||
$res = [ |
|||
[ |
|||
'store_nmae' => '五金杂货铺', |
|||
'price' => '100.00', |
|||
'note' => '多放辣椒', |
|||
'store_id' => 66, |
|||
'goods_list' => |
|||
[ |
|||
[ |
|||
'id' => 3971, |
|||
'goods_id' => 1301, |
|||
'name' => '半边手撕鸡', |
|||
'num' => 4, |
|||
'price' => '90.00', |
|||
'total' => '360.00' |
|||
] |
|||
] |
|||
], |
|||
[ |
|||
'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' |
|||
] |
|||
] |
|||
], |
|||
]; |
|||
return $res; |
|||
} |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
<?php |
|||
|
|||
namespace App\Service\v3\Interfaces; |
|||
|
|||
interface ShopCartServiceInterface |
|||
{ |
|||
public function detail(); |
|||
|
|||
public function check(); |
|||
|
|||
public function undo(); |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue