StorePrdouctReservation.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\controller\api\store\product;
  12. use think\App;
  13. use crmeb\basic\BaseController;
  14. use app\common\repositories\store\product\ProductRepository;
  15. use app\common\repositories\store\product\ProductReservationRepository;
  16. class StorePrdouctReservation extends BaseController
  17. {
  18. /**
  19. * @var ProductRepository
  20. */
  21. protected $repository;
  22. protected $userInfo = null;
  23. /**
  24. * StoreProduct constructor.
  25. * @param App $app
  26. * @param ProductRepository $repository
  27. */
  28. public function __construct(App $app, ProductReservationRepository $repository)
  29. {
  30. parent::__construct($app);
  31. $this->repository = $repository;
  32. $this->userInfo = $this->request->isLogin() ? $this->request->userInfo() : null;
  33. }
  34. public function showMonth($id)
  35. {
  36. $where = $this->request->params([
  37. ['sku_id',''],
  38. ['date',date('Y-m')],
  39. ]);
  40. $data = $this->repository->showMonth($id, $where);
  41. return app('json')->success($data);
  42. }
  43. public function showDay($id )
  44. {
  45. $where = $this->request->params([
  46. ['day',date('d')],
  47. ['date',date('Y-m')],
  48. ['sku_id',0]
  49. ]);
  50. $data = $this->repository->showDay($id, $where);
  51. return app('json')->success($data);
  52. }
  53. }