|
|
@@ -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;
|
|
|
+ }
|
|
|
}
|