where([ "idCard" => $idcard ])->count(); //出现两条数据以上时必为老生 if($count > 1){ return AdmissionNewStudents::IS_NEW_STUDENT_NO; } //为一条数据时检测是否为老生 $studentInfo = AdmissionNewStudents::query()->where([ "idCard" => $idcard ])->first(); if(!empty($studentInfo)){ return $studentInfo->is_new_student; } } }