OrderProfitsharingJob.php 790 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace ln\jobs;
  3. use app\common\repositories\store\order\StoreOrderProfitsharingRepository;
  4. use ln\interfaces\JobInterface;
  5. use think\facade\Log;
  6. class OrderProfitsharingJob implements JobInterface
  7. {
  8. public function fire($job, $id)
  9. {
  10. $make = app()->make(StoreOrderProfitsharingRepository::class);
  11. $profitsharing = $make->get((int)$id);
  12. if (!$profitsharing || $profitsharing->status != 0) {
  13. $job->delete();
  14. return;
  15. }
  16. try {
  17. $make->profitsharing($profitsharing);
  18. } catch (\Exception $e) {
  19. Log::info('自动分账失败:' . $e->getMessage());
  20. }
  21. $job->delete();
  22. }
  23. public function failed($data)
  24. {
  25. // TODO: Implement failed() method.
  26. }
  27. }