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.

36 lines
932 B

6 years ago
  1. <?php
  2. namespace App\Service\v3\Implementations;
  3. use App\Model\v3\ShoppingCart;
  4. use App\Model\v3\Store;
  5. use App\Service\v3\Interfaces\ShopCartServiceInterface;
  6. use Hyperf\DbConnection\Db;
  7. class ShopCartService implements ShopCartServiceInterface
  8. {
  9. public function do()
  10. {
  11. $storeIds = Db::table('lanzu_shopping_cart')->where('user_id',15)->pluck('store_id')->toArray();
  12. $res = Store::query()->with('shoppingCart')->whereIn('id',$storeIds)
  13. ->get();
  14. return $res;
  15. }
  16. public function check($goodsId)
  17. {
  18. return mt_rand(0,6);
  19. }
  20. public function undo()
  21. {
  22. $storeIds = Db::table('lanzu_shopping_cart')->where('user_id',198)->pluck('store_id')->toArray();
  23. $res = Store::query()->with('shoppingCart')->whereIn('id',$storeIds)
  24. ->get();
  25. return $res;
  26. }
  27. public function countGoods()
  28. {
  29. return mt_rand(1,100);
  30. }
  31. }