| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 | <?phpnamespace App\Jobs;use App\Model\CustomerFromThreePlatForm;use Illuminate\Bus\Queueable;use Illuminate\Contracts\Queue\ShouldQueue;use Illuminate\Foundation\Bus\Dispatchable;use Illuminate\Queue\InteractsWithQueue;use Illuminate\Queue\SerializesModels;use Illuminate\Support\Facades\Log;use Symfony\Component\Console\Output\OutputInterface;class CustomerReceivingThirdPlatFormJob implements ShouldQueue{    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;    protected $data;    public function __construct($data)    {        $this->data = $data;    }    public function handle()    {        try {            if(empty($this->data) || empty($this->data["data"])) {                $this->delete();                return;            }            $data = $this->data["data"];            $array = json_decode($data,true);            $content = $array["content"];            $adv_id = "";            if(! empty($content['adInfo'])){                $adInfo = json_decode($content['adInfo'],true);                $adv_id = $adInfo['advId'] ?? "";            }            $insert = [                'crt_time' => time(),                'city' => $content['city'] ?? "",                'actionType' => $content["actionType"] ?? 0,                'acquireTime' => $content["acquireTime"] ?? "",                'clueType' => $content["clueType"] ?? 0,                'product' => $content["product"] ?? "",                'wechat' => $content["wechat"] ?? "",                'clueId' => $content["clueId"] ?? "",                'transformType' => $content["transformType"] ?? "",                'clueSource' => $content["clueSource"] ?? "",                'clueSourceId' => $content["clueSourceId"] ?? "",                'customerName' => $content["customerName"] ?? "",                'platform' => $content["platform"] ?? 0,                'ipLocationCity' => $content["ipLocationCity"] ?? "",                'phone' => $content["phone"] ?? "",                'isRepeatClue' => $content["isRepeatClue"] ?? 0,                'flowType' => $content["flowType"] ?? 0,                'fromUserId' => $array["fromUserId"] ?? "",                'adv_id' => $adv_id,            ];            CustomerFromThreePlatForm::insert($insert);        } catch (\Throwable $e) {            Log::error('Queue error:', ['exception' => $e->getMessage() . '|' . $e->getLine()]);            $this->delete();        }    }    protected function echoMessage(OutputInterface $output)    {        //输出消息        $output->writeln(json_encode($this->data));    }}
 |