You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
922 B
33 lines
922 B
<?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 $shopCartService;
|
|
public function detail()
|
|
{
|
|
//获取购物车商品信息
|
|
$res['store_lists'] = $this->shopCartService->do();
|
|
//获取购物车失效商品信息
|
|
$res['store_lists_invalid'] = $this->shopCartService->undo();
|
|
//计算购物车价格
|
|
$res['total'] = $this->shopCartService->getTotal();
|
|
return $this->success($res);
|
|
}
|
|
|
|
public function info()
|
|
{
|
|
$res['shopcart']['count'] = $this->shopCartService->countGoods();
|
|
$res['shopcart']['total'] = $this->shopCartService->getTotal();
|
|
return $this->success($res);
|
|
}
|
|
}
|