OrderProfitsharingJob.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 crmeb\jobs;
  12. use app\common\repositories\store\order\StoreOrderProfitsharingRepository;
  13. use crmeb\interfaces\JobInterface;
  14. use think\facade\Log;
  15. class OrderProfitsharingJob implements JobInterface
  16. {
  17. public function fire($job, $id)
  18. {
  19. $make = app()->make(StoreOrderProfitsharingRepository::class);
  20. $profitsharing = $make->get((int)$id);
  21. if (!$profitsharing || $profitsharing->status != 0) {
  22. $job->delete();
  23. return;
  24. }
  25. try {
  26. $make->profitsharing($profitsharing);
  27. } catch (\Exception $e) {
  28. Log::info('自动分账失败:' . $e->getMessage());
  29. }
  30. $job->delete();
  31. }
  32. public function failed($data)
  33. {
  34. // TODO: Implement failed() method.
  35. }
  36. }