Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jamesyang1999
ShopXO
提交
84e8e533
ShopXO
项目概览
jamesyang1999
/
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,发现更多精彩内容 >>
提交
84e8e533
编写于
12月 21, 2018
作者:
G
gongfuxiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
匹配管理
上级
5746143e
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
430 addition
and
267 deletion
+430
-267
application/admin/controller/Brand.php
application/admin/controller/Brand.php
+32
-90
application/admin/controller/BrandCategory.php
application/admin/controller/BrandCategory.php
+18
-91
application/admin/view/default/brand/index.html
application/admin/view/default/brand/index.html
+3
-5
application/admin/view/default/brand/save_info.html
application/admin/view/default/brand/save_info.html
+20
-15
application/admin/view/default/brandcategory/index.html
application/admin/view/default/brandcategory/index.html
+5
-5
application/admin/view/default/customview/save_info.html
application/admin/view/default/customview/save_info.html
+20
-4
application/service/BrandService.php
application/service/BrandService.php
+267
-0
application/service/CustomViewService.php
application/service/CustomViewService.php
+4
-28
application/service/GoodsService.php
application/service/GoodsService.php
+1
-1
application/service/ScreeningPriceService.php
application/service/ScreeningPriceService.php
+1
-1
public/install/shopxo_tp5.sql
public/install/shopxo_tp5.sql
+52
-26
public/static/admin/default/css/brand.css
public/static/admin/default/css/brand.css
+6
-1
public/static/common/css/common.css
public/static/common/css/common.css
+1
-0
未找到文件。
application/admin/controller/Brand.php
浏览文件 @
84e8e533
...
...
@@ -121,6 +121,9 @@ class Brand extends Common
// 参数
$this
->
assign
(
'params'
,
$params
);
// 编辑器文件存放地址
$this
->
assign
(
'editor_path_type'
,
'brand'
);
return
$this
->
fetch
();
}
...
...
@@ -134,64 +137,15 @@ class Brand extends Common
public
function
Save
()
{
// 是否ajax请求
if
(
!
IS_AJAX
)
{
$this
->
error
(
'非法访问'
);
}
// 图片
$this
->
FileSave
(
'logo'
,
'file_logo'
,
'brand'
);
// id为空则表示是新增
$m
=
D
(
'Brand'
);
// 公共额外数据处理
$_POST
[
'is_enable'
]
=
intval
(
I
(
'is_enable'
,
0
));
// 添加
if
(
empty
(
$_POST
[
'id'
]))
{
if
(
$m
->
create
(
$_POST
,
1
))
{
// 额外数据处理
$m
->
add_time
=
time
();
$m
->
sort
=
intval
(
I
(
'sort'
));
$m
->
brand_category_id
=
intval
(
I
(
'brand_category_id'
));
$m
->
website_url
=
I
(
'website_url'
);
$m
->
name
=
I
(
'name'
);
// 写入数据库
if
(
$m
->
add
())
{
$this
->
ajaxReturn
(
'新增成功'
);
}
else
{
$this
->
ajaxReturn
(
'新增失败'
,
-
100
);
}
}
}
else
{
// 编辑
if
(
$m
->
create
(
$_POST
,
2
))
{
// 额外数据处理
$m
->
upd_time
=
time
();
$m
->
sort
=
intval
(
I
(
'sort'
));
$m
->
brand_category_id
=
intval
(
I
(
'brand_category_id'
));
$m
->
website_url
=
I
(
'website_url'
);
$m
->
name
=
I
(
'name'
);
// 移除 id
unset
(
$m
->
id
);
// 更新数据库
if
(
$m
->
where
(
array
(
'id'
=>
I
(
'id'
)))
->
save
())
{
$this
->
ajaxReturn
(
'编辑成功'
);
}
else
{
$this
->
ajaxReturn
(
'编辑失败或数据未改变'
,
-
100
);
}
}
}
$this
->
ajaxReturn
(
$m
->
getError
(),
-
1
);
if
(
!
IS_AJAX
)
{
return
$this
->
error
(
'非法访问'
);
}
// 开始处理
$params
=
input
();
$ret
=
BrandService
::
BrandSave
(
$params
);
return
json
(
$ret
);
}
/**
...
...
@@ -203,50 +157,38 @@ class Brand extends Common
*/
public
function
Delete
()
{
if
(
!
IS_AJAX
)
{
$this
->
error
(
'非法访问'
);
}
$m
=
D
(
'Brand'
);
if
(
$m
->
create
(
$_POST
,
5
))
{
$id
=
I
(
'id'
);
// 删除
if
(
$m
->
delete
(
$id
))
{
$this
->
ajaxReturn
(
'删除成功'
);
}
else
{
$this
->
ajaxReturn
(
'删除失败或资源不存在'
,
-
100
);
}
}
else
{
$this
->
ajaxReturn
(
$m
->
getError
(),
-
1
);
}
// 是否ajax请求
if
(
!
IS_AJAX
)
{
return
$this
->
error
(
'非法访问'
);
}
// 开始处理
$params
=
input
();
$params
[
'user_type'
]
=
'admin'
;
$ret
=
BrandService
::
BrandDelete
(
$params
);
return
json
(
$ret
);
}
/**
* [Stat
e
Update 状态更新]
* [Stat
us
Update 状态更新]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2017-01-12T22:23:06+0800
*/
public
function
Stat
e
Update
()
public
function
Stat
us
Update
()
{
// 参数
if
(
empty
(
$_POST
[
'id'
])
||
!
isset
(
$_POST
[
'state'
])
)
// 是否ajax请求
if
(
!
IS_AJAX
)
{
$this
->
ajaxReturn
(
'参数错误'
,
-
1
);
return
$this
->
error
(
'非法访问'
);
}
// 数据更新
if
(
db
(
'Brand'
)
->
where
(
array
(
'id'
=>
I
(
'id'
)))
->
save
(
array
(
'is_enable'
=>
I
(
'state'
))))
{
$this
->
ajaxReturn
(
'编辑成功'
);
}
else
{
$this
->
ajaxReturn
(
'编辑失败或数据未改变'
,
-
100
);
}
// 开始处理
$params
=
input
();
$ret
=
BrandService
::
BrandStatusUpdate
(
$params
);
return
json
(
$ret
);
}
}
?>
\ No newline at end of file
application/admin/controller/BrandCategory.php
浏览文件 @
84e8e533
<?php
namespace
app\admin\controller
;
use
app\service\BrandService
;
/**
* 品牌分类管理
* @author Devil
...
...
@@ -38,8 +40,10 @@ class BrandCategory extends Common
*/
public
function
Index
()
{
// 是否启用
$this
->
assign
(
'common_is_enable_list'
,
lang
(
'common_is_enable_list'
));
$this
->
display
(
'Index'
);
return
$this
->
fetch
();
}
/**
...
...
@@ -57,39 +61,9 @@ class BrandCategory extends Common
$this
->
error
(
'非法访问'
);
}
// 获取数据
$field
=
array
(
'id'
,
'name'
,
'sort'
,
'is_enable'
);
$data
=
db
(
'BrandCategory'
)
->
field
(
$field
)
->
where
(
array
(
'pid'
=>
intval
(
I
(
'id'
,
0
))))
->
select
();
if
(
!
empty
(
$data
))
{
foreach
(
$data
as
$k
=>
$v
)
{
$data
[
$k
][
'is_son'
]
=
$this
->
IsExistSon
(
$v
[
'id'
]);
$data
[
$k
][
'ajax_url'
]
=
url
(
'Admin/BrandCategory/GetNodeSon'
,
array
(
'id'
=>
$v
[
'id'
]));
$data
[
$k
][
'delete_url'
]
=
url
(
'Admin/BrandCategory/Delete'
);
$data
[
$k
][
'json'
]
=
json_encode
(
$v
);
}
}
$msg
=
empty
(
$data
)
?
'没有相关数据'
:
'操作成功'
;
$this
->
ajaxReturn
(
$msg
,
0
,
$data
);
}
/**
* [IsExistSon 节点是否存在子数据]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-25T15:22:47+0800
* @param [int] $id [节点id]
* @return [string] [有数据ok, 则no]
*/
private
function
IsExistSon
(
$id
)
{
if
(
!
empty
(
$id
))
{
return
(
db
(
'BrandCategory'
)
->
where
(
array
(
'pid'
=>
$id
))
->
count
()
>
0
)
?
'ok'
:
'no'
;
}
return
'no'
;
// 开始操作
$ret
=
BrandService
::
BrandCategoryNodeSon
(
input
());
return
json
(
$ret
);
}
/**
...
...
@@ -107,50 +81,9 @@ class BrandCategory extends Common
$this
->
error
(
'非法访问'
);
}
// id为空则表示是新增
$m
=
D
(
'BrandCategory'
);
// 公共额外数据处理
$m
->
sort
=
intval
(
I
(
'sort'
));
// 添加
if
(
empty
(
$_POST
[
'id'
]))
{
if
(
$m
->
create
(
$_POST
,
1
))
{
// 额外数据处理
$m
->
add_time
=
time
();
$m
->
name
=
I
(
'name'
);
// 写入数据库
if
(
$m
->
add
())
{
$this
->
ajaxReturn
(
'新增成功'
);
}
else
{
$this
->
ajaxReturn
(
'新增失败'
,
-
100
);
}
}
}
else
{
// 编辑
if
(
$m
->
create
(
$_POST
,
2
))
{
// 额外数据处理
$m
->
name
=
I
(
'name'
);
$m
->
upd_time
=
time
();
// 移除 id
unset
(
$m
->
id
);
// 更新数据库
if
(
$m
->
where
(
array
(
'id'
=>
I
(
'id'
)))
->
save
())
{
$this
->
ajaxReturn
(
'编辑成功'
);
}
else
{
$this
->
ajaxReturn
(
'编辑失败或数据未改变'
,
-
100
);
}
}
}
$this
->
ajaxReturn
(
$m
->
getError
(),
-
1
);
// 开始操作
$ret
=
BrandService
::
BrandCategorySave
(
input
());
return
json
(
$ret
);
}
/**
...
...
@@ -162,23 +95,17 @@ class BrandCategory extends Common
*/
public
function
Delete
()
{
// 是否ajax
if
(
!
IS_AJAX
)
{
$this
->
error
(
'非法访问'
);
return
$this
->
error
(
'非法访问'
);
}
$m
=
D
(
'BrandCategory'
);
if
(
$m
->
create
(
$_POST
,
5
))
{
if
(
$m
->
delete
(
I
(
'id'
)))
{
$this
->
ajaxReturn
(
'删除成功'
);
}
else
{
$this
->
ajaxReturn
(
'删除失败或资源不存在'
,
-
100
);
}
}
else
{
$this
->
ajaxReturn
(
$m
->
getError
(),
-
1
);
}
// 开始操作
$params
=
input
(
'post.'
);
$params
[
'admin'
]
=
$this
->
admin
;
$ret
=
BrandService
::
BrandCategoryDelete
(
$params
);
return
json
(
$ret
);
}
}
?>
\ No newline at end of file
application/admin/view/default/brand/index.html
浏览文件 @
84e8e533
...
...
@@ -22,7 +22,7 @@
{{/foreach}}
</select>
<select
name=
"brand_category_id"
class=
"am-radius c-p m-t-10 m-l-5 param-where"
>
<option
value=
""
>
品牌分类
</option>
<option
value=
"
-1
"
>
品牌分类
</option>
{{foreach $brand_category as $v}}
<option
value=
"{{$v.id}}"
{{
if
isset
($
params
['
brand_category_id
'])
and
$
params
['
brand_category_id
']
eq
$
v
['
id
']}}
selected
{{/
if
}}
>
{{$v.name}}
</option>
{{/foreach}}
...
...
@@ -84,12 +84,10 @@
</td>
<td
class=
"am-hide-sm-only"
>
{{$v.add_time_time}}
</td>
<td
class=
"view-operation"
>
<a
href=
"{{:url('admin/brand/saveinfo', array
('id'=>$v['id'
]))}}"
>
<a
href=
"{{:url('admin/brand/saveinfo', array
_merge($params, ['id'=>$v['id']
]))}}"
>
<button
class=
"am-btn am-btn-default am-btn-xs am-radius am-icon-edit"
>
编辑
</button>
</a>
{{if $v['is_enable'] eq 0}}
<button
class=
"am-btn am-btn-default am-btn-xs am-radius am-icon-trash-o submit-delete"
data-url=
"{{:url('admin/brand/Delete')}}"
data-id=
"{{$v.id}}"
>
删除
</button>
{{/if}}
<button
class=
"am-btn am-btn-default am-btn-xs am-radius am-icon-trash-o submit-delete"
data-url=
"{{:url('admin/brand/Delete')}}"
data-id=
"{{$v.id}}"
>
删除
</button>
</td>
</tr>
{{/foreach}}
...
...
application/admin/view/default/brand/save_info.html
浏览文件 @
84e8e533
...
...
@@ -4,45 +4,50 @@
<div
class=
"content-right"
>
<div
class=
"content"
>
<!-- form start -->
<form
class=
"am-form form-validation view-save"
action=
"{{:url('
Admin/Brand/Save')}}"
method=
"POST"
request-type=
"ajax-url"
request-value=
"{{:url('Admin/Brand/Index'
)}}"
enctype=
"multipart/form-data"
>
<form
class=
"am-form form-validation view-save"
action=
"{{:url('
admin/brand/save')}}"
method=
"POST"
request-type=
"ajax-url"
request-value=
"{{:url('admin/brand/index', $params
)}}"
enctype=
"multipart/form-data"
>
<input
type=
"hidden"
name=
"max_file_size"
value=
"{{:MyC('home_max_limit_image', 2048000)}}"
/>
<legend>
<span
class=
"fs-16
)}}
<span
class=
"fs-16
"
>
{{if empty($data['id'])}}
品牌添加
{{else /}}
品牌编辑
{{/if}}
</span>
<a href="
{{
:url
('
Admin
/
Brand
/
Index
'
)}}"
class=
"fr fs-14 m-t-5 am-icon-mail-reply"
>
返回
</a>
<a
href=
"{{:url('
admin/brand/index', $params
)}}"
class=
"fr fs-14 m-t-5 am-icon-mail-reply"
>
返回
</a>
</legend>
<div
class=
"am-form-group"
>
<label>
名称
</label>
<input
type=
"text"
name=
"name"
placeholder=
"名称"
minlength=
"2"
maxlength=
"30"
data-validation-message=
"名称格式 2~30 个字符"
class=
"am-radius"
<
notempty
name=
"data"
>
value="{{$data.name}}"{{/if}} required />
<input
type=
"text"
name=
"name"
placeholder=
"名称"
minlength=
"2"
maxlength=
"30"
data-validation-message=
"名称格式 2~30 个字符"
class=
"am-radius"
{{
if
!
empty
($
data
)}}
value=
"{{$data.name}}"
{{/
if
}}
required
/>
</div>
<div
class=
"am-form-group"
>
<label>
品牌分类
</label>
<select
name=
"brand_category_id"
class=
"am-radius c-p chosen-select"
data-placeholder=
"可选择..."
data-validation-message=
"请选择品牌分类"
required
>
<option
value=
""
>
可选择...
</option>
<foreach
name=
"brand_category"
item=
"v"
>
<option
value=
"{{$v.id}}"
{{
if
isset
($
data
['
brand_category_id
'])
and
$
data
['
brand_category_id
']
eq
$
v
['
id
']
"
>
selected{{/if}}>{{$v.name}}
</option>
{{foreach $brand_category as $v}}
<option
value=
"{{$v.id}}"
{{
if
isset
($
data
['
brand_category_id
'])
and
$
data
['
brand_category_id
']
eq
$
v
['
id
']
}}
selected
{{/
if
}}
>
{{$v.name}}
</option>
{{/foreach}}
</select>
</div>
<div
class=
"am-form-group"
>
<label>
官网地址
</label>
<input
type=
"text"
name=
"website_url"
placeholder=
"官网地址"
data-validation-message=
"官网地址最多 255 个字符"
class=
"am-radius"
<
notempty
name=
"data"
>
value="{{$data.website_url}}"{{/if}} />
<label>
官网地址
<span
class=
"fs-12 fw-100 cr-999"
>
(带http://或https://)
</span></label>
<input
type=
"url"
placeholder=
"官网地址"
name=
"website_url"
data-validation-message=
"官网地址格式有误"
class=
"am-radius"
{{
if
!
empty
($
data
)}}
value=
"{{$data.website_url}}"
{{/
if
}}
/>
</div>
<div
class=
"am-form-group am-form-file"
>
<label
class=
"block"
>
LOGO
</label>
<button
type=
"button"
class=
"am-btn am-btn-default am-btn-sm am-radius"
>
<i
class=
"am-icon-cloud-upload"
></i>
选择图片
</button>
<input
type=
"text"
name=
"logo"
class=
"am-radius js-choice-one original-images-url"
data-choice-one-to=
".images-file-event"
<
notempty
name=
"data"
>
value="{{$data.logo}}"{{/if}}" data-validation-message="请选择需要上传的图片" readonly="readonly"
<notempty
name=
"data"
>
value="{{$data.logo}}"{{/if}} required />
<input
type=
"file"
name=
"file_logo"
multiple
data-validation-message=
"请选择需要上传的图片"
accept=
"image/gif,image/jpeg,image/jpg,image/png"
class=
"js-choice-one images-file-event"
data-choice-one-to=
".original-images-url"
data-tips-tag=
"#form-logo-tips"
data-image-tag=
"#form-img-logo"
required
/>
<div
id=
"form-logo-tips"
class=
"m-t-5)}}</div>
<img src="
{{
if
!
empty
($
data
['
logo
'])}}{{$
image_host
}}{{$
data.logo
}}{{
else
/}}{{$
image_host
}}/
Public
/
Admin
/
Default
/
Images
/
default-images.png
{{/
if
}}"
id=
"form-img-logo"
class=
"block m-t-5 am-img-thumbnail am-radius"
width=
"100"
data-default=
"{{if !empty($data['logo'])}}{{$image_host}}{{$data.logo}}{{else /}}{{$image_host}}/Public/Admin/Default/Images/default-images.png{{/if}}"
/>
<ul
class=
"plug-file-upload-view brand-logo-images-view"
data-form-name=
"logo"
data-max-number=
"1"
data-dialog-type=
"images"
>
{{if !empty($data['logo'])}}
<li>
<input
type=
"text"
name=
"logo"
value=
"{{$data.logo}}"
/>
<img
src=
"{{$data.logo}}"
/>
<i>
×
</i>
</li>
{{/if}}
</ul>
<div
class=
"plug-file-upload-submit"
data-view-tag=
"ul.brand-logo-images-view"
>
+上传图片
</div>
</div>
<div
class=
"am-form-group"
>
<label>
顺序
</label>
...
...
@@ -53,7 +58,7 @@
<input
name=
"is_enable"
value=
"1"
type=
"checkbox"
data-off-text=
"否"
data-on-text=
"是"
data-size=
"xs"
data-on-color=
"success"
data-off-color=
"default"
data-handle-width=
"50"
data-am-switch
{{
if
(
isset
($
data
['
is_enable
'])
and
$
data
['
is_enable
']
eq
1)
or
!
isset
($
data
['
is_enable
'])}}
checked=
"true"
{{/
if
}}
/>
</div>
<div
class=
"am-form-group"
>
<input
type=
"hidden"
name=
"id"
<
notempty
name=
"data"
>
value="{{$data.id}}"{{/if}} />
<input
type=
"hidden"
name=
"id"
{{
if
!
empty
($
data
)}}
value=
"{{$data.id}}"
{{/
if
}}
/>
<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>
...
...
application/admin/view/default/brandcategory/index.html
浏览文件 @
84e8e533
...
...
@@ -18,7 +18,7 @@
</div>
<div
class=
"am-popup-bd"
>
<!-- form start -->
<form
class=
"am-form form-validation admin-save"
action=
"{{:url('
Admin/BrandCategory/S
ave')}}"
method=
"POST"
request-type=
"ajax-reload"
request-value=
""
>
<form
class=
"am-form form-validation admin-save"
action=
"{{:url('
admin/brandcategory/s
ave')}}"
method=
"POST"
request-type=
"ajax-reload"
request-value=
""
>
<div
class=
"am-form-group"
>
<label>
名称
</label>
<input
type=
"text"
placeholder=
"名称"
name=
"name"
minlength=
"2"
maxlength=
"16"
data-validation-message=
"名称格式 2~16 个字符"
class=
"am-radius"
required
/>
...
...
@@ -27,7 +27,7 @@
<label>
顺序
</label>
<input
type=
"number"
placeholder=
"顺序"
name=
"sort"
min=
"0"
max=
"255"
data-validation-message=
"顺序 0~255 之间的数值"
class=
"am-radius"
value=
"0"
required
/>
</div>
<include
file=
"Lib/Enable"
/>
{{include file="lib/enable" /}}
<div
class=
"am-form-group"
>
<input
type=
"hidden"
name=
"id"
/>
<button
type=
"submit"
class=
"am-btn am-btn-primary am-radius btn-loading-example am-btn-sm w100"
data-am-loading=
"{loadingText:'处理中...'}"
>
保存
</button>
...
...
@@ -40,9 +40,9 @@
<!-- save win end -->
<!-- list start -->
<div
id=
"tree"
class=
"m-t-15
)}}
<div
id=
"tree"
class=
"m-t-15
"
>
<div
class=
"m-t-30 t-c"
>
<img
src=
"
__PUBLIC__/Common/I
mages/loading.gif"
/>
<img
src=
"
{{$image_host}}/static/common/i
mages/loading.gif"
/>
<p>
处理中...
</p>
</div>
</div>
...
...
@@ -55,5 +55,5 @@
{{include file="public/footer" /}}
<!-- footer end -->
<script>
Tree
(
0
,
"
{{:url('
Admin/BrandCategory/GetNodeS
on')}}
"
,
0
);
Tree
(
0
,
"
{{:url('
admin/brandcategory/getnodes
on')}}
"
,
0
);
</script>
\ No newline at end of file
application/admin/view/default/customview/save_info.html
浏览文件 @
84e8e533
...
...
@@ -19,10 +19,26 @@
<label>
标题
</label>
<input
type=
"text"
name=
"title"
placeholder=
"标题"
minlength=
"2"
maxlength=
"60"
data-validation-message=
"标题长度 2~60 个字符"
class=
"am-radius"
{{
if
!
empty
($
data
)}}
value=
"{{$data.title}}"
{{/
if
}}
required
/>
</div>
{{include file="lib/enable" /}}
{{include file="lib/is_header" /}}
{{include file="lib/is_footer" /}}
{{include file="lib/is_full_screen" /}}
<div
class=
"am-form-group"
>
<label
class=
"block"
>
是否启用
</label>
<input
name=
"is_enable"
value=
"1"
type=
"checkbox"
data-off-text=
"否"
data-on-text=
"是"
data-size=
"xs"
data-on-color=
"success"
data-off-color=
"default"
data-handle-width=
"50"
data-am-switch
{{
if
(
isset
($
data
['
is_enable
'])
and
$
data
['
is_enable
']
eq
1)
or
!
isset
($
data
['
is_enable
'])}}
checked=
"true"
{{/
if
}}
/>
</div>
<div
class=
"am-form-group"
>
<label
class=
"block"
>
是否含头部
</label>
<input
name=
"is_header"
value=
"1"
type=
"checkbox"
data-off-text=
"否"
data-on-text=
"是"
data-size=
"xs"
data-on-color=
"success"
data-off-color=
"default"
data-handle-width=
"50"
data-am-switch
{{
if
(
isset
($
data
['
is_header
'])
and
$
data
['
is_header
']
eq
1)
or
!
isset
($
data
['
is_header
'])}}
checked=
"true"
{{/
if
}}
/>
</div>
<div
class=
"am-form-group"
>
<label
class=
"block"
>
是否含尾部
</label>
<input
name=
"is_footer"
value=
"1"
type=
"checkbox"
data-off-text=
"否"
data-on-text=
"是"
data-size=
"xs"
data-on-color=
"success"
data-off-color=
"default"
data-handle-width=
"50"
data-am-switch
{{
if
(
isset
($
data
['
is_footer
'])
and
$
data
['
is_footer
']
eq
1)
or
!
isset
($
data
['
is_footer
'])}}
checked=
"true"
{{/
if
}}
/>
</div>
<div
class=
"am-form-group"
>
<label
class=
"block"
>
是否满屏
</label>
<input
name=
"is_full_screen"
value=
"1"
type=
"checkbox"
data-off-text=
"否"
data-on-text=
"是"
data-size=
"xs"
data-on-color=
"success"
data-off-color=
"default"
data-handle-width=
"50"
data-am-switch
{{
if
(
isset
($
data
['
is_full_screen
'])
and
$
data
['
is_full_screen
']
eq
1)
or
!
isset
($
data
['
is_full_screen
'])}}
checked=
"true"
{{/
if
}}
/>
</div>
<div
class=
"am-form-group"
>
<label>
内容{{if IsMobile()}}
<span
class=
"fs-12 fw-100 cr-999"
>
(更多编辑功能请使用电脑访问)
</span>
{{/if}}
</label>
<textarea
class=
"am-radius am-validate"
name=
"content"
rows=
"5"
minlength=
"50"
maxlength=
"105000"
{{
if
!
IsMobile
()}}
id=
"editor-tag"
data-url=
"{{:url('admin/ueditor/index', ['path_type'=>'customview'])}}"
placeholder=
"内容长度最少 50~105000 个字符"
{{
else
/}}
placeholder=
"内容长度最少 50~105000 个字符更多编辑功能请使用电脑访问"
{{/
if
}}
data-validation-message=
"内容长度最少 50~105000 个字符"
required
>
{{if !empty($data)}}{{$data.content}}{{/if}}
</textarea>
...
...
application/service/BrandService.php
浏览文件 @
84e8e533
...
...
@@ -217,5 +217,272 @@ class BrandService
return
DataReturn
(
'处理成功'
,
0
,
$data
);
}
/**
* 保存
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-12-18
* @desc description
* @param [array] $params [输入参数]
*/
public
static
function
BrandSave
(
$params
=
[])
{
// 请求类型
$p
=
[
[
'checked_type'
=>
'length'
,
'key_name'
=>
'name'
,
'checked_data'
=>
'2,30'
,
'error_msg'
=>
'名称长度 2~30 个字符'
,
],
[
'checked_type'
=>
'empty'
,
'key_name'
=>
'brand_category_id'
,
'error_msg'
=>
'请选择品牌分类'
,
],
[
'checked_type'
=>
'fun'
,
'key_name'
=>
'website_url'
,
'checked_data'
=>
'CheckUrl'
,
'is_checked'
=>
1
,
'error_msg'
=>
'官网地址格式有误'
,
],
[
'checked_type'
=>
'length'
,
'key_name'
=>
'sort'
,
'checked_data'
=>
'3'
,
'error_msg'
=>
'顺序 0~255 之间的数值'
,
],
];
$ret
=
params_checked
(
$params
,
$p
);
if
(
$ret
!==
true
)
{
return
DataReturn
(
$ret
,
-
1
);
}
// 附件
$data_fields
=
[
'logo'
];
$attachment
=
ResourcesService
::
AttachmentParams
(
$params
,
$data_fields
);
// 数据
$data
=
[
'name'
=>
$params
[
'name'
],
'brand_category_id'
=>
intval
(
$params
[
'brand_category_id'
]),
'logo'
=>
$attachment
[
'data'
][
'logo'
],
'website_url'
=>
empty
(
$params
[
'website_url'
])
?
''
:
$params
[
'website_url'
],
'sort'
=>
intval
(
$params
[
'sort'
]),
'is_enable'
=>
isset
(
$params
[
'is_enable'
])
?
intval
(
$params
[
'is_enable'
])
:
0
,
];
if
(
empty
(
$params
[
'id'
]))
{
$data
[
'add_time'
]
=
time
();
if
(
db
(
'Brand'
)
->
insertGetId
(
$data
)
>
0
)
{
return
DataReturn
(
'添加成功'
,
0
);
}
return
DataReturn
(
'添加失败'
,
-
100
);
}
else
{
$data
[
'upd_time'
]
=
time
();
if
(
db
(
'Brand'
)
->
where
([
'id'
=>
intval
(
$params
[
'id'
])])
->
update
(
$data
))
{
return
DataReturn
(
'编辑成功'
,
0
);
}
return
DataReturn
(
'编辑失败'
,
-
100
);
}
}
/**
* 删除
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-12-18
* @desc description
* @param [array] $params [输入参数]
*/
public
static
function
BrandDelete
(
$params
=
[])
{
// 请求参数
$p
=
[
[
'checked_type'
=>
'empty'
,
'key_name'
=>
'id'
,
'error_msg'
=>
'操作id有误'
,
],
];
$ret
=
params_checked
(
$params
,
$p
);
if
(
$ret
!==
true
)
{
return
DataReturn
(
$ret
,
-
1
);
}
// 删除操作
if
(
db
(
'Brand'
)
->
where
([
'id'
=>
$params
[
'id'
]])
->
delete
())
{
return
DataReturn
(
'删除成功'
);
}
return
DataReturn
(
'删除失败或资源不存在'
,
-
100
);
}
/**
* 状态更新
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-06T21:31:53+0800
* @param [array] $params [输入参数]
*/
public
static
function
BrandStatusUpdate
(
$params
=
[])
{
// 请求参数
$p
=
[
[
'checked_type'
=>
'empty'
,
'key_name'
=>
'id'
,
'error_msg'
=>
'操作id有误'
,
],
[
'checked_type'
=>
'in'
,
'key_name'
=>
'state'
,
'checked_data'
=>
[
0
,
1
],
'error_msg'
=>
'状态有误'
,
],
];
$ret
=
params_checked
(
$params
,
$p
);
if
(
$ret
!==
true
)
{
return
DataReturn
(
$ret
,
-
1
);
}
// 数据更新
if
(
db
(
'Brand'
)
->
where
([
'id'
=>
intval
(
$params
[
'id'
])])
->
update
([
'is_enable'
=>
intval
(
$params
[
'state'
])]))
{
return
DataReturn
(
'编辑成功'
);
}
return
DataReturn
(
'编辑失败或数据未改变'
,
-
100
);
}
/**
* 获取品牌分类节点数据
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2018-12-16T23:54:46+0800
* @param [array] $params [输入参数]
*/
public
static
function
BrandCategoryNodeSon
(
$params
=
[])
{
// id
$id
=
isset
(
$params
[
'id'
])
?
intval
(
$params
[
'id'
])
:
0
;
// 获取数据
$field
=
'*'
;
$data
=
db
(
'BrandCategory'
)
->
field
(
$field
)
->
where
([
'pid'
=>
$id
])
->
order
(
'sort asc'
)
->
select
();
if
(
!
empty
(
$data
))
{
foreach
(
$data
as
&
$v
)
{
$v
[
'is_son'
]
=
(
db
(
'BrandCategory'
)
->
where
([
'pid'
=>
$v
[
'id'
]])
->
count
()
>
0
)
?
'ok'
:
'no'
;
$v
[
'ajax_url'
]
=
url
(
'admin/goodscategory/getnodeson'
,
array
(
'id'
=>
$v
[
'id'
]));
$v
[
'delete_url'
]
=
url
(
'admin/goodscategory/delete'
);
$v
[
'json'
]
=
json_encode
(
$v
);
}
return
DataReturn
(
'操作成功'
,
0
,
$data
);
}
return
DataReturn
(
'没有相关数据'
,
-
100
);
}
/**
* 品牌分类保存
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2018-12-17T01:04:03+0800
* @param [array] $params [输入参数]
*/
public
static
function
BrandCategorySave
(
$params
=
[])
{
// 请求参数
$p
=
[
[
'checked_type'
=>
'length'
,
'key_name'
=>
'name'
,
'checked_data'
=>
'2,16'
,
'error_msg'
=>
'名称格式 2~16 个字符'
,
],
];
$ret
=
params_checked
(
$params
,
$p
);
if
(
$ret
!==
true
)
{
return
DataReturn
(
$ret
,
-
1
);
}
// 数据
$data
=
[
'name'
=>
$params
[
'name'
],
'pid'
=>
isset
(
$params
[
'pid'
])
?
intval
(
$params
[
'pid'
])
:
0
,
'sort'
=>
isset
(
$params
[
'sort'
])
?
intval
(
$params
[
'sort'
])
:
0
,
'is_enable'
=>
isset
(
$params
[
'is_enable'
])
?
intval
(
$params
[
'is_enable'
])
:
0
,
];
// 添加
if
(
empty
(
$params
[
'id'
]))
{
$data
[
'add_time'
]
=
time
();
if
(
db
(
'BrandCategory'
)
->
insertGetId
(
$data
)
>
0
)
{
return
DataReturn
(
'添加成功'
,
0
);
}
return
DataReturn
(
'添加失败'
,
-
100
);
}
else
{
$data
[
'upd_time'
]
=
time
();
if
(
db
(
'BrandCategory'
)
->
where
([
'id'
=>
intval
(
$params
[
'id'
])])
->
update
(
$data
))
{
return
DataReturn
(
'编辑成功'
,
0
);
}
return
DataReturn
(
'编辑失败'
,
-
100
);
}
}
/**
* 品牌分类删除
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @datetime 2018-12-17T02:40:29+0800
* @param [array] $params [输入参数]
*/
public
static
function
BrandCategoryDelete
(
$params
=
[])
{
// 请求参数
$p
=
[
[
'checked_type'
=>
'empty'
,
'key_name'
=>
'id'
,
'error_msg'
=>
'删除数据id有误'
,
],
[
'checked_type'
=>
'empty'
,
'key_name'
=>
'admin'
,
'error_msg'
=>
'用户信息有误'
,
],
];
$ret
=
params_checked
(
$params
,
$p
);
if
(
$ret
!==
true
)
{
return
DataReturn
(
$ret
,
-
1
);
}
// 开始删除
if
(
db
(
'GoodsCategory'
)
->
where
([
'id'
=>
intval
(
$params
[
'id'
])])
->
delete
())
{
return
DataReturn
(
'删除成功'
,
0
);
}
return
DataReturn
(
'删除失败'
,
0
);
}
}
?>
\ No newline at end of file
application/service/CustomViewService.php
浏览文件 @
84e8e533
...
...
@@ -173,30 +173,6 @@ class CustomViewService
'checked_data'
=>
'50,105000'
,
'error_msg'
=>
'内容长度最少 50~105000 个字符'
,
],
[
'checked_type'
=>
'in'
,
'key_name'
=>
'is_enable'
,
'checked_data'
=>
[
0
,
1
],
'error_msg'
=>
'是否显示范围值有误'
,
],
[
'checked_type'
=>
'in'
,
'key_name'
=>
'is_header'
,
'checked_data'
=>
[
0
,
1
],
'error_msg'
=>
'是否包含头部范围值有误'
,
],
[
'checked_type'
=>
'in'
,
'key_name'
=>
'is_footer'
,
'checked_data'
=>
[
0
,
1
],
'error_msg'
=>
'是否包含尾部范围值有误'
,
],
[
'checked_type'
=>
'in'
,
'key_name'
=>
'is_full_screen'
,
'checked_data'
=>
[
0
,
1
],
'error_msg'
=>
'是否满屏范围值有误'
,
]
];
$ret
=
params_checked
(
$params
,
$p
);
if
(
$ret
!==
true
)
...
...
@@ -212,10 +188,10 @@ class CustomViewService
'content'
=>
$content
,
'image'
=>
empty
(
$image
)
?
''
:
json_encode
(
$image
),
'image_count'
=>
count
(
$image
),
'is_enable'
=>
i
ntval
(
$params
[
'is_enable'
])
,
'is_header'
=>
i
ntval
(
$params
[
'is_header'
])
,
'is_footer'
=>
i
ntval
(
$params
[
'is_footer'
])
,
'is_full_screen'
=>
i
ntval
(
$params
[
'is_full_screen'
])
,
'is_enable'
=>
i
sset
(
$params
[
'is_enable'
])
?
intval
(
$params
[
'is_enable'
])
:
0
,
'is_header'
=>
i
sset
(
$params
[
'is_header'
])
?
intval
(
$params
[
'is_header'
])
:
0
,
'is_footer'
=>
i
sset
(
$params
[
'is_footer'
])
?
intval
(
$params
[
'is_footer'
])
:
0
,
'is_full_screen'
=>
i
sset
(
$params
[
'is_full_screen'
])
?
intval
(
$params
[
'is_full_screen'
])
:
0
,
];
if
(
empty
(
$params
[
'id'
]))
...
...
application/service/GoodsService.php
浏览文件 @
84e8e533
...
...
@@ -1780,7 +1780,7 @@ class GoodsService
// 获取数据
$field
=
'id,pid,icon,name,sort,is_enable,bg_color,big_images,vice_name,describe,is_home_recommended'
;
$data
=
db
(
'GoodsCategory'
)
->
field
(
$field
)
->
where
([
'pid'
=>
$id
])
->
select
();
$data
=
db
(
'GoodsCategory'
)
->
field
(
$field
)
->
where
([
'pid'
=>
$id
])
->
order
(
'sort asc'
)
->
select
();
if
(
!
empty
(
$data
))
{
$image_host
=
config
(
'IMAGE_HOST'
);
...
...
application/service/ScreeningPriceService.php
浏览文件 @
84e8e533
...
...
@@ -26,7 +26,7 @@ class ScreeningPriceService
// 获取数据
$field
=
'id,name,sort,is_enable,min_price,max_price'
;
$data
=
db
(
'ScreeningPrice'
)
->
field
(
$field
)
->
where
([
'pid'
=>
$id
])
->
select
();
$data
=
db
(
'ScreeningPrice'
)
->
field
(
$field
)
->
where
([
'pid'
=>
$id
])
->
order
(
'sort asc'
)
->
select
();
if
(
!
empty
(
$data
))
{
$image_host
=
config
(
'IMAGE_HOST'
);
...
...
public/install/shopxo_tp5.sql
浏览文件 @
84e8e533
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
public/static/admin/default/css/brand.css
浏览文件 @
84e8e533
...
...
@@ -15,4 +15,9 @@
}
@media
only
screen
and
(
max-width
:
321px
)
{
.view-operation
button
{
margin
:
2px
0px
;
}
}
\ No newline at end of file
}
/**
* 插件覆盖
*/
ul
.plug-file-upload-view
li
{
width
:
150px
;
height
:
58px
;
}
\ No newline at end of file
public/static/common/css/common.css
浏览文件 @
84e8e533
...
...
@@ -191,6 +191,7 @@ ul.plug-file-upload-view li i {
right
:
5px
;
top
:
5px
;
cursor
:
pointer
;
text-shadow
:
-2px
1px
#fff
;
}
ul
.plug-file-upload-view
li
:hover
>
i
{
color
:
#e90f0f
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录