| xqd
@@ -168,7 +168,7 @@ class Order extends BaseModel
|
|
|
//如果是疫苗就减少疫苗库存
|
|
|
if ($order['product_type'] == 4) {
|
|
|
$orderVaccine = OrderVaccine::where('order_id', $order_id)->first();
|
|
|
- OrganizationVaccine::where('org_id', $order['organization_id'])->where('vaccine_id', $orderVaccine['vaccine_id'])->decrement('stock');
|
|
|
+ Vaccine::where('id', $orderVaccine['vaccine_id'])->decrement('stock');
|
|
|
}
|
|
|
|
|
|
//给用户发送微信消息
|
| xqd
@@ -303,7 +303,7 @@ class Order extends BaseModel
|
|
|
//如果是疫苗预约那么取消订单就增加疫苗库存
|
|
|
if ($order['product_type'] == 4) {
|
|
|
$orderVaccine = OrderVaccine::where('order_id', $order_id)->first();
|
|
|
- OrganizationVaccine::where('org_id', $order['organization_id'])->where('vaccine_id', $orderVaccine['vaccine_id'])->increment('stock');
|
|
|
+ Vaccine::where('id', $orderVaccine['vaccine_id'])->increment('stock');
|
|
|
}
|
|
|
|
|
|
return true;
|
| xqd
@@ -376,7 +376,7 @@ class Order extends BaseModel
|
|
|
|
|
|
//疫苗预约检查库存是否足够
|
|
|
if ($product_type == 4) {
|
|
|
- $stock = OrganizationVaccine::where('org_id', $order['organization_id'])->where('vaccine_id', $order['order_vaccine']['vaccine_id'])->value('stock');
|
|
|
+ $stock = Vaccine::where('id', $order['order_vaccine']['vaccine_id'])->value('stock');
|
|
|
if ($stock <= 0) {
|
|
|
exit_out(null, 10009, '该疫苗库存不足');
|
|
|
}
|