修改上报

This commit is contained in:
wucongxing 2023-04-12 17:04:23 +08:00
parent f571b9d6ed
commit 4e3d6742a4
3 changed files with 32 additions and 31 deletions

View File

@ -114,18 +114,17 @@ class ReportPreProductOrderCommand extends HyperfCommand
// 存储上报成功
$this->savaReportSuccess($item['order_product_id']);
// 清空缓存
$redis->del($redis_key);
$this->line("商品订单上报处方平台成功");
Db::commit();
continue;
} catch (\Exception $e) {
Db::rollBack();
// 记录失败次数
$redis->incr($redis_key);
$this->line("上报失败:失败原因" . $e->getMessage());
continue;
}
// 清空缓存
$redis->del($redis_key);
$this->line("商品订单上报处方平台成功");
}
$this->line("商品订单上报处方平台全部结束");
}

View File

@ -89,7 +89,7 @@ class getPrescriptionOrderStatusCommand extends HyperfCommand
if ($result['status'] == "CFD03" || $result['status'] == "CFD04" || $result['status'] == "CFD06" || $result['status'] == "CFD07"){
// 药师审核未通过/库存不足
// 检测药品订单数据
$res = $this->checkPreFailedOrderStatus($order_prescription);
$res = $this->checkPreFailedOrderStatus($item);
if (!$res){
Db::rollBack();
continue;
@ -97,11 +97,11 @@ class getPrescriptionOrderStatusCommand extends HyperfCommand
// 修改失败时药品订单数据
if ($result['status'] == "CFD03"){
$this->savePreFailedOrderStatus($order_prescription,"复核失败");
$this->savePreFailedOrderStatus($item,"复核失败");
}elseif($result['status'] == "CFD04"){
$this->savePreFailedOrderStatus($order_prescription,"库存不足");
$this->savePreFailedOrderStatus($item,"库存不足");
}else{
$this->savePreFailedOrderStatus($order_prescription,"订单取消");
$this->savePreFailedOrderStatus($item,"订单取消");
}
// 执行退款
@ -115,7 +115,7 @@ class getPrescriptionOrderStatusCommand extends HyperfCommand
if ($result['status'] == "CFD05"){
// 已发货/已取货
// 检测成功时药品订单数据
$res = $this->checkPreSuccessOrderStatus($order_prescription);
$res = $this->checkPreSuccessOrderStatus($item);
if (!$res){
Db::rollBack();
continue;
@ -136,7 +136,7 @@ class getPrescriptionOrderStatusCommand extends HyperfCommand
}
// 修改成功时药品订单数据
$this->savePreSuccessOrderStatus($order_prescription,$result['deliveryId'],$logistics_company_code);
$this->savePreSuccessOrderStatus($item,$result['deliveryId'],$logistics_company_code);
}
$this->line("获取处方平台订单数据结束:处理完毕");
@ -151,6 +151,8 @@ class getPrescriptionOrderStatusCommand extends HyperfCommand
// 检测是否执行了退款
if ($is_refund == 1){
try {
$this->line("发送消息推送");
// 获取患者用户id
$user_id = $this->getPatientUserId($item['patient_id']);
if (!empty($user_id)){
@ -188,6 +190,7 @@ class getPrescriptionOrderStatusCommand extends HyperfCommand
'order_product_no',
'order_prescription_id',
'patient_id',
'order_product_status',
];
$order_product = OrderProduct::getStatusList($params,$order_product_status,$fields);
@ -200,28 +203,28 @@ class getPrescriptionOrderStatusCommand extends HyperfCommand
/**
* 检测失败时药品订单数据
* @param array|object $order_prescription
* @param array|object $order_product
* @return bool
*/
protected function checkPreFailedOrderStatus(array|object $order_prescription): bool
protected function checkPreFailedOrderStatus(array|object $order_product): bool
{
// 订单状态1:待支付 2:待发货 3:已发货 4:已签收 5:已取消)
if ($order_prescription['order_product_status'] == 1){
if ($order_product['order_product_status'] == 1){
$this->line("药品订单未支付,无需处理");
return false;
}
if ($order_prescription['order_product_status'] == 3){
if ($order_product['order_product_status'] == 3){
$this->line("药品订单已发货,无需处理");
return false;
}
if ($order_prescription['order_product_status'] == 4){
if ($order_product['order_product_status'] == 4){
$this->line("药品订单已签收,无需处理");
return false;
}
if ($order_prescription['order_product_status'] == 5){
if ($order_product['order_product_status'] == 5){
$this->line("药品订单已取消,无需处理");
return false;
}
@ -231,23 +234,23 @@ class getPrescriptionOrderStatusCommand extends HyperfCommand
/**
* 检测成功时药品订单数据
* @param array|object $order_prescription
* @param array|object $order_product
* @return bool
*/
protected function checkPreSuccessOrderStatus(array|object $order_prescription): bool
protected function checkPreSuccessOrderStatus(array|object $order_product): bool
{
// 订单状态1:待支付 2:待发货 3:已发货 4:已签收 5:已取消)
if ($order_prescription['order_product_status'] == 1){
if ($order_product['order_product_status'] == 1){
$this->line("药品订单未支付,无需处理");
return false;
}
if ($order_prescription['order_product_status'] == 4){
if ($order_product['order_product_status'] == 4){
$this->line("药品订单已签收,无需处理");
return false;
}
if ($order_prescription['order_product_status'] == 5){
if ($order_product['order_product_status'] == 5){
$this->line("药品订单已取消,无需处理");
return false;
}
@ -258,14 +261,14 @@ class getPrescriptionOrderStatusCommand extends HyperfCommand
/**
* 修改失败时药品订单数据
* @param array|object $order_prescription
* @param array|object $order_product
* @param string $cancel_remarks
*/
protected function savePreFailedOrderStatus(array|object $order_prescription,string $cancel_remarks)
protected function savePreFailedOrderStatus(array|object $order_product,string $cancel_remarks)
{
// 订单状态1:待支付 2:待发货 3:已发货 4:已签收 5:已取消)
$params = array();
$params['order_product_id'] = $order_prescription['order_product_id'];
$params['order_product_id'] = $order_product['order_product_id'];
$data['order_product_status'] = 5;
$data['cancel_reason'] = 2; // 订单取消原因1:主动取消 2:复核失败/库存不足 3:支付超时 4:客服取消)
@ -276,14 +279,14 @@ class getPrescriptionOrderStatusCommand extends HyperfCommand
/**
* 修改成功时药品订单数据
* @param array|object $order_prescription
* @param array|object $order_product
* @param string $logistics_no // 物流编号
* @param string $logistics_company_code // 快递公司编码
*/
protected function savePreSuccessOrderStatus(array|object $order_prescription,string $logistics_no,string $logistics_company_code)
protected function savePreSuccessOrderStatus(array|object $order_product,string $logistics_no,string $logistics_company_code)
{
$params = array();
$params['order_product_id'] = $order_prescription['order_product_id'];
$params['order_product_id'] = $order_product['order_product_id'];
$data['order_product_status'] = 3; // 订单状态1:待支付 2:待发货 3:已发货 4:已签收 5:已取消)
$data['logistics_no'] = $logistics_no; // 物流编号

View File

@ -250,7 +250,6 @@ class OrderProductService extends BaseService
$result = $WechatPay->refund($options);
// 处理订单退款状态
// 订单退款状态0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭)
// 商品订单退款状态0:无退款 1:申请退款 2:退款中 3:退款成功 4:拒绝退款 5:退款关闭 6:退款异常)
$success_time = "";
if ($result['status'] == "SUCCESS") {