Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
纵之格
ShopXO
提交
c1e8003c
ShopXO
项目概览
纵之格
/
ShopXO
通知
394
Star
16
Fork
11
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ShopXO
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
c1e8003c
编写于
4月 21, 2022
作者:
G
gongfuxiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
缓存key统一读取
上级
d87a143d
变更
20
隐藏空白更改
内联
并排
Showing
20 changed file
with
80 addition
and
48 deletion
+80
-48
app/admin/controller/Plugins.php
app/admin/controller/Plugins.php
+2
-1
app/admin/controller/Site.php
app/admin/controller/Site.php
+3
-2
app/index/controller/User.php
app/index/controller/User.php
+3
-2
app/service/AdminPowerService.php
app/service/AdminPowerService.php
+12
-11
app/service/AdminService.php
app/service/AdminService.php
+4
-3
app/service/AppCenterNavService.php
app/service/AppCenterNavService.php
+2
-1
app/service/AppHomeNavService.php
app/service/AppHomeNavService.php
+2
-1
app/service/ArticleService.php
app/service/ArticleService.php
+2
-1
app/service/BannerService.php
app/service/BannerService.php
+2
-1
app/service/ConfigService.php
app/service/ConfigService.php
+3
-2
app/service/GoodsService.php
app/service/GoodsService.php
+5
-4
app/service/LinkService.php
app/service/LinkService.php
+2
-1
app/service/NavigationService.php
app/service/NavigationService.php
+9
-8
app/service/PluginsAdminService.php
app/service/PluginsAdminService.php
+2
-1
app/service/PluginsService.php
app/service/PluginsService.php
+4
-3
app/service/QuickNavService.php
app/service/QuickNavService.php
+2
-1
app/service/RegionService.php
app/service/RegionService.php
+2
-1
app/service/SearchService.php
app/service/SearchService.php
+2
-1
app/service/SystemService.php
app/service/SystemService.php
+14
-0
app/service/UserService.php
app/service/UserService.php
+3
-3
未找到文件。
app/admin/controller/Plugins.php
浏览文件 @
c1e8003c
...
...
@@ -10,6 +10,7 @@
// +----------------------------------------------------------------------
namespace
app\admin\controller
;
use
app\service\SystemService
;
use
app\service\ApiService
;
use
app\service\PluginsService
;
use
app\service\ResourcesService
;
...
...
@@ -85,7 +86,7 @@ class Plugins extends Common
}
// 插件权限校验
$power_plugins
=
MyCache
(
MyConfig
(
'shopxo.cache_admin_power_plugins_key'
)
.
$this
->
admin
[
'id'
]);
$power_plugins
=
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_admin_power_plugins_key'
)
.
$this
->
admin
[
'id'
]);
if
(
empty
(
$power_plugins
)
||
!
array_key_exists
(
$params
[
'data_request'
][
'pluginsname'
],
$power_plugins
))
{
$msg
=
'无权限使用该插件'
;
...
...
app/admin/controller/Site.php
浏览文件 @
c1e8003c
...
...
@@ -10,6 +10,7 @@
// +----------------------------------------------------------------------
namespace
app\admin\controller
;
use
app\service\SystemService
;
use
app\service\ConfigService
;
use
app\service\GoodsService
;
use
app\service\SiteService
;
...
...
@@ -382,11 +383,11 @@ class Site extends Common
{
// 登录
case
'login'
:
MyCache
(
MyConfig
(
'shopxo.cache_user_login_left_key'
),
null
);
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_user_login_left_key'
),
null
);
// 密码找回
case
'forgetpwd'
:
MyCache
(
MyConfig
(
'shopxo.cache_user_forgetpwd_left_key'
),
null
);
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_user_forgetpwd_left_key'
),
null
);
break
;
}
}
...
...
app/index/controller/User.php
浏览文件 @
c1e8003c
...
...
@@ -10,6 +10,7 @@
// +----------------------------------------------------------------------
namespace
app\index\controller
;
use
app\service\SystemService
;
use
app\service\OrderService
;
use
app\service\GoodsService
;
use
app\service\UserService
;
...
...
@@ -221,7 +222,7 @@ class User extends Common
MyViewAssign
(
'home_seo_site_title'
,
SeoService
::
BrowserSeoTitle
(
'密码找回'
,
1
));
// 左侧图片,随机其中一个
$left_data
=
UserService
::
UserEntranceLeftData
([
'left_key'
=>
'forgetpwd'
,
'cache_key'
=>
MyConfig
(
'shopxo.cache_user_forgetpwd_left_key'
)]);
$left_data
=
UserService
::
UserEntranceLeftData
([
'left_key'
=>
'forgetpwd'
,
'cache_key'
=>
SystemService
::
CacheKey
(
'shopxo.cache_user_forgetpwd_left_key'
)]);
MyViewAssign
(
'user_forgetpwd_left_data'
,
empty
(
$left_data
[
'data'
])
?
[]
:
$left_data
[
'data'
][
array_rand
(
$left_data
[
'data'
],
1
)]);
return
MyView
();
...
...
@@ -287,7 +288,7 @@ class User extends Common
MyViewAssign
(
'referer_url'
,
$this
->
GetrefererUrl
());
// 左侧图片,随机其中一个
$left_data
=
UserService
::
UserEntranceLeftData
([
'left_key'
=>
'login'
,
'cache_key'
=>
MyConfig
(
'shopxo.cache_user_login_left_key'
)]);
$left_data
=
UserService
::
UserEntranceLeftData
([
'left_key'
=>
'login'
,
'cache_key'
=>
SystemService
::
CacheKey
(
'shopxo.cache_user_login_left_key'
)]);
MyViewAssign
(
'user_login_left_data'
,
empty
(
$left_data
[
'data'
])
?
[]
:
$left_data
[
'data'
][
array_rand
(
$left_data
[
'data'
],
1
)]);
return
MyView
();
...
...
app/service/AdminPowerService.php
浏览文件 @
c1e8003c
...
...
@@ -11,6 +11,7 @@
namespace
app\service
;
use
think\facade\Db
;
use
app\service\SystemService
;
use
app\service\AdminService
;
use
app\service\AdminRoleService
;
...
...
@@ -189,9 +190,9 @@ class AdminPowerService
{
foreach
(
$admin
as
$id
)
{
MyCache
(
MyConfig
(
'shopxo.cache_admin_left_menu_key'
)
.
$id
,
null
);
MyCache
(
MyConfig
(
'shopxo.cache_admin_power_key'
)
.
$id
,
null
);
MyCache
(
MyConfig
(
'shopxo.cache_admin_power_plugins_key'
)
.
$id
,
null
);
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_admin_left_menu_key'
)
.
$id
,
null
);
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_admin_power_key'
)
.
$id
,
null
);
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_admin_power_plugins_key'
)
.
$id
,
null
);
}
}
}
...
...
@@ -213,9 +214,9 @@ class AdminPowerService
$role_id
=
isset
(
$admin
[
'role_id'
])
?
intval
(
$admin
[
'role_id'
])
:
0
;
// 读取缓存数据
$admin_left_menu
=
MyCache
(
MyConfig
(
'shopxo.cache_admin_left_menu_key'
)
.
$admin_id
);
$admin_power
=
MyCache
(
MyConfig
(
'shopxo.cache_admin_power_key'
)
.
$admin_id
);
$admin_plugins
=
MyCache
(
MyConfig
(
'shopxo.cache_admin_power_plugins_key'
)
.
$admin_id
);
$admin_left_menu
=
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_admin_left_menu_key'
)
.
$admin_id
);
$admin_power
=
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_admin_power_key'
)
.
$admin_id
);
$admin_plugins
=
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_admin_power_plugins_key'
)
.
$admin_id
);
// 缓存没数据则从数据库重新读取
if
(((
$role_id
>
0
||
$admin_id
==
1
)
&&
empty
(
$admin_left_menu
))
||
$is_refresh
||
MyEnv
(
'app_debug'
))
...
...
@@ -309,9 +310,9 @@ class AdminPowerService
$admin_plugins
=
Db
::
name
(
'RolePlugins'
)
->
where
([
'role_id'
=>
$role_id
])
->
column
(
'name'
,
'plugins'
);
}
}
MyCache
(
MyConfig
(
'shopxo.cache_admin_left_menu_key'
)
.
$admin_id
,
$admin_left_menu
);
MyCache
(
MyConfig
(
'shopxo.cache_admin_power_key'
)
.
$admin_id
,
$admin_power
);
MyCache
(
MyConfig
(
'shopxo.cache_admin_power_plugins_key'
)
.
$admin_id
,
$admin_plugins
);
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_admin_left_menu_key'
)
.
$admin_id
,
$admin_left_menu
);
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_admin_power_key'
)
.
$admin_id
,
$admin_power
);
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_admin_power_plugins_key'
)
.
$admin_id
,
$admin_plugins
);
}
return
true
;
}
...
...
@@ -329,7 +330,7 @@ class AdminPowerService
$admin
=
AdminService
::
LoginInfo
();
if
(
!
empty
(
$admin
[
'id'
]))
{
$data
=
MyCache
(
MyConfig
(
'shopxo.cache_admin_left_menu_key'
)
.
$admin
[
'id'
]);
$data
=
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_admin_left_menu_key'
)
.
$admin
[
'id'
]);
}
// 后台左侧菜单钩子
...
...
@@ -357,7 +358,7 @@ class AdminPowerService
$admin
=
AdminService
::
LoginInfo
();
if
(
!
empty
(
$admin
[
'id'
]))
{
$data
=
MyCache
(
MyConfig
(
'shopxo.cache_admin_power_key'
)
.
$admin
[
'id'
]);
$data
=
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_admin_power_key'
)
.
$admin
[
'id'
]);
}
// 后台左侧菜单权限钩子
...
...
app/service/AdminService.php
浏览文件 @
c1e8003c
...
...
@@ -11,6 +11,7 @@
namespace
app\service
;
use
think\facade\Db
;
use
app\service\SystemService
;
use
app\service\AdminPowerService
;
/**
...
...
@@ -506,9 +507,9 @@ class AdminService
if
(
Db
::
name
(
'Admin'
)
->
where
([
'id'
=>
$admin
[
'id'
]])
->
update
(
$data
))
{
// 清空权限缓存数据
MyCache
(
MyConfig
(
'shopxo.cache_admin_left_menu_key'
)
.
$admin
[
'id'
],
null
);
MyCache
(
MyConfig
(
'shopxo.cache_admin_power_key'
)
.
$admin
[
'id'
],
null
);
MyCache
(
MyConfig
(
'shopxo.cache_admin_power_plugins_key'
)
.
$admin
[
'id'
],
null
);
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_admin_left_menu_key'
)
.
$admin
[
'id'
],
null
);
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_admin_power_key'
)
.
$admin
[
'id'
],
null
);
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_admin_power_plugins_key'
)
.
$admin
[
'id'
],
null
);
// 权限菜单初始化
AdminPowerService
::
PowerMenuInit
();
...
...
app/service/AppCenterNavService.php
浏览文件 @
c1e8003c
...
...
@@ -11,6 +11,7 @@
namespace
app\service
;
use
think\facade\Db
;
use
app\service\SystemService
;
use
app\service\ResourcesService
;
/**
...
...
@@ -274,7 +275,7 @@ class AppCenterNavService
public
static
function
AppCenterNav
(
$params
=
[])
{
// 缓存
$key
=
MyConfig
(
'shopxo.cache_app_user_center_navigation_key'
)
.
APPLICATION_CLIENT_TYPE
;
$key
=
SystemService
::
CacheKey
(
'shopxo.cache_app_user_center_navigation_key'
)
.
APPLICATION_CLIENT_TYPE
;
$data
=
MyCache
(
$key
);
if
(
empty
(
$data
))
...
...
app/service/AppHomeNavService.php
浏览文件 @
c1e8003c
...
...
@@ -11,6 +11,7 @@
namespace
app\service
;
use
think\facade\Db
;
use
app\service\SystemService
;
use
app\service\ResourcesService
;
/**
...
...
@@ -269,7 +270,7 @@ class AppHomeNavService
public
static
function
AppHomeNav
(
$params
=
[])
{
// 缓存
$key
=
MyConfig
(
'shopxo.cache_app_home_navigation_key'
)
.
APPLICATION_CLIENT_TYPE
;
$key
=
SystemService
::
CacheKey
(
'shopxo.cache_app_home_navigation_key'
)
.
APPLICATION_CLIENT_TYPE
;
$data
=
MyCache
(
$key
);
if
(
$data
===
null
||
MyEnv
(
'app_debug'
))
{
...
...
app/service/ArticleService.php
浏览文件 @
c1e8003c
...
...
@@ -11,6 +11,7 @@
namespace
app\service
;
use
think\facade\Db
;
use
app\service\SystemService
;
use
app\service\ResourcesService
;
/**
...
...
@@ -34,7 +35,7 @@ class ArticleService
public
static
function
HomeArticleList
(
$params
=
[])
{
// 从缓存获取
$key
=
MyConfig
(
'shopxo.cache_home_article_list_key'
);
$key
=
SystemService
::
CacheKey
(
'shopxo.cache_home_article_list_key'
);
$data
=
MyCache
(
$key
);
if
(
$data
===
null
||
MyEnv
(
'app_debug'
))
{
...
...
app/service/BannerService.php
浏览文件 @
c1e8003c
...
...
@@ -11,6 +11,7 @@
namespace
app\service
;
use
think\facade\Db
;
use
app\service\SystemService
;
use
app\service\ResourcesService
;
/**
...
...
@@ -34,7 +35,7 @@ class BannerService
public
static
function
Banner
(
$params
=
[])
{
// 缓存
$key
=
MyConfig
(
'shopxo.cache_banner_list_key'
)
.
APPLICATION_CLIENT_TYPE
;
$key
=
SystemService
::
CacheKey
(
'shopxo.cache_banner_list_key'
)
.
APPLICATION_CLIENT_TYPE
;
$data
=
MyCache
(
$key
);
if
(
$data
===
null
||
MyEnv
(
'app_debug'
))
{
...
...
app/service/ConfigService.php
浏览文件 @
c1e8003c
...
...
@@ -11,6 +11,7 @@
namespace
app\service
;
use
think\facade\Db
;
use
app\service\SystemService
;
use
app\service\ResourcesService
;
/**
...
...
@@ -204,7 +205,7 @@ class ConfigService
if
(
$success
>
0
)
{
// 删除所有配置的缓存数据
MyCache
(
MyConfig
(
'shopxo.cache_common_my_config_key'
),
null
);
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_common_my_config_key'
),
null
);
// 所有配置信息更新
self
::
ConfigInit
(
1
);
...
...
@@ -257,7 +258,7 @@ class ConfigService
*/
public
static
function
ConfigInit
(
$status
=
0
)
{
$key
=
MyConfig
(
'shopxo.cache_common_my_config_key'
);
$key
=
SystemService
::
CacheKey
(
'shopxo.cache_common_my_config_key'
);
$data
=
MyCache
(
$key
);
if
(
$data
===
null
||
$status
==
1
)
{
...
...
app/service/GoodsService.php
浏览文件 @
c1e8003c
...
...
@@ -11,6 +11,7 @@
namespace
app\service
;
use
think\facade\Db
;
use
app\service\SystemService
;
use
app\service\SystemBaseService
;
use
app\service\ResourcesService
;
use
app\service\BrandService
;
...
...
@@ -63,7 +64,7 @@ class GoodsService
public
static
function
GoodsCategoryAll
(
$params
=
[])
{
// 从缓存获取
$key
=
MyConfig
(
'shopxo.cache_goods_category_key'
);
$key
=
SystemService
::
CacheKey
(
'shopxo.cache_goods_category_key'
);
$data
=
MyCache
(
$key
);
if
(
$data
===
null
||
MyEnv
(
'app_debug'
))
{
...
...
@@ -219,7 +220,7 @@ class GoodsService
public
static
function
HomeFloorList
(
$params
=
[])
{
// 缓存
$key
=
MyConfig
(
'shopxo.cache_goods_floor_list_key'
);
$key
=
SystemService
::
CacheKey
(
'shopxo.cache_goods_floor_list_key'
);
$data
=
MyCache
(
$key
);
if
(
$data
===
null
||
MyEnv
(
'app_debug'
))
{
...
...
@@ -2639,7 +2640,7 @@ class GoodsService
}
// 删除大分类缓存
MyCache
(
MyConfig
(
'shopxo.cache_goods_category_key'
),
null
);
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_goods_category_key'
),
null
);
$res
=
self
::
GoodsCategoryDataHandle
([
$data
]);
return
DataReturn
(
'操作成功'
,
0
,
json_encode
(
$res
[
0
]));
...
...
@@ -2681,7 +2682,7 @@ class GoodsService
if
(
Db
::
name
(
'GoodsCategory'
)
->
where
([
'id'
=>
$ids
])
->
delete
())
{
// 删除大分类缓存
MyCache
(
MyConfig
(
'shopxo.cache_goods_category_key'
),
null
);
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_goods_category_key'
),
null
);
return
DataReturn
(
'删除成功'
,
0
);
}
...
...
app/service/LinkService.php
浏览文件 @
c1e8003c
...
...
@@ -11,6 +11,7 @@
namespace
app\service
;
use
think\facade\Db
;
use
app\service\SystemService
;
use
app\service\GoodsService
;
/**
...
...
@@ -34,7 +35,7 @@ class LinkService
public
static
function
HomeLinkList
(
$params
=
[])
{
// 从缓存获取
$key
=
MyConfig
(
'shopxo.cache_home_link_list_key'
);
$key
=
SystemService
::
CacheKey
(
'shopxo.cache_home_link_list_key'
);
$data
=
MyCache
(
$key
);
if
(
$data
==
null
||
MyEnv
(
'app_debug'
))
{
...
...
app/service/NavigationService.php
浏览文件 @
c1e8003c
...
...
@@ -11,6 +11,7 @@
namespace
app\service
;
use
think\facade\Db
;
use
app\service\SystemService
;
use
app\service\BuyService
;
use
app\service\MessageService
;
use
app\service\OrderService
;
...
...
@@ -40,8 +41,8 @@ class NavigationService
public
static
function
Nav
(
$params
=
[])
{
// 读取缓存数据
$header
=
MyCache
(
MyConfig
(
'shopxo.cache_common_home_nav_header_key'
));
$footer
=
MyCache
(
MyConfig
(
'shopxo.cache_common_home_nav_footer_key'
));
$header
=
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_common_home_nav_header_key'
));
$footer
=
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_common_home_nav_footer_key'
));
// 缓存没数据则从数据库重新读取,顶部菜单
if
(
$header
===
null
||
MyEnv
(
'app_debug'
))
...
...
@@ -157,7 +158,7 @@ class NavigationService
}
// 缓存
MyCache
(
MyConfig
(
'shopxo.cache_common_home_nav_'
.
$nav_type
.
'_key'
),
$data
,
180
);
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_common_home_nav_'
.
$nav_type
.
'_key'
),
$data
,
180
);
return
$data
;
}
...
...
@@ -470,7 +471,7 @@ class NavigationService
public
static
function
NacDataSave
(
$params
=
[])
{
// 缓存 key
$cache_key
=
MyConfig
(
'shopxo.cache_common_home_nav_'
.
$params
[
'nav_type'
]
.
'_key'
);
$cache_key
=
SystemService
::
CacheKey
(
'shopxo.cache_common_home_nav_'
.
$params
[
'nav_type'
]
.
'_key'
);
// 非自定义导航数据处理
if
(
empty
(
$params
[
'name'
]))
...
...
@@ -573,8 +574,8 @@ class NavigationService
Db
::
commit
();
// 清除缓存
MyCache
(
MyConfig
(
'shopxo.cache_common_home_nav_header_key'
),
null
);
MyCache
(
MyConfig
(
'shopxo.cache_common_home_nav_footer_key'
),
null
);
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_common_home_nav_header_key'
),
null
);
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_common_home_nav_footer_key'
),
null
);
return
DataReturn
(
'删除成功'
);
}
...
...
@@ -623,8 +624,8 @@ class NavigationService
if
(
Db
::
name
(
'Navigation'
)
->
where
([
'id'
=>
intval
(
$params
[
'id'
])])
->
update
([
$params
[
'field'
]
=>
intval
(
$params
[
'state'
]),
'upd_time'
=>
time
()]))
{
// 清除缓存
MyCache
(
MyConfig
(
'shopxo.cache_common_home_nav_header_key'
),
null
);
MyCache
(
MyConfig
(
'shopxo.cache_common_home_nav_footer_key'
),
null
);
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_common_home_nav_header_key'
),
null
);
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_common_home_nav_footer_key'
),
null
);
return
DataReturn
(
'编辑成功'
);
}
...
...
app/service/PluginsAdminService.php
浏览文件 @
c1e8003c
...
...
@@ -11,6 +11,7 @@
namespace
app\service
;
use
think\facade\Db
;
use
app\service\SystemService
;
use
app\service\PluginsService
;
use
app\service\ResourcesService
;
use
app\service\SqlConsoleService
;
...
...
@@ -64,7 +65,7 @@ class PluginsAdminService
$admin
=
AdminService
::
LoginInfo
();
if
(
!
empty
(
$admin
))
{
$res
=
MyCache
(
MyConfig
(
'shopxo.cache_admin_power_plugins_key'
)
.
$admin
[
'id'
]);
$res
=
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_admin_power_plugins_key'
)
.
$admin
[
'id'
]);
if
(
!
empty
(
$res
))
{
$power_plugins
=
$res
;
...
...
app/service/PluginsService.php
浏览文件 @
c1e8003c
...
...
@@ -11,6 +11,7 @@
namespace
app\service
;
use
think\facade\Db
;
use
app\service\SystemService
;
use
app\service\ResourcesService
;
use
app\service\PluginsAdminService
;
use
app\service\StoreService
;
...
...
@@ -186,7 +187,7 @@ class PluginsService
*/
public
static
function
PluginsCacheStorage
(
$plugins
,
$data
)
{
return
MyCache
(
MyConfig
(
'shopxo.cache_plugins_data_key'
)
.
$plugins
,
$data
);
return
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_plugins_data_key'
)
.
$plugins
,
$data
);
}
/**
...
...
@@ -200,7 +201,7 @@ class PluginsService
*/
public
static
function
PluginsCacheData
(
$plugins
)
{
return
MyCache
(
MyConfig
(
'shopxo.cache_plugins_data_key'
)
.
$plugins
);
return
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_plugins_data_key'
)
.
$plugins
);
}
/**
...
...
@@ -214,7 +215,7 @@ class PluginsService
*/
public
static
function
PluginsCacheDelete
(
$plugins
)
{
MyCache
(
MyConfig
(
'shopxo.cache_plugins_data_key'
)
.
$plugins
,
null
);
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_plugins_data_key'
)
.
$plugins
,
null
);
}
/**
...
...
app/service/QuickNavService.php
浏览文件 @
c1e8003c
...
...
@@ -11,6 +11,7 @@
namespace
app\service
;
use
think\facade\Db
;
use
app\service\SystemService
;
use
app\service\ResourcesService
;
/**
...
...
@@ -268,7 +269,7 @@ class QuickNavService
public
static
function
QuickNav
(
$params
=
[])
{
// 缓存
$key
=
MyConfig
(
'shopxo.cache_quick_navigation_key'
)
.
APPLICATION_CLIENT_TYPE
;
$key
=
SystemService
::
CacheKey
(
'shopxo.cache_quick_navigation_key'
)
.
APPLICATION_CLIENT_TYPE
;
$data
=
MyCache
(
$key
);
if
(
$data
===
null
||
MyEnv
(
'app_debug'
))
{
...
...
app/service/RegionService.php
浏览文件 @
c1e8003c
...
...
@@ -11,6 +11,7 @@
namespace
app\service
;
use
think\facade\Db
;
use
app\service\SystemService
;
/**
* 地区服务层
...
...
@@ -261,7 +262,7 @@ class RegionService
public
static
function
RegionAll
(
$params
=
[])
{
// 缓存
$key
=
MyConfig
(
'shopxo.cache_region_all_key'
);
$key
=
SystemService
::
CacheKey
(
'shopxo.cache_region_all_key'
);
$data
=
MyCache
(
$key
);
if
(
empty
(
$data
))
{
...
...
app/service/SearchService.php
浏览文件 @
c1e8003c
...
...
@@ -11,6 +11,7 @@
namespace
app\service
;
use
think\facade\Db
;
use
app\service\SystemService
;
use
app\service\GoodsService
;
use
app\service\BrandService
;
use
app\service\ResourcesService
;
...
...
@@ -380,7 +381,7 @@ class SearchService
*/
public
static
function
SearchKeywordsList
(
$params
=
[])
{
$key
=
MyConfig
(
'shopxo.cache_search_keywords_key'
);
$key
=
SystemService
::
CacheKey
(
'shopxo.cache_search_keywords_key'
);
$data
=
MyCache
(
$key
);
if
(
$data
===
null
||
MyEnv
(
'app_debug'
))
{
...
...
app/service/SystemService.php
浏览文件 @
c1e8003c
...
...
@@ -139,5 +139,19 @@ class SystemService
return
$value
;
}
/**
* 缓存key获取
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2022-04-21
* @desc description
* @param [string] $key [缓存key]
*/
public
static
function
CacheKey
(
$key
)
{
return
MyConfig
(
$key
)
.
'_'
.
SYSTEM_TYPE
;
}
}
?>
\ No newline at end of file
app/service/UserService.php
浏览文件 @
c1e8003c
...
...
@@ -95,7 +95,7 @@ class UserService
self
::
UserLoginRecord
(
$user_login_info
[
'id'
]);
if
(
!
empty
(
$user_login_info
[
'token'
]))
{
MyCache
(
MyConfig
(
'shopxo.cache_user_info'
)
.
$user_login_info
[
'token'
],
$user_login_info
);
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_user_info'
)
.
$user_login_info
[
'token'
],
$user_login_info
);
}
}
}
...
...
@@ -114,7 +114,7 @@ class UserService
*/
public
static
function
UserTokenData
(
$token
)
{
$user
=
MyCache
(
MyConfig
(
'shopxo.cache_user_info'
)
.
$token
);
$user
=
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_user_info'
)
.
$token
);
if
(
$user
!==
null
&&
isset
(
$user
[
'id'
]))
{
return
$user
;
...
...
@@ -2107,7 +2107,7 @@ class UserService
$user
[
'token'
]
=
self
::
CreatedUserToken
(
$user_id
);
if
(
Db
::
name
(
'User'
)
->
where
([
'id'
=>
$user_id
])
->
update
([
'token'
=>
$user
[
'token'
],
'upd_time'
=>
time
()]))
{
MyCache
(
MyConfig
(
'shopxo.cache_user_info'
)
.
$user
[
'token'
],
$user
);
MyCache
(
SystemService
::
CacheKey
(
'shopxo.cache_user_info'
)
.
$user
[
'token'
],
$user
);
}
// web端用户登录纪录处理
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录