public function deWeight()
{
$uniqueAddresses = [];
$duplicates = [];
YunUserEntry::orderBy('id', 'desc')->get()
->map(function (YunUserEntry $venue) use (&$uniqueAddresses, &$duplicates) {
$address = sprintf("%s.%s.%s",
$venue->company_id,
date('Y-m-d', strtotime($venue->interview_date)),
$venue->id_no);
if (in_array($address, $uniqueAddresses)) {
$duplicates[] = $venue->id;
} else {
$uniqueAddresses[] = $address;
}
});
$res = YunUserEntry::whereIn('id', $duplicates)->delete();
return BaseController::returnJson(200, "去重{$res}條", null);
}
本作品採用《CC 協議》,轉載必須註明作者和本文連結