切换导航条
此项目
正在载入...
登录
何书鹏
/
anttest
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
macbook
4 years ago
提交
6dadc8d36e228f3e83fe1f03e62d528c716048ce
1 个父辈
4e4f21f2
禁止删除海报商品
隐藏空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
51 行增加
和
5 行删除
application/admin/controller/shopro/goods/Goods.php
application/admin/controller/shopro/goods/Goods.php
查看文件 @
6dadc8d
...
...
@@ -118,7 +118,7 @@ class Goods extends Backend
}
else
{
$params
[
'price'
]
=
0
;
}
if
(
$this
->
dataLimit
&&
$this
->
dataLimitFieldAutoFill
)
{
$params
[
$this
->
dataLimitField
]
=
$this
->
auth
->
id
;
}
...
...
@@ -183,7 +183,7 @@ class Goods extends Backend
}
}
$result
[
'skuList'
]
=
$skuList
;
$skuPrice
=
\app\admin\model\shopro\goods\SkuPrice
::
all
([
'goods_id'
=>
$ids
]);
$result
[
'skuPrice'
]
=
$skuPrice
;
}
else
{
...
...
@@ -202,7 +202,7 @@ class Goods extends Backend
return
$this
->
success
(
'获取成功'
,
null
,
$result
);
}
/**
* 编辑
...
...
@@ -280,6 +280,52 @@ class Goods extends Backend
return
$this
->
view
->
fetch
();
}
/**
* 删除
*/
public
function
del
(
$ids
=
""
)
{
if
(
!
$this
->
request
->
isPost
())
{
$this
->
error
(
__
(
"Invalid parameters"
));
}
$ids
=
$ids
?
$ids
:
$this
->
request
->
post
(
"ids"
);
if
(
$ids
)
{
$pk
=
$this
->
model
->
getPk
();
$adminIds
=
$this
->
getDataLimitAdminIds
();
if
(
is_array
(
$adminIds
))
{
$this
->
model
->
where
(
$this
->
dataLimitField
,
'in'
,
$adminIds
);
}
$id_arr
=
explode
(
','
,
$ids
);
if
(
in_array
(
1
,
$id_arr
)){
$this
->
error
(
'禁止删除海报商品'
);
}
$list
=
$this
->
model
->
where
(
$pk
,
'in'
,
$ids
)
->
select
();
$count
=
0
;
Db
::
startTrans
();
try
{
foreach
(
$list
as
$k
=>
$v
)
{
$count
+=
$v
->
delete
();
}
Db
::
commit
();
}
catch
(
PDOException
$e
)
{
Db
::
rollback
();
$this
->
error
(
$e
->
getMessage
());
}
catch
(
Exception
$e
)
{
Db
::
rollback
();
$this
->
error
(
$e
->
getMessage
());
}
if
(
$count
)
{
$this
->
success
();
}
else
{
$this
->
error
(
__
(
'No rows were deleted'
));
}
}
$this
->
error
(
__
(
'Parameter %s can not be empty'
,
'ids'
));
}
public
function
select
()
{
if
(
$this
->
request
->
isAjax
())
{
...
...
@@ -523,7 +569,7 @@ class Goods extends Backend
'goods_id'
=>
$goods
->
id
]);
}
$allChildrenSku
[
$k2
[
'temp_id'
]]
=
$skuChildrenId
[
$s1
][
$s2
];
$k2
[
'id'
]
=
$skuChildrenId
[
$s1
][
$s2
];
$k2
[
'pid'
]
=
$k1
[
'id'
];
...
...
@@ -613,7 +659,7 @@ class Goods extends Backend
// 查询分类所有子分类,包括自己
$category_ids
=
\addons\shopro\model\Category
::
getCategoryIds
(
$category_id
);
$goods
=
$goods
->
where
(
function
(
$query
)
use
(
$category_ids
)
{
// 所有子分类使用 find_in_set or 匹配,亲测速度并不慢
foreach
(
$category_ids
as
$key
=>
$category_id
)
{
...
...
请
注册
或
登录
后发表评论