xieruidong 2 年之前
父节点
当前提交
35d9780dd3
共有 2 个文件被更改,包括 23 次插入1 次删除
  1. 12 0
      application/api/controller/UserTax.php
  2. 11 1
      public/api.html

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

@@ -4,6 +4,7 @@ namespace app\api\controller;
 use app\api\controller\mall\Orders;
 use app\common\controller\Api;
 use app\common\validate\TaxValidate;
+use think\db\Query;
 use Yansongda\Supports\Arr;
 
 /**
@@ -15,6 +16,7 @@ class UserTax extends Api
     use TaxValidate;
     /**
      * 发票列表
+     * @ApiParams (name=from,description=1自己创建的2订单生成的)
      * @ApiParams (name=id,description=查看单条传id)
      * @ApiParams (name=page,description=分页)
      * @ApiParams (name=limit,description=分页)
@@ -29,6 +31,15 @@ class UserTax extends Api
         }
         $tax=$user->tax()
             ->where($map)
+            ->where(function (Query $query)use ($data){
+                if(!empty($data['from'])){
+                    if($data['from']==1){
+                        $query->whereNull('order_id');
+                    }elseif ($data['from']==2){
+                        $query->whereNotNull('order_id');
+                    }
+                }
+            })
             ->with(['orders','orders.info'])
             ->order('is_default','desc')
             ->order('id','desc')
@@ -48,6 +59,7 @@ class UserTax extends Api
                 'tax_link'=>$item['orders']['tax_link']??null,
                 'status'=>empty($item['orders']['tax_link'])?1:2,
                 'is_default'=>$item['is_default'],
+                'order_id'=>$item['order_id'],
             ];
             $newList['data'][]=$order;
         }

+ 11 - 1
public/api.html

@@ -2188,6 +2188,12 @@
                                                 </thead>
                                                 <tbody>
                                                                                                         <tr>
+                                                        <td>from</td>
+                                                        <td>string</td>
+                                                        <td>是</td>
+                                                        <td>1自己创建的2订单生成的</td>
+                                                    </tr>
+                                                                                                        <tr>
                                                         <td>id</td>
                                                         <td>string</td>
                                                         <td>是</td>
@@ -2228,6 +2234,10 @@
                                                 <div class="panel-body">
                                                     <form enctype="application/x-www-form-urlencoded" role="form" action="/api/user_tax/list" method="get" name="form88" id="form88">
                                                                                                                 <div class="form-group">
+                                                            <label class="control-label" for="from">from</label>
+                                                            <input type="string" class="form-control input-sm" id="from" required placeholder="1自己创建的2订单生成的" name="from">
+                                                        </div>
+                                                                                                                <div class="form-group">
                                                             <label class="control-label" for="id">id</label>
                                                             <input type="string" class="form-control input-sm" id="id" required placeholder="查看单条传id" name="id">
                                                         </div>
@@ -17054,7 +17064,7 @@
 
                 </div>
                 <div class="col-md-6" align="right">
-                    Generated on 2022-11-18 10:11:55 <a href="./" target="_blank">苏州屏酷有限公司</a>
+                    Generated on 2022-11-18 14:51:48 <a href="./" target="_blank">苏州屏酷有限公司</a>
                 </div>
             </div>