|
|
|
@ -51,9 +51,18 @@ class MiniProgramPull extends RowAction |
|
|
|
|
|
|
|
//草稿列表
|
|
|
|
$list = $codeTemplate->getDrafts(); |
|
|
|
if (empty($list['draft_list'])) { |
|
|
|
if (empty($list['draft_list']) || !is_array($list['template_list'])) { |
|
|
|
return $this->response()->error('获取草稿箱失败或草稿箱为空'); |
|
|
|
} |
|
|
|
|
|
|
|
//2021-09-26发现增加了category_list返回参数,
|
|
|
|
$list['draft_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['draft_list']); |
|
|
|
|
|
|
|
MiniProgramDraft::insertOrIgnore($list['draft_list']); |
|
|
|
MiniProgramDraft::whereNotIn('draft_id', array_column($list['draft_list'], 'draft_id'))->delete(); //删除不存在的数据
|
|
|
|
|
|
|
|
@ -74,14 +83,6 @@ 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(); //删除不存在的数据
|
|
|
|
|
|
|
|
|