Merge pull request 'feature/testing_resource_verify_admin' (#11) from feature/testing_resource_verify_admin into release

Reviewed-on: http://8.136.139.249:3000/wmtx/platform/pulls/11
master
廖金灵 4 years ago
commit 342b592976

@ -212,7 +212,8 @@ class TestingResourceController extends ThinkController
'user_account' => '测试账号', 'user_account' => '测试账号',
'user_phone' => '手机号', 'user_phone' => '手机号',
'promote_account' => '所属推广员', 'promote_account' => '所属推广员',
'apply_promote_account' => '申请人', 'apply_username' => '申请人',
'verify_admin_username' => '审核人',
'apply_amount' => '申请金额', 'apply_amount' => '申请金额',
'provide_amount' => '发放金额', 'provide_amount' => '发放金额',
'verify_status_text' => '审核状态', 'verify_status_text' => '审核状态',
@ -230,10 +231,13 @@ class TestingResourceController extends ThinkController
$gameId = $params['game_id'] ?? 0; $gameId = $params['game_id'] ?? 0;
$admins = M('ucenter_member', 'sys_')->field(['id', 'username'])->select();
$this->assign('verifyStatusList', TestingResourceRepository::$verifyStatusList); $this->assign('verifyStatusList', TestingResourceRepository::$verifyStatusList);
$this->assign('provideStatusList', TestingResourceRepository::$provideStatusList); $this->assign('provideStatusList', TestingResourceRepository::$provideStatusList);
$this->assign('servers', $gameRepository->getServersByGameId($gameId)); $this->assign('servers', $gameRepository->getServersByGameId($gameId));
$this->assign('games', $gameRepository->getChoiceGames()); $this->assign('games', $gameRepository->getChoiceGames());
$this->assign('admins', $admins);
$this->assign('count', $count); $this->assign('count', $count);
$this->assign('_page', $pagination); $this->assign('_page', $pagination);
$this->assign('records', $records); $this->assign('records', $records);
@ -266,7 +270,6 @@ class TestingResourceController extends ThinkController
'user_account' => $role['user_account'], 'user_account' => $role['user_account'],
'server_name' => $role['server_name'], 'server_name' => $role['server_name'],
'role_name' => $role['role_name'], 'role_name' => $role['role_name'],
'apply_promote_account' => $applyPromote ? $applyPromote['account'] : '',
'promote_account' => $promote['account'], 'promote_account' => $promote['account'],
'ref_name' => $order['ref_name'], 'ref_name' => $order['ref_name'],
'ref_amount' => $order['ref_amount'], 'ref_amount' => $order['ref_amount'],
@ -337,9 +340,10 @@ class TestingResourceController extends ThinkController
public function doApply() public function doApply()
{ {
$params = I('post.'); $params = I('post.');
$userAuth = session('user_auth');
try { try {
$testingResourceService = new TestingResourceService(); $testingResourceService = new TestingResourceService();
$testingResourceService->apply($params); $testingResourceService->apply($params, null, $userAuth['uid']);
return $this->ajaxReturn(['status' => 1, 'message' => '申请成功,等待审核。']); return $this->ajaxReturn(['status' => 1, 'message' => '申请成功,等待审核。']);
} catch (\Throwable $e) { } catch (\Throwable $e) {
return $this->ajaxReturn(['status' => 0, 'message' => $e->getMessage()]); return $this->ajaxReturn(['status' => 0, 'message' => $e->getMessage()]);
@ -362,11 +366,13 @@ class TestingResourceController extends ThinkController
if (count($batches) == 0) { if (count($batches) == 0) {
return $this->ajaxReturn(['status' => 0, 'message' => '无未审核批次']); return $this->ajaxReturn(['status' => 0, 'message' => '无未审核批次']);
} }
$userAuth = session('user_auth');
foreach ($batches as $batch) { foreach ($batches as $batch) {
if ($status == 1) { if ($status == 1) {
$service->verify($batch); $service->verify($batch, $userAuth['uid']);
} elseif ($status == 2) { } elseif ($status == 2) {
$service->verifyRefuse($batch); $remark = '审核拒绝';
$service->verifyRefuse($batch, $remark, $userAuth['uid']);
} }
} }
return $this->ajaxReturn(['status' => 1, 'message' => '操作成功']); return $this->ajaxReturn(['status' => 1, 'message' => '操作成功']);
@ -510,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 = M('promote', 'tab_')->field(['id', 'account'])->where(['id' => ['in', array_column($batches, 'apply_promote_id')]])->select();
$applyPromotes = index_by_column('id', $applyPromotes); $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 = []; $promotes = [];
if (count($roles) > 0) { if (count($roles) > 0) {
$promotes = M('promote', 'tab_')->field(['id', 'account'])->where(['id' => ['in', array_column($roles, 'promote_id')]])->select(); $promotes = M('promote', 'tab_')->field(['id', 'account'])->where(['id' => ['in', array_column($roles, 'promote_id')]])->select();
@ -525,6 +535,8 @@ class TestingResourceController extends ThinkController
$role = isset($roles[$roleKey]) ? $roles[$roleKey] : null; $role = isset($roles[$roleKey]) ? $roles[$roleKey] : null;
$applyPromote = $applyPromotes[$batch['apply_promote_id']] ?? null; $applyPromote = $applyPromotes[$batch['apply_promote_id']] ?? null;
$promote = $role ? ($promotes[$role['promote_id']] ?? null) : null; $promote = $role ? ($promotes[$role['promote_id']] ?? null) : null;
$verifyAdmin = $verifyAdmins[$batch['verify_admin_id']] ?? null;
$records[] = [ $records[] = [
'id' => $order['id'], 'id' => $order['id'],
'batch_no' => substr($batch['batch_no'], 14), 'batch_no' => substr($batch['batch_no'], 14),
@ -533,8 +545,8 @@ class TestingResourceController extends ThinkController
'user_account' => $role ? $role['user_account'] : '', 'user_account' => $role ? $role['user_account'] : '',
'server_name' => $role ? $role['server_name'] : '', 'server_name' => $role ? $role['server_name'] : '',
'role_name' => $role ? $role['role_name'] : '', 'role_name' => $role ? $role['role_name'] : '',
'apply_promote_account' => $applyPromote ? $applyPromote['account'] : '',
'promote_account' => $promote ? $promote['account'] : '', 'promote_account' => $promote ? $promote['account'] : '',
'verify_admin_username' => $verifyAdmin ? $verifyAdmin['username'] : '系統',
'ref_name' => $order['ref_name'], 'ref_name' => $order['ref_name'],
'ref_amount' => $order['ref_amount'], 'ref_amount' => $order['ref_amount'],
'num' => $order['num'], 'num' => $order['num'],
@ -552,8 +564,8 @@ class TestingResourceController extends ThinkController
'server_name' => '区服名称', 'server_name' => '区服名称',
'user_account' => '测试账号', 'user_account' => '测试账号',
'role_name' => '角色名称', 'role_name' => '角色名称',
'apply_promote_account' => '申请人',
'promote_account' => '所属推广员', 'promote_account' => '所属推广员',
'verify_admin_username' => '审核人',
'ref_name' => '资源名称', 'ref_name' => '资源名称',
'ref_amount' => '资源价值', 'ref_amount' => '资源价值',
'num' => '申请数量', 'num' => '申请数量',

@ -143,6 +143,16 @@
<?php endforeach;?> <?php endforeach;?>
</select> </select>
</div> </div>
<div class="input-list input-list-promote search_label_rehab">
<select name="verify_admin_id" class="select_gallery" style="width:120px;">
<option value="-1">请选择审核人</option>
<?php foreach($admins as $admin):?>
<option value="<?=$admin['id']?>">
<?=$admin['username']?>
</option>
<?php endforeach;?>
</select>
</div>
<div class="input-list"> <div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('TestingResource/batches')}">搜索</a> <a class="sch-btn" href="javascript:;" id="search" url="{:U('TestingResource/batches')}">搜索</a>
<a class="sch-btn" href="{:U('exportOrders', I('get.'))}" style="width: 100px;">导出批次订单</a> <a class="sch-btn" href="{:U('exportOrders', I('get.'))}" style="width: 100px;">导出批次订单</a>
@ -178,7 +188,8 @@
<th>测试账号</th> <th>测试账号</th>
<th>手机号</th> <th>手机号</th>
<th>所属推广员</th> <th>所属推广员</th>
<th>申请人</th> <th>申请人</th>
<th>审核人</th>
<!-- <th>发放总金额</th> --> <!-- <th>发放总金额</th> -->
<th>申请金额</th> <th>申请金额</th>
<th>发放金额</th> <th>发放金额</th>
@ -211,7 +222,8 @@
<td>{$record.user_account}</td> <td>{$record.user_account}</td>
<td>{$record.user_phone}</td> <td>{$record.user_phone}</td>
<td>{$record.promote_account}</td> <td>{$record.promote_account}</td>
<td>{$record.apply_promote_account}</td> <td>{$record.apply_username}</td>
<td>{$record.verify_admin_username}</td>
<!-- <td>{$record.history_provide_amount}</td> --> <!-- <td>{$record.history_provide_amount}</td> -->
<td>{$record.apply_amount}</td> <td>{$record.apply_amount}</td>
<td>{$record.provide_amount}</td> <td>{$record.provide_amount}</td>

@ -45,7 +45,6 @@ body {
<th>玩家账号</th> <th>玩家账号</th>
<th>区服名称</th> <th>区服名称</th>
<th>角色名称</th> <th>角色名称</th>
<th>申请人</th>
<th>资源内容</th> <th>资源内容</th>
<th>资源价值</th> <th>资源价值</th>
<th>申请数量</th> <th>申请数量</th>
@ -72,7 +71,6 @@ body {
<td>{$record.user_account}</td> <td>{$record.user_account}</td>
<td>{$record.server_name}</td> <td>{$record.server_name}</td>
<td>{$record.role_name}</td> <td>{$record.role_name}</td>
<td>{$record.apply_promote_account}</td>
<td>{$record.ref_name}</td> <td>{$record.ref_name}</td>
<td>{$record.ref_amount}</td> <td>{$record.ref_amount}</td>
<td>{$record.num}</td> <td>{$record.num}</td>

@ -88,6 +88,7 @@ class TestingResourceRepository
$verifyStatus = $params['verify_status'] ?? -1; $verifyStatus = $params['verify_status'] ?? -1;
$provideStatus = $params['provide_status'] ?? -1; $provideStatus = $params['provide_status'] ?? -1;
$account = $params['account'] ?? ''; $account = $params['account'] ?? '';
$adminId = $params['verify_admin_id'] ?? -1;
$conditions = []; $conditions = [];
$conditions['_string'] = '1=1'; $conditions['_string'] = '1=1';
@ -113,6 +114,9 @@ class TestingResourceRepository
if ($provideStatus != -1) { if ($provideStatus != -1) {
$conditions['provide_status'] = $provideStatus; $conditions['provide_status'] = $provideStatus;
} }
if ($adminId != -1) {
$conditions['verify_admin_id'] = $adminId;
}
if ($gameId) { if ($gameId) {
$conditions['game_id'] = $gameId; $conditions['game_id'] = $gameId;
} }
@ -136,6 +140,8 @@ class TestingResourceRepository
$applyPromotes = []; $applyPromotes = [];
$users = []; $users = [];
$promotes = []; $promotes = [];
$verifyAdmins = [];
$applyAdmins = [];
if (count($batches) > 0) { if (count($batches) > 0) {
$gameRoleIds = []; $gameRoleIds = [];
foreach ($batches as $batch) { foreach ($batches as $batch) {
@ -153,16 +159,25 @@ class TestingResourceRepository
$applyPromotes = M('promote', 'tab_')->field(['id', 'account'])->where(['id' => ['in', array_column($batches, 'apply_promote_id')]])->select(); $applyPromotes = M('promote', 'tab_')->field(['id', 'account'])->where(['id' => ['in', array_column($batches, 'apply_promote_id')]])->select();
$applyPromotes = index_by_column('id', $applyPromotes); $applyPromotes = index_by_column('id', $applyPromotes);
$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);
if (count($users) > 0) { if (count($users) > 0) {
$promotes = M('promote', 'tab_')->field(['id', 'account'])->where(['id' => ['in', array_column($users, 'promote_id')]])->select(); $promotes = M('promote', 'tab_')->field(['id', 'account'])->where(['id' => ['in', array_column($users, 'promote_id')]])->select();
$promotes = index_by_column('id', $promotes); $promotes = index_by_column('id', $promotes);
} }
$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);
} }
return [ return [
'roles' => $roles, 'roles' => $roles,
'applyPromotes' => $applyPromotes, 'applyPromotes' => $applyPromotes,
'users' => $users, 'users' => $users,
'promotes' => $promotes, 'promotes' => $promotes,
'verifyAdmins' => $verifyAdmins,
'applyAdmins' => $applyAdmins,
]; ];
} }
@ -173,6 +188,8 @@ class TestingResourceRepository
$applyPromotes = $result['applyPromotes']; $applyPromotes = $result['applyPromotes'];
$users = $result['users']; $users = $result['users'];
$promotes = $result['promotes']; $promotes = $result['promotes'];
$verifyAdmins = $result['verifyAdmins'];
$applyAdmins = $result['applyAdmins'];
$records = []; $records = [];
foreach ($batches as $batch) { foreach ($batches as $batch) {
@ -181,6 +198,8 @@ class TestingResourceRepository
$user = $users[$batch['user_id']] ?? null; $user = $users[$batch['user_id']] ?? null;
$applyPromote = $applyPromotes[$batch['apply_promote_id']] ?? null; $applyPromote = $applyPromotes[$batch['apply_promote_id']] ?? null;
$promote = $user && isset($promotes[$user['promote_id']]) ? $promotes[$user['promote_id']] : null; $promote = $user && isset($promotes[$user['promote_id']]) ? $promotes[$user['promote_id']] : null;
$verifyAdmin = $verifyAdmins[$batch['verify_admin_id']] ?? null;
$applyAdmin = $applyAdmins[$batch['apply_admin_id']] ?? null;
$records[] = [ $records[] = [
'id' => $batch['id'], 'id' => $batch['id'],
'batch_no' => substr($batch['batch_no'], 14), 'batch_no' => substr($batch['batch_no'], 14),
@ -190,8 +209,9 @@ class TestingResourceRepository
'role_name' => $role ? $role['role_name'] : '--', 'role_name' => $role ? $role['role_name'] : '--',
'user_account' => $role ?$role['user_account'] : '--', 'user_account' => $role ?$role['user_account'] : '--',
'user_phone' => $user ? $user['phone'] : '', 'user_phone' => $user ? $user['phone'] : '',
'apply_promote_account' => $applyPromote ? $applyPromote['account'] : '', 'apply_username' => $applyPromote ? $applyPromote['account'] . '[推广员]' : ($applyAdmin ? $applyAdmin['username'] . '[管理员]' : ''),
'promote_account' => $promote['account'], 'promote_account' => $promote['account'],
'verify_admin_username' => $batch['verify_status'] == 0 ? '--' : ($verifyAdmin ? $verifyAdmin['username'] : '系統'),
// 'history_provide_amount' => 0.00, // 'history_provide_amount' => 0.00,
'apply_amount' => $batch['apply_amount'], 'apply_amount' => $batch['apply_amount'],
'provide_amount' => $batch['provide_amount'], 'provide_amount' => $batch['provide_amount'],

@ -16,7 +16,7 @@ class TestingResourceService
$this->repository = new TestingResourceRepository(); $this->repository = new TestingResourceRepository();
} }
public function verify($batch) public function verify($batch, $verifyAdminId = 0)
{ {
if ($batch['verify_status'] != 0) { if ($batch['verify_status'] != 0) {
throw new \Exception('审核状态异常'); throw new \Exception('审核状态异常');
@ -36,10 +36,11 @@ class TestingResourceService
$batchData['verify_status'] = 1; $batchData['verify_status'] = 1;
$batchData['verify_remark'] = '审核成功'; $batchData['verify_remark'] = '审核成功';
$batchData['verify_admin_id'] = $verifyAdminId;
M('testing_resource_batch', 'tab_')->where(['id' => $batch['id']])->save($batchData); M('testing_resource_batch', 'tab_')->where(['id' => $batch['id']])->save($batchData);
} }
public function verifyRefuse($batch, $remark = '审核拒绝') public function verifyRefuse($batch, $remark = '审核拒绝', $verifyAdminId = 0)
{ {
if ($batch['verify_status'] != 0) { if ($batch['verify_status'] != 0) {
throw new \Exception('审核状态异常'); throw new \Exception('审核状态异常');
@ -50,6 +51,7 @@ class TestingResourceService
$batchData['update_time'] = time(); $batchData['update_time'] = time();
$batchData['verify_status'] = 2; $batchData['verify_status'] = 2;
$batchData['verify_remark'] = $remark; $batchData['verify_remark'] = $remark;
$batchData['verify_admin_id'] = $verifyAdminId;
M('testing_resource_batch', 'tab_')->where(['id' => $batch['id']])->save($batchData); M('testing_resource_batch', 'tab_')->where(['id' => $batch['id']])->save($batchData);
} }
@ -347,7 +349,7 @@ class TestingResourceService
return M('testing_binding', 'tab_')->where(['id' => $bindingId])->delete(); return M('testing_binding', 'tab_')->where(['id' => $bindingId])->delete();
} }
public function apply($params, $promote = null) public function apply($params, $promote = null, $adminId = 0)
{ {
$gameId = $params['game_id'] ?? 0; $gameId = $params['game_id'] ?? 0;
$roleId = $params['role_id'] ?? ''; $roleId = $params['role_id'] ?? '';
@ -492,6 +494,7 @@ class TestingResourceService
'role_id' => $roleId, 'role_id' => $roleId,
'server_id' => $serverId, 'server_id' => $serverId,
'apply_promote_id' => $promote ? $promote['id'] : 0, 'apply_promote_id' => $promote ? $promote['id'] : 0,
'apply_admin_id' => $adminId,
'apply_amount' => $amount, 'apply_amount' => $amount,
'provide_status' => 0, 'provide_status' => 0,
'verify_status' => 0, 'verify_status' => 0,

@ -100,7 +100,6 @@ class TestingResourceController extends BaseController
'user_account' => $role['user_account'], 'user_account' => $role['user_account'],
'server_name' => $role['server_name'], 'server_name' => $role['server_name'],
'role_name' => $role['role_name'], 'role_name' => $role['role_name'],
'apply_promote_account' => $applyPromote ? $applyPromote['account'] : '',
'promote_account' => $promote['account'], 'promote_account' => $promote['account'],
'ref_name' => $order['ref_name'], 'ref_name' => $order['ref_name'],
'ref_amount' => $order['ref_amount'], 'ref_amount' => $order['ref_amount'],

@ -119,7 +119,6 @@
<th>测试账号</th> <th>测试账号</th>
<th>手机号</th> <th>手机号</th>
<th>所属推广员</th> <th>所属推广员</th>
<th>申请人</th>
<!-- <th>发放总金额</th> --> <!-- <th>发放总金额</th> -->
<th>申请金额</th> <th>申请金额</th>
<th>发放金额</th> <th>发放金额</th>
@ -147,7 +146,6 @@
<td>{$record.user_account}</td> <td>{$record.user_account}</td>
<td>{$record.user_phone}</td> <td>{$record.user_phone}</td>
<td>{$record.promote_account}</td> <td>{$record.promote_account}</td>
<td>{$record.apply_promote_account}</td>
<!-- <td>{$record.history_provide_amount}</td> --> <!-- <td>{$record.history_provide_amount}</td> -->
<td>{$record.apply_amount}</td> <td>{$record.apply_amount}</td>
<td>{$record.provide_amount}</td> <td>{$record.provide_amount}</td>

@ -106,7 +106,6 @@
<th>玩家账号</th> <th>玩家账号</th>
<th>区服名称</th> <th>区服名称</th>
<th>角色名称</th> <th>角色名称</th>
<th>申请人</th>
<th>资源内容</th> <th>资源内容</th>
<th>资源价值</th> <th>资源价值</th>
<th>申请数量</th> <th>申请数量</th>
@ -129,7 +128,6 @@
<td>{$record.user_account}</td> <td>{$record.user_account}</td>
<td>{$record.server_name}</td> <td>{$record.server_name}</td>
<td>{$record.role_name}</td> <td>{$record.role_name}</td>
<td>{$record.apply_promote_account}</td>
<td>{$record.ref_name}</td> <td>{$record.ref_name}</td>
<td>{$record.ref_amount}</td> <td>{$record.ref_amount}</td>
<td>{$record.num}</td> <td>{$record.num}</td>

@ -2753,3 +2753,8 @@ ALTER TABLE `tab_promote_company`
ADD COLUMN `site_domain_prefix` varchar(20) NOT NULL DEFAULT '' COMMENT '推广后台域名前缀' AFTER `is_site_custom`; ADD COLUMN `site_domain_prefix` varchar(20) NOT NULL DEFAULT '' COMMENT '推广后台域名前缀' AFTER `is_site_custom`;
ALTER TABLE `tab_promote_company` ALTER TABLE `tab_promote_company`
ADD COLUMN `site_config` varchar(255) NOT NULL DEFAULT '' COMMENT '推广后台网站配置' AFTER `is_site_custom`; 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`;

Loading…
Cancel
Save