From d48764cc1aa3d7609a1902ac4fc91d2636a9d830 Mon Sep 17 00:00:00 2001 From: unset <193344396@qq.com> Date: Fri, 27 Jul 2018 12:48:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BD=93json=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=E4=B8=B2=E4=B8=ADdata=E4=B8=8D=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E6=88=96=E8=80=85data=E5=86=85=E5=AE=B9=E4=B8=BA=E7=A9=BA,hand?= =?UTF-8?q?le=E5=87=BD=E6=95=B0=E4=B8=AD[0]=E6=9C=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E4=B8=8B=E6=A0=870=E7=9A=84=E9=94=99=E8=AF=AF,=E5=BD=93json?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E4=B8=B2=E4=B8=ADdata=E4=B8=8D=E5=AD=98?= =?UTF-8?q?=E5=9C=A8=E6=88=96=E8=80=85data=E5=86=85=E5=AE=B9=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA,=E5=88=99=E4=B8=8D=E8=BF=9B=E8=A1=8Chandle=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/Fields.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/application/admin/controller/Fields.php b/application/admin/controller/Fields.php index 3f210e2..754c5ab 100644 --- a/application/admin/controller/Fields.php +++ b/application/admin/controller/Fields.php @@ -167,7 +167,12 @@ class Fields extends Base { return $this->buildFailed(ReturnCode::EXCEPTION, 'JSON数据格式有误'); } AdminList::update(['returnStr' => json_encode($data)], ['hash' => $hash]); - $this->handle($data['data'], $dataArr); + //如果json字符串中data不存在或者data内容为空,则不进行handle处理 + if(!isset($data['data']) || sizeof($data['data']) == 0){ + $dataArr = []; + }else{ + $this->handle($data['data'], $dataArr); + } $old = (new AdminFields())->where([ 'hash' => $hash, 'type' => $type