本地生活商品上下架和删除移除user_id要相等的条件

This commit is contained in:
wangxiaowei 2024-10-15 11:49:43 +08:00
parent ad5e02e05e
commit 73b4c1d3a9
2 changed files with 6 additions and 7 deletions

@ -76,7 +76,7 @@ class LocalStoreGoods extends Api
public function setState()
{
$form = $this->request->post();
$result = LocalStoreGoodsLogic::setState($form, $this->user_id);
$result = LocalStoreGoodsLogic::setState($form);
if ($result) {
return JsonServer::success('操作成功');
}
@ -86,7 +86,7 @@ class LocalStoreGoods extends Api
public function delGoods()
{
$form = $this->request->post();
$result = LocalStoreGoodsLogic::delGoods($form, $this->user_id);
$result = LocalStoreGoodsLogic::delGoods($form);
if ($result) {
return JsonServer::success('操作成功');
}

@ -274,10 +274,10 @@ class LocalStoreGoodsLogic extends Logic
}
// 设置状态
public static function setState($form, $user_id)
public static function setState($form)
{
if ($form['type'] == LocalStoreGoodsEnum::SHELVES || $form['type'] == LocalStoreGoodsEnum::STATUS_SOLD_OUT) {
$result = LocalStoreGoods::where(['id' => $form['id'], 'user_id' => $user_id, 'lstore_id' => $form['lstore_id']])->update([
$result = LocalStoreGoods::where(['id' => $form['id'], 'lstore_id' => $form['lstore_id']])->update([
'state' => $form['type'],
'update_time' => time()
]);
@ -291,11 +291,10 @@ class LocalStoreGoodsLogic extends Logic
return false;
}
public static function delGoods($form, $user_id)
public static function delGoods($form)
{
$result = LocalStoreGoods::where([
'id' => $form['id'],
'user_id' => $user_id
'id' => $form['id']
])->update(['delete_time' => time()]);
return $result;