existsWhere([$this->getPk() => $id, 'is_del' => 0, 'mer_id' => $merId]); } public function intersection(?string $ids, int $merId) { if (!$ids) return [0]; return $this->getModel()::getDb()->whereIn('assistant_id',$ids)->where('mer_id', $merId)->column('assistant_id'); } public function existsAll($ids, $merId) { foreach ($ids as $id) { $has = $this->getModel()::getDb()->where('assistant_id',$id)->where('mer_id',$merId)->count(); if (!$has) throw new ValidateException('ID:'.$id.' 不存在'); } return true; } }