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.
 
 

41 lines
1.1 KiB

<?php
namespace App\Service\v3\Implementations;
use App\Model\v3\ShoppingCart;
use App\Model\v3\Store;
use App\Service\v3\Interfaces\ShopCartServiceInterface;
use Hyperf\DbConnection\Db;
class ShopCartService implements ShopCartServiceInterface
{
public function do()
{
$storeIds = Db::table('lanzu_shopping_cart')->where('user_id',15)->pluck('store_id')->toArray();
$res = Store::query()->with(['ShoppingCart' => function($query) {
$query->with('goods');
}])->whereIn('id',$storeIds)
->get();
return $res;
}
public function check($goodsId)
{
return mt_rand(0,6);
}
public function undo()
{
$storeIds = Db::table('lanzu_shopping_cart')->where('user_id',198)->pluck('store_id')->toArray();
$res = Store::query()->with(['ShoppingCart' => function($query) {
$query->with('goods');
}])->whereIn('id',$storeIds)
->get();
return $res;
}
public function countGoods()
{
return mt_rand(1,100);
}
}