From 7676f31de589721338f337eb0778abf9f6999229 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=B2=E9=B9=8F?= Date: Mon, 1 Jun 2020 11:38:46 +0800 Subject: [PATCH 1/4] update app/model/Model.php. [2020-06-01T11:19:11+08:00][error] [10501]SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'cover_id'[E:\wwwroot\sent.feimaocms.com\vendor\topthink\think-orm\src\db\PDOConnection.php:722] --- app/model/Model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/model/Model.php b/app/model/Model.php index c74badcc..3f91e238 100644 --- a/app/model/Model.php +++ b/app/model/Model.php @@ -41,7 +41,7 @@ class Model extends \think\Model { 'title' => ['name' => 'title', 'title' => '标题', 'type' => 'text', 'length' => 200, 'extra' => '', 'remark' => '标题', 'is_show' => 1, 'is_must' => 1, 'value' => ''], 'category_id' => ['name' => 'category_id', 'title' => '栏目', 'type' => 'bind', 'length' => 10, 'extra' => 'category:tree', 'remark' => '栏目', 'is_show' => 1, 'is_must' => 1, 'value' => '0'], 'uid' => ['name' => 'uid', 'title' => '用户UID', 'type' => 'num', 'length' => 11, 'extra' => '', 'remark' => '用户UID', 'is_show' => 0, 'is_must' => 1, 'value' => '0'], - 'cover_id' => ['name' => 'cover_id', 'title' => '内容封面', 'type' => 'image', 'length' => 10, 'extra' => '', 'remark' => '内容封面', 'is_show' => 1, 'is_must' => 0, 'value' => ''], + 'cover_id' => ['name' => 'cover_id', 'title' => '内容封面', 'type' => 'image', 'length' => 10, 'extra' => '', 'remark' => '内容封面', 'is_show' => 1, 'is_must' => 0, 'value' => '0'], 'description' => ['name' => 'description', 'title' => '内容描述', 'type' => 'textarea', 'length' => '', 'extra' => '', 'remark' => '内容描述', 'is_show' => 1, 'is_must' => 0, 'value' => ''], 'content' => ['name' => 'content', 'title' => '内容', 'type' => 'editor', 'length' => '', 'extra' => '', 'remark' => '内容', 'is_show' => 1, 'is_must' => 0, 'value' => ''], 'status' => ['name' => 'status', 'title' => '数据状态', 'type' => 'select', 'length' => 2, 'extra' => "-1:删除\r\n0:禁用\r\n1:正常\r\n2:待审核\r\n3:草稿", 'remark' => '数据状态', 'is_show' => 1, 'is_must' => 1, 'value' => '1'], From ab40244d89ef862e7f866dd9db565185629e6881 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=B2=E9=B9=8F?= Date: Tue, 2 Jun 2020 15:01:16 +0800 Subject: [PATCH 2/4] update app/model/Model.php. --- app/model/Model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/model/Model.php b/app/model/Model.php index c74badcc..3f91e238 100644 --- a/app/model/Model.php +++ b/app/model/Model.php @@ -41,7 +41,7 @@ class Model extends \think\Model { 'title' => ['name' => 'title', 'title' => '标题', 'type' => 'text', 'length' => 200, 'extra' => '', 'remark' => '标题', 'is_show' => 1, 'is_must' => 1, 'value' => ''], 'category_id' => ['name' => 'category_id', 'title' => '栏目', 'type' => 'bind', 'length' => 10, 'extra' => 'category:tree', 'remark' => '栏目', 'is_show' => 1, 'is_must' => 1, 'value' => '0'], 'uid' => ['name' => 'uid', 'title' => '用户UID', 'type' => 'num', 'length' => 11, 'extra' => '', 'remark' => '用户UID', 'is_show' => 0, 'is_must' => 1, 'value' => '0'], - 'cover_id' => ['name' => 'cover_id', 'title' => '内容封面', 'type' => 'image', 'length' => 10, 'extra' => '', 'remark' => '内容封面', 'is_show' => 1, 'is_must' => 0, 'value' => ''], + 'cover_id' => ['name' => 'cover_id', 'title' => '内容封面', 'type' => 'image', 'length' => 10, 'extra' => '', 'remark' => '内容封面', 'is_show' => 1, 'is_must' => 0, 'value' => '0'], 'description' => ['name' => 'description', 'title' => '内容描述', 'type' => 'textarea', 'length' => '', 'extra' => '', 'remark' => '内容描述', 'is_show' => 1, 'is_must' => 0, 'value' => ''], 'content' => ['name' => 'content', 'title' => '内容', 'type' => 'editor', 'length' => '', 'extra' => '', 'remark' => '内容', 'is_show' => 1, 'is_must' => 0, 'value' => ''], 'status' => ['name' => 'status', 'title' => '数据状态', 'type' => 'select', 'length' => 2, 'extra' => "-1:删除\r\n0:禁用\r\n1:正常\r\n2:待审核\r\n3:草稿", 'remark' => '数据状态', 'is_show' => 1, 'is_must' => 1, 'value' => '1'], From 1c920da54d42594120e1c8185d4ea3112d91cb55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=B2=E9=B9=8F?= Date: Thu, 4 Jun 2020 10:12:50 +0800 Subject: [PATCH 3/4] =?UTF-8?q?update=20view/admin/model/index.html.=20?= =?UTF-8?q?=E5=9C=A8=E6=B2=A1=E6=9C=89=E5=90=AF=E7=94=A8=E8=AF=A5=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E6=97=B6,=E7=9B=B4=E6=8E=A5=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E8=AE=BF=E9=97=AE'=E6=95=B0=E6=8D=AE'=E4=BC=9A=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- view/admin/model/index.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/view/admin/model/index.html b/view/admin/model/index.html index c37f4bd2..c935ddb9 100644 --- a/view/admin/model/index.html +++ b/view/admin/model/index.html @@ -51,7 +51,12 @@ {$item['status'] ? '禁用' : '启用'} 编辑 删除 - 数据 + + {if $item['status']} + 数据 + {else} + 数据 + {/if} {/volist} From 2ff5ddeb19e90b9168c7489a24662b125658db95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B2=B2=E9=B9=8F?= Date: Thu, 4 Jun 2020 11:12:47 +0800 Subject: [PATCH 4/4] =?UTF-8?q?update=20app/controller/admin/Form.php.=20?= =?UTF-8?q?=E5=8E=9F=E6=9D=A5=E7=9A=84=E5=86=99=E6=B3=95=E6=98=AFtp5.0?= =?UTF-8?q?=E7=9A=84,=E7=8E=B0=E5=9C=A8=E6=98=AFtp6,=20db,setField?= =?UTF-8?q?=E7=AD=89=E5=9C=A8tp6=E4=B8=8D=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/admin/Form.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controller/admin/Form.php b/app/controller/admin/Form.php index 7c0c5ae5..81ec3861 100644 --- a/app/controller/admin/Form.php +++ b/app/controller/admin/Form.php @@ -272,7 +272,7 @@ class Form extends Base { * @author K先森 <77413254@qq.com> */ public function status() { - $id = $this->getArrayParam('id'); + $id = $this->request->param('form_id', 0); $status = input('status', '0', 'trim,intval'); if (!$id) { @@ -280,7 +280,7 @@ class Form extends Base { } $map['id'] = array('IN', $id); - $result = db('form')->where($map)->setField('status', $status); + $result = FormM::where($map)->update(['status'=>$status]); if ($result) { return $this->success("设置成功!"); } else {