优化部分代码,增加微信公众号模板

This commit is contained in:
李琦
2026-08-13 19:02:05 +08:00
parent 2f5e298d6b
commit 6e2769c528
14 changed files with 1578 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
<?php
namespace App\Http\Controllers\Api;
use App\BaseApp\BaseController;
use App\Service\WechatThemeService;
use Illuminate\Http\JsonResponse;
/**
* 自定义排版主题控制器:图文编辑器「我的模板」导入/列表/更新/删除
* list/delete 走基类create/update 覆盖直传 Service清洗校验都在 Service 内)
*/
class WechatThemeController extends BaseController
{
public function __construct()
{
parent::__construct();
$this->service = WechatThemeService::getInstance();
}
/**
* 导入模板JSON 清洗入库)
* @Method POST
*/
public function create(): JsonResponse
{
return jok($this->service->create(request()->post()), '导入成功');
}
/**
* 更新模板(名称/色板/样式整体覆盖)
* @Method POST
*/
public function update(): JsonResponse
{
$params = request()->post();
$id = (int) ($params['id'] ?? 0);
if ($id <= 0) {
return jerr('参数错误');
}
unset($params['id']);
return jok($this->service->update($id, $params), '更新成功');
}
}