| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?php
- namespace App\Jobs;
- use App\Repositories\ConfigRepoistory;
- use GuzzleHttp\Client;
- use Illuminate\Bus\Queueable;
- use Illuminate\Contracts\Queue\ShouldQueue;
- use Illuminate\Foundation\Bus\Dispatchable;
- use Illuminate\Queue\InteractsWithQueue;
- use Illuminate\Queue\SerializesModels;
- use Modules\InnerApi\Services\CommonService;
- class SendTgWithdrawMegJob implements ShouldQueue
- {
- use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
- public $platform;
- public $uid;
- public $user;
- public $type;
- public $amount;
- public $date;
- /**
- * @param $uid
- * @param $user
- * @param $type
- * @param $amount
- * @param $date
- */
- public function __construct($uid, $user, $type, $amount, $date)
- {
- // 这里最好是普通数据,不要使用携带 IO 的对象,比如 PDO 对象
- $this->uid = $uid;
- $this->user = $user;
- $this->type = $type;
- $this->amount = $amount;
- $this->date = $date;
- }
- public function handle()
- {
- $configRepo = make(ConfigRepoistory::class);
- $tgMsgServer = $configRepo->get('tg_msg_server', 'sys');
- $tgApiToken = $configRepo->get('tg_api_token', 'sys');
- if ($tgMsgServer && $tgApiToken) {
- $type = '未知';
- if ($this->type == 1) {
- $type = '银行卡';
- } elseif ($this->type == 2) {
- $type = 'USDT';
- } elseif ($this->type == 3) {
- $type = '支付宝';
- }
- $commonService = new Client();
- $commonService->request(
- 'POST',
- $tgMsgServer . 'api/tg/send/withdraw/message',
- [
- 'json' => [
- 'uid' => $this->uid,
- 'user' => $this->user,
- 'type_name' => $type,
- 'amount' => $this->amount,
- 'date' => $this->date,
- ],
- 'headers' => ['AUTH-TOKEN' => $tgApiToken]
- ],
- );
- }
- }
- }
|