perf: mac地址已存在检查

This commit is contained in:
kuaifan 2022-12-12 21:02:43 +08:00
parent 4f67329154
commit 1d90451b4e

View File

@ -3,6 +3,7 @@
namespace App\Models; namespace App\Models;
use App\Exceptions\ApiException;
use App\Module\Base; use App\Module\Base;
/** /**
@ -39,6 +40,9 @@ class UserCheckinMac extends AbstractModel
$ids = []; $ids = [];
$list = []; $list = [];
foreach ($array as $item) { foreach ($array as $item) {
if (self::whereMac($item['mac'])->where('userid', '!=', $userid)->exists()) {
throw new ApiException("{$item['mac']} 已被其他成员设置");
}
$update = []; $update = [];
if ($item['remark']) { if ($item['remark']) {
$update = [ $update = [