xieruidong 2 years ago
parent
commit
6e0e635bd7
1 changed files with 7 additions and 8 deletions
  1. 7 8
      application/common/model/Refund.php

+ 7 - 8
application/common/model/Refund.php

@@ -40,6 +40,7 @@ use Yansongda\Supports\Arr;
  * @property string fix_order_no
  * @property string refund_type_text
  * @property string refund_by_text
+ * @property string label
  * @property float amount_last
  * @method static static|Query FilterRefund($status=null)
  * @method static static|Query FilterTs()
@@ -340,11 +341,12 @@ class Refund Extends Model
         }*/
     }
     #用户寄回
-    public function makeUserBackGoods(LogisticsCompany $company,$trans_no){
+    public function makeUserBackGoods(LogisticsCompany $company,$trans_no,$label=null){
         $this->refund_status=static::REFUND_JI;
         $this->user_trans_com_id=$company->id;
         $this->user_trans_no=$trans_no;
         $this->user_send_time=time();
+        $this->label=$label;
         $this->save();
     }
     public function makeComplete(){
@@ -354,8 +356,9 @@ class Refund Extends Model
         return $refund->save();
     }
     public function makeLabelOrder(){
+        $com=LogisticsCompany::where('name','跨越速运')->find();
         list($res,$data)=logistics()
-            ->setLogistics($com=LogisticsCompany::where('name','跨越速运')->find())
+            ->setLogistics($com)
             ->setUserName($this->orders->logistics->from_username)
             ->setPhone($this->orders->logistics->from_mobile)
             ->setToArea($this->orders->logistics->fullArea())
@@ -369,10 +372,6 @@ class Refund Extends Model
         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=session_create_id().'.png';
@@ -381,9 +380,9 @@ class Refund Extends Model
             @mkdir($dir,0755,true);
         }
         file_put_contents($saveName,file_get_contents($data['label']));
-        $this->label=request()->domain().$pubname.'/'.$filename;
+        $label=request()->domain().$pubname.'/'.$filename;
 
-        $this->save();
+        $this->makeUserBackGoods($com,$data['kuaidinum'],$label);
     }
 
     /**