Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
飞鱼0526
ShopXO
提交
82222632
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,发现更多精彩内容 >>
提交
82222632
编写于
6月 07, 2020
作者:
D
devil
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
数据列表优化
上级
abef6b0f
变更
18
展开全部
隐藏空白更改
内联
并排
Showing
18 changed file
with
652 addition
and
358 deletion
+652
-358
application/admin/controller/Common.php
application/admin/controller/Common.php
+11
-15
application/admin/controller/Goods.php
application/admin/controller/Goods.php
+2
-21
application/admin/controller/Plugins.php
application/admin/controller/Plugins.php
+28
-11
application/admin/form/Goods.php
application/admin/form/Goods.php
+18
-6
application/admin/view/default/goods/module/info.html
application/admin/view/default/goods/module/info.html
+2
-2
application/admin/view/default/goods/module/operate.html
application/admin/view/default/goods/module/operate.html
+1
-1
application/admin/view/default/public/form.html
application/admin/view/default/public/form.html
+34
-6
application/api/controller/Common.php
application/api/controller/Common.php
+4
-8
application/api/controller/Plugins.php
application/api/controller/Plugins.php
+30
-4
application/index/controller/Common.php
application/index/controller/Common.php
+64
-7
application/index/controller/Plugins.php
application/index/controller/Plugins.php
+27
-4
application/index/controller/Search.php
application/index/controller/Search.php
+16
-16
application/module/FormHandleModule.php
application/module/FormHandleModule.php
+283
-227
application/service/GoodsService.php
application/service/GoodsService.php
+12
-7
application/service/PluginsService.php
application/service/PluginsService.php
+1
-1
config/shopxo.sql
config/shopxo.sql
+7
-7
public/static/admin/default/css/goods.css
public/static/admin/default/css/goods.css
+0
-13
public/static/common/js/common.js
public/static/common/js/common.js
+112
-2
未找到文件。
application/admin/controller/Common.php
浏览文件 @
82222632
...
...
@@ -12,9 +12,9 @@ namespace app\admin\controller;
use
think\facade\Hook
;
use
think\Controller
;
use
app\module\FormHandleModule
;
use
app\service\AdminPowerService
;
use
app\service\ConfigService
;
use
app\module\FormHandleModule
;
/**
* 管理员公共控制器
...
...
@@ -39,13 +39,9 @@ class Common extends Controller
protected
$controller_name
;
protected
$action_name
;
// 输入参数 post
// 输入参数 post
|get|request
protected
$data_post
;
// 输入参数 get
protected
$data_get
;
// 输入参数 request
protected
$data_request
;
// 分页信息
...
...
@@ -70,14 +66,14 @@ class Common extends Controller
{
parent
::
__construct
();
// 系统初始化
$this
->
SystemInit
();
// 输入参数
$this
->
data_post
=
input
(
'post.'
);
$this
->
data_get
=
input
(
'get.'
);
$this
->
data_request
=
input
();
// 系统初始化
$this
->
SystemInit
();
// 管理员信息
$this
->
admin
=
session
(
'admin'
);
...
...
@@ -204,6 +200,12 @@ class Common extends Controller
$this
->
assign
(
'controller_name'
,
$this
->
controller_name
);
$this
->
assign
(
'action_name'
,
$this
->
action_name
);
// 管理员
$this
->
assign
(
'admin'
,
$this
->
admin
);
// 权限菜单
$this
->
assign
(
'left_menu'
,
$this
->
left_menu
);
// 分页信息
$this
->
page
=
max
(
1
,
isset
(
$this
->
data_request
[
'page'
])
?
intval
(
$this
->
data_request
[
'page'
])
:
1
);
$this
->
page_size
=
MyC
(
'admin_page_number'
,
10
,
true
);
...
...
@@ -222,12 +224,6 @@ class Common extends Controller
$module_js
.
=
file_exists
(
ROOT_PATH
.
'static'
.
DS
.
$module_js
.
'.'
.
$this
->
action_name
.
'.js'
)
?
'.'
.
$this
->
action_name
.
'.js'
:
'.js'
;
$this
->
assign
(
'module_js'
,
file_exists
(
ROOT_PATH
.
'static'
.
DS
.
$module_js
)
?
$module_js
:
''
);
// 权限菜单
$this
->
assign
(
'left_menu'
,
$this
->
left_menu
);
// 用户
$this
->
assign
(
'admin'
,
$this
->
admin
);
// 图片host地址
$this
->
assign
(
'attachment_host'
,
config
(
'shopxo.attachment_host'
));
...
...
application/admin/controller/Goods.php
浏览文件 @
82222632
...
...
@@ -11,7 +11,6 @@
namespace
app\admin\controller
;
use
think\facade\Hook
;
use
app\service\ResourcesService
;
use
app\service\GoodsService
;
use
app\service\RegionService
;
use
app\service\BrandService
;
...
...
@@ -53,12 +52,6 @@ class Goods extends Common
*/
public
function
Index
()
{
// 参数
$params
=
$this
->
data_request
;
// 条件
//$where = GoodsService::GetAdminIndexWhere($params);
// 总数
$total
=
GoodsService
::
GoodsTotal
(
$this
->
form_where
);
...
...
@@ -66,7 +59,7 @@ class Goods extends Common
$page_params
=
array
(
'number'
=>
$this
->
page_size
,
'total'
=>
$total
,
'where'
=>
$
params
,
'where'
=>
$
this
->
data_request
,
'page'
=>
$this
->
page
,
'url'
=>
MyUrl
(
'admin/goods/index'
),
);
...
...
@@ -81,19 +74,7 @@ class Goods extends Common
];
$ret
=
GoodsService
::
GoodsList
(
$data_params
);
// 商品分类
$this
->
assign
(
'goods_category_list'
,
GoodsService
::
GoodsCategoryAll
());
// 品牌分类
$this
->
assign
(
'brand_list'
,
BrandService
::
CategoryBrand
());
// 是否上下架
$this
->
assign
(
'common_is_shelves_list'
,
lang
(
'common_is_shelves_list'
));
// 是否首页推荐
$this
->
assign
(
'common_is_text_list'
,
lang
(
'common_is_text_list'
));
$this
->
assign
(
'params'
,
$params
);
$this
->
assign
(
'params'
,
$this
->
data_request
);
$this
->
assign
(
'page_html'
,
$page
->
GetPageHtml
());
$this
->
assign
(
'data_list'
,
$ret
[
'data'
]);
return
$this
->
fetch
();
...
...
application/admin/controller/Plugins.php
浏览文件 @
82222632
...
...
@@ -32,12 +32,6 @@ class Plugins extends Common
public
function
__construct
()
{
parent
::
__construct
();
// 登录校验
$this
->
IsLogin
();
// 权限校验
$this
->
IsPower
();
}
/**
...
...
@@ -50,7 +44,7 @@ class Plugins extends Common
public
function
Index
()
{
// 参数
$params
=
input
();
$params
=
$this
->
GetClassVars
();
// 请求参数校验
$p
=
[
...
...
@@ -70,7 +64,7 @@ class Plugins extends Common
'error_msg'
=>
'应用操作方法有误'
,
],
];
$ret
=
ParamsChecked
(
$params
,
$p
);
$ret
=
ParamsChecked
(
$params
[
'data_request'
]
,
$p
);
if
(
$ret
!==
true
)
{
if
(
IS_AJAX
)
...
...
@@ -83,9 +77,10 @@ class Plugins extends Common
}
// 应用名称/控制器/方法
$pluginsname
=
$params
[
'pluginsname'
];
$pluginscontrol
=
strtolower
(
$params
[
'pluginscontrol'
]);
$pluginsaction
=
strtolower
(
$params
[
'pluginsaction'
]);
$pluginsname
=
$params
[
'data_request'
][
'pluginsname'
];
$pluginscontrol
=
strtolower
(
$params
[
'data_request'
][
'pluginscontrol'
]);
$pluginsaction
=
strtolower
(
$params
[
'data_request'
][
'pluginsaction'
]);
unset
(
$params
[
'data_request'
][
'pluginsname'
],
$params
[
'data_request'
][
'pluginscontrol'
],
$params
[
'data_request'
][
'pluginsaction'
]);
// 视图初始化
$this
->
PluginsViewInit
(
$pluginsname
,
$pluginscontrol
,
$pluginsaction
);
...
...
@@ -110,6 +105,28 @@ class Plugins extends Common
}
}
/**
* 获取类属性数据
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-06-07
* @desc description
*/
public
function
GetClassVars
()
{
$data
=
[];
$vers
=
get_class_vars
(
get_class
());
foreach
(
$vers
as
$k
=>
$v
)
{
if
(
property_exists
(
$this
,
$k
))
{
$data
[
$k
]
=
$this
->
$k
;
}
}
return
$data
;
}
/**
* 视图初始化
* @author Devil
...
...
application/admin/form/Goods.php
浏览文件 @
82222632
...
...
@@ -48,6 +48,9 @@ class Goods
'status_field'
=>
'is_shelves'
,
'is_search'
=>
1
,
'search_url'
=>
MyUrl
(
'admin/goods/index'
),
'is_delete'
=>
1
,
'delete_url'
=>
MyUrl
(
'admin/goods/delete'
),
'delete_key'
=>
'ids'
,
],
// 表单配置
'form'
=>
[
...
...
@@ -59,16 +62,11 @@ class Goods
'align'
=>
'center'
,
'width'
=>
80
,
],
[
'view_type'
=>
'radio'
,
'align'
=>
'center'
,
'width'
=>
50
,
],
[
'label'
=>
'商品ID'
,
'view_type'
=>
'field'
,
'view_key'
=>
'id'
,
'width'
=>
8
0
,
'width'
=>
12
0
,
'search_config'
=>
[
'form_type'
=>
'input'
,
'form_name'
=>
'id'
,
...
...
@@ -188,6 +186,20 @@ class Goods
'where_type'
=>
'in'
,
],
],
[
'label'
=>
'生产地'
,
'view_type'
=>
'field'
,
'view_key'
=>
'place_origin_name'
,
'search_config'
=>
[
'form_type'
=>
'select'
,
'form_name'
=>
'place_origin'
,
'data'
=>
RegionService
::
RegionItems
([
'pid'
=>
0
]),
'data_key'
=>
'id'
,
'data_name'
=>
'name'
,
'where_type'
=>
'in'
,
'is_multiple'
=>
1
,
],
],
[
'label'
=>
'创建时间'
,
'view_type'
=>
'field'
,
...
...
application/admin/view/default/goods/module/info.html
浏览文件 @
82222632
<!-- 商品基础信息 -->
{{if !empty($module_data)}}
<div
class=
"
goods
"
>
<div
class=
"
am-nbfc
"
>
<a
href=
"{{$module_data.goods_url}}"
target=
"_blank"
title=
"{{$module_data.title}}"
>
<img
src=
"{{$module_data['images']}}"
class=
"am-img-thumbnail am-radius
goods-images
"
/>
<img
src=
"{{$module_data['images']}}"
class=
"am-img-thumbnail am-radius
am-margin-right-xs am-fl"
width=
"60"
height=
"60
"
/>
</a>
<a
href=
"{{$module_data.goods_url}}"
target=
"_blank"
title=
"{{$module_data.title}}"
{{
if
!
empty
($
module_data
['
title_color
'])}}
style=
"color:{{$module_data.title_color}};"
{{/
if
}}
class=
"am-nowrap-initial"
>
{{$module_data.title}}
</a>
{{if !empty($module_data['simple_desc'])}}
...
...
application/admin/view/default/goods/module/operate.html
浏览文件 @
82222632
...
...
@@ -7,7 +7,7 @@
<i
class=
"am-icon-edit"
></i>
<span>
编辑
</span>
</a>
<button
type=
"button"
class=
"am-btn am-btn-danger am-btn-xs am-radius am-btn-block submit-delete"
data-url=
"{{:MyUrl('admin/goods/delete')}}"
data-id=
"{{$module_data.id}}"
>
<button
type=
"button"
class=
"am-btn am-btn-danger am-btn-xs am-radius am-btn-block submit-delete"
data-url=
"{{:MyUrl('admin/goods/delete')}}"
data-id=
"{{$module_data.id}}"
data-key=
"ids"
>
<i
class=
"am-icon-trash-o"
></i>
<span>
删除
</span>
</button>
\ No newline at end of file
application/admin/view/default/public/form.html
浏览文件 @
82222632
...
...
@@ -50,8 +50,19 @@
<div
class=
"am-g form-table-operate-top"
>
{{block name="form_operate_top"}}
<!-- 公共操作 -->
<a
href=
"{{:MyUrl('admin/goods/index')}}"
class=
"am-btn am-btn-warning am-radius am-btn-sm am-icon-filter"
>
重置
</a>
<button
type=
"submit"
class=
"am-btn am-btn-primary am-radius am-btn-xs btn-loading-example am-icon-search"
data-am-loading=
"{loadingText:' 搜索中...'}"
>
搜索
</button>
<!-- 是否开启删除操作 -->
{{if isset($form_table['base']['is_delete']) and $form_table['base']['is_delete'] eq 1}}
<button
type=
"button"
class=
"am-btn am-btn-danger am-radius am-btn-xs am-icon-trash-o form-table-operate-top-delete-submit"
data-url=
"{{if isset($form_table['base']['delete_url'])}}{{$form_table.base.delete_url}}{{/if}}"
data-form=
"{{if isset($form_table['base']['delete_form'])}}{{$form_table.base.delete_form}}{{/if}}"
data-key=
"{{if isset($form_table['base']['delete_key'])}}{{$form_table.base.delete_key}}{{/if}}"
data-confirm-title=
"{{if isset($form_table['base']['confirm_title'])}}{{$form_table.base.confirm_title}}{{/if}}"
data-confirm-msg=
"{{if isset($form_table['base']['confirm_msg'])}}{{$form_table.base.confirm_msg}}{{/if}}"
data-timeout=
"{{if isset($form_table['base']['timeout'])}}{{$form_table.base.timeout}}{{/if}}"
>
删除
</button>
{{/if}}
<!-- 钩子 -->
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
...
...
@@ -73,13 +84,19 @@
}
}
{{/php}}
<!-- 是否开启搜索操作 公共搜索操作放在最后面 -->
{{if isset($form_table['base']['is_search']) and $form_table['base']['is_search'] eq 1}}
<a
href=
"{{if isset($form_table['base']['search_url'])}}{{$form_table.base.search_url}}{{/if}}"
class=
"am-btn am-btn-warning am-radius am-btn-sm am-icon-filter"
>
重置
</a>
<button
type=
"submit"
class=
"am-btn am-btn-primary am-radius am-btn-xs btn-loading-example am-icon-search"
data-am-loading=
"{loadingText:' 搜索中...'}"
>
搜索
</button>
{{/if}}
{{/block}}
</div>
<!-- top operate end -->
<!-- list start -->
<div
class=
"am-scrollable-horizontal am-table-scrollable-horizontal am-margin-top-sm"
>
<table
class=
"am-table am-table-striped am-table-hover am-table-bordered am-text-nowrap"
>
<table
class=
"am-table am-table-striped am-table-hover am-table-bordered am-text-nowrap
form-table-data-list
"
>
<thead>
<tr>
{{foreach $form_table['form'] as $t}}
...
...
@@ -243,7 +260,14 @@
{{else /}}
<!-- 非数组则直接取值 -->
{{if isset($data_list[$i][$t['view_key']])}}
{{$data_list[$i][$t['view_key']]|raw}}
<!-- 是否指定数据转换 -->
{{if !empty($t['view_data']) and is_array($t['view_data']) and isset($t['view_data'][$data_list[$i][$t['view_key']]])}}
{{$t['view_data'][$data_list[$i][$t['view_key']]]}}
<!-- 直接展示数据 -->
{{else /}}
{{$data_list[$i][$t['view_key']]|raw}}
{{/if}}
{{/if}}
{{/if}}
{{/case}}
...
...
@@ -297,7 +321,7 @@
{{if isset($data_list[$i][$form_table['base']['key_field']])}}
<div
class=
"form-table-operate-checkbox"
>
<label
class=
"am-checkbox am-secondary am-checkbox-inline"
>
<input
type=
"checkbox"
name=
"{{$t.view_key}}"
value=
"{{$data_list[$i][$form_table['base']['key_field']]}}"
{{
if
!
empty
($
form_params
)
and
isset
($
form_params
[$
t
['
view_key
']])
and
in_array
($
data_list
[$
i
][$
form_table
['
base
']['
key_field
']],
$
form_params
[$
t
['
view_key
']])
}}
checked
{{/
if
}}
data-am-ucheck
/>
<input
type=
"checkbox"
name=
"{{$t.view_key}}"
value=
"{{$data_list[$i][$form_table['base']['key_field']]}}"
{{
if
isset
($
t
['
is_checked
'])
and
$
t
['
is_checked
']
eq
1
}}
checked
{{/
if
}}
data-am-ucheck
/>
</label>
</div>
{{/if}}
...
...
@@ -306,7 +330,7 @@
{{if isset($data_list[$i][$form_table['base']['key_field']])}}
<div
class=
"form-table-operate-radio"
>
<label
class=
"am-radio am-secondary am-radio-inline"
>
<input
type=
"radio"
name=
"{{$t.view_key}}"
value=
"{{$data_list[$i][$form_table['base']['key_field']]}}"
{{
if
!
empty
($
form_params
)
and
isset
($
form_params
[$
t
['
view_key
']])
and
$
form_params
[$
t
['
view_key
']]
eq
$
data_list
[$
i
][$
form_table
['
base
']['
key_field
']]
}}
checked
{{/
if
}}
data-am-ucheck
/>
<input
type=
"radio"
name=
"{{$t.view_key}}"
value=
"{{$data_list[$i][$form_table['base']['key_field']]}}"
{{
if
isset
($
t
['
is_checked
'])
and
$
t
['
is_checked
']
eq
1
}}
checked
{{/
if
}}
data-am-ucheck
/>
</label>
</div>
{{/if}}
...
...
@@ -363,6 +387,10 @@
{{/block}}
<!-- page end -->
<!-- extend start -->
{{block name="form_extend"}}{{/block}}
<!-- extend end -->
<!-- content inside top hook -->
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
<div
class=
"plugins-tag"
>
...
...
application/api/controller/Common.php
浏览文件 @
82222632
...
...
@@ -27,13 +27,9 @@ class Common extends Controller
// 用户信息
protected
$user
;
// 输入参数 post
// 输入参数 post
|get|request
protected
$data_post
;
// 输入参数 get
protected
$data_get
;
// 输入参数 request
protected
$data_request
;
/**
...
...
@@ -48,14 +44,14 @@ class Common extends Controller
{
parent
::
__construct
();
// 系统运行开始
SystemService
::
SystemBegin
();
// 输入参数
$this
->
data_post
=
input
(
'post.'
);
$this
->
data_get
=
input
(
'get.'
);
$this
->
data_request
=
input
();
// 系统运行开始
SystemService
::
SystemBegin
();
// 系统初始化
$this
->
SystemInit
();
...
...
application/api/controller/Plugins.php
浏览文件 @
82222632
...
...
@@ -44,6 +44,9 @@ class Plugins extends Common
*/
public
function
Index
()
{
// 参数
$params
=
$this
->
GetClassVars
();
// 请求参数校验
$p
=
[
[
...
...
@@ -69,12 +72,13 @@ class Plugins extends Common
}
// 应用名称/控制器/方法
$pluginsname
=
$this
->
data_request
[
'pluginsname'
];
$pluginscontrol
=
strtolower
(
$this
->
data_request
[
'pluginscontrol'
]);
$pluginsaction
=
strtolower
(
$this
->
data_request
[
'pluginsaction'
]);
$pluginsname
=
$params
[
'data_request'
][
'pluginsname'
];
$pluginscontrol
=
strtolower
(
$params
[
'data_request'
][
'pluginscontrol'
]);
$pluginsaction
=
strtolower
(
$params
[
'data_request'
][
'pluginsaction'
]);
unset
(
$params
[
'data_request'
][
'pluginsname'
],
$params
[
'data_request'
][
'pluginscontrol'
],
$params
[
'data_request'
][
'pluginsaction'
]);
// 调用
$ret
=
PluginsService
::
PluginsControlCall
(
$pluginsname
,
$pluginscontrol
,
$pluginsaction
,
'api'
,
$
this
->
data_request
);
$ret
=
PluginsService
::
PluginsControlCall
(
$pluginsname
,
$pluginscontrol
,
$pluginsaction
,
'api'
,
$
params
);
if
(
$ret
[
'code'
]
==
0
)
{
return
$ret
[
'data'
];
...
...
@@ -83,5 +87,27 @@ class Plugins extends Common
// 调用失败
return
$ret
;
}
/**
* 获取类属性数据
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-06-07
* @desc description
*/
public
function
GetClassVars
()
{
$data
=
[];
$vers
=
get_class_vars
(
get_class
());
foreach
(
$vers
as
$k
=>
$v
)
{
if
(
property_exists
(
$this
,
$k
))
{
$data
[
$k
]
=
$this
->
$k
;
}
}
return
$data
;
}
}
?>
\ No newline at end of file
application/index/controller/Common.php
浏览文件 @
82222632
...
...
@@ -12,6 +12,7 @@ namespace app\index\controller;
use
think\facade\Hook
;
use
think\Controller
;
use
app\module\FormHandleModule
;
use
app\service\SystemService
;
use
app\service\GoodsService
;
use
app\service\NavigationService
;
...
...
@@ -44,6 +45,26 @@ class Common extends Controller
// 请求参数
protected
$params
;
// 当前操作名称
protected
$module_name
;
protected
$controller_name
;
protected
$action_name
;
// 输入参数 post|get|request
protected
$data_post
;
protected
$data_get
;
protected
$data_request
;
// 分页信息
protected
$page
;
protected
$page_size
;
// 动态表格
protected
$form_table
;
protected
$form_where
;
protected
$form_params
;
protected
$form_error
;
/**
* 构造方法
* @author Devil
...
...
@@ -56,6 +77,11 @@ class Common extends Controller
{
parent
::
__construct
();
// 输入参数
$this
->
data_post
=
input
(
'post.'
);
$this
->
data_get
=
input
(
'get.'
);
$this
->
data_request
=
input
();
// 系统初始化
$this
->
SystemInit
();
...
...
@@ -74,6 +100,9 @@ class Common extends Controller
// 视图初始化
$this
->
ViewInit
();
// 动态表格初始化
$this
->
FormTableInit
();
// 公共钩子初始化
$this
->
CommonPluginsInit
();
}
...
...
@@ -148,10 +177,7 @@ class Common extends Controller
* @desc description
*/
private
function
SystemInit
()
{
// 公共参数
$this
->
params
=
input
();
{
// 配置信息初始化
ConfigService
::
ConfigInit
();
...
...
@@ -162,9 +188,9 @@ class Common extends Controller
}
// 推荐人
if
(
!
empty
(
$this
->
params
[
'referrer'
]))
if
(
!
empty
(
$this
->
data_request
[
'referrer'
]))
{
session
(
'share_referrer_id'
,
$this
->
params
[
'referrer'
]);
session
(
'share_referrer_id'
,
$this
->
data_request
[
'referrer'
]);
}
}
...
...
@@ -211,7 +237,7 @@ class Common extends Controller
public
function
ViewInit
()
{
// 公共参数
$this
->
assign
(
'params'
,
$this
->
params
);
$this
->
assign
(
'params'
,
$this
->
data_request
);
// 价格符号
$this
->
assign
(
'price_symbol'
,
config
(
'shopxo.price_symbol'
));
...
...
@@ -319,6 +345,37 @@ class Common extends Controller
$this
->
assign
(
'is_load_baidu_map_api'
,
0
);
}
/**
* 动态表格初始化
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-06-02
* @desc description
*/
public
function
FormTableInit
()
{
// 获取表格模型
$module
=
FormModulePath
(
$this
->
data_request
);
if
(
!
empty
(
$module
))
{
// 调用表格处理
$res
=
(
new
FormHandleModule
())
->
Run
(
$module
,
$this
->
data_request
);
if
(
$res
[
'code'
]
==
0
)
{
$this
->
form_table
=
$res
[
'data'
][
'table'
];
$this
->
form_where
=
$res
[
'data'
][
'where'
];
$this
->
form_params
=
$res
[
'data'
][
'params'
];
$this
->
assign
(
'form_table'
,
$this
->
form_table
);
$this
->
assign
(
'form_params'
,
$this
->
form_params
);
}
else
{
$this
->
form_error
=
$res
[
'msg'
];
$this
->
assign
(
'form_error'
,
$this
->
form_error
);
}
}
}
/**
* [NavInit 导航初始化]
* @author Devil
...
...
application/index/controller/Plugins.php
浏览文件 @
82222632
...
...
@@ -44,7 +44,7 @@ class Plugins extends Common
public
function
Index
()
{
// 参数
$params
=
input
();
$params
=
$this
->
GetClassVars
();
// 请求参数校验
$p
=
[
...
...
@@ -77,9 +77,10 @@ class Plugins extends Common
}
// 应用名称/控制器/方法
$pluginsname
=
$params
[
'pluginsname'
];
$pluginscontrol
=
strtolower
(
$params
[
'pluginscontrol'
]);
$pluginsaction
=
strtolower
(
$params
[
'pluginsaction'
]);
$pluginsname
=
$params
[
'data_request'
][
'pluginsname'
];
$pluginscontrol
=
strtolower
(
$params
[
'data_request'
][
'pluginscontrol'
]);
$pluginsaction
=
strtolower
(
$params
[
'data_request'
][
'pluginsaction'
]);
unset
(
$params
[
'data_request'
][
'pluginsname'
],
$params
[
'data_request'
][
'pluginscontrol'
],
$params
[
'data_request'
][
'pluginsaction'
]);
// 视图初始化
$this
->
PluginsViewInit
(
$pluginsname
,
$pluginscontrol
,
$pluginsaction
);
...
...
@@ -104,6 +105,28 @@ class Plugins extends Common
}
}
/**
* 获取类属性数据
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-06-07
* @desc description
*/
public
function
GetClassVars
()
{
$data
=
[];
$vers
=
get_class_vars
(
get_class
());
foreach
(
$vers
as
$k
=>
$v
)
{
if
(
property_exists
(
$this
,
$k
))
{
$data
[
$k
]
=
$this
->
$k
;
}
}
return
$data
;
}
/**
* 视图初始化
* @author Devil
...
...
application/index/controller/Search.php
浏览文件 @
82222632
...
...
@@ -56,16 +56,16 @@ class Search extends Common
$this
->
ParamsInit
();
// 品牌列表
$this
->
assign
(
'brand_list'
,
BrandService
::
CategoryBrandList
([
'category_id'
=>
$this
->
params
[
'category_id'
],
'keywords'
=>
$this
->
params
[
'wd'
]]));
$this
->
assign
(
'brand_list'
,
BrandService
::
CategoryBrandList
([
'category_id'
=>
$this
->
data_request
[
'category_id'
],
'keywords'
=>
$this
->
data_request
[
'wd'
]]));
// 商品分类
$this
->
assign
(
'category_list'
,
SearchService
::
GoodsCategoryList
([
'category_id'
=>
$this
->
params
[
'category_id'
]]));
$this
->
assign
(
'category_list'
,
SearchService
::
GoodsCategoryList
([
'category_id'
=>
$this
->
data_request
[
'category_id'
]]));
// 筛选价格区间
$this
->
assign
(
'screening_price_list'
,
SearchService
::
ScreeningPriceList
([
'field'
=>
'id,name'
]));
// 参数
$this
->
assign
(
'params'
,
$this
->
params
);
$this
->
assign
(
'params'
,
$this
->
data_request
);
// seo
$this
->
SetSeo
();
...
...
@@ -86,10 +86,10 @@ class Search extends Common
*/
private
function
SetSeo
()
{
$seo_title
=
$this
->
params
[
'wd'
];
if
(
!
empty
(
$this
->
params
[
'category_id'
]))
$seo_title
=
$this
->
data_request
[
'wd'
];
if
(
!
empty
(
$this
->
data_request
[
'category_id'
]))
{
$category
=
GoodsService
::
GoodsCategoryRow
([
'id'
=>
$this
->
params
[
'category_id'
],
'field'
=>
'name,seo_title,seo_keywords,seo_desc'
]);
$category
=
GoodsService
::
GoodsCategoryRow
([
'id'
=>
$this
->
data_request
[
'category_id'
],
'field'
=>
'name,seo_title,seo_keywords,seo_desc'
]);
if
(
!
empty
(
$category
))
{
$seo_title
=
empty
(
$category
[
'seo_title'
])
?
$category
[
'name'
]
:
$category
[
'seo_title'
];
...
...
@@ -118,23 +118,23 @@ class Search extends Common
private
function
ParamsInit
()
{
// 品牌id
$this
->
params
[
'brand_id'
]
=
isset
(
$this
->
params
[
'brand_id'
])
?
intval
(
$this
->
params
[
'brand_id'
])
:
0
;
$this
->
data_request
[
'brand_id'
]
=
isset
(
$this
->
data_request
[
'brand_id'
])
?
intval
(
$this
->
data_request
[
'brand_id'
])
:
0
;
// 分类id
$this
->
params
[
'category_id'
]
=
isset
(
$this
->
params
[
'category_id'
])
?
intval
(
$this
->
params
[
'category_id'
])
:
0
;
$this
->
data_request
[
'category_id'
]
=
isset
(
$this
->
data_request
[
'category_id'
])
?
intval
(
$this
->
data_request
[
'category_id'
])
:
0
;
// 筛选价格id
$this
->
params
[
'screening_price_id'
]
=
isset
(
$this
->
params
[
'screening_price_id'
])
?
intval
(
$this
->
params
[
'screening_price_id'
])
:
0
;
$this
->
data_request
[
'screening_price_id'
]
=
isset
(
$this
->
data_request
[
'screening_price_id'
])
?
intval
(
$this
->
data_request
[
'screening_price_id'
])
:
0
;
// 搜索关键字
$this
->
params
[
'wd'
]
=
empty
(
$this
->
params
[
'wd'
])
?
''
:
(
IS_AJAX
?
trim
(
$this
->
params
[
'wd'
])
:
AsciiToStr
(
$this
->
params
[
'wd'
]));
$this
->
data_request
[
'wd'
]
=
empty
(
$this
->
data_request
[
'wd'
])
?
''
:
(
IS_AJAX
?
trim
(
$this
->
data_request
[
'wd'
])
:
AsciiToStr
(
$this
->
data_request
[
'wd'
]));
// 排序方式
$this
->
params
[
'order_by_field'
]
=
empty
(
$this
->
params
[
'order_by_field'
])
?
'default'
:
$this
->
params
[
'order_by_field'
];
$this
->
params
[
'order_by_type'
]
=
empty
(
$this
->
params
[
'order_by_type'
])
?
'desc'
:
$this
->
params
[
'order_by_type'
];
$this
->
data_request
[
'order_by_field'
]
=
empty
(
$this
->
data_request
[
'order_by_field'
])
?
'default'
:
$this
->
data_request
[
'order_by_field'
];
$this
->
data_request
[
'order_by_type'
]
=
empty
(
$this
->
data_request
[
'order_by_type'
])
?
'desc'
:
$this
->
data_request
[
'order_by_type'
];
// 用户信息
$this
->
params
[
'user_id'
]
=
isset
(
$this
->
user
[
'id'
])
?
$this
->
user
[
'id'
]
:
0
;
$this
->
data_request
[
'user_id'
]
=
isset
(
$this
->
user
[
'id'
])
?
$this
->
user
[
'id'
]
:
0
;
}
/**
...
...
@@ -157,11 +157,11 @@ class Search extends Common
$this
->
ParamsInit
();
// 获取商品列表
$this
->
params
[
'keywords'
]
=
$this
->
params
[
'wd'
];
$ret
=
SearchService
::
GoodsList
(
$this
->
params
);
$this
->
data_request
[
'keywords'
]
=
$this
->
data_request
[
'wd'
];
$ret
=
SearchService
::
GoodsList
(
$this
->
data_request
);
// 搜索记录
SearchService
::
SearchAdd
(
$this
->
params
);
SearchService
::
SearchAdd
(
$this
->
data_request
);
// 无数据直接返回
if
(
empty
(
$ret
[
'data'
][
'data'
])
||
$ret
[
'code'
]
!=
0
)
...
...
application/module/FormHandleModule.php
浏览文件 @
82222632
此差异已折叠。
点击以展开。
application/service/GoodsService.php
浏览文件 @
82222632
...
...
@@ -1790,43 +1790,48 @@ class GoodsService
public
static
function
GoodsDelete
(
$params
=
[])
{
// 参数是否有误
if
(
empty
(
$params
[
'id'
]))
if
(
empty
(
$params
[
'id
s
'
]))
{
return
DataReturn
(
'商品id有误'
,
-
1
);
}
// 是否数组
if
(
!
is_array
(
$params
[
'ids'
]))
{
$params
[
'ids'
]
=
explode
(
','
,
$params
[
'ids'
]);
}
// 开启事务
Db
::
startTrans
();
// 删除商品
if
(
Db
::
name
(
'Goods'
)
->
delete
(
intval
(
$params
[
'id'
])
))
if
(
Db
::
name
(
'Goods'
)
->
where
([
'id'
=>
$params
[
'ids'
]])
->
delete
(
))
{
// 商品规格
if
(
Db
::
name
(
'GoodsSpecType'
)
->
where
([
'goods_id'
=>
intval
(
$params
[
'id'
])
])
->
delete
()
===
false
)
if
(
Db
::
name
(
'GoodsSpecType'
)
->
where
([
'goods_id'
=>
$params
[
'ids'
]
])
->
delete
()
===
false
)
{
Db
::
rollback
();
return
DataReturn
(
'规格类型删除失败'
,
-
100
);
}
if
(
Db
::
name
(
'GoodsSpecValue'
)
->
where
([
'goods_id'
=>
intval
(
$params
[
'id'
])
])
->
delete
()
===
false
)
if
(
Db
::
name
(
'GoodsSpecValue'
)
->
where
([
'goods_id'
=>
$params
[
'ids'
]
])
->
delete
()
===
false
)
{
Db
::
rollback
();
return
DataReturn
(
'规格值删除失败'
,
-
100
);
}
if
(
Db
::
name
(
'GoodsSpecBase'
)
->
where
([
'goods_id'
=>
intval
(
$params
[
'id'
])
])
->
delete
()
===
false
)
if
(
Db
::
name
(
'GoodsSpecBase'
)
->
where
([
'goods_id'
=>
$params
[
'ids'
]
])
->
delete
()
===
false
)
{
Db
::
rollback
();
return
DataReturn
(
'规格基础删除失败'
,
-
100
);
}
// 相册
if
(
Db
::
name
(
'GoodsPhoto'
)
->
where
([
'goods_id'
=>
intval
(
$params
[
'id'
])
])
->
delete
()
===
false
)
if
(
Db
::
name
(
'GoodsPhoto'
)
->
where
([
'goods_id'
=>
$params
[
'ids'
]
])
->
delete
()
===
false
)
{
Db
::
rollback
();
return
DataReturn
(
'相册删除失败'
,
-
100
);
}
// app内容
if
(
Db
::
name
(
'GoodsContentApp'
)
->
where
([
'goods_id'
=>
intval
(
$params
[
'id'
])
])
->
delete
()
===
false
)
if
(
Db
::
name
(
'GoodsContentApp'
)
->
where
([
'goods_id'
=>
$params
[
'ids'
]
])
->
delete
()
===
false
)
{
Db
::
rollback
();
return
DataReturn
(
'相册删除失败'
,
-
100
);
...
...
application/service/PluginsService.php
浏览文件 @
82222632
...
...
@@ -241,7 +241,7 @@ class PluginsService
// 调用方法
$action
=
ucfirst
(
$action
);
$obj
=
new
$plugins
();
$obj
=
new
$plugins
(
$params
);
if
(
!
method_exists
(
$obj
,
$action
))
{
return
DataReturn
(
'应用方法未定义['
.
$action
.
']'
,
-
1
);
...
...
config/shopxo.sql
浏览文件 @
82222632
此差异已折叠。
点击以展开。
public/static/admin/default/css/goods.css
浏览文件 @
82222632
/**
* 列表
*/
.goods
.goods-images
{
width
:
60px
;
height
:
60px
;
float
:
left
;
margin-right
:
5px
;
}
.goods
{
overflow
:
hidden
;
}
/**
* 详情
*/
...
...
public/static/common/js/common.js
浏览文件 @
82222632
...
...
@@ -847,25 +847,32 @@ function FomatFloat(value, pos)
*/
function
DataDelete
(
e
)
{
// 参数获取
var
id
=
e
.
attr
(
'
data-id
'
);
var
key
=
e
.
attr
(
'
data-key
'
)
||
'
id
'
;
var
url
=
e
.
attr
(
'
data-url
'
);
var
view
=
e
.
attr
(
'
data-view
'
)
||
'
delete
'
;
var
value
=
e
.
attr
(
'
data-value
'
)
||
null
;
var
ext_delete_tag
=
e
.
attr
(
'
data-ext-delete-tag
'
)
||
null
;
// 参数校验
if
((
id
||
null
)
==
null
||
(
url
||
null
)
==
null
)
{
Prompt
(
'
参数配置有误
'
);
return
false
;
}
// 请求数据
var
data
=
{};
data
[
key
]
=
id
;
// 请求删除数据
$
.
ajax
({
url
:
url
,
type
:
'
POST
'
,
dataType
:
"
json
"
,
timeout
:
e
.
attr
(
'
data-timeout
'
)
||
30000
,
data
:
{
"
id
"
:
id
}
,
data
:
data
,
success
:
function
(
result
)
{
if
(
result
.
code
==
0
)
...
...
@@ -973,19 +980,25 @@ function ConfirmDataDelete(e)
*/
function
AjaxRequest
(
e
)
{
// 参数
var
id
=
e
.
attr
(
'
data-id
'
);
var
key
=
e
.
attr
(
'
data-key
'
)
||
'
id
'
;
var
field
=
e
.
attr
(
'
data-field
'
)
||
''
;
var
value
=
e
.
attr
(
'
data-value
'
)
||
''
;
var
url
=
e
.
attr
(
'
data-url
'
);
var
view
=
e
.
attr
(
'
data-view
'
)
||
''
;
// 请求数据
var
data
=
{
"
value
"
:
value
,
"
field
"
:
field
};
data
[
key
]
=
id
;
// ajax
$
.
ajax
({
url
:
url
,
type
:
'
POST
'
,
dataType
:
"
json
"
,
timeout
:
e
.
attr
(
'
data-timeout
'
)
||
30000
,
data
:
{
"
id
"
:
id
,
"
value
"
:
value
,
"
field
"
:
field
}
,
data
:
data
,
success
:
function
(
result
)
{
if
(
result
.
code
==
0
)
...
...
@@ -1652,6 +1665,103 @@ $(function()
$
(
this
).
attr
(
'
data-value
'
,
value
==
1
?
0
:
1
);
});
// 表格公共删除操作
$
(
'
.form-table-operate-top-delete-submit
'
).
on
(
'
click
'
,
function
()
{
// 请求 url
var
url
=
$
(
this
).
data
(
'
url
'
)
||
null
;
if
(
url
==
null
)
{
Prompt
(
'
url参数有误
'
);
return
false
;
}
// form name 名称
var
form
=
$
(
this
).
data
(
'
form
'
)
||
null
;
if
(
form
==
null
)
{
Prompt
(
'
form参数有误
'
);
return
false
;
}
// 获取复选框选中的值
var
values
=
[];
$
(
document
).
find
(
'
input[name="
'
+
form
+
'
"]
'
).
each
(
function
(
key
,
tmp
)
{
if
(
$
(
this
).
is
(
'
:checked
'
))
{
values
.
push
(
tmp
.
value
);
}
});
// 获取单选框的值
if
(
values
.
length
<=
0
)
{
var
val
=
$
(
'
input[name="
'
+
form
+
'
"]:checked
'
).
val
();
if
(
val
!=
undefined
)
{
values
.
push
(
val
);
}
}
// 是否有选择的数据
if
(
values
.
length
<=
0
)
{
Prompt
(
'
请先选中数据
'
);
return
false
;
}
// 提交字段名称|超时时间|标题|描述
var
key
=
$
(
this
).
data
(
'
key
'
)
||
form
;
var
timeout
=
$
(
this
).
data
(
'
timeout
'
)
||
30000
;
var
title
=
$
(
this
).
data
(
'
confirm-title
'
)
||
'
温馨提示
'
;
var
msg
=
$
(
this
).
data
(
'
confirm-msg
'
)
||
'
删除后不可恢复、确认操作吗?
'
;
// 再次确认
AMUI
.
dialog
.
confirm
({
title
:
title
,
content
:
msg
,
onConfirm
:
function
(
result
)
{
// 数组转对象
var
data
=
{};
data
[
key
]
=
{};
for
(
var
i
in
values
)
{
data
[
key
][
i
]
=
values
[
i
];
}
// ajax请求操作
$
.
ajax
({
url
:
url
,
type
:
'
POST
'
,
dataType
:
"
json
"
,
timeout
:
timeout
,
data
:
data
,
success
:
function
(
result
)
{
if
(
result
.
code
==
0
)
{
// 成功则删除数据列表
Prompt
(
result
.
msg
,
'
success
'
);
for
(
var
i
in
values
)
{
$
(
'
#data-list-
'
+
values
[
i
]).
remove
();
}
}
else
{
Prompt
(
result
.
msg
);
}
},
error
:
function
(
xhr
,
type
)
{
Prompt
(
'
网络异常出错
'
);
}
});
},
onCancel
:
function
(){}
});
});
/**
* 页面加载 loading
*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录