Check(); \Log::info('check_cid_error_end'.date('Y-m-d')); } public function Check() { $msg = '['.env('PROJECT_NAME').']'; $wrong_next_cid = DB::select('select bid,next_cid,count(1) as num from chapters c where next_cid =0 and bid > 0 group by c.bid having num > 1'); $msg .= !empty($wrong_next_cid) ? 'wrong_next_cid: '.\GuzzleHttp\json_encode($wrong_next_cid) : ''; $wrong_prev_cid = DB::select('select bid,prev_cid,count(1) as num from chapters c where prev_cid =0 and bid > 0 group by c.bid having num > 1;'); $msg .= !empty($wrong_prev_cid) ? 'wrong_prev_cid: '.\GuzzleHttp\json_encode($wrong_prev_cid) : ''; \Log::info('check_cid_error'.date('Y-m-d').$msg); if($msg){ $notify = MessageNotify::mail([ 'to_emails' => implode(",", $this->emails), 'subject' => $msg, 'body' =>$msg, 'delay_times' => 0, ]); $notify->notify(); exit(); } } }