更新前端相关
This commit is contained in:
parent
a32b1656b0
commit
776aacfa2e
@ -8,7 +8,7 @@ use app\admin\BaseController;
|
|||||||
use think\exception\ValidateException;
|
use think\exception\ValidateException;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
use think\response\Json;
|
use think\response\Json;
|
||||||
use app\model\SystemSiteSettings;
|
use app\model\System\SystemSiteSettings;
|
||||||
|
|
||||||
class SiteSettingsController extends BaseController
|
class SiteSettingsController extends BaseController
|
||||||
{
|
{
|
||||||
@ -19,7 +19,7 @@ class SiteSettingsController extends BaseController
|
|||||||
public function getNormalInfos()
|
public function getNormalInfos()
|
||||||
{
|
{
|
||||||
$siteSettings = SystemSiteSettings::where('delete_time', null)
|
$siteSettings = SystemSiteSettings::where('delete_time', null)
|
||||||
->field('id, label, value, sort')
|
->field('id, label, value, sort')
|
||||||
->order('id', 'asc')
|
->order('id', 'asc')
|
||||||
->select();
|
->select();
|
||||||
return json([
|
return json([
|
||||||
@ -69,11 +69,11 @@ class SiteSettingsController extends BaseController
|
|||||||
|
|
||||||
$allSettings = SystemSiteSettings::column('value', 'label');
|
$allSettings = SystemSiteSettings::column('value', 'label');
|
||||||
$allSettings['type'] = 'normal';
|
$allSettings['type'] = 'normal';
|
||||||
|
|
||||||
$labels = array_column($data, 'label');
|
$labels = array_column($data, 'label');
|
||||||
$userInfo = $this->getAdminUserInfo();
|
$userInfo = $this->getAdminUserInfo();
|
||||||
$this->logSuccess('站点设置管理', '保存基本信息', ['labels' => $labels], $userInfo);
|
$this->logSuccess('站点设置管理', '保存基本信息', ['labels' => $labels], $userInfo);
|
||||||
|
|
||||||
return json([
|
return json([
|
||||||
'code' => 200,
|
'code' => 200,
|
||||||
'msg' => '保存成功',
|
'msg' => '保存成功',
|
||||||
@ -88,7 +88,7 @@ class SiteSettingsController extends BaseController
|
|||||||
public function getLegalInfos()
|
public function getLegalInfos()
|
||||||
{
|
{
|
||||||
$siteSettings = SystemSiteSettings::where('delete_time', null)
|
$siteSettings = SystemSiteSettings::where('delete_time', null)
|
||||||
->field('id, label, value, sort')
|
->field('id, label, value, sort')
|
||||||
->order('id', 'asc')
|
->order('id', 'asc')
|
||||||
->select();
|
->select();
|
||||||
return json([
|
return json([
|
||||||
@ -139,19 +139,19 @@ class SiteSettingsController extends BaseController
|
|||||||
|
|
||||||
$allSettings = SystemSiteSettings::column('value', 'label');
|
$allSettings = SystemSiteSettings::column('value', 'label');
|
||||||
$allSettings['type'] = 'legal_notice';
|
$allSettings['type'] = 'legal_notice';
|
||||||
|
|
||||||
$labels = array_column($data, 'label');
|
$labels = array_column($data, 'label');
|
||||||
|
|
||||||
$userId = Session::get('user_id', 0);
|
$userId = Session::get('user_id', 0);
|
||||||
$userFromSession = Session::get('user', []);
|
$userFromSession = Session::get('user', []);
|
||||||
$userFromCache = Cache::get('userInfo_' . $userId, []);
|
$userFromCache = Cache::get('userInfo_' . $userId, []);
|
||||||
$account = Session::get('account', '');
|
$account = Session::get('account', '');
|
||||||
$name = Session::get('name', '');
|
$name = Session::get('name', '');
|
||||||
|
|
||||||
\think\facade\Log::record('SiteSettings Debug - user_id: ' . $userId . ', userFromSession: ' . json_encode($userFromSession) . ', userFromCache: ' . json_encode($userFromCache) . ', account: ' . $account . ', name: ' . $name);
|
\think\facade\Log::record('SiteSettings Debug - user_id: ' . $userId . ', userFromSession: ' . json_encode($userFromSession) . ', userFromCache: ' . json_encode($userFromCache) . ', account: ' . $account . ', name: ' . $name);
|
||||||
|
|
||||||
$this->logSuccess('站点设置管理', '保存法律声明和隐私条款', ['labels' => $labels]);
|
$this->logSuccess('站点设置管理', '保存法律声明和隐私条款', ['labels' => $labels]);
|
||||||
|
|
||||||
return json([
|
return json([
|
||||||
'code' => 200,
|
'code' => 200,
|
||||||
'msg' => '保存成功',
|
'msg' => '保存成功',
|
||||||
|
|||||||
@ -10,6 +10,7 @@ use app\model\FrontMenu;
|
|||||||
use app\model\OnePage;
|
use app\model\OnePage;
|
||||||
use think\db\exception\DbException;
|
use think\db\exception\DbException;
|
||||||
use think\facade\Env;
|
use think\facade\Env;
|
||||||
|
use app\model\System\SystemSiteSettings;
|
||||||
|
|
||||||
class Index extends BaseController
|
class Index extends BaseController
|
||||||
{
|
{
|
||||||
@ -30,7 +31,7 @@ class Index extends BaseController
|
|||||||
$files = glob($logPath . '*.log');
|
$files = glob($logPath . '*.log');
|
||||||
if ($files) {
|
if ($files) {
|
||||||
// 按修改时间排序,最新的在前
|
// 按修改时间排序,最新的在前
|
||||||
usort($files, function($a, $b) {
|
usort($files, function ($a, $b) {
|
||||||
return filemtime($b) - filemtime($a);
|
return filemtime($b) - filemtime($a);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -39,7 +40,7 @@ class Index extends BaseController
|
|||||||
if (file_exists($latestFile)) {
|
if (file_exists($latestFile)) {
|
||||||
$content = file_get_contents($latestFile);
|
$content = file_get_contents($latestFile);
|
||||||
$lines = explode("\n", $content);
|
$lines = explode("\n", $content);
|
||||||
|
|
||||||
// 倒序遍历,只取最近的100条
|
// 倒序遍历,只取最近的100条
|
||||||
$count = 0;
|
$count = 0;
|
||||||
for ($i = count($lines) - 1; $i >= 0 && $count < 100; $i--) {
|
for ($i = count($lines) - 1; $i >= 0 && $count < 100; $i--) {
|
||||||
@ -48,7 +49,7 @@ class Index extends BaseController
|
|||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 再倒序回来,使最新的日志在最后
|
// 再倒序回来,使最新的日志在最后
|
||||||
$logs = array_reverse($logs);
|
$logs = array_reverse($logs);
|
||||||
}
|
}
|
||||||
@ -138,15 +139,15 @@ class Index extends BaseController
|
|||||||
$requestPath = $this->request->pathinfo();
|
$requestPath = $this->request->pathinfo();
|
||||||
$path = str_replace('onepage/', '', $requestPath);
|
$path = str_replace('onepage/', '', $requestPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 确保路径以 / 开头
|
// 确保路径以 / 开头
|
||||||
if (empty($path) || $path[0] !== '/') {
|
if (empty($path) || $path[0] !== '/') {
|
||||||
$path = '/' . $path;
|
$path = '/' . $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 解码路径
|
// 解码路径
|
||||||
$path = urldecode($path);
|
$path = urldecode($path);
|
||||||
|
|
||||||
// 查找对应路径的单页
|
// 查找对应路径的单页
|
||||||
$onePage = OnePage::where('path', $path)
|
$onePage = OnePage::where('path', $path)
|
||||||
->where('status', 1)
|
->where('status', 1)
|
||||||
@ -174,4 +175,30 @@ class Index extends BaseController
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 前端底部数据
|
||||||
|
* @return \think\response\Json
|
||||||
|
*/
|
||||||
|
public function getFooterData()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$footerData = SystemSiteSettings::where('delete_time', null)
|
||||||
|
->field('label, value')
|
||||||
|
->select()
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
return json([
|
||||||
|
'code' => 200,
|
||||||
|
'msg' => 'success',
|
||||||
|
'data' => $footerData
|
||||||
|
]);
|
||||||
|
} catch (DbException $e) {
|
||||||
|
return json([
|
||||||
|
'code' => 500,
|
||||||
|
'msg' => 'fail:' . $e->getMessage(),
|
||||||
|
'data' => null
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,9 @@ use think\facade\Route;
|
|||||||
Route::get('/', 'app\index\controller\Index@index');
|
Route::get('/', 'app\index\controller\Index@index');
|
||||||
Route::get('index/index', 'app\index\controller\Index@index');
|
Route::get('index/index', 'app\index\controller\Index@index');
|
||||||
|
|
||||||
|
// --- 前端底部数据路由 ---
|
||||||
|
Route::get('footerdata', 'app\index\controller\Index@getFooterData');
|
||||||
|
|
||||||
// --- 文章详情路由 ---
|
// --- 文章详情路由 ---
|
||||||
Route::get('kingdeenews/detail/:id', 'app\index\controller\Article\NewsCenterController@getKingdeeNewsDetail');
|
Route::get('kingdeenews/detail/:id', 'app\index\controller\Article\NewsCenterController@getKingdeeNewsDetail');
|
||||||
Route::get('companynews/detail/:id', 'app\index\controller\Article\NewsCenterController@getCompanyNewsDetail');
|
Route::get('companynews/detail/:id', 'app\index\controller\Article\NewsCenterController@getCompanyNewsDetail');
|
||||||
|
|||||||
@ -9,28 +9,28 @@
|
|||||||
// | Author: Liu21st <liu21st@gmail.com>
|
// | Author: Liu21st <liu21st@gmail.com>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
namespace app\model;
|
namespace app\model\System;
|
||||||
|
|
||||||
use think\Model;
|
use think\Model;
|
||||||
use think\model\concern\SoftDelete;
|
use think\model\concern\SoftDelete;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文章分类模型
|
* 站点设置模型
|
||||||
*/
|
*/
|
||||||
class SystemSiteSettings extends Model
|
class SystemSiteSettings extends Model
|
||||||
{
|
{
|
||||||
// 启用软删除
|
// 启用软删除
|
||||||
use SoftDelete;
|
use SoftDelete;
|
||||||
|
|
||||||
// 数据库表名
|
// 数据库表名
|
||||||
protected $name = 'mete_system_site_settings';
|
protected $name = 'mete_system_site_settings';
|
||||||
|
|
||||||
// 字段类型转换
|
// 字段类型转换
|
||||||
protected $type = [
|
protected $type = [
|
||||||
'id' => 'integer',
|
'id' => 'integer',
|
||||||
'label' => 'string',
|
'label' => 'string',
|
||||||
'value' => 'string',
|
'value' => 'string',
|
||||||
'sort' => 'integer',
|
'sort' => 'integer',
|
||||||
'remark' => 'string',
|
'remark' => 'string',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
BIN
public/storage/uploads/2026/02/05/6984b341c401d.png
Normal file
BIN
public/storage/uploads/2026/02/05/6984b341c401d.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.2 KiB |
BIN
public/storage/uploads/2026/02/05/6984bc0015123.png
Normal file
BIN
public/storage/uploads/2026/02/05/6984bc0015123.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.7 KiB |
Loading…
Reference in New Issue
Block a user