浏览代码

会员升级

Kirin 1 年之前
父节点
当前提交
1c0fdc6e4f

+ 30 - 0
app/controller/admin/v1/other/export/ExportExcel.php

@@ -31,6 +31,7 @@ use app\services\system\form\SystemFormDataServices;
 use app\services\user\member\MemberCardServices;
 use app\services\user\UserBillServices;
 use app\services\user\UserBrokerageServices;
+use app\services\user\UserExtractServices;
 use app\services\user\UserMoneyServices;
 use app\services\user\UserRechargeServices;
 use app\services\wechat\WechatUserServices;
@@ -352,6 +353,35 @@ class ExportExcel extends AuthController
         return $this->success($this->service->storeOrder($data, $type));
     }
 
+
+    /**
+     * 订单列表导出
+     * @param UserExtractServices $services
+     * @return mixed
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     */
+    public function extract(UserExtractServices $services)
+    {
+        $where = $this->request->getMore([
+            ['status', ''],
+            ['extract_type', ''],
+            ['nireid', '', '', 'like'],
+            ['data', '', '', 'time'],
+        ]);
+        if (isset($where['extract_type']) && $where['extract_type'] == 'wx') {
+            $where['extract_type'] = 'weixin';
+        }
+        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);
+        return $this->success($this->service->extract($data));
+    }
+
     /**
      * 获取提货点
      * @return mixed

+ 89 - 46
app/services/other/export/ExportServices.php

@@ -498,7 +498,7 @@ class ExportServices extends BaseServices
      */
     public function storeSeckill($data = [], $type = 1)
     {
-        $header = ['编号', '活动标题', '活动简介', '原价', '秒杀价', '限量', '限量剩余','秒杀状态', '结束时间', '状态'];
+        $header = ['编号', '活动标题', '活动简介', '原价', '秒杀价', '限量', '限量剩余', '秒杀状态', '结束时间', '状态'];
         $title = ['秒杀商品导出', ' ', ' 生成时间:' . date('Y-m-d H:i:s', time())];
         $filename = '秒杀商品导出_' . date('YmdHis', time());
         $export = [];
@@ -522,7 +522,7 @@ class ExportServices extends BaseServices
                     'info' => $item['info'],
                     'ot_price' => $item['ot_price'],
                     'price' => $item['price'],
-					'quota_show' => $item['quota_show'],
+                    'quota_show' => $item['quota_show'],
                     'quota' => $item['quota'],
                     'start_name' => $item['start_name'],
                     'stop_time' => $item['stop_time'] ? date('Y-m-d H:i:s', $item['stop_time']) : '/',
@@ -741,7 +741,7 @@ class ExportServices extends BaseServices
                     if (isset($item['pinkStatus']) && $item['pinkStatus'] != 2) {
                         continue;
                     }
-					if (isset($item['refund']) && $item['refund']) {
+                    if (isset($item['refund']) && $item['refund']) {
                         continue;
                     }
                     $goodsName = [];
@@ -866,6 +866,49 @@ class ExportServices extends BaseServices
         }
     }
 
+
+    /**
+     * 商铺自提点导出
+     * @param array $data
+     * @param int $type
+     * @return array|mixed
+     */
+    public function extract($data = [], $type = 1)
+    {
+        $header = ['收款账号', '收款人名称', '收款银行', '金额', '用途', '状态'];
+        $title = ['用户提现导出', '用户提现信息' . time(), ' 生成时间:' . date('Y-m-d H:i:s', time())];
+        $filename = '用户提现导出_' . date('YmdHis', time());
+        $export = [];
+        $filekey = [];
+        if (!empty($data)) {
+            $i = 0;
+            foreach ($data as $index => $item) {
+                $one_data = [
+                    'bank_code' => $item['bank_code'],
+                    'real_name' => $item['real_name'],
+                    'bank_address' => $item['bank_address'],
+                    'extract_price' => $item['extract_price'],
+                    'mark' => '工资发放',
+                    'status' => ($item['status'] == 1 ? '通过' : ($item['status'] == 0 ? '申请中' : '未通过'))
+                ];
+                if ($type == 1) {
+                    $export[] = $one_data;
+                    if ($i == 0) {
+                        $filekey = array_keys($one_data);
+                    }
+                } else {
+                    $export[] = array_values($one_data);
+                }
+                $i++;
+            }
+        }
+        if ($type == 1) {
+            return compact('header', 'filekey', 'export', 'filename');
+        } else {
+            return $this->export($header, $title, $export, $filename);
+        }
+    }
+
     /**
      * 会员卡导出
      * @param array $data
@@ -934,8 +977,8 @@ class ExportServices extends BaseServices
             $i = 0;
             foreach ($data as $index => $item) {
                 if (!$item) {
-					continue;
-				}
+                    continue;
+                }
                 if (in_array($queueType, [7, 8, 9])) {
                     $one_data = [
                         'order_id' => $item['order_id'] ?? '',
@@ -1372,45 +1415,45 @@ class ExportServices extends BaseServices
         }
     }
 
-	/**
-	 * 系统表单收集数据导出
-	 * @param array $data
-	 * @param int $type
-	 * @return array|mixed
-	 */
-	public function systemFormData(array $data, int $type = 1)
-	{
-		$header = ['模版名称', '用户UID', '用户昵称', '手机号', '模版内容', '创建时间'];
-		$title = ['系统表单收集数据导出', '表单收集数据导出' . time(), '生成时间:' . date('Y-m-d H:i:s', time())];
-		$filename = '系统表单收集数据导出' . date('YmdHis', time());
-		$export = [];
-		$filekey = [];
-		if (!empty($data)) {
-			$i = 0;
-			foreach ($data as $key => $item) {
-				$one_data = [
-					'system_form_name' => $item['system_form_name'] ?? '',
-					'uid' => $item['uid'] ?? 0,
-					'nickname' => $item['nickname'] ?? '',
-					'phone' => $item['phone'] ?? '',
-					'form_data' => is_string($item['value']) ? json_decode($item['value']) : $item['value'],
-					'add_time' => $item['add_time'],
-				];
-				if ($type == 1) {
-					$export[] = $one_data;
-					if ($i == 0) {
-						$filekey = array_keys($one_data);
-					}
-				} else {
-					$export[] = array_values($one_data);
-				}
-				$i++;
-			}
-		}
-		if ($type == 1) {
-			return compact('header', 'filekey', 'export', 'filename');
-		} else {
-			return $this->export($header, $title, $export, $filename);
-		}
-	}
+    /**
+     * 系统表单收集数据导出
+     * @param array $data
+     * @param int $type
+     * @return array|mixed
+     */
+    public function systemFormData(array $data, int $type = 1)
+    {
+        $header = ['模版名称', '用户UID', '用户昵称', '手机号', '模版内容', '创建时间'];
+        $title = ['系统表单收集数据导出', '表单收集数据导出' . time(), '生成时间:' . date('Y-m-d H:i:s', time())];
+        $filename = '系统表单收集数据导出' . date('YmdHis', time());
+        $export = [];
+        $filekey = [];
+        if (!empty($data)) {
+            $i = 0;
+            foreach ($data as $key => $item) {
+                $one_data = [
+                    'system_form_name' => $item['system_form_name'] ?? '',
+                    'uid' => $item['uid'] ?? 0,
+                    'nickname' => $item['nickname'] ?? '',
+                    'phone' => $item['phone'] ?? '',
+                    'form_data' => is_string($item['value']) ? json_decode($item['value']) : $item['value'],
+                    'add_time' => $item['add_time'],
+                ];
+                if ($type == 1) {
+                    $export[] = $one_data;
+                    if ($i == 0) {
+                        $filekey = array_keys($one_data);
+                    }
+                } else {
+                    $export[] = array_values($one_data);
+                }
+                $i++;
+            }
+        }
+        if ($type == 1) {
+            return compact('header', 'filekey', 'export', 'filename');
+        } else {
+            return $this->export($header, $title, $export, $filename);
+        }
+    }
 }

+ 19 - 1
app/services/user/UserExtractServices.php

@@ -221,7 +221,7 @@ class UserExtractServices extends BaseServices
                 //消息推送
                 event('notice.notice', [['uid' => $userExtract['uid'], 'userType' => strtolower($userType), 'extractNumber' => $extractNumber, 'nickname' => $nickname], 'user_extract']);
             } else {
-                if (!$this->dao->update($id, ['status' => 2])) {
+                if (!$this->dao->update($id, ['status' => 1])) {
                     throw new AdminException('修改失败');
                 }
 //                $userServices = app()->make(UserServices::class);
@@ -275,6 +275,24 @@ class UserExtractServices extends BaseServices
         return compact('extract_statistics', 'list');
     }
 
+
+    /**
+     * 显示资源列表
+     * @param array $where
+     * @return array
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     */
+    public function getExportList(array $where)
+    {
+        $list = $this->dao->getExtractList($where);
+        foreach ($list as &$item) {
+            $item['nickname'] = $item['user']['nickname'] ?? '';
+        }
+        return $list;
+    }
+
     /**
      * 显示编辑资源表单页.
      *