Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
纵之格
ShopXO
提交
afe6d300
ShopXO
项目概览
纵之格
/
ShopXO
通知
394
Star
16
Fork
11
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ShopXO
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
afe6d300
编写于
4月 05, 2022
作者:
G
gongfuxiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
购物车列表数据处理分离+css细节优化
上级
982f59d2
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
23 addition
and
4 deletion
+23
-4
app/service/BuyService.php
app/service/BuyService.php
+22
-3
public/static/admin/default/css/common.css
public/static/admin/default/css/common.css
+1
-1
未找到文件。
app/service/BuyService.php
浏览文件 @
afe6d300
...
...
@@ -229,6 +229,7 @@ class BuyService
return
DataReturn
(
$ret
,
-
1
);
}
// 获取购物车数据
$where
=
(
!
empty
(
$params
[
'where'
])
&&
is_array
(
$params
[
'where'
]))
?
$params
[
'where'
]
:
[];
$where
[
'c.user_id'
]
=
$params
[
'user'
][
'id'
];
...
...
@@ -236,6 +237,22 @@ class BuyService
$data
=
Db
::
name
(
'Cart'
)
->
alias
(
'c'
)
->
leftJoin
(
'goods g'
,
'g.id=c.goods_id'
)
->
where
(
$where
)
->
field
(
$field
)
->
order
(
'c.id desc'
)
->
select
()
->
toArray
();
// 数据处理
$data
=
self
::
CartListDataHandle
(
$data
,
$params
);
return
DataReturn
(
'操作成功'
,
0
,
$data
);
}
/**
* 购物车列表数据处理
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2022-04-05
* @desc description
* @param [array] $data [购物车数据]
* @param [array] $params [输入参数]
*/
public
static
function
CartListDataHandle
(
$data
,
$params
=
[])
{
if
(
!
empty
(
$data
))
{
foreach
(
$data
as
&
$v
)
...
...
@@ -316,8 +333,7 @@ class BuyService
}
}
}
return
DataReturn
(
'操作成功'
,
0
,
$data
);
return
$data
;
}
/**
...
...
@@ -538,7 +554,7 @@ class BuyService
'is_delete_time'
=>
0
,
'is_shelves'
=>
1
,
],
'field'
=>
'id
, id
AS goods_id, title, images, inventory_unit, buy_min_number, buy_max_number, model'
,
'field'
=>
'id AS goods_id, title, images, inventory_unit, buy_min_number, buy_max_number, model'
,
]);
$ret
=
GoodsService
::
GoodsList
(
$goods_params
);
if
(
empty
(
$ret
[
'data'
][
0
]))
...
...
@@ -550,6 +566,9 @@ class BuyService
// 规格
$goods
[
'spec'
]
=
self
::
GoodsSpecificationsHandle
(
$params
);
// id处理、避免不同规格导致id一样
$goods
[
'id'
]
=
md5
(
$goods
[
'goods_id'
]
.
(
empty
(
$goods
[
'spec'
])
?
'default'
:
implode
(
''
,
array_column
(
$goods
[
'spec'
],
'value'
))));
// 获取商品基础信息
$spec_params
=
array_merge
(
$params
,
[
'id'
=>
$goods
[
'goods_id'
],
...
...
public/static/admin/default/css/common.css
浏览文件 @
afe6d300
...
...
@@ -449,7 +449,7 @@ ul {margin-top:0;}
*/
.am-container
{
padding-left
:
0px
;
padding-right
:
0px
;}
@media
only
screen
and
(
min-width
:
641px
)
{
.submit
{
display
:
none
;
}
#tree
tr
.submit
{
display
:
none
;
}
#tree
tr
:hover
.submit
{
display
:
block
!important
;
}
}
@media
only
screen
and
(
min-width
:
1025px
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录