whereIn('id', $row['city'])->column('name'); return $cityNames ? implode(',', $cityNames) : ''; } public function unique($field, $msg = '') { $map = []; foreach ($field as $key => $val) { if (is_numeric($key)) { $map[$val] = $this->data[$val]; } else { $map[$key] = $val; } } $result = $this->where($map)->find(); if ($result) { $this->error = $msg ?: '数据已存在'; return false; } return true; } }