Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
jcy2004x
ShopXO
提交
7b54a3c4
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,发现更多精彩内容 >>
提交
7b54a3c4
编写于
12月 26, 2018
作者:
G
gongfuxiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
商品规格图片优化
上级
7f710915
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
429 addition
and
145 deletion
+429
-145
application/admin/controller/Common.php
application/admin/controller/Common.php
+1
-2
application/admin/controller/Error.php
application/admin/controller/Error.php
+1
-2
application/admin/view/default/goods/save_info.html
application/admin/view/default/goods/save_info.html
+19
-13
application/index/view/default/buy/index.html
application/index/view/default/buy/index.html
+0
-4
application/index/view/default/goods/index.html
application/index/view/default/goods/index.html
+4
-4
application/index/view/default/search/index.html
application/index/view/default/search/index.html
+0
-4
application/index/view/default/user/index.html
application/index/view/default/user/index.html
+4
-0
application/service/GoodsService.php
application/service/GoodsService.php
+35
-58
public/install/shopxo_tp5.sql
public/install/shopxo_tp5.sql
+365
-58
未找到文件。
application/admin/controller/Common.php
浏览文件 @
7b54a3c4
...
@@ -171,8 +171,7 @@ class Common extends Controller
...
@@ -171,8 +171,7 @@ class Common extends Controller
{
{
exit
(
json_encode
(
DataReturn
(
$name
.
' 非法访问'
,
-
1000
)));
exit
(
json_encode
(
DataReturn
(
$name
.
' 非法访问'
,
-
1000
)));
}
else
{
}
else
{
$this
->
assign
(
'msg'
,
$name
.
' 非法访问'
);
exit
(
$name
.
' 非法访问'
);
return
$this
->
fetch
(
'public/error'
);
}
}
}
}
}
}
...
...
application/admin/controller/Error.php
浏览文件 @
7b54a3c4
...
@@ -28,8 +28,7 @@ class Error extends Common
...
@@ -28,8 +28,7 @@ class Error extends Common
{
{
exit
(
json_encode
(
DataReturn
(
$request
->
controller
()
.
' 控制器不存在'
,
-
1000
)));
exit
(
json_encode
(
DataReturn
(
$request
->
controller
()
.
' 控制器不存在'
,
-
1000
)));
}
else
{
}
else
{
$this
->
assign
(
'msg'
,
$request
->
controller
()
.
' 控制器不存在'
);
exit
(
$request
->
controller
()
.
' 控制器不存在'
);
return
$this
->
fetch
(
'public/error'
);
}
}
}
}
}
}
...
...
application/admin/view/default/goods/save_info.html
浏览文件 @
7b54a3c4
...
@@ -255,23 +255,29 @@
...
@@ -255,23 +255,29 @@
<span
class=
"business-operations-submit specifications-line-add"
>
+添加一行
</span>
<span
class=
"business-operations-submit specifications-line-add"
>
+添加一行
</span>
<span
class=
"business-operations-submit specifications-line-images-add m-l-10"
>
+添加规格图片
</span>
<span
class=
"business-operations-submit specifications-line-images-add m-l-10"
>
+添加规格图片
</span>
<ul
class=
"spec-images-list"
>
<ul
class=
"spec-images-list"
>
{{if !empty($specifications['images'])}}
<div
class=
"am-alert am-alert-warning am-radius"
data-am-alert
>
<div
class=
"am-alert am-alert-warning am-radius"
data-am-alert
>
<button
type=
"button"
class=
"am-close"
>
×
</button>
<button
type=
"button"
class=
"am-close"
>
×
</button>
<p
class=
"fs-12"
>
规格名称与规格值保持一致,相同规格名称添加一次即可,重复添加则后面覆盖前面,顺序不影响前端展示效果。
</p>
<p
class=
"fs-12"
>
规格名称与规格值保持一致,相同规格名称添加一次即可,重复添加则后面覆盖前面,顺序不影响前端展示效果。
</p>
</div>
</div>
{{foreach $specifications.images as $spec_images}}
{{if !empty($specifications['type'])}}
<li
class=
"spec-images-items spec-images-items-{{$spec_images.id}}"
>
{{foreach $specifications.type as $type}}
<input
type=
"text"
name=
"spec_images_name[{{$spec_images.id}}]"
placeholder=
"规格名称"
class=
"am-radius t-c"
data-validation-message=
"请填写规格名称"
value=
"{{$spec_images.name}}"
required
>
{{if !empty($type['value'])}}
<ul
class=
"plug-file-upload-view spec-images-view-{{$spec_images.id}}"
data-form-name=
"spec_images[{{$spec_images.id}}]"
data-max-number=
"1"
data-delete=
'0'
data-dialog-type=
"images"
>
{{foreach $type.value as $spec_key=>$spec}}
<li>
{{if !empty($spec['images'])}}
<input
type=
"hidden"
name=
"spec_images[{{$spec_images.id}}]"
value=
"{{$spec_images.images_old}}"
data-validation-message=
"请上传规格图片"
required
/>
<li
class=
"spec-images-items spec-images-items-{{$type.id}}{{$spec_key}}"
>
<img
src=
"{{$spec_images.images}}"
/>
<input
type=
"text"
name=
"spec_images_name[{{$type.id}}{{$spec_key}}]"
placeholder=
"规格名称"
class=
"am-radius t-c"
data-validation-message=
"请填写规格名称"
value=
"{{$spec.name}}"
required
>
<i>
×
</i>
<ul
class=
"plug-file-upload-view spec-images-view-{{$type.id}}{{$spec_key}}"
data-form-name=
"spec_images[{{$type.id}}{{$spec_key}}]"
data-max-number=
"1"
data-delete=
'0'
data-dialog-type=
"images"
>
</li>
<li>
</ul>
<input
type=
"hidden"
name=
"spec_images[{{$type.id}}{{$spec_key}}]"
value=
"{{$spec.images_old}}"
data-validation-message=
"请上传规格图片"
required
/>
<div
class=
"plug-file-upload-submit"
data-view-tag=
"ul.spec-images-view-{{$spec_images.id}}"
>
+上传图片
</div>
<img
src=
"{{$spec.images}}"
/>
</li>
<i>
×
</i>
</li>
</ul>
<div
class=
"plug-file-upload-submit"
data-view-tag=
"ul.spec-images-view-{{$type.id}}{{$spec_key}}"
>
+上传图片
</div>
</li>
{{/if}}
{{/foreach}}
{{/if}}
{{/foreach}}
{{/foreach}}
{{/if}}
{{/if}}
</ul>
</ul>
...
...
application/index/view/default/buy/index.html
浏览文件 @
7b54a3c4
{{include file="public/header" /}}
{{include file="public/header" /}}
<!-- nav start -->
{{include file="public/nav" /}}
<!-- nav end -->
<!-- header top nav -->
<!-- header top nav -->
{{include file="public/header_top_nav" /}}
{{include file="public/header_top_nav" /}}
...
...
application/index/view/default/goods/index.html
浏览文件 @
7b54a3c4
...
@@ -144,11 +144,11 @@
...
@@ -144,11 +144,11 @@
<div
class=
"cart-title"
>
{{$spec.name}}
</div>
<div
class=
"cart-title"
>
{{$spec.name}}
</div>
<ul>
<ul>
{{foreach $spec.value as $keys=>$specs}}
{{foreach $spec.value as $keys=>$specs}}
<li
class=
"sku-line {{if !empty($
goods['specifications']['images'][$specs])}} sku-line-images{{/if}} {{if $key gt 0}} sku-dont-choose{{/if}}"
data-type-value=
"{{$spec.name}}"
data-value=
"{{$specs}}"
{{
if
!
empty
($
goods
['
specifications
']['
images
'][$
specs
])}}
data-type-images=
"{{$goods.specifications.images[$specs]
}}"
{{/
if
}}
>
<li
class=
"sku-line {{if !empty($
specs['images'])}} sku-line-images{{/if}} {{if $key gt 0}} sku-dont-choose{{/if}}"
data-type-value=
"{{$spec.name}}"
data-value=
"{{$specs.name}}"
{{
if
!
empty
($
specs
['
images
'])}}
data-type-images=
"{{$specs.images
}}"
{{/
if
}}
>
{{if !empty($
goods['specifications']['images'][$specs
])}}
{{if !empty($
specs['images'
])}}
<img
src=
"{{$
goods.specifications.images[$specs]
}}"
/>
<img
src=
"{{$
specs.images
}}"
/>
{{/if}}
{{/if}}
{{$specs}}
<i></i>
{{$specs
.name
}}
<i></i>
</li>
</li>
{{/foreach}}
{{/foreach}}
</ul>
</ul>
...
...
application/index/view/default/search/index.html
浏览文件 @
7b54a3c4
{{include file="public/header" /}}
{{include file="public/header" /}}
<!-- nav start -->
{{include file="public/nav" /}}
<!-- nav end -->
<!-- header top nav -->
<!-- header top nav -->
{{include file="public/header_top_nav" /}}
{{include file="public/header_top_nav" /}}
...
...
application/index/view/default/user/index.html
浏览文件 @
7b54a3c4
{{include file="public/header" /}}
{{include file="public/header" /}}
<!-- nav start -->
{{include file="public/nav" /}}
<!-- nav end -->
<!-- header top nav -->
<!-- header top nav -->
{{include file="public/header_top_nav" /}}
{{include file="public/header_top_nav" /}}
...
...
application/service/GoodsService.php
浏览文件 @
7b54a3c4
...
@@ -371,25 +371,20 @@ class GoodsService
...
@@ -371,25 +371,20 @@ class GoodsService
$type
=
Db
::
name
(
'GoodsSpecType'
)
->
where
(
$where
)
->
order
(
'id asc'
)
->
select
();
$type
=
Db
::
name
(
'GoodsSpecType'
)
->
where
(
$where
)
->
order
(
'id asc'
)
->
select
();
if
(
!
empty
(
$type
))
if
(
!
empty
(
$type
))
{
{
// 数据处理
$images_host
=
config
(
'images_host'
);
foreach
(
$type
as
&
$temp_type
)
foreach
(
$type
as
&
$temp_type
)
{
{
$temp_type
[
'value'
]
=
json_decode
(
$temp_type
[
'value'
],
true
);
$temp_type_value
=
json_decode
(
$temp_type
[
'value'
],
true
);
foreach
(
$temp_type_value
as
&
$vs
)
{
$vs
[
'images'
]
=
empty
(
$vs
[
'images'
])
?
''
:
$images_host
.
$vs
[
'images'
];
}
$temp_type
[
'value'
]
=
$temp_type_value
;
$temp_type
[
'add_time'
]
=
date
(
'Y-m-d H:i:s'
);
$temp_type
[
'add_time'
]
=
date
(
'Y-m-d H:i:s'
);
}
}
}
}
return
[
'type'
=>
$type
];
// 规格图片
$images
=
Db
::
name
(
'GoodsSpecImages'
)
->
where
(
$where
)
->
column
(
'name,images'
);
if
(
!
empty
(
$images
))
{
$images_host
=
config
(
'images_host'
);
foreach
(
$images
as
&
$temp_iamges
)
{
$temp_iamges
=
$images_host
.
$temp_iamges
;
}
}
return
[
'type'
=>
$type
,
'images'
=>
$images
];
}
}
/**
/**
...
@@ -1155,13 +1150,9 @@ class GoodsService
...
@@ -1155,13 +1150,9 @@ class GoodsService
{
{
if
(
!
empty
(
$params
[
'spec_images'
][
$k
]))
if
(
!
empty
(
$params
[
'spec_images'
][
$k
]))
{
{
$images
[
$v
]
=
[
$images
[
$v
]
=
$params
[
'spec_images'
][
$k
];
'name'
=>
$v
,
'images'
=>
$params
[
'spec_images'
][
$k
],
];
}
}
}
}
$images
=
array_values
(
$images
);
}
}
return
DataReturn
(
'success'
,
0
,
[
'data'
=>
$data
,
'title'
=>
$title
,
'images'
=>
$images
]);
return
DataReturn
(
'success'
,
0
,
[
'data'
=>
$data
,
'title'
=>
$title
,
'images'
=>
$images
]);
...
@@ -1344,15 +1335,22 @@ class GoodsService
...
@@ -1344,15 +1335,22 @@ class GoodsService
Db
::
name
(
'GoodsSpecType'
)
->
where
([
'goods_id'
=>
$goods_id
])
->
delete
();
Db
::
name
(
'GoodsSpecType'
)
->
where
([
'goods_id'
=>
$goods_id
])
->
delete
();
Db
::
name
(
'GoodsSpecValue'
)
->
where
([
'goods_id'
=>
$goods_id
])
->
delete
();
Db
::
name
(
'GoodsSpecValue'
)
->
where
([
'goods_id'
=>
$goods_id
])
->
delete
();
Db
::
name
(
'GoodsSpecBase'
)
->
where
([
'goods_id'
=>
$goods_id
])
->
delete
();
Db
::
name
(
'GoodsSpecBase'
)
->
where
([
'goods_id'
=>
$goods_id
])
->
delete
();
Db
::
name
(
'GoodsSpecImages'
)
->
where
([
'goods_id'
=>
$goods_id
])
->
delete
();
// 类型
// 类型
if
(
!
empty
(
$data
[
'title'
]))
if
(
!
empty
(
$data
[
'title'
]))
{
{
foreach
(
$data
[
'title'
]
as
&
$v
)
foreach
(
$data
[
'title'
]
as
&
$v
)
{
{
$spec
=
[];
foreach
(
$v
[
'value'
]
as
$vs
)
{
$spec
[]
=
[
'name'
=>
$vs
,
'images'
=>
isset
(
$data
[
'images'
][
$vs
])
?
ResourcesService
::
AttachmentPathHandle
(
$data
[
'images'
][
$vs
])
:
''
,
];
}
$v
[
'goods_id'
]
=
$goods_id
;
$v
[
'goods_id'
]
=
$goods_id
;
$v
[
'value'
]
=
json_encode
(
array_values
(
$v
[
'value'
])
);
$v
[
'value'
]
=
json_encode
(
$spec
);
$v
[
'add_time'
]
=
time
();
$v
[
'add_time'
]
=
time
();
}
}
if
(
Db
::
name
(
'GoodsSpecType'
)
->
insertAll
(
$data
[
'title'
])
<
count
(
$data
[
'title'
]))
if
(
Db
::
name
(
'GoodsSpecType'
)
->
insertAll
(
$data
[
'title'
])
<
count
(
$data
[
'title'
]))
...
@@ -1432,25 +1430,6 @@ class GoodsService
...
@@ -1432,25 +1430,6 @@ class GoodsService
}
}
}
}
// 规格图片
if
(
!
empty
(
$data
[
'images'
]))
{
$images
=
[];
foreach
(
$data
[
'images'
]
as
$v
)
{
$images
[]
=
[
'goods_id'
=>
$goods_id
,
'name'
=>
$v
[
'name'
],
'images'
=>
ResourcesService
::
AttachmentPathHandle
(
$v
[
'images'
]),
'add_time'
=>
time
(),
];
}
if
(
Db
::
name
(
'GoodsSpecImages'
)
->
insertAll
(
$images
)
<
count
(
$images
))
{
return
DataReturn
(
'规格图片添加失败'
,
-
1
);
}
}
return
DataReturn
(
'添加成功'
,
0
);
return
DataReturn
(
'添加成功'
,
0
);
}
}
...
@@ -1578,11 +1557,19 @@ class GoodsService
...
@@ -1578,11 +1557,19 @@ class GoodsService
if
(
!
empty
(
$type
))
if
(
!
empty
(
$type
))
{
{
// 数据处理
// 数据处理
foreach
(
$type
as
&
$v
)
$images_host
=
config
(
'images_host'
);
foreach
(
$type
as
&
$temp_type
)
{
{
$v
[
'value'
]
=
json_decode
(
$v
[
'value'
],
true
);
$temp_type_value
=
json_decode
(
$temp_type
[
'value'
],
true
);
foreach
(
$temp_type_value
as
&
$vs
)
{
$vs
[
'images_old'
]
=
$vs
[
'images'
];
$vs
[
'images'
]
=
empty
(
$vs
[
'images'
])
?
''
:
$images_host
.
$vs
[
'images'
];
}
$temp_type
[
'value'
]
=
$temp_type_value
;
}
}
// 获取规格值
// 获取规格值
$temp_value
=
Db
::
name
(
'GoodsSpecValue'
)
->
where
(
$where
)
->
field
(
'goods_spec_base_id,value'
)
->
order
(
'id asc'
)
->
select
();
$temp_value
=
Db
::
name
(
'GoodsSpecValue'
)
->
where
(
$where
)
->
field
(
'goods_spec_base_id,value'
)
->
order
(
'id asc'
)
->
select
();
if
(
!
empty
(
$temp_value
))
if
(
!
empty
(
$temp_value
))
...
@@ -1592,10 +1579,13 @@ class GoodsService
...
@@ -1592,10 +1579,13 @@ class GoodsService
$key
=
''
;
$key
=
''
;
foreach
(
$type
as
$type_v
)
foreach
(
$type
as
$type_v
)
{
{
if
(
in_array
(
$value_v
[
'value'
],
$type_v
[
'value'
])
)
foreach
(
$type_v
[
'value'
]
as
$type_vs
)
{
{
$key
=
$type_v
[
'id'
];
if
(
$type_vs
[
'name'
]
==
$value_v
[
'value'
])
break
;
{
$key
=
$type_v
[
'id'
];
break
;
}
}
}
}
}
$value
[
$value_v
[
'goods_spec_base_id'
]][]
=
[
$value
[
$value_v
[
'goods_spec_base_id'
]][]
=
[
...
@@ -1627,22 +1617,9 @@ class GoodsService
...
@@ -1627,22 +1617,9 @@ class GoodsService
];
];
}
}
// 规格图片
$images
=
Db
::
name
(
'GoodsSpecImages'
)
->
where
(
$where
)
->
select
();
if
(
!
empty
(
$images
))
{
$images_host
=
config
(
'images_host'
);
foreach
(
$images
as
&
$temp_iamges
)
{
$temp_iamges
[
'images_old'
]
=
$temp_iamges
[
'images'
];
$temp_iamges
[
'images'
]
=
$images_host
.
$temp_iamges
[
'images'
];
}
}
return
[
return
[
'type'
=>
$type
,
'type'
=>
$type
,
'value'
=>
array_values
(
$value
),
'value'
=>
array_values
(
$value
),
'images'
=>
$images
,
];
];
}
}
...
...
public/install/shopxo_tp5.sql
100755 → 100644
浏览文件 @
7b54a3c4
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录