diff --git a/MySQL_change.sql b/MySQL_change.sql index ec21ae8..851f2fa 100644 --- a/MySQL_change.sql +++ b/MySQL_change.sql @@ -147,4 +147,7 @@ ALTER TABLE `order_product_items` # 17:55 2021/9/26 ALTER TABLE `mini_program_drafts` - ADD COLUMN `category_list` JSON NULL AFTER `developer`; + ADD COLUMN `category_list` JSON NULL DEFAULT NULL AFTER `developer`; +ALTER TABLE `mini_program_templates` + ADD COLUMN `category_list` JSON NULL DEFAULT NULL AFTER `developer`; + diff --git a/app/Admin/Extensions/Grid/MiniProgramPull.php b/app/Admin/Extensions/Grid/MiniProgramPull.php index 2892a5f..ea3ac28 100644 --- a/app/Admin/Extensions/Grid/MiniProgramPull.php +++ b/app/Admin/Extensions/Grid/MiniProgramPull.php @@ -83,6 +83,14 @@ class MiniProgramPull extends RowAction 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(); //删除不存在的数据