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.

39 lines
843 B

  1. <?php
  2. namespace App\Service\v3\Implementations;
  3. use App\Constants\v3\ActivityType;
  4. use App\Model\v3\GoodsActivity;
  5. use App\Service\v3\Interfaces\ActivityServiceInterface;
  6. class ActivityService implements ActivityServiceInterface
  7. {
  8. public function do()
  9. {
  10. // TODO: Implement do() method.
  11. }
  12. public function check()
  13. {
  14. // TODO: Implement check() method.
  15. }
  16. public function undo()
  17. {
  18. // TODO: Implement undo() method.
  19. }
  20. public function allForAppletIndex($type, $marketId)
  21. {
  22. $builder = GoodsActivity::query()
  23. ->select(['*'])
  24. ->where(['type' => $type])
  25. ->addSelect('sales as total_sales');
  26. if ($marketId) {
  27. $builder->where(['market_id' => $marketId]);
  28. }
  29. return $builder->get()->toArray();
  30. }
  31. }