SendTgWithdrawMegJob.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. namespace App\Jobs;
  3. use App\Events\Task\LastSignInEvent;
  4. use App\Model\TaskAwarkLogModel;
  5. use App\Repositories\ConfigRepoistory;
  6. use App\Repositories\Service\CommonService;
  7. use App\Repositories\Service\UserSingInService;
  8. use App\Repositories\TaskAwarkLogRepository;
  9. use GuzzleHttp\Client;
  10. use Hyperf\AsyncQueue\Job;
  11. use Hyperf\Guzzle\ClientFactory;
  12. class SendTgWithdrawMegJob extends Job
  13. {
  14. public $platform;
  15. public $uid;
  16. public $name;
  17. public $type;
  18. public $amount;
  19. public $date;
  20. /**
  21. * @param $platform
  22. * @param $uid
  23. * @param $user
  24. * @param $type
  25. * @param $amount
  26. * @param $date
  27. */
  28. public function __construct($platform, $uid, $user, $type, $amount, $date)
  29. {
  30. // 这里最好是普通数据,不要使用携带 IO 的对象,比如 PDO 对象
  31. $this->platform = $platform;
  32. $this->uid = $uid;
  33. $this->user = $user;
  34. $this->type = $type;
  35. $this->amount = $amount;
  36. $this->date = $date;
  37. }
  38. public function handle()
  39. {
  40. $configRepo = make(ConfigRepoistory::class);
  41. $tgMsgServer = $configRepo->get('tg_msg_server', 'sys', '');
  42. $tgApiToken = $configRepo->get('tg_api_token', 'sys', '');
  43. if ($tgMsgServer && $tgApiToken) {
  44. $type = '未知';
  45. if ($this->type == 1) {
  46. $type = 'USDT';
  47. } elseif ($this->type == 2) {
  48. $type = '银行卡';
  49. } elseif ($this->type == 3) {
  50. $type = '支付宝';
  51. }
  52. make(CommonService::class)->httpPostJson(
  53. $tgMsgServer . 'api/tg/send/user/withdraw/message',
  54. [
  55. 'platform' => $this->platform,
  56. 'uid' => $this->uid,
  57. 'user' => $this->user,
  58. 'type_name' => $type,
  59. 'amount' => $this->amount,
  60. 'date' => $this->date,
  61. ],
  62. ['AUTH-TOKEN' => $tgApiToken]);
  63. }
  64. }
  65. }