Merge branch 'feature/purchase_record' into dev

This commit is contained in:
luofei 2023-07-10 16:45:25 +08:00
commit f44067b12f
2 changed files with 28 additions and 26 deletions

View File

@ -2311,7 +2311,9 @@ class ProductRepository extends BaseRepository
$price = $orderProduct['product_price'] ?? 0; $price = $orderProduct['product_price'] ?? 0;
$supplierMerId = $orderMerId ?? 0; $supplierMerId = $orderMerId ?? 0;
} }
if ($stockIn > 0) { if ($stockIn <= 0) {
throw new \Exception('入库数量不能小于等于0');
}
$attrValue->stock = $attrValue->stock + $stockIn; $attrValue->stock = $attrValue->stock + $stockIn;
$attrValue->save(); $attrValue->save();
$product->stock = $stockIn + $product->stock; $product->stock = $stockIn + $product->stock;
@ -2336,7 +2338,6 @@ class ProductRepository extends BaseRepository
if (isset($orderProduct) && !$orderProduct->save(['is_imported' => 1])) { if (isset($orderProduct) && !$orderProduct->save(['is_imported' => 1])) {
throw new \Exception('订单商品更新出错'); throw new \Exception('订单商品更新出错');
} }
}
Db::commit(); Db::commit();
} catch (\Exception $e) { } catch (\Exception $e) {
Db::rollback(); Db::rollback();

View File

@ -29,7 +29,8 @@ class MerchantUpdateValidate extends Validate
'mer_address|店铺地址' => 'require|max:128', 'mer_address|店铺地址' => 'require|max:128',
'long|店铺经度' => 'max:24', 'long|店铺经度' => 'max:24',
'lat|店铺纬度' => 'max:24', 'lat|店铺纬度' => 'max:24',
'interest_rate|利率' => 'max:0.05', 'interest_rate|利率' => 'min:0.01|max:0.1',
'settle_cycle|结算周期' => 'min:15|max:90',
]; ];
protected function isPhone($val) protected function isPhone($val)