Update Base.php

This commit is contained in:
邹景立 2022-10-17 11:37:42 +08:00
parent b597feb6df
commit 4740c66768

View File

@ -75,13 +75,13 @@ class Base extends Controller
if ($this->request->isGet()) { if ($this->request->isGet()) {
$this->types = SystemBase::types(); $this->types = SystemBase::types();
$this->types[] = '--- 新增类型 ---'; $this->types[] = '--- 新增类型 ---';
$this->type = input('get.type') ?: ($this->types[0] ?? '-'); $this->type = $this->get['type'] ?? ($this->types[0] ?? '-');
} else { } else {
$map = []; $map = [];
$map[] = ['deleted', '=', 0]; $map[] = ['deleted', '=', 0];
$map[] = ['code', '=', $data['code']]; $map[] = ['code', '=', $data['code']];
$map[] = ['type', '=', $data['type']]; $map[] = ['type', '=', $data['type']];
if (isset($data['id'])) $map[] = ['id', '<>', $data['id']]; $map[] = ['id', '<>', $data['id'] ?? 0];
if (SystemBase::mk()->where($map)->count() > 0) { if (SystemBase::mk()->where($map)->count() > 0) {
$this->error("同类型的数据编码已经存在!"); $this->error("同类型的数据编码已经存在!");
} }