addDays(21); $timetable=new Timetable; $timetable->date=$trialExpires->toDateString(); $timetable->tip=$whether_manual==0?'自动提交':'手动提交'; $timetable->save(); return Result::show(200, 'ok', ['time' => $timetable]); } /** * 每天访问一次的任务 */ public function scheduled_tasks($name = 'ThinkPHP6') { $db_time = Timetable::where('id', Timetable::where('id','>',0)->max('id'))->first(); $time = $db_time['date']; // 获取当前时间 $current = Carbon::now(); for ($i = 0; $i < 8; $i++) { $current->subDay($i); if (strcmp($current->toDateString(), $time) == 0) { $i == 7 ? $this->updated(0) : ''; return Result::show(200, 'ok', ['time' => $current->toDateString(), 'time2' => $time]); } } return Result::show(200,'ok',''); } public function send_msg($title='', $body='') { $brak_key='3vrp4DbTGmSWxVbzHnUnPB'; $curl = new Curl(); $curl->get('https://api.day.app/3vrp4DbTGmSWxVbzHnUnPB/'.$title.'/'.$body); if ($curl->error) { $curl->diagnose(); Log::info('消息发送失败', $curl->errorMessage); } return Result::show(200,'ok',''); } }