AfEvent.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace App\Jobs;
  3. use Illuminate\Bus\Queueable;
  4. use Illuminate\Queue\SerializesModels;
  5. use Illuminate\Queue\InteractsWithQueue;
  6. use Illuminate\Contracts\Queue\ShouldQueue;
  7. use Illuminate\Foundation\Bus\Dispatchable;
  8. use Illuminate\Support\Facades\Log;
  9. class AfEvent implements ShouldQueue
  10. {
  11. use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
  12. protected $data;
  13. /**
  14. * Create a new job instance.
  15. *
  16. * @return void
  17. */
  18. public function __construct($data = [])
  19. {
  20. $this->data = $data;
  21. }
  22. /**
  23. * Execute the job.
  24. *
  25. * @return void
  26. */
  27. public function handle()
  28. {
  29. Log::channel('adjustEvent')->info('enter:'.json_encode($this->data));
  30. if (empty($this->data)) return;
  31. // return;
  32. // 接收数据
  33. [$UserID, $payAmt, $AdId, $eventType] = $this->data;
  34. if (empty($eventType)) $eventType = 2;
  35. Log::info('接收数据' . \GuzzleHttp\json_encode($this->data));
  36. // 执行AF事件
  37. $dao = new \App\dao\af\AfEvent();
  38. $dao->pay($AdId, $UserID, $eventType);
  39. $dao->paySum($AdId, $UserID, $payAmt, $eventType);
  40. $dao->payCount($AdId, $UserID, $eventType);
  41. // $dao->recordKwaiRecharge($UserID, $payAmt);
  42. // $dao->recordGoogleRecharge($UserID, $payAmt);
  43. }
  44. }