From ad389c4fca96b98206d362bf27193b252c90d871 Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Tue, 30 Apr 2024 11:47:34 +0800 Subject: [PATCH] 1 --- .../getPrescriptionOrderStatusCommand.php | 36 +++++++------------ 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/app/Command/getPrescriptionOrderStatusCommand.php b/app/Command/getPrescriptionOrderStatusCommand.php index 97e6014..04e12b8 100644 --- a/app/Command/getPrescriptionOrderStatusCommand.php +++ b/app/Command/getPrescriptionOrderStatusCommand.php @@ -45,20 +45,20 @@ class getPrescriptionOrderStatusCommand extends HyperfCommand try { // 获取可查询商品订单 - $order_product_ids = $this->getSearchableProductOrder(); - if (empty($order_product_ids)){ + $order_products = $this->getSearchableProductOrder(); + if (empty($order_products)){ $this->line("结束:无可执行的商品订单"); return; } - foreach ($order_product_ids as $item) { + foreach ($order_products as $order_product) { Db::beginTransaction(); - $this->line("本次请求订单号:" . $item['order_product_id']); + $this->line("本次请求订单号:" . $order_product['order_product_id']); // 获取药品订单处方数据 $params = array(); - $params['order_prescription_id'] = $item['order_prescription_id']; + $params['order_prescription_id'] = $order_product['order_prescription_id']; $order_prescription = OrderPrescription::getOne($params); if (empty($order_prescription)){ Db::rollBack(); @@ -68,7 +68,7 @@ class getPrescriptionOrderStatusCommand extends HyperfCommand try { $Prescription = new Prescription(); - $result = $Prescription->getPrescription($item['order_product_no'],$order_prescription['prescription_code']); + $result = $Prescription->getPrescription($order_product['order_product_no'],$order_prescription['prescription_code']); $this->line("处方平台数据:" . json_encode($result,JSON_UNESCAPED_UNICODE)); @@ -88,7 +88,7 @@ class getPrescriptionOrderStatusCommand extends HyperfCommand if ($result['status'] == "CFD03" || $result['status'] == "CFD04" || $result['status'] == "CFD06" || $result['status'] == "CFD07"){ // 药师审核未通过/库存不足/已取消/申请退款 // 检测药品订单数据 - $res = $this->checkPreFailedOrderStatus($item); + $res = $this->checkPreFailedOrderStatus($order_product); if (!$res){ Db::rollBack(); continue; @@ -96,22 +96,22 @@ class getPrescriptionOrderStatusCommand extends HyperfCommand // 修改失败时药品订单数据 if ($result['status'] == "CFD03"){ - $this->savePreFailedOrderStatus($item,"复核失败"); + $this->savePreFailedOrderStatus($order_product,"复核失败"); }elseif($result['status'] == "CFD04"){ - $this->savePreFailedOrderStatus($item,"库存不足"); + $this->savePreFailedOrderStatus($order_product,"库存不足"); }else{ - $this->savePreFailedOrderStatus($item,"订单取消"); + $this->savePreFailedOrderStatus($order_product,"订单取消"); } // 执行退款 $OrderService = new OrderService(); - $OrderService->orderRefund($item['order_product_no'],"订单退款"); + $OrderService->orderRefund($order_product['order_product_no'],"订单退款"); } if ($result['status'] == "CFD05"){ // 已发货/已取货 // 检测成功时药品订单数据 - $res = $this->checkPreSuccessOrderStatus($item); + $res = $this->checkPreSuccessOrderStatus($order_product); if (!$res){ Db::rollBack(); continue; @@ -198,17 +198,7 @@ class getPrescriptionOrderStatusCommand extends HyperfCommand $order_product_status = [2,3];// 订单状态(1:待支付 2:待发货 3:已发货 4:已签收 5:已取消) - $fields = [ - 'order_product_id', - 'order_product_no', - 'order_prescription_id', - 'patient_id', - 'order_product_status', - 'consignee_tel', - 'logistics_no', - ]; - - $order_product = OrderProduct::getStatusList($params,$order_product_status,$fields); + $order_product = OrderProduct::getStatusList($params,$order_product_status); if (empty($order_product)){ return []; }