Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
飞鱼0526
ShopXO
提交
18cf3581
ShopXO
项目概览
飞鱼0526
/
ShopXO
与 Fork 源项目一致
Fork自
纵之格 / ShopXO
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ShopXO
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
18cf3581
编写于
4月 03, 2020
作者:
D
devil
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
短信优化,新增缓存
上级
cdec48a0
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
142 addition
and
74 deletion
+142
-74
application/api/controller/Goods.php
application/api/controller/Goods.php
+1
-2
application/service/AppHomeNavService.php
application/service/AppHomeNavService.php
+26
-7
application/service/BannerService.php
application/service/BannerService.php
+18
-8
application/service/GoodsService.php
application/service/GoodsService.php
+28
-19
application/tags.php
application/tags.php
+24
-25
config/shopxo.php
config/shopxo.php
+9
-0
extend/base/Sms.php
extend/base/Sms.php
+36
-13
未找到文件。
application/api/controller/Goods.php
浏览文件 @
18cf3581
...
...
@@ -218,8 +218,7 @@ class Goods extends Common
{
// 开始处理
$params
=
$this
->
data_post
;
$data
=
GoodsService
::
GoodsCategory
(
$params
);
return
DataReturn
(
'success'
,
0
,
$data
);
return
DataReturn
(
'success'
,
0
,
GoodsService
::
GoodsCategoryAll
(
$params
));
}
/**
...
...
application/service/AppHomeNavService.php
浏览文件 @
18cf3581
...
...
@@ -342,16 +342,35 @@ class AppHomeNavService
*/
public
static
function
AppHomeNav
(
$params
=
[])
{
$client_type
=
(
APPLICATION_CLIENT_TYPE
==
'pc'
)
?
(
IsMobile
()
?
'h5'
:
'pc'
)
:
APPLICATION_CLIENT_TYPE
;
$data
=
Db
::
name
(
'AppHomeNav'
)
->
field
(
'id,name,images_url,event_value,event_type,bg_color,is_need_login'
)
->
where
([
'platform'
=>
$client_type
,
'is_enable'
=>
1
])
->
order
(
'sort asc'
)
->
select
();
if
(
!
empty
(
$data
))
// 平台
$platform
=
APPLICATION_CLIENT_TYPE
;
// web端手机访问
if
(
$platform
==
'pc'
&&
IsMobile
())
{
foreach
(
$data
as
&
$v
)
$platform
=
'h5'
;
}
// 缓存
$key
=
config
(
'shopxo.cache_navigation_key'
)
.
$platform
;
$data
=
cache
(
$key
);
if
(
empty
(
$data
))
{
// 获取导航数据
$data
=
Db
::
name
(
'AppHomeNav'
)
->
field
(
'id,name,images_url,event_value,event_type,bg_color,is_need_login'
)
->
where
([
'platform'
=>
$platform
,
'is_enable'
=>
1
])
->
order
(
'sort asc'
)
->
select
();
if
(
!
empty
(
$data
))
{
$v
[
'images_url_old'
]
=
$v
[
'images_url'
];
$v
[
'images_url'
]
=
ResourcesService
::
AttachmentPathViewHandle
(
$v
[
'images_url'
]);
$v
[
'event_value'
]
=
empty
(
$v
[
'event_value'
])
?
null
:
$v
[
'event_value'
];
foreach
(
$data
as
&
$v
)
{
$v
[
'images_url_old'
]
=
$v
[
'images_url'
];
$v
[
'images_url'
]
=
ResourcesService
::
AttachmentPathViewHandle
(
$v
[
'images_url'
]);
$v
[
'event_value'
]
=
empty
(
$v
[
'event_value'
])
?
null
:
$v
[
'event_value'
];
}
}
// 存储缓存
cache
(
$key
,
$data
,
3600
*
24
);
}
return
$data
;
}
...
...
application/service/BannerService.php
浏览文件 @
18cf3581
...
...
@@ -42,18 +42,28 @@ class BannerService
$platform
=
'h5'
;
}
// 获取banner数据
$banner
=
Db
::
name
(
'Slide'
)
->
field
(
'name,images_url,event_value,event_type,bg_color'
)
->
where
([
'platform'
=>
$platform
,
'is_enable'
=>
1
])
->
order
(
'sort asc,id asc'
)
->
select
();
if
(
!
empty
(
$banner
))
// 缓存
$key
=
config
(
'shopxo.cache_banner_list_key'
)
.
$platform
;
$data
=
cache
(
$key
);
if
(
empty
(
$data
))
{
foreach
(
$banner
as
&
$v
)
// 获取banner数据
$data
=
Db
::
name
(
'Slide'
)
->
field
(
'name,images_url,event_value,event_type,bg_color'
)
->
where
([
'platform'
=>
$platform
,
'is_enable'
=>
1
])
->
order
(
'sort asc,id asc'
)
->
select
();
if
(
!
empty
(
$data
))
{
$v
[
'images_url_old'
]
=
$v
[
'images_url'
];
$v
[
'images_url'
]
=
ResourcesService
::
AttachmentPathViewHandle
(
$v
[
'images_url'
]);
$v
[
'event_value'
]
=
empty
(
$v
[
'event_value'
])
?
null
:
$v
[
'event_value'
];
foreach
(
$data
as
&
$v
)
{
$v
[
'images_url_old'
]
=
$v
[
'images_url'
];
$v
[
'images_url'
]
=
ResourcesService
::
AttachmentPathViewHandle
(
$v
[
'images_url'
]);
$v
[
'event_value'
]
=
empty
(
$v
[
'event_value'
])
?
null
:
$v
[
'event_value'
];
}
}
// 存储缓存
cache
(
$key
,
$data
,
3600
*
24
);
}
return
$
banner
;
return
$
data
;
}
}
?>
\ No newline at end of file
application/service/GoodsService.php
浏览文件 @
18cf3581
...
...
@@ -59,18 +59,16 @@ class GoodsService
// 从缓存获取
$key
=
config
(
'shopxo.cache_goods_category_key'
);
$data
=
cache
(
$key
);
if
(
!
empty
(
$data
))
{
return
$data
;
}
// 获取分类
$params
[
'where'
]
=
[
'pid'
=>
0
,
'is_enable'
=>
1
];
$data
=
self
::
GoodsCategory
(
$params
);
// 存储缓存
cache
(
$key
,
$data
);
if
(
empty
(
$data
))
{
// 获取分类
$params
[
'where'
]
=
[
'pid'
=>
0
,
'is_enable'
=>
1
];
$data
=
self
::
GoodsCategory
(
$params
);
// 存储缓存
cache
(
$key
,
$data
,
3600
*
24
);
}
return
$data
;
}
...
...
@@ -178,19 +176,30 @@ class GoodsService
*/
public
static
function
HomeFloorList
(
$params
=
[])
{
// 商品大分类
$params
[
'where'
]
=
[
'pid'
=>
0
,
'is_home_recommended'
=>
1
,
'is_enable'
=>
1
];
$goods_category
=
self
::
GoodsCategory
(
$params
);
if
(
!
empty
(
$goods_category
))
// 缓存
$key
=
config
(
'shopxo.cache_goods_floor_list_key'
);
$data
=
cache
(
$key
);
if
(
empty
(
$data
))
{
foreach
(
$goods_category
as
&
$v
)
// 商品大分类
$params
[
'where'
]
=
[
'pid'
=>
0
,
'is_home_recommended'
=>
1
,
'is_enable'
=>
1
];
$data
=
self
::
GoodsCategory
(
$params
);
if
(
!
empty
(
$data
))
{
$category_ids
=
self
::
GoodsCategoryItemsIds
([
$v
[
'id'
]],
1
);
$goods
=
self
::
CategoryGoodsList
([
'where'
=>
[
'gci.category_id'
=>
$category_ids
,
'g.is_home_recommended'
=>
1
,
'g.is_shelves'
=>
1
],
'm'
=>
0
,
'n'
=>
8
,
'field'
=>
'g.*'
]);
$v
[
'goods'
]
=
$goods
[
'data'
];
// 根据分类获取楼层商品
foreach
(
$data
as
&
$v
)
{
$category_ids
=
self
::
GoodsCategoryItemsIds
([
$v
[
'id'
]],
1
);
$goods
=
self
::
CategoryGoodsList
([
'where'
=>
[
'gci.category_id'
=>
$category_ids
,
'g.is_home_recommended'
=>
1
,
'g.is_shelves'
=>
1
],
'm'
=>
0
,
'n'
=>
8
,
'field'
=>
'g.*'
]);
$v
[
'goods'
]
=
$goods
[
'data'
];
}
}
// 存储缓存
cache
(
$key
,
$data
,
3600
*
24
);
}
return
$
goods_category
;
return
$
data
;
}
/**
...
...
application/tags.php
浏览文件 @
18cf3581
...
...
@@ -62,6 +62,26 @@ return array (
0
=>
'app\\plugins\\orderexportprint\\Hook'
,
1
=>
'app\\plugins\\orderpricerevision\\Hook'
,
),
'plugins_view_user_login_info_top'
=>
array
(
0
=>
'app\\plugins\\weixinwebauthorization\\Hook'
,
),
'plugins_view_user_reg_info'
=>
array
(
0
=>
'app\\plugins\\weixinwebauthorization\\Hook'
,
),
'plugins_view_header_navigation_top_left'
=>
array
(
0
=>
'app\\plugins\\weixinwebauthorization\\Hook'
,
),
'plugins_service_users_personal_show_field_list_handle'
=>
array
(
0
=>
'app\\plugins\\weixinwebauthorization\\Hook'
,
),
'plugins_service_system_begin'
=>
array
(
0
=>
'app\\plugins\\weixinwebauthorization\\Hook'
,
),
'plugins_service_users_center_left_menu_handle'
=>
array
(
0
=>
'app\\plugins\\excellentbuyreturntocash\\Hook'
,
...
...
@@ -97,6 +117,7 @@ return array (
0
=>
'app\\plugins\\excellentbuyreturntocash\\Hook'
,
1
=>
'app\\plugins\\coupon\\Hook'
,
2
=>
'app\\plugins\\distribution\\Hook'
,
3
=>
'app\\plugins\\neworderemail\\Hook'
,
),
'plugins_view_goods_detail_panel_bottom'
=>
array
(
...
...
@@ -127,7 +148,7 @@ return array (
array
(
0
=>
'app\\plugins\\coupon\\Hook'
,
1
=>
'app\\plugins\\membershiplevelvip\\Hook'
,
2
=>
'app\\plugins\\
touristbuy
\\Hook'
,
2
=>
'app\\plugins\\
speedplaceorder
\\Hook'
,
),
'plugins_view_buy_goods_bottom'
=>
array
(
...
...
@@ -184,13 +205,11 @@ return array (
),
'plugins_service_goods_handle_end'
=>
array
(
0
=>
'app\\plugins\\usernotloginhidegoodsprice\\Hook'
,
1
=>
'app\\plugins\\membershiplevelvip\\Hook'
,
0
=>
'app\\plugins\\membershiplevelvip\\Hook'
,
),
'plugins_service_goods_spec_base'
=>
array
(
0
=>
'app\\plugins\\usernotloginhidegoodsprice\\Hook'
,
1
=>
'app\\plugins\\membershiplevelvip\\Hook'
,
0
=>
'app\\plugins\\membershiplevelvip\\Hook'
,
),
'plugins_service_user_login_success_record'
=>
array
(
...
...
@@ -220,25 +239,5 @@ return array (
array
(
0
=>
'app\\plugins\\share\\Hook'
,
),
'plugins_service_system_begin'
=>
array
(
0
=>
'app\\plugins\\touristbuy\\Hook'
,
),
'plugins_common_header'
=>
array
(
0
=>
'app\\plugins\\touristbuy\\Hook'
,
),
'plugins_view_header_navigation_top_left'
=>
array
(
0
=>
'app\\plugins\\touristbuy\\Hook'
,
),
'plugins_view_user_login_info_top'
=>
array
(
0
=>
'app\\plugins\\touristbuy\\Hook'
,
),
'plugins_view_user_reg_info'
=>
array
(
0
=>
'app\\plugins\\touristbuy\\Hook'
,
),
);
?>
\ No newline at end of file
config/shopxo.php
浏览文件 @
18cf3581
...
...
@@ -48,6 +48,15 @@ return [
// 用户缓存信息
'cache_user_info'
=>
'cache_user_info_'
,
// 首页楼层缓存信息
'cache_goods_floor_list_key'
=>
'cache_goods_floor_list_data'
,
// 轮播缓存信息
'cache_banner_list_key'
=>
'cache_banner_list_data_'
,
// 导航缓存信息
'cache_navigation_key'
=>
'cache_navigation_data_'
,
// 附件host, 数据库图片地址以/static/...开头
'attachment_host'
=>
defined
(
'__MY_PUBLIC_URL__'
)
?
substr
(
__MY_PUBLIC_URL__
,
0
,
-
1
)
:
''
,
...
...
extend/base/Sms.php
浏览文件 @
18cf3581
...
...
@@ -82,21 +82,41 @@ class Sms
$signature
=
base64_encode
(
hash_hmac
(
'sha1'
,
$stringToSign
,
$accessKeySecret
.
'&'
,
true
)
);
return
$signature
;
}
/**
* @param unknown $mobile
* @param unknown $verify_code
*
* 短信发送
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-04-02
* @desc description
* @param [string] $mobile [手机号码,多个以 英文逗号 , 分割]
* @param [string|array] $code [变量code(单个直接传入 code 即可,多个传入数组)]
* @param [string] $template_code [模板 id]
* @param [boolean] $sign_name [自定义签名,默认使用基础配置的签名]
*/
public
function
SendCode
(
$mobile
,
$code
,
$template_code
)
{
// 是否频繁操作
if
(
!
$this
->
IntervalTimeCheck
())
{
$this
->
error
=
'防止造成骚扰,请勿频繁发送'
;
return
false
;
}
public
function
SendCode
(
$mobile
,
$code
,
$template_code
,
$sign_name
=
''
)
{
// 单个验证码需要校验是否频繁
if
(
is_string
(
$code
))
{
// 是否频繁操作
if
(
!
$this
->
IntervalTimeCheck
())
{
$this
->
error
=
'防止造成骚扰,请勿频繁发送'
;
return
false
;
}
$codes
=
[
'code'
=>
$code
];
}
else
{
$codes
=
$code
;
}
// 签名
$SignName
=
empty
(
$sign_name
)
?
$this
->
signName
:
$sign_name
;
// 请求参数
$params
=
array
(
//此处作了修改
'SignName'
=>
$
this
->
s
ignName
,
'SignName'
=>
$
S
ignName
,
'Format'
=>
'JSON'
,
'Version'
=>
'2017-05-25'
,
'AccessKeyId'
=>
$this
->
accessKeyId
,
...
...
@@ -107,7 +127,7 @@ class Sms
'Action'
=>
'SendSms'
,
'TemplateCode'
=>
$template_code
,
'PhoneNumbers'
=>
$mobile
,
'TemplateParam'
=>
'{"code":"'
.
$code
.
'"}'
'TemplateParam'
=>
json_encode
(
$codes
,
JSON_UNESCAPED_UNICODE
),
);
//print_r($params);die;
// 计算签名并把签名结果加入请求参数
...
...
@@ -132,7 +152,10 @@ class Sms
}
// 种session
$this
->
KindofSession
(
$code
);
if
(
is_string
(
$code
))
{
$this
->
KindofSession
(
$code
);
}
return
true
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录