Browse Source

会员升级

Kirin 1 year ago
parent
commit
3e2b19d28a
1 changed files with 45 additions and 38 deletions
  1. 45 38
      app/controller/admin/v1/other/export/ExportExcel.php

+ 45 - 38
app/controller/admin/v1/other/export/ExportExcel.php

@@ -270,10 +270,10 @@ class ExportExcel extends AuthController
             ['cate_id', ''],
             ['cate_id', ''],
             ['type', 1, '', 'status'],
             ['type', 1, '', 'status'],
             ['ids', ''],
             ['ids', ''],
-			['supplier_id', 0],
-			['store_id', 0],
-			['store_label_id', ''],
-			['brand_id', '']
+            ['supplier_id', 0],
+            ['store_id', 0],
+            ['store_label_id', ''],
+            ['brand_id', '']
         ]);
         ]);
         if ($where_tmp['ids']) {
         if ($where_tmp['ids']) {
             $where['id'] = explode(',', $where_tmp['ids']);
             $where['id'] = explode(',', $where_tmp['ids']);
@@ -281,15 +281,15 @@ class ExportExcel extends AuthController
             unset($where_tmp['ids']);
             unset($where_tmp['ids']);
             $where = $where_tmp;
             $where = $where_tmp;
         }
         }
-		if ($where_tmp['supplier_id']) {
-			$where['relation_id'] = $where_tmp['supplier_id'];
-			$where['type'] = 2;
-		} elseif ($where_tmp['store_id']) {
-			$where['relation_id'] = $where_tmp['store_id'];
-			$where['type'] = 1;
-		} else {
-			$where['pid'] = 0;
-		}
+        if ($where_tmp['supplier_id']) {
+            $where['relation_id'] = $where_tmp['supplier_id'];
+            $where['type'] = 2;
+        } elseif ($where_tmp['store_id']) {
+            $where['relation_id'] = $where_tmp['store_id'];
+            $where['type'] = 1;
+        } else {
+            $where['pid'] = 0;
+        }
         $data = $services->searchList($where, true, $this->service->limit);
         $data = $services->searchList($where, true, $this->service->limit);
         return $this->success($this->service->storeProduct($data['list'] ?? []));
         return $this->success($this->service->storeProduct($data['list'] ?? []));
     }
     }
@@ -309,18 +309,19 @@ class ExportExcel extends AuthController
             ['real_name', ''],
             ['real_name', ''],
             ['is_del', ''],
             ['is_del', ''],
             ['data', '', '', 'time'],
             ['data', '', '', 'time'],
-			['type', ''],
+            ['type', ''],
             ['export_type', ''],
             ['export_type', ''],
             ['pay_type', ''],
             ['pay_type', ''],
-			['plat_type', -1],
+            ['plat_type', -1],
             ['order', ''],
             ['order', ''],
             ['field_key', ''],
             ['field_key', ''],
             ['store_id', ''],
             ['store_id', ''],
             ['supplier_id', ''],
             ['supplier_id', ''],
+            ['plat_type', -1],
             ['ids', '']
             ['ids', '']
         ]);
         ]);
         $type = $where_tmp['export_type'];
         $type = $where_tmp['export_type'];
-		unset($where_tmp['export_type']);
+        unset($where_tmp['export_type']);
         $with = [];
         $with = [];
         if ($where_tmp['ids']) {
         if ($where_tmp['ids']) {
             $where['id'] = explode(',', $where_tmp['ids']);
             $where['id'] = explode(',', $where_tmp['ids']);
@@ -332,17 +333,22 @@ class ExportExcel extends AuthController
             $where['shipping_type'] = 1;
             $where['shipping_type'] = 1;
             $where['pid'] = 0;
             $where['pid'] = 0;
             $with = ['pink', 'refund' => function ($query) {
             $with = ['pink', 'refund' => function ($query) {
-						$query->whereIn('refund_type', [1, 2, 4, 5])->where('is_cancel', 0)->where('is_del', 0)->field('id,store_order_id');
-					}];
+                $query->whereIn('refund_type', [1, 2, 4, 5])->where('is_cancel', 0)->where('is_del', 0)->field('id,store_order_id');
+            }];
         }
         }
         if (!$where_tmp['ids'] && !$type) {
         if (!$where_tmp['ids'] && !$type) {
             unset($where_tmp['ids']);
             unset($where_tmp['ids']);
             $where = $where_tmp;
             $where = $where_tmp;
         }
         }
         $where['is_system_del'] = 0;
         $where['is_system_del'] = 0;
-		$where['plat_type'] = $where_tmp['plat_type'];
-		$where['store_id'] = $where_tmp['store_id'];
-		$where['supplier_id'] = $where_tmp['supplier_id'];
+        $where['plat_type'] = $where_tmp['plat_type'];
+        $where['store_id'] = $where_tmp['store_id'];
+        $where['supplier_id'] = $where_tmp['supplier_id'];
+        if ($where['store_id'] || $where['supplier_id'] || in_array($where['plat_type'], [0, 1, 2])) {
+            $where['pid'] = 0;
+        } elseif (!in_array($where['status'], [-1, -2, -3])) {
+            $where['pid'] = [0, -1];
+        }
         $data = $services->getExportList($where, $with, $this->service->limit);
         $data = $services->getExportList($where, $with, $this->service->limit);
         return $this->success($this->service->storeOrder($data, $type));
         return $this->success($this->service->storeOrder($data, $type));
     }
     }
@@ -502,6 +508,7 @@ class ExportExcel extends AuthController
         $data = $services->getList($where);
         $data = $services->getList($where);
         return $this->success($this->service->SupplierFinanceRecord($data['list'] ?? []));
         return $this->success($this->service->SupplierFinanceRecord($data['list'] ?? []));
     }
     }
+
     /**
     /**
      * 发票导出
      * 发票导出
      * @param StoreOrderInvoiceServices $services
      * @param StoreOrderInvoiceServices $services
@@ -521,21 +528,21 @@ class ExportExcel extends AuthController
         return $this->success($this->service->invoiceRecord($data['list'] ?? []));
         return $this->success($this->service->invoiceRecord($data['list'] ?? []));
     }
     }
 
 
-	/**
-	 * 系统表单收集数据导出
-	 * @param SystemFormDataServices $systemFormDataServices
-	 * @param $id
-	 * @return mixed
-	 * @throws \think\db\exception\DataNotFoundException
-	 * @throws \think\db\exception\DbException
-	 * @throws \think\db\exception\ModelNotFoundException'
-	 */
-	public function systemFormDataExport(SystemFormDataServices $systemFormDataServices, $id)
-	{
-		$where = $this->request->postMore([
-			['data', '', '', 'time']
-		]);
-		$data = $systemFormDataServices->getFormDataList((int)$id, $where);
-		return $this->success($this->service->systemFormData($data['list'] ?? []));
-	}
+    /**
+     * 系统表单收集数据导出
+     * @param SystemFormDataServices $systemFormDataServices
+     * @param $id
+     * @return mixed
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException'
+     */
+    public function systemFormDataExport(SystemFormDataServices $systemFormDataServices, $id)
+    {
+        $where = $this->request->postMore([
+            ['data', '', '', 'time']
+        ]);
+        $data = $systemFormDataServices->getFormDataList((int)$id, $where);
+        return $this->success($this->service->systemFormData($data['list'] ?? []));
+    }
 }
 }