xieruidong 2 роки тому
батько
коміт
b270387d18

+ 12 - 6
application/api/controller/UserTax.php

@@ -16,13 +16,19 @@ class UserTax extends Api
      * @ApiParams (name=limit,dexcription=分页)
      */
     public function list(){
-        /*$user=$this->auth->getUser();
+        $user=$this->auth->getUser();
         $tax=$user->tax()
+            ->with(['orders'])
             ->order('id','desc')
-            ->paginate(input('limit',15));*/
-        $tax=new Orders;
-        $tax->taxApi=true;
-        $tax->users();
-        //$this->success('',$tax);
+            ->paginate(input('limit',15));
+
+        $newList=[];
+        foreach ($tax->items() as $item){
+            $order=[
+                'order_no'=>$item['orders']['order_no']??'',
+                'create_time'=>$item['orders']['create_time']??'',
+            ];
+        }
+        $this->success('',$tax);
     }
 }

+ 6 - 0
application/common/model/UserTax.php

@@ -7,6 +7,8 @@ use think\Model;
 
 class UserTax extends Model
 {
+    protected $autoWriteTimestamp=true;
+    protected $updateTime=null;
     protected $type=[
         'tax'=>'json',
     ];
@@ -23,4 +25,8 @@ class UserTax extends Model
             }
         }
     }
+
+    public function orders(){
+        return $this->belongsTo(Orders::class,'order_id');
+    }
 }