From 6a25700cb4b1cb0ebf50ce54c53ee0d967f996ba Mon Sep 17 00:00:00 2001 From: liapples Date: Sun, 26 Sep 2021 18:00:24 +0800 Subject: [PATCH] =?UTF-8?q?category=5Flist=E5=8F=82=E6=95=B0=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MySQL_change.sql | 3 +++ app/Admin/Extensions/Grid/MiniProgramPull.php | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/MySQL_change.sql b/MySQL_change.sql index 0dce124..ec21ae8 100644 --- a/MySQL_change.sql +++ b/MySQL_change.sql @@ -145,3 +145,6 @@ ALTER TABLE `order_product_items` CHANGE COLUMN `agent_product_spec_id` `agent_product_spec_id` JSON NOT NULL COMMENT '代理商产品规格ID' AFTER `price`, CHANGE COLUMN `product_spec_id` `product_spec_id` JSON NOT NULL COMMENT '供应商产品规格ID' AFTER `product_type`; +# 17:55 2021/9/26 +ALTER TABLE `mini_program_drafts` + ADD COLUMN `category_list` JSON NULL AFTER `developer`; diff --git a/app/Admin/Extensions/Grid/MiniProgramPull.php b/app/Admin/Extensions/Grid/MiniProgramPull.php index f26ada9..ef0a531 100644 --- a/app/Admin/Extensions/Grid/MiniProgramPull.php +++ b/app/Admin/Extensions/Grid/MiniProgramPull.php @@ -70,9 +70,18 @@ class MiniProgramPull extends RowAction //模板列表 $list = $codeTemplate->list(); - if (empty($list['template_list'])) { + if (empty($list['template_list']) || !is_array($list['template_list'])) { return $this->response()->error('获取模板失败或模板为空'); } + + //2021-09-26发现增加了category_list返回参数, + $list['template_list'] = array_map(function ($v) { + if (isset($v['category_list']) && is_array($v['category_list'])) { + $v['category_list'] = json_encode($v['category_list']); + } + return $v; + }, $list['template_list']); + MiniProgramTemplate::insertOrIgnore($list['template_list']); MiniProgramTemplate::whereNotIn('template_id', array_column($list['template_list'], 'template_id'))->delete(); //删除不存在的数据