新增模板,修复模板选择bug

This commit is contained in:
2026-03-19 15:47:01 +08:00
parent bf21006d4e
commit a7908e0677
22 changed files with 964 additions and 2301 deletions
@@ -7,6 +7,7 @@ namespace app\admin\controller\Cms\Theme;
use app\admin\BaseController;
use app\service\ThemeService;
use think\facade\Request;
use app\model\Cms\TemplateSiteConfig;
/**
@@ -30,11 +31,15 @@ class ThemeController extends BaseController
*/
public function index()
{
$tid = Request::get('tid', 0, 'int');
$tid = $this->getTenantId();
$themes = $this->themeService->getThemeList();
$currentTheme = $this->themeService->getCurrentTheme($tid);
$theme_useing = TemplateSiteConfig::where('tid', $tid)
->where('key', 'current_theme')
->value('value');
return json([
'code' => 200,
'msg' => 'success',
@@ -51,14 +56,13 @@ class ThemeController extends BaseController
*/
public function switch()
{
// 从当前登录用户获取tid,而不是从前端参数
$tid = $this->getTenantId();
$tid = Request::post('tid', 0, 'int');
$themeKey = Request::post('theme_key', '');
if (empty($tid) || $tid == 0) {
return json([
'code' => 401,
'msg' => '未获取到租户ID,请重新登录'
'msg' => '未获取到租户ID,请先选择租户'
]);
}