商品显示状态更新添加事务
This commit is contained in:
parent
ca94036d36
commit
31d861c725
@ -1556,8 +1556,16 @@ class ProductRepository extends BaseRepository
|
|||||||
throw new ValidateException('商品正在参与预售活动');
|
throw new ValidateException('商品正在参与预售活动');
|
||||||
if ($status == 1 && $product['product_type'] == 3)
|
if ($status == 1 && $product['product_type'] == 3)
|
||||||
throw new ValidateException('商品正在参与助力活动');
|
throw new ValidateException('商品正在参与助力活动');
|
||||||
$this->dao->update($id,[$field => $status]);
|
Db::startTrans();
|
||||||
app()->make(SpuRepository::class)->changeStatus($id,$product->product_type);
|
if ($this->dao->update($id, [$field => $status]) === false) {
|
||||||
|
Db::rollback();
|
||||||
|
throw new ValidateException('商品更新出错');
|
||||||
|
}
|
||||||
|
if (app()->make(SpuRepository::class)->changeStatus($id, $product->product_type) === false) {
|
||||||
|
Db::rollback();
|
||||||
|
throw new ValidateException('商品spu更新出错');
|
||||||
|
}
|
||||||
|
Db::commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function batchSwitchShow($id, $status, $field, $merId = 0)
|
public function batchSwitchShow($id, $status, $field, $merId = 0)
|
||||||
|
@ -318,8 +318,10 @@ class SpuRepository extends BaseRepository
|
|||||||
Queue(SendSmsJob::class, ['tempId' => 'PRODUCT_INCREASE', 'id' => $id]);
|
Queue(SendSmsJob::class, ['tempId' => 'PRODUCT_INCREASE', 'id' => $id]);
|
||||||
}
|
}
|
||||||
if (in_array($productType, [0, 98])) Queue::push(SyncProductTopJob::class,[]);
|
if (in_array($productType, [0, 98])) Queue::push(SyncProductTopJob::class,[]);
|
||||||
|
return true;
|
||||||
} catch (\Exception $exception) {
|
} catch (\Exception $exception) {
|
||||||
Log::info($exception->getMessage());
|
Log::info($exception->getMessage());
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user