切换导航条
此项目
正在载入...
登录
何书鹏
/
anttest
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
macbook
4 years ago
提交
e9f305a23494e7da87a64c0e8fd626749b98b085
1 个父辈
42ae9e09
取消海报商品
隐藏空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
9 行增加
和
9 行删除
addons/shopro/model/Goods.php
addons/shopro/model/Goods.php
查看文件 @
e9f305a
...
...
@@ -45,7 +45,7 @@ class Goods extends Model
extract
(
$params
);
$where
=
[
'status'
=>
'up'
,
'id'
=>
[
'>'
,
1
],
//现把ID为1的商品固定作为海报商品
//
'id' => ['>',1], //现把ID为1的商品固定作为海报商品
];
//排序字段
if
(
isset
(
$order
)
&&
$order
!==
''
)
{
...
...
@@ -116,7 +116,7 @@ class Goods extends Model
// 存在缓存直接 返回
$goodsCache
=
json_decode
(
$goodsCache
,
true
);
return
$goodsCache
?
:
[];
}
}
if
(
$is_page
)
{
$goods
=
$goods
->
paginate
(
$per_page
??
10
);
...
...
@@ -129,7 +129,7 @@ class Goods extends Model
if
(
$goodsData
)
{
$collection
=
collection
(
$goodsData
);
$data
=
$collection
->
hidden
(
self
::
$list_hidden
);
// 处理活动
// load_relation($data, 'skuPrice'); // 只针对数组
$data
->
load
(
'skuPrice'
);
// 延迟预加载
...
...
@@ -146,7 +146,7 @@ class Goods extends Model
$goods
->
data
=
$data
;
}
else
{
$goods
=
$data
;
// 目前只缓存不分页的请求
cache
(
$cacheKey
,
json_encode
(
$goods
),
(
600
+
mt_rand
(
0
,
300
)));
}
...
...
@@ -366,12 +366,12 @@ class Goods extends Model
if
(
!
$detail
||
$detail
->
status
===
'down'
)
{
throw
new
Exception
(
'商品不存在或已下架'
);
}
$detail
=
$detail
->
append
([
'service'
,
'sku'
,
'coupons'
]);
// 处理活动规格
$detail
=
self
::
operActivitySkuPrice
(
$detail
,
$detail
->
sku_price
);
return
$detail
;
}
...
...
@@ -431,7 +431,7 @@ class Goods extends Model
$sku_price
=
$new_sku_price
;
$member_price
=
array_column
(
$sku_price
,
'member_price'
);
$detail
[
'member_price'
]
=
$member_price
?
min
(
$member_price
)
:
0
;
if
(
!
empty
(
$activity
))
{
switch
(
$activity
[
'type'
])
{
case
'seckill'
:
...
...
@@ -527,7 +527,7 @@ class Goods extends Model
$grouponPrices
=
array_column
(
$sku_price
,
'groupon_price'
);
$detail
[
'groupon_price'
]
=
$grouponPrices
?
min
(
$grouponPrices
)
:
0
;
}
$detail
[
'sales'
]
=
array_sum
(
array_column
(
$sku_price
,
'sales'
));
}
else
{
// 正常商品加上显示销量
...
...
@@ -537,7 +537,7 @@ class Goods extends Model
$detail
[
'sku_price'
]
=
array_values
(
$sku_price
);
$detail
[
'stock'
]
=
array_sum
(
array_column
(
$sku_price
,
'stock'
));
...
...
请
注册
或
登录
后发表评论