Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jcy2004x
ShopXO
提交
e8fd6b55
ShopXO
项目概览
jcy2004x
/
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,体验更适合开发者的 AI 搜索 >>
提交
e8fd6b55
编写于
2月 26, 2019
作者:
G
gongfuxiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新增用户未登录不展示商品价格
上级
3f7a7d0a
变更
30
展开全部
隐藏空白更改
内联
并排
Showing
30 changed file
with
489 addition
and
94 deletion
+489
-94
application/admin/controller/Goods.php
application/admin/controller/Goods.php
+11
-10
application/api/controller/Goods.php
application/api/controller/Goods.php
+5
-5
application/index/controller/Common.php
application/index/controller/Common.php
+6
-6
application/index/controller/Goods.php
application/index/controller/Goods.php
+11
-9
application/index/controller/Search.php
application/index/controller/Search.php
+3
-3
application/index/controller/User.php
application/index/controller/User.php
+1
-1
application/index/view/default/goods/index.html
application/index/view/default/goods/index.html
+1
-1
application/plugins/commongobacktop/Hook.php
application/plugins/commongobacktop/Hook.php
+2
-2
application/plugins/commononlineservice/Hook.php
application/plugins/commononlineservice/Hook.php
+2
-2
application/plugins/commonrightnavigation/Hook.php
application/plugins/commonrightnavigation/Hook.php
+2
-2
application/plugins/commontopmaxpicture/Hook.php
application/plugins/commontopmaxpicture/Hook.php
+2
-2
application/plugins/commontopnotice/Hook.php
application/plugins/commontopnotice/Hook.php
+2
-2
application/plugins/usercentertopnotice/Hook.php
application/plugins/usercentertopnotice/Hook.php
+2
-2
application/plugins/userloginrewardintegral/Hook.php
application/plugins/userloginrewardintegral/Hook.php
+3
-3
application/plugins/userloginrewardintegral/config.json
application/plugins/userloginrewardintegral/config.json
+1
-1
application/plugins/usernotloginhidegoodsprice/Admin.php
application/plugins/usernotloginhidegoodsprice/Admin.php
+96
-0
application/plugins/usernotloginhidegoodsprice/Hook.php
application/plugins/usernotloginhidegoodsprice/Hook.php
+116
-0
application/plugins/usernotloginhidegoodsprice/config.json
application/plugins/usernotloginhidegoodsprice/config.json
+28
-0
application/plugins/view/usernotloginhidegoodsprice/admin/index.html
.../plugins/view/usernotloginhidegoodsprice/admin/index.html
+51
-0
application/plugins/view/usernotloginhidegoodsprice/admin/saveinfo.html
...ugins/view/usernotloginhidegoodsprice/admin/saveinfo.html
+43
-0
application/service/BuyService.php
application/service/BuyService.php
+12
-12
application/service/GoodsService.php
application/service/GoodsService.php
+32
-2
application/service/PluginsAdminService.php
application/service/PluginsAdminService.php
+8
-2
application/service/UserService.php
application/service/UserService.php
+14
-2
application/tags.php
application/tags.php
+5
-1
config/shopxo.php
config/shopxo.php
+1
-1
config/shopxo.sql
config/shopxo.sql
+13
-22
public/static/index/default/css/goods.css
public/static/index/default/css/goods.css
+1
-1
public/static/plugins/css/usernotloginhidegoodsprice/admin.css
...c/static/plugins/css/usernotloginhidegoodsprice/admin.css
+15
-0
public/static/upload/images/plugins_usernotloginhidegoodsprice/2019/02/26/1551184745400164.png
...sernotloginhidegoodsprice/2019/02/26/1551184745400164.png
+0
-0
未找到文件。
application/admin/controller/Goods.php
浏览文件 @
e8fd6b55
...
...
@@ -74,12 +74,13 @@ class Goods extends Common
// 获取数据列表
$data_params
=
[
'where'
=>
$where
,
'm'
=>
$page
->
GetPageStarNumber
(),
'n'
=>
$number
,
'is_category'
=>
1
,
'where'
=>
$where
,
'm'
=>
$page
->
GetPageStarNumber
(),
'n'
=>
$number
,
'is_category'
=>
1
,
'is_admin_access'
=>
1
,
];
$
data
=
GoodsService
::
GoodsList
(
$data_params
);
$
ret
=
GoodsService
::
GoodsList
(
$data_params
);
// 是否上下架
$this
->
assign
(
'common_is_shelves_list'
,
lang
(
'common_is_shelves_list'
));
...
...
@@ -89,7 +90,7 @@ class Goods extends Common
$this
->
assign
(
'params'
,
$params
);
$this
->
assign
(
'page_html'
,
$page
->
GetPageHtml
());
$this
->
assign
(
'data'
,
$
data
);
$this
->
assign
(
'data'
,
$
ret
[
'data'
]
);
return
$this
->
fetch
();
}
...
...
@@ -116,15 +117,15 @@ class Goods extends Common
'is_content_app'
=>
1
,
'is_category'
=>
1
,
];
$
data
=
GoodsService
::
GoodsList
(
$data_params
);
if
(
empty
(
$
data
[
0
]))
$
ret
=
GoodsService
::
GoodsList
(
$data_params
);
if
(
empty
(
$
ret
[
'data'
]
[
0
]))
{
return
$this
->
error
(
'商品信息不存在'
,
MyUrl
(
'admin/goods/index'
));
}
$this
->
assign
(
'data'
,
$
data
[
0
]);
$this
->
assign
(
'data'
,
$
ret
[
'data'
]
[
0
]);
// 获取商品编辑规格
$specifications
=
GoodsService
::
GoodsEditSpecifications
(
$
data
[
0
][
'id'
]);
$specifications
=
GoodsService
::
GoodsEditSpecifications
(
$
ret
[
'data'
]
[
0
][
'id'
]);
$this
->
assign
(
'specifications'
,
$specifications
);
}
...
...
application/api/controller/Goods.php
浏览文件 @
e8fd6b55
...
...
@@ -61,16 +61,16 @@ class Goods extends Common
'is_spec'
=>
true
,
'is_content_app'
=>
true
,
];
$
goods
=
GoodsService
::
GoodsList
(
$params
);
if
(
empty
(
$
goods
[
0
])
||
$goods
[
0
][
'is_delete_time'
]
!=
0
)
$
ret
=
GoodsService
::
GoodsList
(
$params
);
if
(
empty
(
$
ret
[
'data'
][
0
])
||
$ret
[
'data'
]
[
0
][
'is_delete_time'
]
!=
0
)
{
return
DataReturn
(
'商品不存在或已删除'
,
-
1
);
}
unset
(
$
goods
[
0
][
'content_web'
]);
unset
(
$
ret
[
'data'
]
[
0
][
'content_web'
]);
// 当前登录用户是否已收藏
$ret_favor
=
GoodsService
::
IsUserGoodsFavor
([
'goods_id'
=>
$goods_id
,
'user'
=>
$this
->
user
]);
$
goods
[
0
][
'is_favor'
]
=
(
$ret_favor
[
'code'
]
==
0
)
?
$ret_favor
[
'data'
]
:
0
;
$
ret
[
'data'
]
[
0
][
'is_favor'
]
=
(
$ret_favor
[
'code'
]
==
0
)
?
$ret_favor
[
'data'
]
:
0
;
// 商品访问统计
GoodsService
::
GoodsAccessCountInc
([
'goods_id'
=>
$goods_id
]);
...
...
@@ -80,7 +80,7 @@ class Goods extends Common
// 数据返回
$result
=
[
'goods'
=>
$
goods
[
0
],
'goods'
=>
$
ret
[
'data'
]
[
0
],
'common_order_is_booking'
=>
(
int
)
MyC
(
'common_order_is_booking'
,
0
),
];
return
DataReturn
(
'success'
,
0
,
$result
);
...
...
application/index/controller/Common.php
浏览文件 @
e8fd6b55
...
...
@@ -81,22 +81,22 @@ class Common extends Controller
private
function
CommonPluginsInit
()
{
// css钩子
$this
->
assign
(
'plugins_css_data'
,
Hook
::
listen
(
'plugins_css'
,
[
'hook_name'
=>
'plugins_css'
,
'is_
control
'
=>
false
]));
$this
->
assign
(
'plugins_css_data'
,
Hook
::
listen
(
'plugins_css'
,
[
'hook_name'
=>
'plugins_css'
,
'is_
backend
'
=>
false
]));
// js钩子
$this
->
assign
(
'plugins_js_data'
,
Hook
::
listen
(
'plugins_js'
,
[
'hook_name'
=>
'plugins_js'
,
'is_
control
'
=>
false
]));
$this
->
assign
(
'plugins_js_data'
,
Hook
::
listen
(
'plugins_js'
,
[
'hook_name'
=>
'plugins_js'
,
'is_
backend
'
=>
false
]));
// 公共header内钩子
$this
->
assign
(
'plugins_common_header_data'
,
Hook
::
listen
(
'plugins_common_header'
,
[
'hook_name'
=>
'plugins_common_header'
,
'is_
control
'
=>
false
,
'user'
=>
$this
->
user
]));
$this
->
assign
(
'plugins_common_header_data'
,
Hook
::
listen
(
'plugins_common_header'
,
[
'hook_name'
=>
'plugins_common_header'
,
'is_
backend
'
=>
false
,
'user'
=>
$this
->
user
]));
// 公共页面底部钩子
$this
->
assign
(
'plugins_common_page_bottom_data'
,
Hook
::
listen
(
'plugins_common_page_bottom'
,
[
'hook_name'
=>
'plugins_common_page_bottom'
,
'is_
control
'
=>
false
,
'user'
=>
$this
->
user
]));
$this
->
assign
(
'plugins_common_page_bottom_data'
,
Hook
::
listen
(
'plugins_common_page_bottom'
,
[
'hook_name'
=>
'plugins_common_page_bottom'
,
'is_
backend
'
=>
false
,
'user'
=>
$this
->
user
]));
// 公共顶部钩子
$this
->
assign
(
'plugins_view_common_top_data'
,
Hook
::
listen
(
'plugins_view_common_top'
,
[
'hook_name'
=>
'plugins_view_common_top'
,
'is_
control
'
=>
false
,
'user'
=>
$this
->
user
]));
$this
->
assign
(
'plugins_view_common_top_data'
,
Hook
::
listen
(
'plugins_view_common_top'
,
[
'hook_name'
=>
'plugins_view_common_top'
,
'is_
backend
'
=>
false
,
'user'
=>
$this
->
user
]));
// 公共底部钩子
$this
->
assign
(
'plugins_view_common_bottom_data'
,
Hook
::
listen
(
'plugins_view_common_bottom'
,
[
'hook_name'
=>
'plugins_view_common_bottom'
,
'is_
control
'
=>
false
,
'user'
=>
$this
->
user
]));
$this
->
assign
(
'plugins_view_common_bottom_data'
,
Hook
::
listen
(
'plugins_view_common_bottom'
,
[
'hook_name'
=>
'plugins_view_common_bottom'
,
'is_
backend
'
=>
false
,
'user'
=>
$this
->
user
]));
}
/**
...
...
application/index/controller/Goods.php
浏览文件 @
e8fd6b55
...
...
@@ -52,24 +52,24 @@ class Goods extends Common
'is_photo'
=>
true
,
'is_spec'
=>
true
,
];
$
goods
=
GoodsService
::
GoodsList
(
$params
);
if
(
empty
(
$
goods
[
0
])
||
$goods
[
0
][
'is_delete_time'
]
!=
0
)
$
ret
=
GoodsService
::
GoodsList
(
$params
);
if
(
empty
(
$
ret
[
'data'
][
0
])
||
$ret
[
'data'
]
[
0
][
'is_delete_time'
]
!=
0
)
{
$this
->
assign
(
'msg'
,
'资源不存在或已被删除'
);
return
$this
->
fetch
(
'/public/tips_error'
);
}
else
{
// 当前登录用户是否已收藏
$ret_favor
=
GoodsService
::
IsUserGoodsFavor
([
'goods_id'
=>
$id
,
'user'
=>
$this
->
user
]);
$
goods
[
0
][
'is_favor'
]
=
(
$ret_favor
[
'code'
]
==
0
)
?
$ret_favor
[
'data'
]
:
0
;
$
ret
[
'data'
]
[
0
][
'is_favor'
]
=
(
$ret_favor
[
'code'
]
==
0
)
?
$ret_favor
[
'data'
]
:
0
;
// 商品评价总数
$
goods
[
0
][
'comments_count'
]
=
GoodsService
::
GoodsCommentsTotal
(
$id
);
$
ret
[
'data'
]
[
0
][
'comments_count'
]
=
GoodsService
::
GoodsCommentsTotal
(
$id
);
// 商品收藏总数
$
goods
[
0
][
'favor_count'
]
=
GoodsService
::
GoodsFavorTotal
([
'goods_id'
=>
$id
]);
$
ret
[
'data'
]
[
0
][
'favor_count'
]
=
GoodsService
::
GoodsFavorTotal
([
'goods_id'
=>
$id
]);
$this
->
assign
(
'goods'
,
$
goods
[
0
]);
$this
->
assign
(
'home_seo_site_title'
,
$
goods
[
0
][
'title'
]);
$this
->
assign
(
'goods'
,
$
ret
[
'data'
]
[
0
]);
$this
->
assign
(
'home_seo_site_title'
,
$
ret
[
'data'
]
[
0
][
'title'
]);
// 二维码
$this
->
assign
(
'qrcode_url'
,
MyUrl
(
'index/qrcode/index'
,
[
'content'
=>
urlencode
(
base64_encode
(
MyUrl
(
'index/goods/index'
,
[
'id'
=>
$id
],
true
,
true
)))]));
...
...
@@ -90,7 +90,8 @@ class Goods extends Common
'field'
=>
'id,title,title_color,price,images'
,
'n'
=>
10
,
];
$this
->
assign
(
'left_goods'
,
GoodsService
::
GoodsList
(
$params
));
$right_goods
=
GoodsService
::
GoodsList
(
$params
);
$this
->
assign
(
'left_goods'
,
$right_goods
[
'data'
]);
// 详情tab商品 猜你喜欢
$params
=
[
...
...
@@ -103,7 +104,8 @@ class Goods extends Common
'field'
=>
'id,title,title_color,price,images,home_recommended_images'
,
'n'
=>
16
,
];
$this
->
assign
(
'detail_like_goods'
,
GoodsService
::
GoodsList
(
$params
));
$like_goods
=
GoodsService
::
GoodsList
(
$params
);
$this
->
assign
(
'detail_like_goods'
,
$like_goods
[
'data'
]);
return
$this
->
fetch
();
}
...
...
application/index/controller/Search.php
浏览文件 @
e8fd6b55
...
...
@@ -97,8 +97,8 @@ class Search extends Common
public
function
GoodsList
()
{
// 获取商品列表
$
data
=
SearchService
::
GoodsList
(
$this
->
params
);
if
(
empty
(
$
data
[
'data'
]))
$
ret
=
SearchService
::
GoodsList
(
$this
->
params
);
if
(
empty
(
$
ret
[
'data'
]))
{
$msg
=
'没有相关数据'
;
$code
=
-
100
;
...
...
@@ -111,7 +111,7 @@ class Search extends Common
SearchService
::
SearchAdd
(
$this
->
params
);
// 返回
return
DataReturn
(
$msg
,
$code
,
$
data
);
return
DataReturn
(
$msg
,
$code
,
$
ret
[
'data'
]
);
}
}
?>
\ No newline at end of file
application/index/controller/User.php
浏览文件 @
e8fd6b55
...
...
@@ -137,7 +137,7 @@ class User extends Common
$this
->
assign
(
'goods_browse_list'
,
$data
[
'data'
]);
// 用户中心顶部钩子
$this
->
assign
(
'plugins_view_user_center_top_data'
,
Hook
::
listen
(
'plugins_view_user_center_top'
,
[
'hook_name'
=>
'plugins_view_user_center_top'
,
'is_
control
'
=>
false
,
'user'
=>
$this
->
user
]));
$this
->
assign
(
'plugins_view_user_center_top_data'
,
Hook
::
listen
(
'plugins_view_user_center_top'
,
[
'hook_name'
=>
'plugins_view_user_center_top'
,
'is_
backend
'
=>
false
,
'user'
=>
$this
->
user
]));
return
$this
->
fetch
();
}
...
...
application/index/view/default/goods/index.html
浏览文件 @
e8fd6b55
...
...
@@ -91,7 +91,7 @@
</div>
{{/if}}
<div
class=
"items price iteminfo_mktprice"
>
<dt>
促销
价
</dt>
<dt>
销售
价
</dt>
<dd>
<em>
¥
</em>
<b
class=
"sys_item_price"
data-original-price=
"{{$goods.price}}"
>
{{$goods.price}}
</b>
...
...
application/plugins/commongobacktop/Hook.php
浏览文件 @
e8fd6b55
...
...
@@ -33,9 +33,9 @@ class Hook extends Controller
public
function
run
(
$params
=
[])
{
// 是否控制器钩子
// is_
control 当前为控制器
业务处理
// is_
backend 当前为后端
业务处理
// hook_name 钩子名称
if
(
isset
(
$params
[
'is_
control'
])
&&
$params
[
'is_control
'
]
===
true
&&
!
empty
(
$params
[
'hook_name'
]))
if
(
isset
(
$params
[
'is_
backend'
])
&&
$params
[
'is_backend
'
]
===
true
&&
!
empty
(
$params
[
'hook_name'
]))
{
// 参数一 描述
// 参数二 0 为处理成功, 负数为失败
...
...
application/plugins/commononlineservice/Hook.php
浏览文件 @
e8fd6b55
...
...
@@ -33,9 +33,9 @@ class Hook extends Controller
public
function
run
(
$params
=
[])
{
// 是否控制器钩子
// is_
control 当前为控制器
业务处理
// is_
backend 当前为后端
业务处理
// hook_name 钩子名称
if
(
isset
(
$params
[
'is_
control'
])
&&
$params
[
'is_control
'
]
===
true
&&
!
empty
(
$params
[
'hook_name'
]))
if
(
isset
(
$params
[
'is_
backend'
])
&&
$params
[
'is_backend
'
]
===
true
&&
!
empty
(
$params
[
'hook_name'
]))
{
// 参数一 描述
// 参数二 0 为处理成功, 负数为失败
...
...
application/plugins/commonrightnavigation/Hook.php
浏览文件 @
e8fd6b55
...
...
@@ -34,9 +34,9 @@ class Hook extends Controller
public
function
run
(
$params
=
[])
{
// 是否控制器钩子
// is_
control 当前为控制器
业务处理
// is_
backend 当前为后端
业务处理
// hook_name 钩子名称
if
(
isset
(
$params
[
'is_
control'
])
&&
$params
[
'is_control
'
]
===
true
&&
!
empty
(
$params
[
'hook_name'
]))
if
(
isset
(
$params
[
'is_
backend'
])
&&
$params
[
'is_backend
'
]
===
true
&&
!
empty
(
$params
[
'hook_name'
]))
{
// 参数一 描述
// 参数二 0 为处理成功, 负数为失败
...
...
application/plugins/commontopmaxpicture/Hook.php
浏览文件 @
e8fd6b55
...
...
@@ -31,8 +31,8 @@ class Hook extends Controller
*/
public
function
run
(
$params
=
[])
{
// 是否
控制器
钩子
if
(
isset
(
$params
[
'is_
control'
])
&&
$params
[
'is_control
'
]
===
true
&&
!
empty
(
$params
[
'hook_name'
]))
// 是否
后端
钩子
if
(
isset
(
$params
[
'is_
backend'
])
&&
$params
[
'is_backend
'
]
===
true
&&
!
empty
(
$params
[
'hook_name'
]))
{
return
DataReturn
(
'无需处理'
,
0
);
...
...
application/plugins/commontopnotice/Hook.php
浏览文件 @
e8fd6b55
...
...
@@ -32,8 +32,8 @@ class Hook extends Controller
*/
public
function
run
(
$params
=
[])
{
// 是否
控制器
钩子
if
(
isset
(
$params
[
'is_
control'
])
&&
$params
[
'is_control
'
]
===
true
&&
!
empty
(
$params
[
'hook_name'
]))
// 是否
后端
钩子
if
(
isset
(
$params
[
'is_
backend'
])
&&
$params
[
'is_backend
'
]
===
true
&&
!
empty
(
$params
[
'hook_name'
]))
{
return
DataReturn
(
'无需处理'
,
0
);
...
...
application/plugins/usercentertopnotice/Hook.php
浏览文件 @
e8fd6b55
...
...
@@ -32,8 +32,8 @@ class Hook extends Controller
*/
public
function
run
(
$params
=
[])
{
// 是否
控制器
钩子
if
(
isset
(
$params
[
'is_
control'
])
&&
$params
[
'is_control
'
]
===
true
&&
!
empty
(
$params
[
'hook_name'
]))
// 是否
后端
钩子
if
(
isset
(
$params
[
'is_
backend'
])
&&
$params
[
'is_backend
'
]
===
true
&&
!
empty
(
$params
[
'hook_name'
]))
{
return
DataReturn
(
'无需处理'
,
0
);
...
...
application/plugins/userloginrewardintegral/Hook.php
浏览文件 @
e8fd6b55
...
...
@@ -34,15 +34,15 @@ class Hook
*/
public
function
run
(
$params
=
[])
{
// 是否
控制器
钩子
if
(
isset
(
$params
[
'is_
control'
])
&&
$params
[
'is_control
'
]
===
true
&&
!
empty
(
$params
[
'hook_name'
]))
// 是否
后端
钩子
if
(
isset
(
$params
[
'is_
backend'
])
&&
$params
[
'is_backend
'
]
===
true
&&
!
empty
(
$params
[
'hook_name'
]))
{
if
(
!
empty
(
$params
[
'user_id'
]))
{
switch
(
$params
[
'hook_name'
])
{
// 用户登录成功后赠送积分
case
'plugins_
control
_user_login_end'
:
case
'plugins_
service
_user_login_end'
:
$ret
=
$this
->
LoginGiveIntegral
(
$params
);
break
;
...
...
application/plugins/userloginrewardintegral/config.json
浏览文件 @
e8fd6b55
...
...
@@ -17,7 +17,7 @@
"is_home"
:
false
},
"hook"
:{
"plugins_
control
_user_login_end"
:[
"plugins_
service
_user_login_end"
:[
"app
\\
plugins
\\
userloginrewardintegral
\\
Hook"
]
}
...
...
application/plugins/usernotloginhidegoodsprice/Admin.php
0 → 100644
浏览文件 @
e8fd6b55
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011~2019 http://shopxo.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace
app\plugins\usernotloginhidegoodsprice
;
use
think\Controller
;
use
app\service\PluginsService
;
/**
* 未登录隐藏商品价格 - 后台管理
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class
Admin
extends
Controller
{
/**
* 首页
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-02-07T08:21:54+0800
* @param [array] $params [输入参数]
*/
public
function
index
(
$params
=
[])
{
$ret
=
PluginsService
::
PluginsData
(
'usernotloginhidegoodsprice'
);
if
(
$ret
[
'code'
]
==
0
)
{
// 限制终端
$common_platform_type
=
lang
(
'common_platform_type'
);
$limit_terminal_all
=
[];
if
(
!
empty
(
$ret
[
'data'
][
'limit_terminal'
]))
{
foreach
(
explode
(
','
,
$ret
[
'data'
][
'limit_terminal'
])
as
$type
)
{
if
(
isset
(
$common_platform_type
[
$type
]))
{
$limit_terminal_all
[]
=
$common_platform_type
[
$type
][
'name'
];
}
}
}
$ret
[
'data'
][
'limit_terminal_text'
]
=
implode
(
','
,
$limit_terminal_all
);
$this
->
assign
(
'data'
,
$ret
[
'data'
]);
return
$this
->
fetch
(
'../../../plugins/view/usernotloginhidegoodsprice/admin/index'
);
}
else
{
return
$ret
[
'msg'
];
}
}
/**
* 编辑页面
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-02-07T08:21:54+0800
* @param [array] $params [输入参数]
*/
public
function
saveinfo
(
$params
=
[])
{
$ret
=
PluginsService
::
PluginsData
(
'usernotloginhidegoodsprice'
);
if
(
$ret
[
'code'
]
==
0
)
{
// 限制终端
$ret
[
'data'
][
'limit_terminal'
]
=
empty
(
$ret
[
'data'
][
'limit_terminal'
])
?
[]
:
explode
(
','
,
$ret
[
'data'
][
'limit_terminal'
]);
$this
->
assign
(
'data'
,
$ret
[
'data'
]);
return
$this
->
fetch
(
'../../../plugins/view/usernotloginhidegoodsprice/admin/saveinfo'
);
}
else
{
return
$ret
[
'msg'
];
}
}
/**
* 数据保存
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-02-07T08:21:54+0800
* @param [array] $params [输入参数]
*/
public
function
save
(
$params
=
[])
{
return
PluginsService
::
PluginsDataSave
([
'plugins'
=>
'usernotloginhidegoodsprice'
,
'data'
=>
$params
]);
}
}
?>
\ No newline at end of file
application/plugins/usernotloginhidegoodsprice/Hook.php
0 → 100644
浏览文件 @
e8fd6b55
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011~2019 http://shopxo.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace
app\plugins\usernotloginhidegoodsprice
;
use
think\Controller
;
use
app\service\PluginsService
;
/**
* 未登录隐藏商品价格 - 钩子入口
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class
Hook
extends
Controller
{
// 应用响应入口
public
function
run
(
$params
=
[])
{
// 是否控制器钩子
// is_backend 当前为后端业务处理
// hook_name 钩子名称
if
(
isset
(
$params
[
'is_backend'
])
&&
$params
[
'is_backend'
]
===
true
&&
!
empty
(
$params
[
'hook_name'
]))
{
return
$this
->
PriceHandle
(
$params
);
// 默认返回视图
}
else
{
return
''
;
}
}
/**
* 价格处理
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2019-02-14T22:19:08+0800
* @param [array] $params [参数]
*/
private
function
PriceHandle
(
$params
)
{
// 获取应用数据
$ret
=
PluginsService
::
PluginsData
(
'usernotloginhidegoodsprice'
);
if
(
$ret
[
'code'
]
==
0
)
{
// 用户是否已登录
if
(
session
(
'user'
)
!=
null
)
{
return
DataReturn
(
'无需处理'
,
0
);
}
// 限制终端
if
(
!
empty
(
$ret
[
'data'
][
'limit_terminal'
]))
{
$limit_terminal_all
=
explode
(
','
,
$ret
[
'data'
][
'limit_terminal'
]);
$client_type
=
APPLICATION_CLIENT_TYPE
;
if
(
$client_type
==
'pc'
&&
IsMobile
())
{
$client_type
=
'h5'
;
}
if
(
!
in_array
(
$client_type
,
$limit_terminal_all
))
{
return
DataReturn
(
'无需处理'
,
0
);
}
}
// 原价
$original_price_placeholder
=
isset
(
$ret
[
'data'
][
'original_price_placeholder'
])
?
$ret
[
'data'
][
'original_price_placeholder'
]
:
''
;
// 销售价
$price_placeholder
=
isset
(
$ret
[
'data'
][
'price_placeholder'
])
?
$ret
[
'data'
][
'price_placeholder'
]
:
''
;
// 商品原价
if
(
isset
(
$params
[
'goods'
][
'original_price'
]))
{
$params
[
'goods'
][
'original_price'
]
=
$original_price_placeholder
;
}
if
(
isset
(
$params
[
'goods'
][
'min_original_price'
]))
{
$params
[
'goods'
][
'min_original_price'
]
=
$original_price_placeholder
;
}
if
(
isset
(
$params
[
'goods'
][
'max_original_price'
]))
{
$params
[
'goods'
][
'max_original_price'
]
=
$original_price_placeholder
;
}
// 销售价
if
(
isset
(
$params
[
'goods'
][
'price'
]))
{
$params
[
'goods'
][
'price'
]
=
$price_placeholder
;
}
if
(
isset
(
$params
[
'goods'
][
'min_price'
]))
{
$params
[
'goods'
][
'min_price'
]
=
$price_placeholder
;
}
if
(
isset
(
$params
[
'goods'
][
'max_price'
]))
{
$params
[
'goods'
][
'max_price'
]
=
$price_placeholder
;
}
return
DataReturn
(
'处理成功'
,
0
);
}
else
{
return
$ret
;
}
}
}
?>
\ No newline at end of file
application/plugins/usernotloginhidegoodsprice/config.json
0 → 100644
浏览文件 @
e8fd6b55
{
"base"
:{
"plugins"
:
"usernotloginhidegoodsprice"
,
"name"
:
"未登录隐藏商品价格"
,
"logo"
:
"
\/
static
\/
upload
\/
images
\/
plugins_usernotloginhidegoodsprice
\/
2019
\/
02
\/
26
\/
1551184745400164.png"
,
"author"
:
"Devil"
,
"author_url"
:
"https:
\/\/
shopxo.net
\/
"
,
"version"
:
"1.0.0"
,
"desc"
:
"用户未登录不展示商品价格"
,
"apply_terminal"
:[
"pc"
,
"h5"
,
"app"
,
"alipay"
,
"weixin"
,
"baidu"
],
"apply_version"
:[
"1.4.0"
],
"is_home"
:
false
},
"hook"
:{
"plugins_service_goods_handle_begin"
:[
"app
\\
plugins
\\
usernotloginhidegoodsprice
\\
Hook"
]
}
}
\ No newline at end of file
application/plugins/view/usernotloginhidegoodsprice/admin/index.html
0 → 100755
浏览文件 @
e8fd6b55
{{include file="public/header" /}}
<!-- right content start -->
<div
class=
"content-right"
>
<div
class=
"content"
>
<legend>
<span
class=
"fs-16"
>
未登录隐藏商品价格
</span>
<a
href=
"{{:MyUrl('admin/pluginsadmin/index')}}"
class=
"fr fs-14 m-t-5 am-icon-mail-reply"
>
返回
</a>
</legend>
<div
class=
"usernotloginhidegoodsprice-content"
>
<div
class=
"items"
>
<label>
原价占位符
</label>
<div>
{{if !empty($data['original_price_placeholder'])}}
{{$data.original_price_placeholder}}
{{else /}}
<span
class=
"empty-text"
>
未填写
</span>
{{/if}}
</div>
</div>
<div
class=
"items"
>
<label>
销售价占位符
</label>
<div>
{{if !empty($data['price_placeholder'])}}
{{$data.price_placeholder}}
{{else /}}
<span
class=
"empty-text"
>
未填写
</span>
{{/if}}
</div>
</div>
<div
class=
"items"
>
<label>
限制终端
<span
class=
"fs-12 fw-100 cr-999"
>
(留空则全部)
</span></label>
<div>
{{if !empty($data['limit_terminal_text'])}}
{{$data.limit_terminal_text}}
{{else /}}
全部
{{/if}}
</div>
</div>
<a
href=
"{{:PluginsAdminUrl('usernotloginhidegoodsprice', 'admin', 'saveinfo')}}"
class=
"am-btn am-btn-secondary am-radius btn-loading-example am-btn-sm am-btn-block edit-submit"
>
编辑
</a>
</div>
</div>
</div>
<!-- right content end -->
<!-- footer start -->
{{include file="public/footer" /}}
<!-- footer end -->
\ No newline at end of file
application/plugins/view/usernotloginhidegoodsprice/admin/saveinfo.html
0 → 100755
浏览文件 @
e8fd6b55
{{include file="public/header" /}}
<!-- right content start -->
<div
class=
"content-right"
>
<div
class=
"content"
>
<!-- form start -->
<form
class=
"am-form form-validation view-save"
action=
"{{:PluginsAdminUrl('usernotloginhidegoodsprice', 'admin', 'save')}}"
method=
"POST"
request-type=
"ajax-url"
request-value=
"{{:PluginsAdminUrl('usernotloginhidegoodsprice', 'admin', 'index')}}"
enctype=
"multipart/form-data"
>
<legend>
<span
class=
"fs-16"
>
未登录隐藏商品价格
</span>
<a
href=
"{{:PluginsAdminUrl('usernotloginhidegoodsprice', 'admin', 'index')}}"
class=
"fr fs-14 m-t-5 am-icon-mail-reply"
>
返回
</a>
</legend>
<div
class=
"am-form-group"
>
<label>
限制终端
<span
class=
"fs-12 fw-100 cr-999"
>
(留空则全部)
</span></label>
<select
name=
"limit_terminal"
class=
"am-radius c-p chosen-select"
multiple=
"multiple"
minchecked=
"1"
data-placeholder=
"可选择..."
data-validation-message=
"至少选择一个限制终端"
>
{{foreach :lang('common_platform_type') as $v}}
<option
value=
"{{$v.value}}"
{{
if
isset
($
data
['
limit_terminal
'])
and
in_array
($
v
['
value
'],
$
data
['
limit_terminal
'])}}
selected
{{/
if
}}
>
{{$v.name}}
</option>
{{/foreach}}
</select>
</div>
<div
class=
"am-form-group"
>
<label>
原价占位符
</label>
<input
type=
"text"
name=
"original_price_placeholder"
placeholder=
"原价占位符"
maxlength=
"16"
data-validation-message=
"原价占位符最多16个字符"
class=
"am-radius"
value=
"{{if !empty($data)}}{{$data.original_price_placeholder}}{{/if}}"
/>
</div>
<div
class=
"am-form-group"
>
<label>
销售价占位符
</label>
<input
type=
"text"
name=
"price_placeholder"
placeholder=
"销售价占位符"
maxlength=
"16"
data-validation-message=
"销售价占位符最多16个字符"
class=
"am-radius"
value=
"{{if !empty($data)}}{{$data.price_placeholder}}{{/if}}"
/>
</div>
<div
class=
"am-form-group"
>
<button
type=
"submit"
class=
"am-btn am-btn-primary am-radius btn-loading-example am-btn-sm w100"
data-am-loading=
"{loadingText:'处理中...'}"
>
保存
</button>
</div>
</form>
<!-- form end -->
</div>
</div>
<!-- right content end -->
<!-- footer start -->
{{include file="public/footer" /}}
<!-- footer end -->
\ No newline at end of file
application/service/BuyService.php
浏览文件 @
e8fd6b55
...
...
@@ -371,32 +371,32 @@ class BuyService
],
'field'
=>
'id, id AS goods_id, title, images, inventory_unit, buy_min_number, buy_max_number'
,
];
$
goods
=
GoodsService
::
GoodsList
(
$p
);
if
(
empty
(
$
goods
[
0
]))
$
ret
=
GoodsService
::
GoodsList
(
$p
);
if
(
empty
(
$
ret
[
'data'
]
[
0
]))
{
return
DataReturn
(
'资源不存在或已被删除'
,
-
10
);
}
// 规格
$
goods
[
0
][
'spec'
]
=
self
::
GoodsSpecificationsHandle
(
$params
);
$
ret
[
'data'
]
[
0
][
'spec'
]
=
self
::
GoodsSpecificationsHandle
(
$params
);
// 获取商品基础信息
$goods_base
=
GoodsService
::
GoodsSpecDetail
([
'id'
=>
$
goods
[
0
][
'goods_id'
],
'spec'
=>
$goods
[
0
][
'spec'
]]);
$goods_base
=
GoodsService
::
GoodsSpecDetail
([
'id'
=>
$
ret
[
'data'
][
0
][
'goods_id'
],
'spec'
=>
$ret
[
'data'
]
[
0
][
'spec'
]]);
if
(
$goods_base
[
'code'
]
==
0
)
{
$
goods
[
0
][
'inventory'
]
=
$goods_base
[
'data'
][
'inventory'
];
$
goods
[
0
][
'price'
]
=
$goods_base
[
'data'
][
'price'
];
$
goods
[
0
][
'original_price'
]
=
$goods_base
[
'data'
][
'original_price'
];
$
goods
[
0
][
'spec_weight'
]
=
$goods_base
[
'data'
][
'weight'
];
$
goods
[
0
][
'spec_coding'
]
=
$goods_base
[
'data'
][
'coding'
];
$
goods
[
0
][
'spec_barcode'
]
=
$goods_base
[
'data'
][
'barcode'
];
$
ret
[
'data'
]
[
0
][
'inventory'
]
=
$goods_base
[
'data'
][
'inventory'
];
$
ret
[
'data'
]
[
0
][
'price'
]
=
$goods_base
[
'data'
][
'price'
];
$
ret
[
'data'
]
[
0
][
'original_price'
]
=
$goods_base
[
'data'
][
'original_price'
];
$
ret
[
'data'
]
[
0
][
'spec_weight'
]
=
$goods_base
[
'data'
][
'weight'
];
$
ret
[
'data'
]
[
0
][
'spec_coding'
]
=
$goods_base
[
'data'
][
'coding'
];
$
ret
[
'data'
]
[
0
][
'spec_barcode'
]
=
$goods_base
[
'data'
][
'barcode'
];
}
else
{
return
$goods_base
;
}
// 数量/小计
$
goods
[
0
][
'stock'
]
=
$params
[
'stock'
];
$
goods
[
0
][
'total_price'
]
=
$params
[
'stock'
]
*
$goods
[
0
][
'price'
];
$
ret
[
'data'
]
[
0
][
'stock'
]
=
$params
[
'stock'
];
$
ret
[
'data'
][
0
][
'total_price'
]
=
$params
[
'stock'
]
*
$ret
[
'data'
]
[
0
][
'price'
];
return
DataReturn
(
'操作成功'
,
0
,
$goods
);
}
...
...
application/service/GoodsService.php
浏览文件 @
e8fd6b55
...
...
@@ -11,6 +11,7 @@
namespace
app\service
;
use
think\Db
;
use
think\facade\Hook
;
use
app\service\ResourcesService
;
use
app\service\BrandService
;
use
app\service\RegionService
;
...
...
@@ -153,7 +154,8 @@ class GoodsService
foreach
(
$goods_category
as
&
$v
)
{
$category_ids
=
self
::
GoodsCategoryItemsIds
([
$v
[
'id'
]],
1
);
$v
[
'goods'
]
=
self
::
CategoryGoodsList
([
'where'
=>
[
'gci.category_id'
=>
$category_ids
,
'is_home_recommended'
=>
1
],
'm'
=>
0
,
'n'
=>
6
,
'field'
=>
'g.id,g.title,g.title_color,g.images,g.home_recommended_images,g.original_price,g.price,g.min_price,g.max_price,g.inventory,g.buy_min_number,g.buy_max_number'
]);
$goods
=
self
::
CategoryGoodsList
([
'where'
=>
[
'gci.category_id'
=>
$category_ids
,
'is_home_recommended'
=>
1
],
'm'
=>
0
,
'n'
=>
6
,
'field'
=>
'g.id,g.title,g.title_color,g.images,g.home_recommended_images,g.original_price,g.price,g.min_price,g.max_price,g.inventory,g.buy_min_number,g.buy_max_number'
]);
$v
[
'goods'
]
=
$goods
[
'data'
];
}
}
return
$goods_category
;
...
...
@@ -246,6 +248,20 @@ class GoodsService
// 开始处理数据
foreach
(
$data
as
&
$v
)
{
// 商品处理前钩子
$hook_name
=
'plugins_service_goods_handle_begin'
;
$ret
=
Hook
::
listen
(
$hook_name
,
[
'hook_name'
=>
$hook_name
,
'is_backend'
=>
true
,
'params'
=>
&
$params
,
'goods'
=>
&
$v
,
'goods_id'
=>
$v
[
'id'
]
]);
if
(
isset
(
$ret
[
'code'
])
&&
$ret
[
'code'
]
!=
0
)
{
return
$ret
;
}
// 商品url地址
if
(
!
empty
(
$v
[
'id'
]))
{
...
...
@@ -328,9 +344,23 @@ class GoodsService
{
$v
[
'content_app'
]
=
self
::
GoodsContentApp
([
'goods_id'
=>
$v
[
'id'
]]);
}
// 商品处理前钩子
$hook_name
=
'plugins_service_goods_handle_end'
;
$ret
=
Hook
::
listen
(
$hook_name
,
[
'hook_name'
=>
$hook_name
,
'is_backend'
=>
true
,
'params'
=>
&
$params
,
'goods'
=>
&
$v
,
'goods_id'
=>
$v
[
'id'
]
]);
if
(
isset
(
$ret
[
'code'
])
&&
$ret
[
'code'
]
!=
0
)
{
return
$ret
;
}
}
}
return
$data
;
return
DataReturn
(
'处理成功'
,
0
,
$data
)
;
}
/**
...
...
application/service/PluginsAdminService.php
浏览文件 @
e8fd6b55
...
...
@@ -486,7 +486,9 @@ class PluginsAdminService
$admin
=
<<<php
<?php
namespace app\plugins\\$plugins;
use think\Controller;
/**
* {$params['name']} - 后台管理
* @author Devil
...
...
@@ -511,7 +513,9 @@ php;
$hook
=
<<<php
<?php
namespace app\plugins\\$plugins;
use think\Controller;
/**
* {$params['name']} - 钩子入口
* @author Devil
...
...
@@ -525,9 +529,9 @@ class Hook extends Controller
public function run(\$params = [])
{
// 是否控制器钩子
// is_
control 当前为控制器
业务处理
// is_
backend 当前为后端
业务处理
// hook_name 钩子名称
if(isset(\$params['is_
control']) && \$params['is_control
'] === true && !empty(\$params['hook_name']))
if(isset(\$params['is_
backend']) && \$params['is_backend
'] === true && !empty(\$params['hook_name']))
{
// 参数一 描述
// 参数二 0 为处理成功, 负数为失败
...
...
@@ -546,7 +550,9 @@ php;
$index
=
<<<php
<?php
namespace app\plugins\\$plugins;
use think\Controller;
/**
* {$params['name']} - 前端独立页面入口
* @author Devil
...
...
application/service/UserService.php
浏览文件 @
e8fd6b55
...
...
@@ -833,7 +833,13 @@ class UserService
}
// 用户登录前钩子
$ret
=
Hook
::
listen
(
'plugins_control_user_login_begin'
,
[
'hook_name'
=>
'plugins_control_user_login_begin'
,
'is_control'
=>
true
,
'params'
=>
$params
,
'user_id'
=>
$user
[
'id'
]]);
$hook_name
=
'plugins_service_user_login_begin'
;
$ret
=
Hook
::
listen
(
$hook_name
,
[
'hook_name'
=>
$hook_name
,
'is_backend'
=>
true
,
'params'
=>
&
$params
,
'user_id'
=>
$user
[
'id'
]
]);
if
(
isset
(
$ret
[
'code'
])
&&
$ret
[
'code'
]
!=
0
)
{
return
$ret
;
...
...
@@ -852,7 +858,13 @@ class UserService
if
(
self
::
UserLoginRecord
(
$user
[
'id'
]))
{
// 用户登录后钩子
$ret
=
Hook
::
listen
(
'plugins_control_user_login_end'
,
[
'hook_name'
=>
'plugins_control_user_login_end'
,
'is_control'
=>
true
,
'params'
=>
$params
,
'user_id'
=>
$user
[
'id'
]]);
$hook_name
=
'plugins_service_user_login_end'
;
$ret
=
Hook
::
listen
(
$hook_name
,
[
'hook_name'
=>
$hook_name
,
'is_backend'
=>
true
,
'params'
=>
&
$params
,
'user_id'
=>
$user
[
'id'
]
]);
if
(
isset
(
$ret
[
'code'
])
&&
$ret
[
'code'
]
!=
0
)
{
return
$ret
;
...
...
application/tags.php
浏览文件 @
e8fd6b55
...
...
@@ -41,7 +41,7 @@ return array (
array
(
0
=>
'app\\plugins\\usercentertopnotice\\Hook'
,
),
'plugins_
control
_user_login_end'
=>
'plugins_
service
_user_login_end'
=>
array
(
0
=>
'app\\plugins\\userloginrewardintegral\\Hook'
,
),
...
...
@@ -60,5 +60,9 @@ return array (
0
=>
'app\\plugins\\commonrightnavigation\\Hook'
,
1
=>
'app\\plugins\\commononlineservice\\Hook'
,
),
'plugins_service_goods_handle_begin'
=>
array
(
0
=>
'app\\plugins\\usernotloginhidegoodsprice\\Hook'
,
),
);
?>
\ No newline at end of file
config/shopxo.php
浏览文件 @
e8fd6b55
...
...
@@ -15,7 +15,7 @@
return
[
// 开发模式
'is_develop'
=>
fals
e
,
'is_develop'
=>
tru
e
,
// 默认编码
'default_charset'
=>
'utf-8'
,
...
...
config/shopxo.sql
浏览文件 @
e8fd6b55
此差异已折叠。
点击以展开。
public/static/index/default/css/goods.css
浏览文件 @
e8fd6b55
...
...
@@ -381,7 +381,7 @@ li.am-comment{ width:100%}
.tb-detail-price
{
background
:
#fcf1e3
url(../images/goods_meta_bg.png)
;
background-size
:
cover
;
-moz-background-size
:
cover
;
background-repeat
:
no-repeat
;
}
.tb-detail-price
.items
{
display
:
block
;
margin
:
0px
10px
;}
.tb-detail-price
.items
dt
{
width
:
70px
;
float
:
left
;
text-align
:
left
;}
.sys_item_price
{
font-size
:
24px
;
font-weight
:
bold
;}
.sys_item_price
{
font-size
:
24px
;
font-weight
:
bold
;
line-height
:
16px
;
}
.sys_item_mktprice
{
font-size
:
14px
;}
...
...
public/static/plugins/css/usernotloginhidegoodsprice/admin.css
0 → 100755
浏览文件 @
e8fd6b55
/**
* 首页
*/
.usernotloginhidegoodsprice-content
.items
{
margin
:
10px
0
20px
0
;
border-bottom
:
1px
dashed
#f1f1f1
;
padding-bottom
:
20px
;
}
.usernotloginhidegoodsprice-content
.items
.empty-text
{
color
:
#ccc
;
}
.usernotloginhidegoodsprice-content
.edit-submit
{
margin-bottom
:
20px
;
}
\ No newline at end of file
public/static/upload/images/plugins_usernotloginhidegoodsprice/2019/02/26/1551184745400164.png
0 → 100644
浏览文件 @
e8fd6b55
6.8 KB
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录