xieruidong 2 年之前
父节点
当前提交
7c52c57d7b
共有 2 个文件被更改,包括 23 次插入6 次删除
  1. 22 5
      application/common/model/Refund.php
  2. 1 1
      extend/logistics/Kd100.php

+ 22 - 5
application/common/model/Refund.php

@@ -341,7 +341,8 @@ class Refund Extends Model
             if($this->refund_type==self::REFUND_TYPE_MONEY){
                 $this->payToUser();
                 $this->orders->makeCancel();
-            }elseif($this->refund_by==self::TH_TYPE_SENDER){
+            }
+            if($this->refund_by==self::TH_TYPE_SENDER){
                 $this->makeLabelOrder();
             }
         }
@@ -370,8 +371,8 @@ class Refund Extends Model
         return $refund->save();
     }
     public function makeLabelOrder(){
-        $res=logistics()
-            ->setLogistics(LogisticsCompany::where('name','跨越速运')->find())
+        list($res,$data)=logistics()
+            ->setLogistics($com=LogisticsCompany::where('name','宅急送')->find())
             ->setUserName($this->orders->logistics->from_username)
             ->setPhone($this->orders->logistics->from_mobile)
             ->setToArea($this->orders->logistics->fullArea())
@@ -382,7 +383,23 @@ class Refund Extends Model
             ->setCount($this->num)
             ->setOrderNo($this->orders->order_no)
             ->labelOrder();
-        dd($res);
+        if(!$res){
+            throw_user($data);
+        }
+        $this->user_trans_no=$data['kuaidinum'];
+        $this->user_send_time=time();
+        $this->user_trans_com_id=$com['id'];
+
+        $pubname='/uploads/md/'.$this['id'];
+        $dir=ROOT_PATH.'public'.$pubname;
+        $filename=$dir.'/'.session_create_id().'.png';
+        if(!is_dir($dir)){
+            @mkdir($dir,0755,true);
+        }
+        file_put_contents($filename,file_get_contents($data['label']));
+        $this->label=request()->domain().$pubname;
+
+        $this->save();
     }
 
     /**
@@ -495,7 +512,7 @@ class Refund Extends Model
     }
     #是否可以已收货
     public function getNeedRecAttr($_,$model){
-        return $this->self_back_goods && $this->user_send_time;
+        return $this->user_send_time;
     }
     #是否可以退款
     public function getNeedTkAttr($_,$model){

+ 1 - 1
extend/logistics/Kd100.php

@@ -127,11 +127,11 @@ class Kd100 extends QueryInterface{
                 'name'=>$this->getFromUsername(),
                 'mobile'=>$this->getFromMobile(),
                 'printAddr'=>$this->getFromArea(),
-                'cargo'=>$this->getCargo(),
                 'count'=>$this->getCount(),
             ],
             'tempId'=>config('site.kd100_lo_tempId')?:'3f733ac0e8ca4ebfaadfc2d9b9ca2519',
             'orderId'=>$this->getOrderNo(),
+            'cargo'=>$this->getCargo(),
         ];
         $body=[
             'method'=>'order',