|
@@ -0,0 +1,65 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace App\Jobs\QappTikTok;
|
|
|
+
|
|
|
+use App\Consts\SysConsts;
|
|
|
+use GuzzleHttp\Client;
|
|
|
+use Illuminate\Bus\Queueable;
|
|
|
+use Illuminate\Queue\SerializesModels;
|
|
|
+use Illuminate\Queue\InteractsWithQueue;
|
|
|
+use Illuminate\Contracts\Queue\ShouldQueue;
|
|
|
+use Illuminate\Foundation\Bus\Dispatchable;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 抖音用户充值
|
|
|
+ */
|
|
|
+class NewQappTikTokUserCharge implements ShouldQueue
|
|
|
+{
|
|
|
+ use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
|
|
+
|
|
|
+ private $reportParams;
|
|
|
+
|
|
|
+ protected $url = 'https://newtrackapi.zhuishuyun.com/api/qappuser/new_charge';
|
|
|
+
|
|
|
+ /**
|
|
|
+ * QappTikTokUserCharge constructor.
|
|
|
+ * @param QappTikTokUserChargeRequest $reportParams
|
|
|
+ */
|
|
|
+ public function __construct(QappTikTokUserChargeRequest $reportParams)
|
|
|
+ {
|
|
|
+ $this->reportParams = $reportParams;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Execute the job.
|
|
|
+ * @throws \GuzzleHttp\Exception\GuzzleException
|
|
|
+ */
|
|
|
+ public function handle()
|
|
|
+ {
|
|
|
+ $client = new Client();
|
|
|
+ $params = [
|
|
|
+ 'uid' => (int)$this->reportParams->uid,
|
|
|
+ 'amount' => (float)$this->reportParams->amount,
|
|
|
+ 'pay_time' => (string)$this->reportParams->pay_time,
|
|
|
+ 'order_no' => (string)$this->reportParams->order_no,
|
|
|
+ 'book_id' => (string)$this->reportParams->book_id,
|
|
|
+ 'book_name' => (string)$this->reportParams->book_name,
|
|
|
+ 'source' => 'zsy',
|
|
|
+ ];
|
|
|
+
|
|
|
+ // 避免签名错误
|
|
|
+ if ($this->reportParams->send_order_id) {
|
|
|
+ $params['send_order_id'] = $this->reportParams->send_order_id;
|
|
|
+ }
|
|
|
+
|
|
|
+ $params['sign'] = _sign($params, SysConsts::TIKTOK_KEY);
|
|
|
+ $response = $client->request('post', $this->url, ['form_params' => $params])->getBody()->getContents();
|
|
|
+ myLog('qapp_user_charge')->info($response);
|
|
|
+ $result = json_decode($response);
|
|
|
+ if ($result) {
|
|
|
+ if ($result->code != 0) {
|
|
|
+ myLog('qapp_user_charge')->info($response);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|