Sfoglia il codice sorgente

1.fix bug: CancelOrderForm.php 2.蜂鸟订单回调

shizhongqi 8 mesi fa
parent
commit
9b8788e326

+ 4 - 0
app-ghs/models/delivery/CancelOrderForm.php

@@ -15,6 +15,7 @@ class CancelOrderForm extends BaseForm
     public $orderId;           // 第三方平台订单ID (可选)
     public $platform;          // 配送平台 (可选)
     public $order_cancel_code; // 订单取消原因代码 (用于蜂鸟平台)
+    public $order_cancel_reason; // 订单取消原因(20字以内)
 
     public function rules()
     {
@@ -25,6 +26,8 @@ class CancelOrderForm extends BaseForm
             ['orderId', 'string'],
             ['platform', 'string'],
             ['order_cancel_code', 'string'],
+            ['order_cancel_reason', 'required'],
+            ['order_cancel_reason', 'string', 'max' => 20],
         ];
     }
 
@@ -35,6 +38,7 @@ class CancelOrderForm extends BaseForm
             'orderId' => '平台订单ID',
             'platform' => '配送平台',
             'order_cancel_code' => '取消原因代码',
+            'order_cancel_reason' => '取消原因',
         ];
     }
 

+ 56 - 2
common/components/delivery/platform/fengniao/CallBackNotify.php

@@ -2,6 +2,7 @@
 namespace common\components\delivery\platform\fengniao;
 
 use bizGhs\express\classes\GhsDeliveryOrderClass;
+use bizGhs\order\classes\OrderClass;
 
 //回调业务类型
 const TYPE_ORDER_STATUS_NOTIFY = 'orderStatusNotify'; //订单状态回调
@@ -26,31 +27,84 @@ class CallBackNotify
                 return self::handleAbnormalReportNotify($data);
             case TYPE_COOKING_FINISH_NOTIFY:
                 return self::handleCookingFinishNotify($data);
+            case TYPE_CHAINSTORE_STATUS_NOTIFY:
+                return self::handleChainstoreStatusNotify($data);
+            case TYPE_CHAINSTORE_SERVICE_STATUS_NOTIFY:
+                return self::handleChainstoreServiceStatusNotify($data);
+            case TYPE_CHAINSTORE_BUSINESS_TIME_NOTIFY:
+                return self::handleChainstoreBusinessTimeNotify($data);
+            default:
+                throw new \Exception('不支持的回调业务类型: ' . $type);
         }
     }
 
+    /**
+     * 处理订单状态回调
+     * @param array $data 回调数据
+     * @return bool 处理结果
+     */
     private function handleOrderStatusNotify($data)
     {
-        $order = GhsDeliveryOrderClass::getByCondition(['deliveryId'=>'fengniao', 'orderId'=>$data['order_id']], true);
+        $deliveryOrder = GhsDeliveryOrderClass::getByCondition(['deliveryId'=>'fengniao', 'orderId'=>$data['order_id']], true);
         // 将蜂鸟平台的订单状态转换为系统内的 orderStatus
-        $order->orderStatus = OrderStatusUtil::convertOrderStatus($data['order_status']);
+        $sendStatus = OrderStatusUtil::convertOrderStatus($data['order_status']);
+        $deliveryOrder->orderStatus = $sendStatus;
+        $deliveryOrder->save();
+
+        $order = OrderClass::getById($deliveryOrder->ghsOrderId, true, 'sendType,sendStatus,deliveryId');
+        $order->sendStatus = $sendStatus;
         $order->save();
 
         return true;
     }
 
+    /**
+     * 处理异常报备回调
+     * @param array $data 回调数据
+     * @return bool 处理结果
+     */
     private function handleAbnormalReportNotify($data)
     {
         return $data;
     }
 
+    /**
+     * 处理商户出餐回调
+     * @param array $data 回调数据
+     * @return bool 处理结果
+     */
     private function handleCookingFinishNotify($data)
     {
         return $data;
     }
 
+    /**
+     * 处理门店状态变更回调
+     * @param array $data 回调数据
+     * @return bool 处理结果
+     */
     private function handleChainstoreStatusNotify($data)
     {
         return $data;
     }
+
+    /**
+     * 处理门店采购服务变更回调
+     * @param array $data 回调数据
+     * @return bool 处理结果
+     */
+    private function handleChainstoreServiceStatusNotify($data)
+    {
+        return $data;
+    }
+    
+    /**
+     * 处理门店营业时间变更回调
+     * @param array $data 回调数据
+     * @return bool 处理结果
+     */
+    private function handleChainstoreBusinessTimeNotify($data)
+    {
+        return $data;
+    }
 }