WithdrawFreeAuditJob.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. *
  5. * User: king/QQ:995265288
  6. * Date: 2018/6/15 下午2:33
  7. * Email: livsyitian@163.com
  8. */
  9. namespace app\Jobs;
  10. use app\frontend\modules\withdraw\models\Withdraw;
  11. use app\frontend\modules\withdraw\services\AutomateAuditService;
  12. use app\host\HostManager;
  13. use Illuminate\Bus\Queueable;
  14. use Illuminate\Queue\SerializesModels;
  15. use Illuminate\Queue\InteractsWithQueue;
  16. use Illuminate\Contracts\Queue\ShouldQueue;
  17. class WithdrawFreeAuditJob implements ShouldQueue
  18. {
  19. use InteractsWithQueue, Queueable, SerializesModels;
  20. /**
  21. * @var Withdraw
  22. */
  23. private $withdrawModel;
  24. public function __construct(Withdraw $withdrawModel)
  25. {
  26. $hostCount = count((new HostManager())->hosts() ?: []) ? : 1;
  27. $this->queue = 'limit:'.($withdrawModel->member_id % (3 * $hostCount));
  28. $this->withdrawModel = $withdrawModel;
  29. }
  30. public function handle()
  31. {
  32. $automateAuditService = new AutomateAuditService($this->withdrawModel);
  33. try {
  34. $automateAuditService->freeAudit();
  35. } catch (\Exception $e) {
  36. \Log::debug('提现审核',[$e->getMessage()]);
  37. }
  38. }
  39. }