删除锁定库存,新增同步处方平台kucun

This commit is contained in:
2023-03-15 19:16:41 +08:00
parent f2450cbcd5
commit d19a1271d3
8 changed files with 164 additions and 52 deletions
+1 -19
View File
@@ -305,7 +305,7 @@ class CallBackController extends AbstractController
$server = $app->getServer();
$message = $server->getRequestMessage();
dump($message);
if (empty($message)){
return $this->response->withStatus(500)->withBody(new SwooleStream(strval(json_encode(['code' => 'ERROR', 'message' => "药品微信支付回调数据为空"], JSON_UNESCAPED_UNICODE))));
}
@@ -391,24 +391,6 @@ class CallBackController extends AbstractController
return $server->serve();
}
// 修改库存,去除锁定
foreach ($order_product_item as $item){
// 释放锁定库存
$params = array();
$params['product_id'] = $item['product_id'];
$product = Product::getWithAmountOne($params);
if (empty($product)){
Db::rollBack();
Log::getInstance()->info("药品微信支付回调数据处理失败,未查询到对应订单商品订单列表");
return $server->serve();
}
// 锁定库存-订单商品数量 = 实际锁定库存数量
$params = array();
$params['amount_id'] = $product['ProductPlatformAmount']['amount_id'];
ProductPlatformAmount::dec($params, 'lock_stock', (float)$item['amount']);
}
Db::commit();
} catch (\Exception $e) {
Db::rollBack();