where('close_time', '>=', time())->value('stage_id'); $pairs = PairModel::select('uid', 'stage_id', 'assoc_id') ->where('stage_id', $stageId) ->where('rematch', 1) ->get(); $maxCount = $pairs->count(); $uuid = uuid(); $path = sprintf("media/%s", date('Y-m-d')); $local_file = sprintf("storage/app/public/%s.csv", $uuid); $fp = fopen($local_file, 'w'); fputcsv($fp, [ 'to_user', 'pair.stage_id' ]); foreach ($pairs as $pair) { $user = UserModel::find($pair->uid); fputcsv($fp, [ json_encode($user->getAuth()), $stageId ]); if ($pair->assoc_id) { $other = PairModel::find($pair->assoc_id); PairSuccessReportJob::dispatch($pair->uid, $other->uid, $stageId, 2); } } fclose($fp); $file = new File($local_file); $file = Storage::disk('oss')->putFileAs($path, $file, $uuid . '.' . $file->getExtension()); $fileUrl = Storage::disk('oss')->url($file); // 导入通知 $url = "https://push.fenpeiduixiang.com/api/v1/marketing/set_up_activity"; $eventId = 10107; $payload = [ 'memo' => "72小时重配通知-{$stageId}期", 'queryType' => 1, 'queryUrl' => $fileUrl, 'eventId' => $eventId, 'startAt' => mktime(12, 20, 0), 'maxEveryDay' => $maxCount, 'secondSendRate' => 60, 'delayPiece' => 10, ]; $response = Curl::to($url)->withData([ 'payload' => $payload ])->asJson(true)->post(); dd($response); } }