|  | @@ -3,15 +3,16 @@
 | 
	
		
			
				|  |  |  namespace app\common\service\order\shippingInfo;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  use app\common\model\OrderGoods as OrderGoodsModel;
 | 
	
		
			
				|  |  | -// use app\common\model\order\Express as OrderExpress;
 | 
	
		
			
				|  |  | +use app\common\model\OrderExpress as OrderExpressModel;
 | 
	
		
			
				|  |  |  use app\common\model\OrderAddress as OrderAddressModel;
 | 
	
		
			
				|  |  | +use app\common\Enum\OrderGoodsEnum;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  class OrderShippingInfo extends Base
 | 
	
		
			
				|  |  |  {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      protected $orderItems = null;
 | 
	
		
			
				|  |  |      
 | 
	
		
			
				|  |  | -    protected $dispatchTypes = [];
 | 
	
		
			
				|  |  | +    protected $deliveryTypes = [];
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
	
		
			
				|  | @@ -26,26 +27,26 @@ class OrderShippingInfo extends Base
 | 
	
		
			
				|  |  |          $this->setSendOrderItems();
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          $uploadParams = [];
 | 
	
		
			
				|  |  | -        if (in_array('express', $this->dispatchTypes)) {
 | 
	
		
			
				|  |  | +        if (in_array('express', $this->deliveryTypes)) {
 | 
	
		
			
				|  |  |              // 有 快递物流 商品
 | 
	
		
			
				|  |  |              $expressUploadParams = $this->getExpressShippingParams();
 | 
	
		
			
				|  |  |              $uploadParams = array_merge($uploadParams, $expressUploadParams);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        if (!$uploadParams && array_intersect(['autosend', 'custom'], $this->dispatchTypes)) {
 | 
	
		
			
				|  |  | +        if (!$uploadParams && array_intersect(['autosend', 'custom'], $this->deliveryTypes)) {
 | 
	
		
			
				|  |  |              // 有 自动发货,或者手动发货 商品
 | 
	
		
			
				|  |  |              $virtualParams = $this->getVirtualShippingParams();
 | 
	
		
			
				|  |  |              $uploadParams[] = $virtualParams;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        if (!$uploadParams && in_array('selfetch', $this->dispatchTypes)) {
 | 
	
		
			
				|  |  | +        if (!$uploadParams && in_array('selfetch', $this->deliveryTypes)) {
 | 
	
		
			
				|  |  |              // 有 到店自提 商品
 | 
	
		
			
				|  |  |              $selfParams = $this->getSelfetchShippingParams();
 | 
	
		
			
				|  |  |              $uploadParams[] = $selfParams;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        if (!$uploadParams && in_array('store_delivery', $this->dispatchTypes)) {
 | 
	
		
			
				|  |  | +        if (!$uploadParams && in_array('store_delivery', $this->deliveryTypes)) {
 | 
	
		
			
				|  |  |              // 有 店铺配送 商品
 | 
	
		
			
				|  |  |              $storeDeliveryParams = $this->getStoreDeliveryShippingParams();
 | 
	
		
			
				|  |  |              $uploadParams[] = $storeDeliveryParams;
 | 
	
	
		
			
				|  | @@ -89,7 +90,7 @@ class OrderShippingInfo extends Base
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      private function getExpressShippingParams()
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  | -        $orderExpresses = collection(OrderExpress::where('order_id', $this->order['id'])->select());
 | 
	
		
			
				|  |  | +        $orderExpresses = collection(OrderExpressModel::where('order_id', $this->order['id'])->select());
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          return $this->getExpressShippingParamsByExpresses($orderExpresses);
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -107,7 +108,7 @@ class OrderShippingInfo extends Base
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          $uploadParams = [];
 | 
	
		
			
				|  |  |          if (!$orderExpresses->isEmpty()) {
 | 
	
		
			
				|  |  | -            $orderAddress = OrderAddress::where('order_id', $this->order['id'])->find();
 | 
	
		
			
				|  |  | +            $orderAddress = OrderAddressModel::where('order_id', $this->order['id'])->find();
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              $receiver_contact = $orderAddress ? mb_substr($orderAddress->mobile, 0, 3) . '****' . mb_substr($orderAddress->mobile, -4) : '130****0000';
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -155,7 +156,7 @@ class OrderShippingInfo extends Base
 | 
	
		
			
				|  |  |      private function getVirtualShippingParams()
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          // 是否存在虚拟发货商品
 | 
	
		
			
				|  |  | -        $virtualItems = $this->getItemsByCondition('dispatch_type', ['autosend', 'custom'], 'in_array');
 | 
	
		
			
				|  |  | +        $virtualItems = $this->getItemsByCondition('_type', ['autosend', 'custom'], 'in_array');
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          if (!$virtualItems->isEmpty()) {
 | 
	
		
			
				|  |  |              $shippingList = [];
 | 
	
	
		
			
				|  | @@ -192,7 +193,7 @@ class OrderShippingInfo extends Base
 | 
	
		
			
				|  |  |      public function getSelfetchShippingParams()
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          // 到店自提商品
 | 
	
		
			
				|  |  | -        $selfetchItems = $this->getItemsByCondition('dispatch_type', ['selfetch'], 'in_array');
 | 
	
		
			
				|  |  | +        $selfetchItems = $this->getItemsByCondition('delivery_type', ['selfetch'], 'in_array');
 | 
	
		
			
				|  |  |          if (!$selfetchItems->isEmpty()) {
 | 
	
		
			
				|  |  |              $shippingList = [];
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -228,7 +229,7 @@ class OrderShippingInfo extends Base
 | 
	
		
			
				|  |  |      public function getStoreDeliveryShippingParams()
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          // 到店自提商品
 | 
	
		
			
				|  |  | -        $storeDeliveryItems = $this->getItemsByCondition('dispatch_type', ['store_delivery'], 'in_array');
 | 
	
		
			
				|  |  | +        $storeDeliveryItems = $this->getItemsByCondition('delivery_type', ['store_delivery'], 'in_array');
 | 
	
		
			
				|  |  |          if (!$storeDeliveryItems->isEmpty()) {
 | 
	
		
			
				|  |  |              $shippingList = [];
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -265,13 +266,16 @@ class OrderShippingInfo extends Base
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          $orderItems = OrderGoodsModel::where('order_id', $this->order['id'])
 | 
	
		
			
				|  |  |              // ->where('refund_status', OrderItem::REFUND_STATUS_NOREFUND)
 | 
	
		
			
				|  |  | -            ->whereIn('dispatch_status', 
 | 
	
		
			
				|  |  | -            [OrderGoodsModel::DISPATCH_STATUS_SENDED, OrderGoodsModel::DISPATCH_STATUS_GETED])
 | 
	
		
			
				|  |  | +            ->whereIn('delivery_status', 
 | 
	
		
			
				|  |  | +            [
 | 
	
		
			
				|  |  | +                OrderGoodsEnum::DELIVERY_STATUS_SENDED,
 | 
	
		
			
				|  |  | +                OrderGoodsEnum::DELIVERY_STATUS_GETED
 | 
	
		
			
				|  |  | +                ])
 | 
	
		
			
				|  |  |              ->select();
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          $this->orderItems = $orderItems instanceof \think\Collection ? $orderItems : collection($orderItems);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        $this->dispatchTypes = array_values(array_unique(array_filter($this->orderItems->column('dispatch_type'))));
 | 
	
		
			
				|  |  | +        $this->deliveryTypes = array_values(array_unique(array_filter($this->orderItems->column('delivery_type'))));
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 |