uid = $uid; $this->time = $time; } /** * Execute the job. * * @return void */ public function handle() { $user = User::find($this->uid); $date = date('Y-m-d', strtotime($this->time)); $is_next_day = date('Y-m-d', strtotime($user->created_at)) == date('Y-m-d', strtotime('-1 days', strtotime($this->time))); if ($is_next_day) { $exists = QappUserRententionLog::where('uid', $this->uid)->exists(); if ($exists) { return; } $client = new Client(); $params = [ 'uid' => $this->uid, 'source' => 'zsy' ]; $params['sign'] = _sign($params, SysConsts::TIKTOK_KEY); $url = 'https://newtrackapi.zhuishuyun.com/api/qappuser/rentention'; $response = $client->post($url, ['form_params' => $params])->getBody()->getContents(); myLog('new_user_rentention')->info($response); $result = json_decode($response); if ($result) { if ($result->code == 0) { QappUserRententionLog::create([ 'date' => $date, 'uid' => $this->uid, 'register_time' => $user->created_at, 'read_time' => $this->time, ]); } } } } }