修正医生体现数据

This commit is contained in:
2024-04-23 11:45:21 +08:00
parent c499184ebe
commit 2d0305ea2f
8 changed files with 657 additions and 279 deletions
+48
View File
@@ -4,6 +4,7 @@ declare(strict_types=1);
namespace App\Command;
use App\Model\DoctorWithdrawalOrder;
use App\Model\Order;
use App\Model\OrderCoupon;
use App\Model\OrderDetection;
@@ -64,6 +65,9 @@ class MoveOrderCommand extends HyperfCommand
// 处理检测订单退款
// $this->handleOrderDetectionRefund();
// 修正医生提现关联订单表数据
// $this->handleDoctorWithdrawalOrder();
}
/**
@@ -120,6 +124,9 @@ class MoveOrderCommand extends HyperfCommand
if (!empty($order_inquiry['cancel_reason'])){
$data['cancel_remarks'] = inquiryCancelReasonToString($order_inquiry['cancel_reason']);
}
$data['is_withdrawal'] = $order_inquiry['is_withdrawal'];
$data['withdrawal_time'] = $order_inquiry['withdrawal_time'];
$order = Order::addOrder($data);
if (empty($order)) {
Db::rollBack();
@@ -314,6 +321,7 @@ class MoveOrderCommand extends HyperfCommand
}
$data['cancel_time'] = $order_product['cancel_time'];
$data['cancel_remarks'] = $order_product['cancel_remarks'];
$data['is_withdrawal'] = 3;
$order = Order::addOrder($data);
if (empty($order)) {
Db::rollBack();
@@ -502,6 +510,8 @@ class MoveOrderCommand extends HyperfCommand
$data['cancel_remarks'] = detectionCancelReasonToString($order_detection['cancel_reason']);
}
$data['is_withdrawal'] = 3;
$order = Order::addOrder($data);
if (empty($order)) {
Db::rollBack();
@@ -583,4 +593,42 @@ class MoveOrderCommand extends HyperfCommand
}
}
/**
* 修正医生提现关联订单表数据
* @return void
*/
public function handleDoctorWithdrawalOrder(): void
{
$params = array();
$doctor_withdrawal_orders = DoctorWithdrawalOrder::getList($params);
if (empty($doctor_withdrawal_orders)){
$this->line("无检测退款订单需要执行");
return;
}
foreach ($doctor_withdrawal_orders as $doctor_withdrawal_order){
$params = array();
$params['order_inquiry_id'] = $doctor_withdrawal_order['order_inquiry_id'];
$order_inquiry = OrderInquiry::getOne($params);
if (empty($order_inquiry)){
$this->line("无对应订单数据");
continue;
}
Db::beginTransaction();
try {
$params = array();
$params['withdrawal_order_id'] = $doctor_withdrawal_order['withdrawal_order_id'];
$data = array();
$data['order_id'] = $order_inquiry['order_id'];
DoctorWithdrawalOrder::edit($params,$data);
Db::commit();
}catch (\Throwable $e){
Db::rollBack();
$this->line($e->getMessage());
}
}
}
}