From 78caa452b2b67f6824f180b7d7745174216c6b8b Mon Sep 17 00:00:00 2001
From: ELF <360197197@qq.com>
Date: Fri, 4 Dec 2020 10:12:10 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=B5=84=E6=BA=90=E6=B7=BB?=
 =?UTF-8?q?=E5=8A=A0=E5=AE=A1=E6=A0=B8=E4=BA=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../Admin/Controller/TestingResourceController.class.php  | 8 ++++++++
 .../Base/Repository/TestingResourceRepository.class.php   | 4 ++--
 Data/update.sql                                           | 7 ++++++-
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/Application/Admin/Controller/TestingResourceController.class.php b/Application/Admin/Controller/TestingResourceController.class.php
index a139edbae..581ecf923 100644
--- a/Application/Admin/Controller/TestingResourceController.class.php
+++ b/Application/Admin/Controller/TestingResourceController.class.php
@@ -516,6 +516,10 @@ class TestingResourceController extends ThinkController
             $applyPromotes = M('promote', 'tab_')->field(['id', 'account'])->where(['id' => ['in', array_column($batches, 'apply_promote_id')]])->select();
             $applyPromotes = index_by_column('id', $applyPromotes);
 
+            $verifyAdminIds = array_column($batches, 'verify_admin_id');
+            $verifyAdmins = M('ucenter_member', 'sys_')->field(['id', 'username'])->where(['id' => ['in', $verifyAdminIds]])->select();
+            $verifyAdmins = index_by_column('id', $verifyAdmins);
+
             $promotes = [];
             if (count($roles) > 0) {
                 $promotes = M('promote', 'tab_')->field(['id', 'account'])->where(['id' => ['in', array_column($roles, 'promote_id')]])->select();
@@ -531,6 +535,8 @@ class TestingResourceController extends ThinkController
                 $role = isset($roles[$roleKey]) ? $roles[$roleKey] : null;
                 $applyPromote = $applyPromotes[$batch['apply_promote_id']] ?? null;
                 $promote = $role ? ($promotes[$role['promote_id']] ?? null) : null;
+                $verifyAdmin = $verifyAdmins[$batch['verify_admin_id']] ?? null;
+                
                 $records[] = [
                     'id' => $order['id'],
                     'batch_no' => substr($batch['batch_no'], 14),
@@ -540,6 +546,7 @@ class TestingResourceController extends ThinkController
                     'server_name' => $role ? $role['server_name'] : '',
                     'role_name' => $role ? $role['role_name'] : '',
                     'promote_account' => $promote ? $promote['account'] : '',
+                    'verify_admin_username' => $verifyAdmin ? $verifyAdmin['username'] : '系統',
                     'ref_name' => $order['ref_name'],
                     'ref_amount' => $order['ref_amount'],
                     'num' => $order['num'],
@@ -558,6 +565,7 @@ class TestingResourceController extends ThinkController
             'user_account' => '测试账号',
             'role_name' => '角色名称',
             'promote_account' => '所属推广员',
+            'verify_admin_username' => '审核人',
             'ref_name' => '资源名称',
             'ref_amount' => '资源价值',
             'num' => '申请数量',
diff --git a/Application/Base/Repository/TestingResourceRepository.class.php b/Application/Base/Repository/TestingResourceRepository.class.php
index 51a3c47fc..5abe28999 100644
--- a/Application/Base/Repository/TestingResourceRepository.class.php
+++ b/Application/Base/Repository/TestingResourceRepository.class.php
@@ -159,7 +159,7 @@ class TestingResourceRepository
             $applyPromotes = M('promote', 'tab_')->field(['id', 'account'])->where(['id' => ['in', array_column($batches, 'apply_promote_id')]])->select();
             $applyPromotes = index_by_column('id', $applyPromotes);
 
-            $applyAdminIds = array_column('apply_admin_id', $batches);
+            $applyAdminIds = array_column($batches, 'apply_admin_id');
             $applyAdmins = M('ucenter_member', 'sys_')->field(['id', 'username'])->where(['id' => ['in', $applyAdminIds]])->select();
             $applyAdmins = index_by_column('id', $applyAdmins);
 
@@ -167,7 +167,7 @@ class TestingResourceRepository
                 $promotes = M('promote', 'tab_')->field(['id', 'account'])->where(['id' => ['in', array_column($users, 'promote_id')]])->select();
                 $promotes = index_by_column('id', $promotes);
             }
-            $verifyAdminIds = array_column('verify_admin_id', $batches);
+            $verifyAdminIds = array_column($batches, 'verify_admin_id');
             $verifyAdmins = M('ucenter_member', 'sys_')->field(['id', 'username'])->where(['id' => ['in', $verifyAdminIds]])->select();
             $verifyAdmins = index_by_column('id', $verifyAdmins);
         }
diff --git a/Data/update.sql b/Data/update.sql
index 7a48acc83..25dcc3d3a 100644
--- a/Data/update.sql
+++ b/Data/update.sql
@@ -2724,4 +2724,9 @@ ADD COLUMN `is_site_custom` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否定制
 ALTER TABLE `tab_promote_company`
 ADD COLUMN `site_domain_prefix` varchar(20) NOT NULL DEFAULT '' COMMENT '推广后台域名前缀' AFTER `is_site_custom`;
 ALTER TABLE `tab_promote_company`
-ADD COLUMN `site_config` varchar(255) NOT NULL DEFAULT '' COMMENT '推广后台网站配置' AFTER `is_site_custom`;
\ No newline at end of file
+ADD COLUMN `site_config` varchar(255) NOT NULL DEFAULT '' COMMENT '推广后台网站配置' AFTER `is_site_custom`;
+
+ALTER TABLE `tab_testing_resource_batch`
+ADD COLUMN `verify_admin_id` int(11) NOT NULL DEFAULT 0 COMMENT '審核管理員ID' AFTER `verify_status`;
+ALTER TABLE `tab_testing_resource_batch`
+ADD COLUMN `apply_admin_id` int(11) NOT NULL DEFAULT 0 COMMENT '申請管理員ID' AFTER `apply_promote_id`;
\ No newline at end of file