Merge branch 'feature/testing_resource_admin' of wmtx/platform into release
测试资源发放master
commit
b2098410a1
@ -0,0 +1,534 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Admin\Controller;
|
||||
|
||||
use Base\Model\PromoteModel;
|
||||
use Base\Service\PromoteService;
|
||||
use Base\Service\TestingResourceService;
|
||||
use Base\Service\PartnerService;
|
||||
use Base\Repository\TestingResourceRepository;
|
||||
use Base\Repository\GameRepository;
|
||||
|
||||
class TestingResourceController extends ThinkController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$params = I('get.');
|
||||
$gameId = $params['game_id'] ?? 0;
|
||||
|
||||
$repository = new TestingResourceRepository();
|
||||
$query = $repository->getTestingUsersQuery($params);
|
||||
|
||||
[$roles, $page, $count] = $this->paginate($query);
|
||||
|
||||
$records = $repository->makeTestingUserRecords($roles);
|
||||
|
||||
$gameRepository = new GameRepository();
|
||||
|
||||
$this->assign('games', $gameRepository->getChoiceGames());
|
||||
$this->assign('servers', $gameRepository->getServersByGameId($gameId));
|
||||
$this->assign('count', $count);
|
||||
$this->assign('records', $records);
|
||||
$this->assign('_page', $page);
|
||||
$this->display();
|
||||
}
|
||||
|
||||
public function getServers()
|
||||
{
|
||||
$gameId = I('game_id', 0);
|
||||
$gameRepository = new GameRepository();
|
||||
$servers = $gameRepository->getServersByGameId($gameId);
|
||||
return $this->ajaxReturn(['status' => 1, 'message' => '获取成功', 'data' => ['servers' => $servers]]);
|
||||
}
|
||||
|
||||
public function gameSettings()
|
||||
{
|
||||
$page = I('p', 1);
|
||||
$row = I('row', 10);
|
||||
|
||||
$gameId = I('base_game_id', 0);
|
||||
$partnerId = I('partner_id', 0);
|
||||
|
||||
$conditions = [];
|
||||
$conditions['_string'] = '1=1';
|
||||
if ($partnerId > 0) {
|
||||
$partnerService = new PartnerService();
|
||||
$baseGames = $partnerService->findBaseGamesByPartnerId($partnerId);
|
||||
if (empty($baseGames)) {
|
||||
$conditions['_string'] = '1=0';
|
||||
} else {
|
||||
$conditions['base_game_id'] = ['in', array_column($baseGames, 'id')];
|
||||
}
|
||||
}
|
||||
if ($gameId > 0) {
|
||||
$conditions['base_game_id'] = $gameId;
|
||||
}
|
||||
$query = M('testing_game_setting', 'tab_')->where($conditions)->order('create_time desc');
|
||||
[$items, $page, $count] = $this->paginate($query);
|
||||
|
||||
$baseGames = M('base_game', 'tab_')->select();
|
||||
$baseGames = index_by_column('id', $baseGames);
|
||||
$partners = M('partner', 'tab_')->field(['id', 'partner'])->select();
|
||||
$partners = index_by_column('id', $partners);
|
||||
|
||||
$games = M('game', 'tab_')->where(['id', 'partner_id'])->select();
|
||||
$games = index_by_column('id', $games);
|
||||
foreach ($baseGames as $key => $baseGame) {
|
||||
if ($baseGame['android_game_id'] > 0) {
|
||||
$baseGame['partner_id'] = $games[$baseGame['android_game_id']]['partner_id'];
|
||||
} else {
|
||||
$baseGame['partner_id'] = $games[$baseGame['ios_game_id']]['partner_id'];
|
||||
}
|
||||
$baseGames[$key] = $baseGame;
|
||||
}
|
||||
|
||||
$spendList = [];
|
||||
$provideItems = [];
|
||||
if (count($items) > 0) {
|
||||
$pageGameIds = array_merge(array_column($baseGames, 'android_game_id'), array_column($baseGames, 'ios_game_id'));
|
||||
/* $spendCondition = [
|
||||
'pay_status' => 1,
|
||||
'game_id' => ['in', $pageGameIds]
|
||||
];
|
||||
$spendList = M('spend', 'tab_')->field('sum(pay_amount) amount, game_id')->where($spendCondition)->group('game_id')->select();
|
||||
$spendList = index_by_column('game_id', $spendList); */
|
||||
|
||||
$provideItems = M('testing_resource_batch', 'tab_')
|
||||
->field('sum(provide_amount) amount, game_id')
|
||||
->where([
|
||||
'verify_status' => 1,
|
||||
'game_id' => ['in', $pageGameIds]
|
||||
])
|
||||
->group('game_id')
|
||||
->select();
|
||||
$provideItems = index_by_column('game_id', $provideItems);
|
||||
}
|
||||
|
||||
$records = [];
|
||||
foreach ($items as $item) {
|
||||
$baseGame = $baseGames[$item['base_game_id']] ?? null;
|
||||
$partnerId = $baseGame ? $baseGame['partner_id'] : 0;
|
||||
$partner = $partners[$partnerId] ?? null;
|
||||
|
||||
/* $aSpendItem = $spendList[$baseGame['android_game_id']] ?? null;
|
||||
$bSpendItem = $spendList[$baseGame['ios_game_id']] ?? null;
|
||||
$aSpendQuota = $aSpendItem ? $aSpendItem['amount'] : 0;
|
||||
$bSpendQuota = $bSpendItem ? $bSpendItem['amount'] : 0; */
|
||||
|
||||
$aProvideItem = $provideItems[$baseGame['ios_game_id']] ?? null;
|
||||
$bProvideItem = $provideItems[$baseGame['android_game_id']] ?? null;
|
||||
$aProvideQuota = $aProvideItem ? $aProvideItem['amount'] : 0;
|
||||
$bProvideQuota = $bProvideItem ? $bProvideItem['amount'] : 0;
|
||||
|
||||
$records[] = [
|
||||
'id' => $item['id'],
|
||||
'base_game_id' => $item['base_game_id'],
|
||||
'game_name' => $baseGame ? $baseGame['name'] : '无此游戏',
|
||||
'partner_name' => $partner ? $partner['partner'] : '--',
|
||||
'rate' => $item['rate'],
|
||||
'base_quota' => $item['base_quota'],
|
||||
// 'quota' => round(($aSpendQuota + $bSpendQuota) * $item['rate'] / 100, 2),
|
||||
'provide_quota' => $aProvideQuota + $bProvideQuota
|
||||
];
|
||||
}
|
||||
|
||||
$this->assign('_page', $page);
|
||||
$this->assign('records', $records);
|
||||
$this->assign('partners', $partners);
|
||||
$this->assign('baseGames', $baseGames);
|
||||
$this->display();
|
||||
}
|
||||
|
||||
public function saveGameSetting()
|
||||
{
|
||||
$params = I('post.');
|
||||
try {
|
||||
$testingResourceService = new TestingResourceService();
|
||||
$testingResourceService->saveGameSetting($params);
|
||||
return $this->ajaxReturn(['status' => 1, 'message' => '保存成功']);
|
||||
} catch (\Exception $e) {
|
||||
return $this->ajaxReturn(['status' => 0, 'message' => '保存失败!' . $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteGameSetting()
|
||||
{
|
||||
$id = I('id', 0);
|
||||
M('testing_game_setting', 'tab_')->where(['id' => $id])->delete();
|
||||
return $this->ajaxReturn(['status' => 1, 'message' => '删除成功']);
|
||||
}
|
||||
|
||||
public function addTestingUsers()
|
||||
{
|
||||
$accountsStr = trim(I('accounts', ''), ',');
|
||||
if ($accountsStr == '') {
|
||||
return $this->ajaxReturn(['status' => 0, 'message' => '请输入测试资源账号']);
|
||||
}
|
||||
$accounts = explode(',', $accountsStr);
|
||||
|
||||
$testingResourceService = new TestingResourceService();
|
||||
$result = $testingResourceService->addTestingUsers($accounts);
|
||||
|
||||
return $this->ajaxReturn(['status' => 1, 'message' => '请求成功', 'data' => $result]);
|
||||
}
|
||||
|
||||
public function batches()
|
||||
{
|
||||
$params = I('get.');
|
||||
$isExport = $params['export'] ?? 0;
|
||||
|
||||
$repository = new TestingResourceRepository();
|
||||
$query = $repository->getBatchesQuery($params);
|
||||
|
||||
if ($isExport == 1) {
|
||||
$batches = $query->select();
|
||||
$records = $repository->makeBatchesRecords($batches);
|
||||
data2csv($records, '申请批次列表', [
|
||||
'batch_no' => '批次号',
|
||||
'create_time' => '申请时间',
|
||||
'game_name' => '游戏名称',
|
||||
'server_name' => '区服名称',
|
||||
'role_name' => '角色名称',
|
||||
'user_account' => '测试账号',
|
||||
'user_phone' => '手机号',
|
||||
'promote_account' => '所属推广员',
|
||||
'apply_promote_account' => '申请人',
|
||||
'apply_amount' => '申请金额',
|
||||
'provide_amount' => '发放金额',
|
||||
'verify_status_text' => '审核状态',
|
||||
'verify_time' => '审核时间',
|
||||
'provide_status_text' => '发放状态',
|
||||
'provide_time' => '发放时间'
|
||||
]);
|
||||
}
|
||||
|
||||
list($batches, $pagination, $count) = $this->paginate($query);
|
||||
|
||||
$records = $repository->makeBatchesRecords($batches);
|
||||
|
||||
$gameRepository = new GameRepository();
|
||||
|
||||
$gameId = $params['game_id'] ?? 0;
|
||||
|
||||
$this->assign('verifyStatusList', TestingResourceRepository::$verifyStatusList);
|
||||
$this->assign('provideStatusList', TestingResourceRepository::$provideStatusList);
|
||||
$this->assign('servers', $gameRepository->getServersByGameId($gameId));
|
||||
$this->assign('games', $gameRepository->getChoiceGames());
|
||||
$this->assign('count', $count);
|
||||
$this->assign('_page', $pagination);
|
||||
$this->assign('records', $records);
|
||||
$this->display();
|
||||
}
|
||||
|
||||
public function orders()
|
||||
{
|
||||
$id = I('id', 0);
|
||||
|
||||
$batch = M('testing_resource_batch', 'tab_')->where(['id' => $id])->find();
|
||||
|
||||
$role = M('user_play_info', 'tab_')
|
||||
->field(['id', 'game_name', 'server_name', 'role_name', 'game_role_id', 'user_account'])
|
||||
->where(['game_id' => $batch['game_id'], 'role_id' => $batch['role_id']])
|
||||
->find();
|
||||
|
||||
$applyPromote = M('promote', 'tab_')->field(['id', 'account'])->where(['id' => $batch['apply_promote_id']])->find();
|
||||
$promote = M('promote', 'tab_')->field(['id', 'account'])->where(['id' => $role['apply_promote_id']])->find();
|
||||
|
||||
$query = M('testing_resource_order', 'tab_')->where(['batch_id' => $id])->order('id desc');
|
||||
list($orders, $pagination, $count) = $this->paginate($query);
|
||||
|
||||
$repository = new TestingResourceRepository();
|
||||
foreach ($orders as $order) {
|
||||
$records[] = [
|
||||
'id' => $order['id'],
|
||||
'create_time' => $batch['create_time'] == 0 ? '--' : date('Y-m-d H:i:s', $batch['create_time']),
|
||||
'game_name' => $role['game_name'],
|
||||
'user_account' => $role['user_account'],
|
||||
'server_name' => $role['server_name'],
|
||||
'role_name' => $role['role_name'],
|
||||
'apply_promote_account' => $applyPromote ? $applyPromote['account'] : '',
|
||||
'promote_account' => $promote['account'],
|
||||
'ref_name' => $order['ref_name'],
|
||||
'ref_amount' => $order['ref_amount'],
|
||||
'num' => $order['num'],
|
||||
'amount' => $order['num'] * $order['ref_amount'],
|
||||
'remark' => $order['remark'],
|
||||
'provide_status' => $order['provide_status'],
|
||||
'provide_status_text' => $repository->getProvideStatusText($order['provide_status']),
|
||||
];
|
||||
}
|
||||
|
||||
$this->assign('count', $count);
|
||||
$this->assign('_page', $pagination);
|
||||
$this->assign('records', $records);
|
||||
$this->display();
|
||||
}
|
||||
|
||||
public function apply()
|
||||
{
|
||||
$id = I('id', 0);
|
||||
|
||||
$role = null;
|
||||
if ($id != 0) {
|
||||
$role = M('user_play_info', 'tab_')
|
||||
->field(['id', 'role_id', 'user_id', 'game_id', 'server_id', 'user_account', 'role_name', 'testing_other_quota'])
|
||||
->where(['id' => $id])
|
||||
->find();
|
||||
}
|
||||
|
||||
|
||||
$hasItf = 0;
|
||||
|
||||
$servers = [];
|
||||
$bindingRole = null;
|
||||
if ($role) {
|
||||
$servers = M('server', 'tab_')->field('id,server_name,server_id')->where(['game_id' => $role['game_id']])->order('server_id asc')->select();
|
||||
$binding = M('testing_binding', 'tab_')->where(['game_id' => $role['game_id'], 'role_id' => $role['role_id']])->find();
|
||||
if ($binding) {
|
||||
$bindingRole = M('user_play_info', 'tab_')
|
||||
->field(['id', 'role_id', 'user_id', 'game_id', 'server_id', 'user_account', 'role_name'])
|
||||
->where(['game_id' => $binding['game_id'], 'role_id' => $binding['bind_role_id']])
|
||||
->find();
|
||||
}
|
||||
|
||||
$repository = new TestingResourceRepository();
|
||||
$gameSetting = $repository->getGameSettingByGameId($role['game_id']);
|
||||
|
||||
$hasItf = $gameSetting ? $gameSetting['has_itf'] : 0;
|
||||
}
|
||||
|
||||
|
||||
$testingResourceService = new TestingResourceService();
|
||||
$quota = $testingResourceService->getRemainQuota($role, $bindingRole);
|
||||
|
||||
$games = M('game', 'tab_')->field(['id' , 'game_name'])->select();
|
||||
|
||||
$this->assign('hasItf', $hasItf);
|
||||
$this->assign('games', $games);
|
||||
$this->assign('servers', $servers);
|
||||
$this->assign('bindingRole', $bindingRole);
|
||||
$this->assign('role', $role);
|
||||
$this->assign('quota', $quota);
|
||||
$this->display();
|
||||
}
|
||||
|
||||
public function doApply()
|
||||
{
|
||||
$params = I('post.');
|
||||
try {
|
||||
$testingResourceService = new TestingResourceService();
|
||||
$testingResourceService->apply($params);
|
||||
return $this->ajaxReturn(['status' => 1, 'message' => '申请成功,等待审核。']);
|
||||
} catch (\Throwable $e) {
|
||||
return $this->ajaxReturn(['status' => 0, 'message' => $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
public function verify()
|
||||
{
|
||||
$ids = I('ids', []);
|
||||
$status = I('status', 0);
|
||||
if (count($ids) == 0) {
|
||||
return $this->ajaxReturn(['status' => 0, 'message' => '请选择要审核的批次']);
|
||||
}
|
||||
if (!in_array($status, [1, 2])) {
|
||||
return $this->ajaxReturn(['status' => 0, 'message' => '请求状态异常']);
|
||||
}
|
||||
try {
|
||||
$service = new TestingResourceService();
|
||||
$batches = M('testing_resource_batch', 'tab_')->where(['verify_status' => 0, 'id' => ['in', $ids]])->select();
|
||||
if (count($batches) == 0) {
|
||||
return $this->ajaxReturn(['status' => 0, 'message' => '无未审核批次']);
|
||||
}
|
||||
foreach ($batches as $batch) {
|
||||
if ($status == 1) {
|
||||
$service->verify($batch);
|
||||
} elseif ($status == 2) {
|
||||
$service->verifyRefuse($batch);
|
||||
}
|
||||
}
|
||||
return $this->ajaxReturn(['status' => 1, 'message' => '操作成功']);
|
||||
} catch (\Throwable $e) {
|
||||
return $this->ajaxReturn(['status' => 0, 'message' => $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
public function provide()
|
||||
{
|
||||
$ids = I('ids', []);
|
||||
$status = I('status', 0);
|
||||
if (count($ids) == 0) {
|
||||
return $this->ajaxReturn(['status' => 0, 'message' => '请选择要审核的批次']);
|
||||
}
|
||||
if (!in_array($status, [1, 2])) {
|
||||
return $this->ajaxReturn(['status' => 0, 'message' => '请求状态异常']);
|
||||
}
|
||||
try {
|
||||
$service = new TestingResourceService();
|
||||
$batches = M('testing_resource_batch', 'tab_')->where(['verify_status' => 1, 'provide_status' => 0, 'id' => ['in', $ids]])->select();
|
||||
if (count($batches) == 0) {
|
||||
return $this->ajaxReturn(['status' => 0, 'message' => '无符合条件的批次']);
|
||||
}
|
||||
foreach ($batches as $batch) {
|
||||
if ($status == 1) {
|
||||
$service->provide($batch);
|
||||
} elseif ($status == 2) {
|
||||
$service->provideRefuse($batch);
|
||||
}
|
||||
}
|
||||
return $this->ajaxReturn(['status' => 1, 'message' => '操作成功']);
|
||||
} catch (\Throwable $e) {
|
||||
return $this->ajaxReturn(['status' => 0, 'message' => $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
public function bindRole()
|
||||
{
|
||||
$params = I('post.');
|
||||
try {
|
||||
$testingResourceService = new TestingResourceService();
|
||||
$testingResourceService->bindRole($params);
|
||||
return $this->ajaxReturn(['status' => 1, 'message' => '绑定成功']);
|
||||
} catch (\Throwable $e) {
|
||||
return $this->ajaxReturn(['status' => 0, 'message' => $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
public function unbindRole()
|
||||
{
|
||||
$bindingId = I('binding_id', 0);
|
||||
try {
|
||||
$testingResourceService = new TestingResourceService();
|
||||
$testingResourceService->unbindRole($bindingId);
|
||||
return $this->ajaxReturn(['status' => 1, 'message' => '解绑成功']);
|
||||
} catch (\Throwable $e) {
|
||||
return $this->ajaxReturn(['status' => 0, 'message' => $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
public function setOtherQuota()
|
||||
{
|
||||
$id = I('id', 0);
|
||||
$otherQuota = I('other_quota', 0);
|
||||
M('user_play_info', 'tab_')->where(['id' => $id])->save(['testing_other_quota' => $otherQuota]);
|
||||
return $this->ajaxReturn(['status' => 1, 'message' => '设置成功']);
|
||||
}
|
||||
|
||||
public function getUserRoles()
|
||||
{
|
||||
$gameId = I('game_id', 0);
|
||||
$serverId = I('server_id', 0);
|
||||
$userAccount = I('user_account', '');
|
||||
$server = M('server', 'tab_')->field(['id', 'server_name', 'server_id'])->where(['id' => $serverId])->find();
|
||||
if (is_null($server)) {
|
||||
return $this->ajaxReturn(['status' => 0, 'message' => '区服不存在']);
|
||||
}
|
||||
|
||||
$user = M('user', 'tab_')->field(['id', 'promote_id'])->where(['account' => $userAccount])->find();
|
||||
if (is_null($user)) {
|
||||
return $this->ajaxReturn(['status' => 0, 'message' => '账号不存在']);
|
||||
}
|
||||
|
||||
$testingUser = M('testing_user', 'tab_')->where(['user_account' => $userAccount])->find();
|
||||
$isTestingAccount = is_null($testingUser) ? false : true;
|
||||
|
||||
$roles = M('user_play_info', 'tab_')
|
||||
->field(['id', 'role_id', 'role_name'])
|
||||
->where(['user_account' => $userAccount, 'game_id' => $gameId, 'server_id' => $server['server_id']])
|
||||
->select();
|
||||
return $this->ajaxReturn(['status' => 1, 'message' => '获取成功', 'data' => ['roles' => $roles, 'is_testing_account' => $isTestingAccount]]);
|
||||
}
|
||||
|
||||
public function getResourceTypes()
|
||||
{
|
||||
$gameId = I('game_id', 0);
|
||||
$testingResourceService = new TestingResourceService();
|
||||
$resourceTypes = $testingResourceService->getResourceTypes($gameId);
|
||||
return $this->ajaxReturn(['status' => 1, 'message' => '获取成功', 'data' => ['resourceTypes' => $resourceTypes]]);
|
||||
}
|
||||
|
||||
public function getResources()
|
||||
{
|
||||
$typeId = I('type_id', 0);
|
||||
$testingResourceService = new TestingResourceService();
|
||||
$resources = $testingResourceService->getResources($typeId);
|
||||
return $this->ajaxReturn(['status' => 1, 'message' => '获取成功', 'data' => ['resources' => $resources]]);
|
||||
}
|
||||
|
||||
public function exportOrders()
|
||||
{
|
||||
$params = I('get.');
|
||||
$repository = new TestingResourceRepository();
|
||||
$batches = $repository->getBatchesQuery($params)->select();
|
||||
$batches = index_by_column('id', $batches);
|
||||
|
||||
$records = [];
|
||||
if (count($batches)) {
|
||||
$gameRoleIds = [];
|
||||
foreach ($batches as $batch) {
|
||||
$gameRoleIds[] = $repository->getGameRoleId($batch['game_id'], $batch['role_id']);
|
||||
}
|
||||
$roles = M('user_play_info', 'tab_')
|
||||
->field(['id', 'game_name', 'server_name', 'role_name', 'game_role_id', 'user_account', 'promote_id'])
|
||||
->where(['game_role_id' => ['in', $gameRoleIds]])
|
||||
->select();
|
||||
$roles = index_by_column('game_role_id', $roles);
|
||||
|
||||
$applyPromotes = M('promote', 'tab_')->field(['id', 'account'])->where(['id' => ['in', array_column($batches, 'apply_promote_id')]])->select();
|
||||
$applyPromotes = index_by_column('id', $applyPromotes);
|
||||
|
||||
$promotes = [];
|
||||
if (count($roles) > 0) {
|
||||
$promotes = M('promote', 'tab_')->field(['id', 'account'])->where(['id' => ['in', array_column($roles, 'promote_id')]])->select();
|
||||
$promotes = index_by_column('id', $promotes);
|
||||
}
|
||||
|
||||
$orders = M('testing_resource_order', 'tab_')->where(['batch_id' => ['in', array_column($batches, 'id')]])->order('batch_id desc')->select();
|
||||
|
||||
foreach ($orders as $order) {
|
||||
|
||||
$batch = $batches[$order['batch_id']];
|
||||
$roleKey = $repository->getGameRoleId($batch['game_id'], $batch['role_id']);
|
||||
$role = isset($roles[$roleKey]) ? $roles[$roleKey] : null;
|
||||
$applyPromote = $applyPromotes[$batch['apply_promote_id']] ?? null;
|
||||
$promote = $role ? ($promotes[$role['promote_id']] ?? null) : null;
|
||||
$records[] = [
|
||||
'id' => $order['id'],
|
||||
'batch_no' => substr($batch['batch_no'], 14),
|
||||
'create_time' => $batch['create_time'] == 0 ? '--' : date('Y-m-d H:i:s', $batch['create_time']),
|
||||
'game_name' => $role ? $role['game_name'] : '',
|
||||
'user_account' => $role ? $role['user_account'] : '',
|
||||
'server_name' => $role ? $role['server_name'] : '',
|
||||
'role_name' => $role ? $role['role_name'] : '',
|
||||
'apply_promote_account' => $applyPromote ? $applyPromote['account'] : '',
|
||||
'promote_account' => $promote ? $promote['account'] : '',
|
||||
'ref_name' => $order['ref_name'],
|
||||
'ref_amount' => $order['ref_amount'],
|
||||
'num' => $order['num'],
|
||||
'amount' => $order['num'] * $order['ref_amount'],
|
||||
'remark' => $order['remark'],
|
||||
'verify_status_text' => $repository->getVerifyStatusText($batch['verify_status']),
|
||||
'provide_status_text' => $repository->getProvideStatusText($order['provide_status']),
|
||||
];
|
||||
}
|
||||
}
|
||||
data2csv($records, '批次订单列表', [
|
||||
'batch_no' => '批次号',
|
||||
'create_time' => '申请时间',
|
||||
'game_name' => '游戏名称',
|
||||
'server_name' => '区服名称',
|
||||
'user_account' => '测试账号',
|
||||
'role_name' => '角色名称',
|
||||
'apply_promote_account' => '申请人',
|
||||
'promote_account' => '所属推广员',
|
||||
'ref_name' => '资源名称',
|
||||
'ref_amount' => '资源价值',
|
||||
'num' => '申请数量',
|
||||
'amount' => '申请金额',
|
||||
'remark' => '申请备注',
|
||||
'verify_status_text' => '审核状态',
|
||||
'provide_status_text' => '发放状态'
|
||||
]);
|
||||
}
|
||||
}
|
@ -0,0 +1,746 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta charset="UTF-8">
|
||||
<title>游戏登陆列表|----软件管理平台</title>
|
||||
<link href="http://admin.vlcms.com/Public/icon.ico" type="image/x-icon" rel="shortcut icon">
|
||||
<link rel="stylesheet" type="text/css" href="__CSS__/base.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="__CSS__/common.css" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="__CSS__/module.css">
|
||||
<link rel="stylesheet" type="text/css" href="__CSS__/style.css" media="all">
|
||||
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
|
||||
<link rel="stylesheet" type="text/css" href="__CSS__/default_color.css" media="all">
|
||||
<script type="text/javascript" src="__STATIC__/jquery-2.0.3.min.js"></script>
|
||||
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
|
||||
<script type="text/javascript" src="__STATIC__/layer/extend/layer.ext.js"></script>
|
||||
<script type="text/javascript" src="__JS__/select2.min.js"></script>
|
||||
</head>
|
||||
<style>
|
||||
html {
|
||||
min-width:100%;
|
||||
height: 1000px;
|
||||
}
|
||||
body {
|
||||
padding: 0px;
|
||||
}
|
||||
.trunk-search .form-group {
|
||||
margin-left: 10px;
|
||||
}
|
||||
.normal_table input {
|
||||
position: relative;
|
||||
padding: 5px;
|
||||
border: 1px solid #E5E5E5;
|
||||
border-radius: 4px;
|
||||
height: 25px;
|
||||
}
|
||||
.normal_table td {
|
||||
padding: 5px;
|
||||
text-align: center;
|
||||
}
|
||||
.normal_table td select {
|
||||
width: 100%;
|
||||
}
|
||||
.normal_table td button {
|
||||
width: 70px;
|
||||
height: 35px;
|
||||
display: block;
|
||||
background: #409eff;
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.normal_table td button.delete-row {
|
||||
background-color: rgb(249,104,104);
|
||||
}
|
||||
.btn-row {
|
||||
position: relative;
|
||||
font-size: 11px;
|
||||
margin-top: 28px;
|
||||
text-align: center;
|
||||
}
|
||||
.btn-row button {
|
||||
width: 70px;
|
||||
height: 35px;
|
||||
background: #409eff;
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
padding: 0px;
|
||||
}
|
||||
.btn-row button.close-btn {
|
||||
background: #E5E5E5;
|
||||
color: #535875;
|
||||
}
|
||||
.form-group .static-input {
|
||||
line-height: 32px;
|
||||
display: inline-block;
|
||||
}
|
||||
.trunk-search button {
|
||||
width: 70px;
|
||||
height: 35px;
|
||||
display: block;
|
||||
background: #409eff;
|
||||
color: #fff;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
}
|
||||
.info-row {
|
||||
margin-top: 10px;
|
||||
}
|
||||
.info-row button {
|
||||
width: auto;
|
||||
height: 25px;
|
||||
display: block;
|
||||
background: #E5E5E5;
|
||||
color: #535875;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
margin-left: 10px;
|
||||
}
|
||||
.info-row button.bind-btn {
|
||||
background: #409eff;
|
||||
color: #fff;
|
||||
}
|
||||
.form-group {
|
||||
float: left;
|
||||
}
|
||||
.form-group input {
|
||||
padding: 5px;
|
||||
border: 1px solid #E5E5E5;
|
||||
border-radius: 4px;
|
||||
height: 24px;
|
||||
}
|
||||
.clearfix:after {
|
||||
content: "\20";
|
||||
display: block;
|
||||
height: 0;
|
||||
clear: both;
|
||||
}
|
||||
.clearfix {
|
||||
*zoom: 1;
|
||||
}
|
||||
.select2-container--open {
|
||||
z-index: 1001;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<div id="main" class="main" style="min-height: 342px;">
|
||||
<div class="page-search normal_list promoteCoin-record-search" style="padding: 20px;">
|
||||
<div class="trunk-content article">
|
||||
<div class="trunk-search clearfix" style="margin-bottom: 10px;">
|
||||
<form method="post" class="clearfix">
|
||||
<div class="clearfix">
|
||||
<div class="form-group">
|
||||
<select id="game-select" name="" class="select_gallery" style="width:150px" <?php if($role):?>disabled<?php endif;?>>
|
||||
<option value="0">请选择游戏</option>
|
||||
<?php foreach($games as $game):?>
|
||||
<option value="<?=$game['id']?>" <?php if($role && $role['game_id'] == $game['id']):?>selected<?php endif;?>>
|
||||
<?=$game['game_name']?>
|
||||
</option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<select id="server-select" class="select_gallery" style="width:150px" <?php if($role):?>disabled<?php endif;?>>
|
||||
<option value="0">请选择区服</option>
|
||||
<?php foreach($servers as $server):?>
|
||||
<option value="<?=$server['id']?>" <?php if($role && $server['server_id'] == $role['server_id']):?>selected<?php endif;?>>
|
||||
<?=$server['server_name']?>
|
||||
</option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input id="test_account" type="text" name="account" class="txt normal_txt" placeholder="请输入测试资源账号" value="{$role.user_account}" <?php if($role):?>disabled<?php endif;?>>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<select id="role-select" name="role_id" class="select_gallery" style="width:150px" <?php if($role):?>disabled<?php endif;?>>
|
||||
<option value="">请选择角色</option>
|
||||
<?php if($role):?>
|
||||
<option value="<?=$role['role_id']?>" selected><?=$role['role_name']?></option>
|
||||
<?php endif;?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<?php if($role):?>
|
||||
<div class="info-row">
|
||||
<?php if($bindingRole):?>
|
||||
<button type="button">绑定角色: <?= $bindingRole['role_name']?></button>
|
||||
<?php else:?>
|
||||
<button id="bind-btn" class="bind-btn" type="button">绑定玩家角色</button>
|
||||
<?php endif;?>
|
||||
<div class="" style="display:inline-block; margin-left: 10px;">
|
||||
当前可用额度:<span id="quota" data-quota="<?=$quota?>"><?=$quota?></span> 待审核额度:<span id="verify-quota">0</span>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
|
||||
<div class="clearfix" style="margin-top: 10px;">
|
||||
<input id="hasItf" type="hidden" value="<?=$hasItf?>" name="has_itf">
|
||||
<?php if ($hasItf):?>
|
||||
<div class="form-group fl">
|
||||
<select id="resource-type-select" name="resource_type_id" style="width:150px" class="select_gallery">
|
||||
<option value="">请选择资源类型</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group fl">
|
||||
<select id="resource-select" name="resource_id" style="width:150px" class="select_gallery">
|
||||
<option value="">请选择资源内容</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group fl">
|
||||
<input id="remark-input" type="text" name="remark" class="txt normal_txt" placeholder="请输入备注" value="">
|
||||
</div>
|
||||
<div class="form-group fl">
|
||||
<p id="resource-amount" class="static-input">资源价值: --</p>
|
||||
</div>
|
||||
<div class="form-group fl">
|
||||
<p class="static-input">资源数量: 1</p>
|
||||
<!-- <input id="num-input" type="text" name="num" class="txt normal_txt" id="uid" placeholder="请输入资源数量" value=""> -->
|
||||
</div>
|
||||
<?php else:?>
|
||||
<div class="form-group fl">
|
||||
<input id="remark-input" type="text" name="remark" class="txt normal_txt" placeholder="请输入资源备注" value="">
|
||||
</div>
|
||||
<div class="form-group fl">
|
||||
<input id="remark-amount" type="text" name="amount" class="txt normal_txt" placeholder="请输入资源价值" value="">
|
||||
</div>
|
||||
<?php endif;?>
|
||||
<div class="form-group fl">
|
||||
<button id="add-row" class="add-row" type="button">增加</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="trunk-list list_normal data_list" style="margin-top: 20px">
|
||||
<div class="table-wrapper" style="height: 315px;">
|
||||
<?php if($hasItf):?>
|
||||
<table id="resource-table" class="table normal_table ">
|
||||
<thead>
|
||||
<tr class="table-header">
|
||||
<th width="150">资源类型</th>
|
||||
<th width="150">资源内容</th>
|
||||
<th>资源价值</th>
|
||||
<th>资源数量</th>
|
||||
<th>备注</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<?php else:?>
|
||||
<table id="resource-table" class="table normal_table ">
|
||||
<thead>
|
||||
<tr class="table-header">
|
||||
<th>资源备注</th>
|
||||
<th>资源价值</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
<div class="btn-row clearfix">
|
||||
<button id="submit-btn" class="submit-btn" type="button">提交</button>
|
||||
<button id="close-btn" class="close-btn" type="button">关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="bind-box" class="layer-box" style="display: none;">
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<div class="form-group">
|
||||
<label>玩家账号</label>
|
||||
<div class="form-item" style="width: 250px">
|
||||
<input id="bind_account" name="account" type="text" class="form-input" style="width: 100%;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>玩家角色</label>
|
||||
<div class="form-item" style="width: 250px">
|
||||
<select id="bind-role-select" name="role_id" style="width:270px" class="select_gallery">
|
||||
<option value="">请选择</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label></label>
|
||||
<a id="submit-bind" href="javascript:;" class="add-submit btn">确定</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(".select_gallery").select2()
|
||||
var globalGameId = $('#game-select').val()
|
||||
var hasItf = $('#hasItf').val()
|
||||
if (globalGameId > 0) {
|
||||
initTable(globalGameId)
|
||||
}
|
||||
$('#game-select').on({
|
||||
change: function () {
|
||||
var gameId = $(this).val()
|
||||
globalGameId = gameId
|
||||
$.ajax({
|
||||
url: "{:U('getServers')}",
|
||||
type: "post",
|
||||
data: { game_id: gameId },
|
||||
dataType: 'json',
|
||||
success: function(result){
|
||||
if (result.status == 1) {
|
||||
var servers = result.data.servers
|
||||
var html = "<option value='0'>请选择区服</option>";
|
||||
for (var i in servers){
|
||||
html += "<option value='"+servers[i].id+"'>"+servers[i].server_name+"</option>"
|
||||
}
|
||||
$("#server-select").html(html);
|
||||
$("#server-select").select2();
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
initTable(gameId)
|
||||
}
|
||||
})
|
||||
var resourceTypes = new Array()
|
||||
var rowCount = 0
|
||||
function initTable(gameId) {
|
||||
var table = $('#resource-table');
|
||||
table.find('.normal-row').remove()
|
||||
if (hasItf != 1) {
|
||||
return;
|
||||
}
|
||||
$.ajax({
|
||||
url: "{:U('getResourceTypes')}",
|
||||
type: "post",
|
||||
data: { game_id: gameId },
|
||||
dataType: 'json',
|
||||
success: function(result){
|
||||
if (result.status == 1) {
|
||||
rowCount = 0
|
||||
resourceTypes = result.data.resourceTypes
|
||||
var selector = $('#resource-type-select')
|
||||
var html = getResourceTypesHtml()
|
||||
selector.html(html)
|
||||
selector.select2();
|
||||
|
||||
var resourceSelector = $('#resource-select')
|
||||
resourceSelector.html(getResourcesHtml([]))
|
||||
resourceSelector.select2();
|
||||
|
||||
$('#resource-amount').html('资源价值:--')
|
||||
$('#resource-table tbody').html('')
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
function getResourceTypesHtml() {
|
||||
var html = "<option value=''>请选择资源类型</option>";
|
||||
for (var i in resourceTypes) {
|
||||
html += "<option value='"+resourceTypes[i].id+"'>"+resourceTypes[i].name+"</option>"
|
||||
}
|
||||
return html
|
||||
}
|
||||
$('#resource-type-select').change(function () {
|
||||
var that = this
|
||||
var typeId = $(this).val()
|
||||
$.ajax({
|
||||
url: "{:U('getResources')}",
|
||||
type: "post",
|
||||
data: { type_id: typeId },
|
||||
dataType: 'json',
|
||||
success: function(result){
|
||||
if (result.status == 1) {
|
||||
var resources = result.data.resources
|
||||
var html = getResourcesHtml(resources)
|
||||
var rowSelect = $('#resource-select')
|
||||
rowSelect.html(html);
|
||||
rowSelect.select2();
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
function getResourcesHtml(resources) {
|
||||
var html = "<option value=''>请选择资源内容</option>";
|
||||
for (var i in resources){
|
||||
html += "<option value='"+resources[i].ref_id+"' data-amount="+resources[i].amount+">"+resources[i].name+"</option>"
|
||||
}
|
||||
return html
|
||||
}
|
||||
$('#resource-select').change(function () {
|
||||
var amount = $(this).find('option:selected').attr('data-amount')
|
||||
amount = amount == undefined ? '--' : amount
|
||||
$('#resource-amount').html('资源价值:' + amount)
|
||||
})
|
||||
$('#add-row').click(function () {
|
||||
if (rowCount >= 5) {
|
||||
return layer.msg('最多同时只能添加5条')
|
||||
}
|
||||
var hasItf = $('#hasItf').val()
|
||||
if (hasItf == 1) {
|
||||
addRowItf()
|
||||
} else {
|
||||
addRow()
|
||||
}
|
||||
})
|
||||
|
||||
function isFloat(num){
|
||||
if(!num) {
|
||||
return false
|
||||
}
|
||||
var strPreg = /^\d+(\.\d+)?$/;
|
||||
if(!strPreg.test(num)) {
|
||||
return false
|
||||
}
|
||||
|
||||
try{
|
||||
if(parseFloat(num) != num) {
|
||||
return false
|
||||
}
|
||||
} catch(ex) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
function isNumber(num){
|
||||
if(!num) {
|
||||
return false
|
||||
}
|
||||
var strPreg = /^\d+$/
|
||||
if(!strPreg.test(num)) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
function addRow() {
|
||||
var remark = $('#remark-input').val()
|
||||
var amount = $('#remark-amount').val()
|
||||
if (remark == '') {
|
||||
return layer.msg('请输入资源备注')
|
||||
}
|
||||
if (amount == '') {
|
||||
return layer.msg('请输入资源价值')
|
||||
}
|
||||
if (!isNumber(amount)) {
|
||||
return layer.msg('资源价值只能为正整数')
|
||||
}
|
||||
var html = '<tr class="normal-row" >' +
|
||||
'<td style="width:420px" class="remark"><input name="remark" type="text" style="width:400px" value="' + remark + '"></td>' +
|
||||
'<td class="amount"><input name="amount" type="text" value="' + amount + '"></td>' +
|
||||
'<td><button class="delete-row" type="button" class="danger-btn">删除</button></td>' +
|
||||
'</tr>';
|
||||
$('#resource-table tbody').append(html)
|
||||
rowCount ++
|
||||
$(".select_gallery").select2()
|
||||
statQuota()
|
||||
}
|
||||
|
||||
function addRowItf() {
|
||||
var resourceTypeId = $('#resource-type-select').val()
|
||||
var resourceId = $('#resource-select').val()
|
||||
var resourceTypeName = $('#resource-type-select option:selected').html()
|
||||
var resourceName = $('#resource-select option:selected').html()
|
||||
var amount = $('#resource-select option:selected').attr('data-amount')
|
||||
amount = amount == undefined ? '--' : amount
|
||||
// var num = $('#num-input').val()
|
||||
var num = 1
|
||||
var remark = $('#remark-input').val()
|
||||
|
||||
if (resourceTypeId == '') {
|
||||
return layer.msg('请选择资源类型')
|
||||
}
|
||||
if (resourceId == '') {
|
||||
return layer.msg('请选择资源内容')
|
||||
}
|
||||
if (num == '') {
|
||||
return layer.msg('请输入资源数量')
|
||||
}
|
||||
if (!isNumber(num)) {
|
||||
return layer.msg('资源数量只能为正整数')
|
||||
}
|
||||
|
||||
var html = '<tr class="normal-row" data-resource-id="' + resourceId + '" data-resource-type-id="' + resourceTypeId + '" >' +
|
||||
'<td>' + resourceTypeName + '</td>' +
|
||||
'<td>' + resourceName + '</td>' +
|
||||
'<td class="amount">' + amount + '</td>' +
|
||||
'<td class="num"><input name="num" type="text" value="' + num + '" readonly></td>' +
|
||||
'<td class="remark"><input name="remark" type="text" value="' + remark + '"></td>' +
|
||||
'<td><button class="delete-row" type="button" class="danger-btn">删除</button></td>' +
|
||||
'</tr>';
|
||||
|
||||
$('#resource-table tbody').append(html)
|
||||
rowCount ++
|
||||
$(".select_gallery").select2()
|
||||
statQuota()
|
||||
}
|
||||
|
||||
$('#resource-table').on('click', '.delete-row', function () {
|
||||
var tr = $(this).parents('tr').eq(0)
|
||||
rowCount --
|
||||
tr.remove()
|
||||
statQuota()
|
||||
})
|
||||
$('#resource-table').on('blur', 'input[name=num]', function() {
|
||||
if($(this).val() == '') {
|
||||
return layer.msg('请输入资源数量')
|
||||
} else {
|
||||
statQuota()
|
||||
}
|
||||
})
|
||||
$('#resource-table').on('blur', 'input[name=amount]', function() {
|
||||
if($(this).val() == '') {
|
||||
return layer.msg('请输入资源数量')
|
||||
} else {
|
||||
statQuota()
|
||||
}
|
||||
})
|
||||
function statQuota() {
|
||||
var quota = $('#quota').attr('data-quota')
|
||||
var hasItf = $('#hasItf').val()
|
||||
|
||||
var verifyQuota = 0
|
||||
if (hasItf == 1) {
|
||||
$('#resource-table').find('.normal-row').each(function (index, ele) {
|
||||
verifyQuota += $(ele).find('.amount').html() * $(ele).find('.num').children('input').val()
|
||||
})
|
||||
} else {
|
||||
$('#resource-table').find('.normal-row').each(function (index, ele) {
|
||||
verifyQuota += parseInt($(ele).find('.amount').children('input').val())
|
||||
})
|
||||
}
|
||||
|
||||
$('#verify-quota').html(verifyQuota)
|
||||
$('#quota').html(quota-verifyQuota)
|
||||
}
|
||||
$('#test_account').on({
|
||||
blur: function() {
|
||||
var gameId = $('#game-select').val()
|
||||
if (gameId == 0) {
|
||||
return layer.msg('请选择游戏')
|
||||
}
|
||||
var serverId = $('#server-select').val()
|
||||
if (serverId == 0) {
|
||||
return layer.msg('请选择区服')
|
||||
}
|
||||
var userAccount = $('#test_account').val()
|
||||
if (userAccount == '') {
|
||||
return layer.msg('请输入测试资源账号')
|
||||
}
|
||||
getUserRoles(userAccount, gameId, serverId, function(roles, isTestingAccount) {
|
||||
if (roles.length == 0) {
|
||||
return layer.msg('当前账号在该区服未创建角色')
|
||||
}
|
||||
if (!isTestingAccount) {
|
||||
return layer.msg('此账号非测试账号')
|
||||
}
|
||||
var html = "<option value=''>请选择角色</option>";
|
||||
for (var i in roles){
|
||||
html += "<option value='"+roles[i].role_id+"'>"+roles[i].role_name+"</option>"
|
||||
}
|
||||
$("#role-select").html(html);
|
||||
$("#role-select").select2();
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
function getUserRoles(userAccount, gameId, serverId, callback) {
|
||||
$.ajax({
|
||||
url: "{:U('getUserRoles')}",
|
||||
type: "post",
|
||||
data: { user_account: userAccount, game_id: gameId, server_id: serverId },
|
||||
dataType: 'json',
|
||||
success: function(result){
|
||||
if (result.status == 1) {
|
||||
var roles = result.data.roles
|
||||
var isTestingAccount = result.data.is_testing_account
|
||||
callback(roles, isTestingAccount)
|
||||
} else {
|
||||
layer.msg(result.message)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
$('#bind_account').on({
|
||||
blur: function () {
|
||||
var gameId = $('#game-select').val()
|
||||
if (gameId == 0) {
|
||||
return layer.msg('请选择游戏')
|
||||
}
|
||||
var serverId = $('#server-select').val()
|
||||
if (serverId == 0) {
|
||||
return layer.msg('请选择区服')
|
||||
}
|
||||
var userAccount = $('#bind_account').val()
|
||||
if (userAccount == '') {
|
||||
return layer.msg('请输入玩家账号')
|
||||
}
|
||||
getUserRoles(userAccount, gameId, serverId, function(roles, isTestingAccount) {
|
||||
if (roles.length == 0) {
|
||||
return layer.msg('玩家账号在该区服未创建角色')
|
||||
}
|
||||
if (isTestingAccount) {
|
||||
return layer.msg('此账号为测试账号,无法绑定')
|
||||
}
|
||||
var html = "<option value=''>请选择角色</option>";
|
||||
for (var i in roles){
|
||||
html += "<option value='"+roles[i].role_id+"'>"+roles[i].role_name+"</option>"
|
||||
}
|
||||
$("#bind-role-select").html(html);
|
||||
$("#bind-role-select").select2();
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
function getRecords() {
|
||||
var records = []
|
||||
var hasItf = $('#hasItf').val()
|
||||
if (hasItf == 1) {
|
||||
$('#resource-table tbody tr').each(function (index, tr) {
|
||||
var num = $(tr).find('input[name=num]').val()
|
||||
var remark = $(tr).find('input[name=remark]').val()
|
||||
var resourceId = $(tr).attr('data-resource-id')
|
||||
var resourceTypeId = $(tr).attr('data-resource-type-id')
|
||||
records.push({
|
||||
resource_id: resourceId,
|
||||
resource_type_id: resourceTypeId,
|
||||
num: num,
|
||||
remark: remark,
|
||||
})
|
||||
})
|
||||
} else {
|
||||
$('#resource-table tbody tr').each(function (index, tr) {
|
||||
var amount = $(tr).find('input[name=amount]').val()
|
||||
var remark = $(tr).find('input[name=remark]').val()
|
||||
records.push({
|
||||
amount: amount,
|
||||
remark: remark,
|
||||
})
|
||||
})
|
||||
}
|
||||
return records
|
||||
}
|
||||
|
||||
$('#bind-btn').click(function () {
|
||||
var box = $('#bind-box')
|
||||
layer.open({
|
||||
title: '绑定玩家角色',
|
||||
type: 1,
|
||||
content: box,
|
||||
area: ['500px', '250px'],
|
||||
zIndex: 250,
|
||||
scrollbar: false
|
||||
})
|
||||
});
|
||||
|
||||
$('#submit-bind').click(function () {
|
||||
var gameId = $('#game-select').val()
|
||||
if (gameId == 0) {
|
||||
return layer.msg('请选择游戏')
|
||||
}
|
||||
var roleId = $('#role-select').val()
|
||||
if (roleId == 0) {
|
||||
return layer.msg('请选择测试账号角色')
|
||||
}
|
||||
var bindRoleId = $('#bind-role-select').val()
|
||||
if (bindRoleId == 0) {
|
||||
return layer.msg('请选择玩家角色')
|
||||
}
|
||||
$.ajax({
|
||||
url: "{:U('bindRole')}",
|
||||
type: "post",
|
||||
data: { game_id: gameId, bind_role_id: bindRoleId, testing_role_id: roleId},
|
||||
dataType: 'json',
|
||||
success: function(result){
|
||||
if (result.status == 1) {
|
||||
layer.msg(result.message, function(){
|
||||
window.location.href = window.location.href
|
||||
})
|
||||
} else {
|
||||
layer.msg(result.message)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
$('#submit-btn').on({
|
||||
click: function () {
|
||||
var records = getRecords()
|
||||
|
||||
if (records.length == 0) {
|
||||
return layer.msg('至少添加一项资源申请')
|
||||
}
|
||||
|
||||
for (var i in records) {
|
||||
if (records[i].num == '') {
|
||||
return layer.msg('请输入资源数量')
|
||||
}
|
||||
}
|
||||
|
||||
var gameId = $('#game-select').val()
|
||||
var serverId = $('#server-select').val()
|
||||
var userAccount = $('#test_account').val()
|
||||
var roleId = $('#role-select').val()
|
||||
|
||||
if (gameId == 0) {
|
||||
return layer.msg('请选择游戏')
|
||||
}
|
||||
if (serverId == 0) {
|
||||
return layer.msg('请选择区服')
|
||||
}
|
||||
if (userAccount == '') {
|
||||
return layer.msg('请输入测试资源账号')
|
||||
}
|
||||
if (roleId == 0) {
|
||||
return layer.msg('请选择角色')
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "{:U('doApply')}",
|
||||
type: "post",
|
||||
data: { records: records, game_id: gameId, server_id: serverId, user_account: userAccount, role_id: roleId},
|
||||
dataType: 'json',
|
||||
success: function(result){
|
||||
if (result.status == 1) {
|
||||
layer.msg(result.message, function(){
|
||||
parent.window.location.href = "{:U('batches')}"
|
||||
})
|
||||
} else {
|
||||
layer.msg(result.message)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
$('#close-btn').on({
|
||||
click: function () {
|
||||
var index = parent.layer.getFrameIndex(window.name)
|
||||
parent.layer.close(index)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,477 @@
|
||||
<extend name="Public/base"/>
|
||||
<block name="css">
|
||||
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="__CSS__/promote.css" type="text/css"/>
|
||||
<script src="__STATIC__/laydate/laydate.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="__STATIC__/webuploader/webuploader.css" media="all">
|
||||
<style>
|
||||
.select2-container--open {
|
||||
z-index: 1001;
|
||||
}
|
||||
.select2-container--default .select2-selection--single {
|
||||
color: #000;
|
||||
resize: none;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
|
||||
box-shadow: 0px 3px 3px #F7F8F9 inset;height:35px;
|
||||
height:28px;border-radius:3px;font-size:12px;
|
||||
}
|
||||
.select2-container--default .select2-selection--single .select2-selection__rendered {
|
||||
line-height:35px;
|
||||
line-height:28px;
|
||||
}
|
||||
.select2-container--default .select2-selection--single .select2-selection__arrow {
|
||||
height:26px;
|
||||
}
|
||||
.select2-container--default .select2-search--dropdown .select2-search__field {
|
||||
height:26px;line-height:26px;font-size:12px;
|
||||
}
|
||||
.select2-results__option[aria-selected] {font-size:12px;}
|
||||
.textarea-style {
|
||||
width: 200px;
|
||||
height: 80px;
|
||||
border-radius: 5px;
|
||||
padding: 5px;
|
||||
}
|
||||
.mustmark {
|
||||
color: #FF0000;
|
||||
font-style: normal;
|
||||
margin: 0 3px;
|
||||
}
|
||||
.clearfix:after {
|
||||
content: "\20";
|
||||
display: block;
|
||||
height: 0;
|
||||
clear: both;
|
||||
}
|
||||
.clearfix {
|
||||
*zoom: 1;
|
||||
}
|
||||
.butnbox {
|
||||
padding: 10px 0 10px;
|
||||
}
|
||||
.butnbox .butnlist .butn {
|
||||
display: inline-block;
|
||||
width: 120px;
|
||||
height: 28px;
|
||||
line-height: 28px;
|
||||
text-align: center;
|
||||
color: #FFF;
|
||||
background: #3C95C8;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.data_list table td .status-0 {
|
||||
color: #e6a23c;
|
||||
}
|
||||
.data_list table td .status-1 {
|
||||
color: #67c23a;
|
||||
}
|
||||
.data_list table td .status-2 {
|
||||
color: #f56c6c;
|
||||
}
|
||||
</style>
|
||||
</block>
|
||||
<block name="body">
|
||||
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
|
||||
<script type="text/javascript" src="__JS__/select2.min.js"></script>
|
||||
<script type="text/javascript" src="__JS__/jquery.form.js"></script>
|
||||
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
|
||||
|
||||
<script src="__STATIC__/md5.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="__STATIC__/webuploader/webuploader.js"></script>
|
||||
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
|
||||
<script type="text/javascript" src="__STATIC__/layer/extend/layer.ext.js"></script>
|
||||
<div class="cf main-place top_nav_list navtab_list">
|
||||
<h3 class="page_title">测试资源申请批次</h3>
|
||||
</div>
|
||||
<div class="cf top_nav_list" style="height: 38px;">
|
||||
<!-- 高级搜索 -->
|
||||
<div class="jssearch cf search_list">
|
||||
<div class="input-list search-title-box">
|
||||
<label>搜索:</label>
|
||||
</div>
|
||||
<div class="input-list input-list-promote search_label_rehab">
|
||||
<select id="game_id" name="game_id" class="select_gallery" style="width:120px;">
|
||||
<option value="0">请选游戏</option>
|
||||
<?php foreach($games as $game):?>
|
||||
<option game-id="<?=$game['id']?>" value="<?=$game['id']?>"><?=$game['game_name']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-list input-list-promote search_label_rehab">
|
||||
<select id="server_id" name="server_id" class="select_gallery" style="width:120px;">
|
||||
<option value="">请选择区服</option>
|
||||
<?php foreach($servers as $server):?>
|
||||
<option server-id="<?=$server['server_id']?>" value="<?=$server['server_id']?>">
|
||||
<?=$server['server_name']?>
|
||||
</option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-list">
|
||||
<input type="text" name="account" placeholder="测试账号" class="" value="" style="width: 150px">
|
||||
</div>
|
||||
<div class="input-list input-list-promote search_label_rehab">
|
||||
<input type="text" readonly name="create_time_start" class="time-select" value="{:I('create_time_start')}"
|
||||
placeholder="申请开始时间"/>
|
||||
-
|
||||
<div class="input-append date" id="datetimepicker" style="display:inline-block">
|
||||
<input type="text" readonly name="create_time_end" class="time-select" value="{:I('create_time_end')}"
|
||||
placeholder="申请结束时间"/>
|
||||
<span class="add-on"><i class="icon-th"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-list input-list-promote search_label_rehab">
|
||||
<select name="verify_status" class="select_gallery" style="width:120px;">
|
||||
<option value="-1">请选择审核状态</option>
|
||||
<?php foreach($verifyStatusList as $key => $name):?>
|
||||
<option value="<?=$key?>">
|
||||
<?=$name?>
|
||||
</option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-list input-list-promote search_label_rehab">
|
||||
<select name="provide_status" class="select_gallery" style="width:120px;">
|
||||
<option value="-1">请选择发放状态</option>
|
||||
<?php foreach($provideStatusList as $key => $name):?>
|
||||
<option value="<?=$key?>">
|
||||
<?=$name?>
|
||||
</option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-list">
|
||||
<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>
|
||||
</div>
|
||||
<!-- <div class="input-list">
|
||||
<a class="sch-btn" href="{:U('Export/expUser',array_merge(array('id'=>12,),I('get.')))}">导出</a>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
<div class="butnbox">
|
||||
<div class="butnlist jscheckbutn" style="margin-left: 2px">
|
||||
<a class="butn" id="verify-agree-btn">审批通过</a>
|
||||
<a class="butn" id="verify-refuse-btn" style="background-color: red;">审核拒绝</a>
|
||||
<a class="butn" id="provide-agree-btn">设为已发放</a>
|
||||
<a class="butn" id="provide-refuse-btn" style="background-color: red;">设为发放失败</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 数据列表 -->
|
||||
<div class="data_list">
|
||||
<div class="">
|
||||
<table>
|
||||
<!-- 表头 -->
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<input class="check-all" type="checkbox">
|
||||
</th>
|
||||
<th width="125px">批次号</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>发放时间</th>
|
||||
<!-- <th>资源内容</th> -->
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<!-- 列表 -->
|
||||
<tbody>
|
||||
<empty name ="records">
|
||||
<td colspan="99" class="text-center">aOh! 暂时还没有内容!</td>
|
||||
<else />
|
||||
<volist name="records" id="record" mod="2">
|
||||
<tr data-id="{$record.id}" class="<eq name='mod' value='1'>odd</eq>">
|
||||
<td><input class="ids" type="checkbox" value="{$record['id']}" name="ids[]"></td>
|
||||
<td style="word-wrap:break-word;">{$record.batch_no}</td>
|
||||
<td>
|
||||
<?=substr($record['create_time'], 0, 10)?>
|
||||
<br>
|
||||
<?=substr($record['create_time'], 10)?>
|
||||
</td>
|
||||
<td>{$record.game_name}</td>
|
||||
<td>{$record.server_name}</td>
|
||||
<td>{$record.role_name}</td>
|
||||
<td>{$record.user_account}</td>
|
||||
<td>{$record.user_phone}</td>
|
||||
<td>{$record.promote_account}</td>
|
||||
<td>{$record.apply_promote_account}</td>
|
||||
<!-- <td>{$record.history_provide_amount}</td> -->
|
||||
<td>{$record.apply_amount}</td>
|
||||
<td>{$record.provide_amount}</td>
|
||||
<td>
|
||||
<span class="status-{$record.verify_status}">{$record.verify_status_text}</span>
|
||||
</td>
|
||||
<td>
|
||||
<?=substr($record['verify_time'], 0, 10)?>
|
||||
<br>
|
||||
<?=substr($record['verify_time'], 10)?>
|
||||
</td>
|
||||
<td>
|
||||
<span class="status-{$record.provide_status}">{$record.provide_status_text}</span>
|
||||
</td>
|
||||
<td>
|
||||
<?=substr($record['provide_time'], 0, 10)?>
|
||||
<br>
|
||||
<?=substr($record['provide_time'], 10)?>
|
||||
</td>
|
||||
<!-- <td>{$record.content}</td> -->
|
||||
<td>
|
||||
<a href="javascript:;" class="view-detail">查看</a>
|
||||
</td>
|
||||
</tr>
|
||||
</volist>
|
||||
</empty>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="page">
|
||||
|
||||
<a class="sch-btn export-btn"
|
||||
href="{:U(CONTROLLER_NAME.'/'.ACTION_NAME,array_merge(['export'=>1],I('get.')))}" target="_blank">导出</a>
|
||||
|
||||
{$_page|default=''}
|
||||
</div>
|
||||
|
||||
<div class="common_settings">
|
||||
<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
|
||||
<form class="addShortcutIcon">
|
||||
<input type="hidden" name="title" value="{$m_title}">
|
||||
<input type="hidden" name="url" value="Query/withdraw">
|
||||
</form>
|
||||
<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
|
||||
</div>
|
||||
|
||||
<div id="add-box" class="layer-box" style="display: none;">
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<div class="form-group">
|
||||
<label>用户账号</label>
|
||||
<div class="form-item" style="width:200px">
|
||||
<select name="base_game_id" class="select_gallery" style="width:220px;">
|
||||
<option value="0">游戏名称</option>
|
||||
<?php foreach($baseGames as $baseGame):?>
|
||||
<option value="<?=$baseGame['id']?>"><?=$baseGame['name']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>初始额度</label>
|
||||
<div class="form-item" style="width:200px">
|
||||
<input type="text" class="form-input" name="base_quota" style="width:200px" value="" placeholder="请输入初始额度">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>奖金池比例</label>
|
||||
<div class="form-item" style="width:200px">
|
||||
<input type="text" class="form-input" name="rate" style="width:155px" value="" placeholder="请输入奖金池比例"> %
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label></label>
|
||||
<a id="add-submit" href="javascript:;" class="add-submit btn">确定</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</block>
|
||||
|
||||
<block name="script">
|
||||
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
|
||||
<script type="text/javascript" src="__STATIC__/layer/extend/layer.ext.js" ></script>
|
||||
<script src="__STATIC__/jquery.cookie.js" charset="utf-8"></script>
|
||||
<script>
|
||||
<volist name=":I('get.')" id="vo">
|
||||
Think.setValue('{$key}',"{$vo}");
|
||||
</volist>
|
||||
$(".select_gallery").select2();
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
//导航高亮
|
||||
highlight_subnav("{:U('TestingResource/batches')}");
|
||||
$(function(){
|
||||
// 添加全部选项
|
||||
if ('all' == "{:I('row', 0)}") {
|
||||
$("#pagechange").prepend("<option value='all' selected>全部</option>");
|
||||
} else {
|
||||
$("#pagechange").prepend("<option value='all'>全部</option>");
|
||||
}
|
||||
|
||||
$('.time-select').each(function(){
|
||||
laydate.render({
|
||||
elem: this,
|
||||
type: 'date'
|
||||
});
|
||||
});
|
||||
//搜索功能
|
||||
$("#search").click(function(){
|
||||
|
||||
var url = $(this).attr('url');
|
||||
var query = $('.jssearch').find('input').serialize();
|
||||
query += "&"+$('.jssearch').find('select').serialize();
|
||||
//query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
|
||||
query = query.replace(/^&/g,'');
|
||||
if( url.indexOf('?')>0 ){
|
||||
url += '&' + query;
|
||||
}else{
|
||||
url += '?' + query;
|
||||
}
|
||||
window.location.href = url;
|
||||
});
|
||||
//回车自动提交
|
||||
$('.jssearch').find('input').keyup(function(event){
|
||||
if(event.keyCode===13){
|
||||
$("#search").click();
|
||||
}
|
||||
});
|
||||
$('.view-detail').on({
|
||||
click:function () {
|
||||
var url = "{:U('TestingResource/orders', '', '')}"
|
||||
var id = $(this).parents('tr').eq(0).attr('data-id')
|
||||
url += '/id/' + id
|
||||
layer.open({
|
||||
title: '查看申请订单',
|
||||
type: 2,
|
||||
content: [url , 'no'],
|
||||
area: ['1200px', '400px'],
|
||||
zIndex: 250,
|
||||
scrollbar: false,
|
||||
})
|
||||
}
|
||||
})
|
||||
function getIds() {
|
||||
var ids = [];
|
||||
$('.ids:checked').each(function() {
|
||||
ids.push($(this).val());
|
||||
})
|
||||
return ids;
|
||||
}
|
||||
$("#game_id").change(function () {
|
||||
$.ajax({
|
||||
url: "{:U('getServers')}",
|
||||
type: "post",
|
||||
data: { game_id: $("#game_id option:selected").attr('game-id') },
|
||||
dataType: 'json',
|
||||
success: function (result ) {
|
||||
if (result.status == 1) {
|
||||
var servers = result.data.servers
|
||||
var str = "<option value=''>请选择区服</option>"
|
||||
for (var i in servers){
|
||||
str += "<option value='"+servers[i].server_id+"'>"+servers[i].server_name+"</option>"
|
||||
}
|
||||
$("#server_id").empty()
|
||||
$("#server_id").append(str)
|
||||
$("#server_id").select2()
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
$('#verify-agree-btn').on({
|
||||
click:function () {
|
||||
var ids = getIds()
|
||||
if (ids.length == 0) {
|
||||
return layer.msg('请选择要操作的批次')
|
||||
}
|
||||
layer.confirm('确定要审核通过这些批次吗?', {
|
||||
title: '审核通过',
|
||||
btn: ['确定']
|
||||
}, function(){
|
||||
verify(ids, 1)
|
||||
})
|
||||
}
|
||||
})
|
||||
$('#verify-refuse-btn').on({
|
||||
click:function () {
|
||||
var ids = getIds()
|
||||
if (ids.length == 0) {
|
||||
return layer.msg('请选择要操作的批次')
|
||||
}
|
||||
layer.confirm('确定要审核拒绝这些批次吗?', {
|
||||
title: '审核拒绝',
|
||||
btn: ['确定']
|
||||
}, function(){
|
||||
verify(ids, 2)
|
||||
})
|
||||
}
|
||||
})
|
||||
$('#provide-agree-btn').on({
|
||||
click:function () {
|
||||
var ids = getIds()
|
||||
if (ids.length == 0) {
|
||||
return layer.msg('请选择要操作的批次')
|
||||
}
|
||||
layer.confirm('确定将这些批次设为已发放吗?', {
|
||||
title: '设为已发放',
|
||||
btn: ['确定']
|
||||
}, function(){
|
||||
provide(ids, 1)
|
||||
})
|
||||
}
|
||||
})
|
||||
$('#provide-refuse-btn').on({
|
||||
click:function () {
|
||||
var ids = getIds()
|
||||
if (ids.length == 0) {
|
||||
return layer.msg('请选择要操作的批次')
|
||||
}
|
||||
layer.confirm('确定将这些批次设为发放失败吗?', {
|
||||
title: '设为发放失败',
|
||||
btn: ['确定']
|
||||
}, function(){
|
||||
provide(ids, 2)
|
||||
})
|
||||
}
|
||||
})
|
||||
function verify(ids, status) {
|
||||
$.ajax({
|
||||
url: "{:U('verify')}",
|
||||
type: "post",
|
||||
data: { ids: ids, status: status },
|
||||
dataType: 'json',
|
||||
success: function (result ) {
|
||||
if (result.status == 1) {
|
||||
layer.msg(result.message, function(){
|
||||
window.location.href = window.location.href
|
||||
})
|
||||
} else {
|
||||
layer.msg(result.message)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
function provide(ids, status) {
|
||||
$.ajax({
|
||||
url: "{:U('provide')}",
|
||||
type: "post",
|
||||
data: { ids: ids, status: status },
|
||||
dataType: 'json',
|
||||
success: function (result ) {
|
||||
if (result.status == 1) {
|
||||
layer.msg(result.message, function(){
|
||||
window.location.href = window.location.href
|
||||
})
|
||||
} else {
|
||||
layer.msg(result.message)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</block>
|
@ -0,0 +1,352 @@
|
||||
<extend name="Public/base"/>
|
||||
<block name="css">
|
||||
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="__CSS__/promote.css" type="text/css"/>
|
||||
<script src="__STATIC__/laydate/laydate.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="__STATIC__/webuploader/webuploader.css" media="all">
|
||||
<style>
|
||||
.select2-container--open {
|
||||
z-index: 1001;
|
||||
}
|
||||
.select2-container--default .select2-selection--single {
|
||||
color: #000;
|
||||
resize: none;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
|
||||
box-shadow: 0px 3px 3px #F7F8F9 inset;height:35px;
|
||||
height:28px;border-radius:3px;font-size:12px;
|
||||
}
|
||||
.select2-container--default .select2-selection--single .select2-selection__rendered {
|
||||
line-height:35px;
|
||||
line-height:28px;
|
||||
}
|
||||
.select2-container--default .select2-selection--single .select2-selection__arrow {
|
||||
height:26px;
|
||||
}
|
||||
.select2-container--default .select2-search--dropdown .select2-search__field {
|
||||
height:26px;line-height:26px;font-size:12px;
|
||||
}
|
||||
.select2-results__option[aria-selected] {font-size:12px;}
|
||||
.textarea-style {
|
||||
width: 200px;
|
||||
height: 80px;
|
||||
border-radius: 5px;
|
||||
padding: 5px;
|
||||
}
|
||||
.mustmark {
|
||||
color: #FF0000;
|
||||
font-style: normal;
|
||||
margin: 0 3px;
|
||||
}
|
||||
.clearfix:after {
|
||||
content: "\20";
|
||||
display: block;
|
||||
height: 0;
|
||||
clear: both;
|
||||
}
|
||||
.clearfix {
|
||||
*zoom: 1;
|
||||
}
|
||||
</style>
|
||||
</block>
|
||||
<block name="body">
|
||||
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
|
||||
<script type="text/javascript" src="__JS__/select2.min.js"></script>
|
||||
<script type="text/javascript" src="__JS__/jquery.form.js"></script>
|
||||
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
|
||||
|
||||
<script src="__STATIC__/md5.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="__STATIC__/webuploader/webuploader.js"></script>
|
||||
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
|
||||
<script type="text/javascript" src="__STATIC__/layer/extend/layer.ext.js"></script>
|
||||
<div class="cf main-place top_nav_list navtab_list">
|
||||
<h3 class="page_title">游戏测试资源设置</h3>
|
||||
</div>
|
||||
<div class="cf top_nav_list">
|
||||
<!-- 高级搜索 -->
|
||||
<div class="jssearch cf search_list">
|
||||
<div class="input-list search-title-box">
|
||||
<label>搜索:</label>
|
||||
</div>
|
||||
<div class="input-list input-list-promote search_label_rehab">
|
||||
<select id="base_game_id" name="base_game_id" class="select_gallery" style="width:120px;">
|
||||
<option value="0">游戏名称</option>
|
||||
<?php foreach($baseGames as $baseGame):?>
|
||||
<option value="<?=$baseGame['id']?>"><?=$baseGame['name']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-list input-list-promote search_label_rehab">
|
||||
<select id="partner_id" name="partner_id" class="select_gallery" style="width:120px;">
|
||||
<option value="">游戏合作方</option>
|
||||
<?php foreach($partners as $partner):?>
|
||||
<option value="<?=$partner['id']?>"><?=$partner['partner']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-list">
|
||||
<a class="sch-btn" href="javascript:;" id="search" url="{:U('TestingResource/gameSettings')}">搜索</a>
|
||||
<a class="sch-btn" href="javascript:;" id="add-btn">新增</a>
|
||||
</div>
|
||||
<!-- <div class="input-list">
|
||||
<a class="sch-btn" href="{:U('Export/expUser',array_merge(array('id'=>12,),I('get.')))}">导出</a>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 数据列表 -->
|
||||
<div class="data_list">
|
||||
<div class="">
|
||||
<table>
|
||||
<!-- 表头 -->
|
||||
<thead>
|
||||
<tr>
|
||||
<th>游戏名称</th>
|
||||
<th>游戏合作方</th>
|
||||
<th>初始额度</th>
|
||||
<th>奖金比例</th>
|
||||
<th>当前已申请资源</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<!-- 列表 -->
|
||||
<tbody>
|
||||
<empty name ="records">
|
||||
<td colspan="99" class="text-center">aOh! 暂时还没有内容!</td>
|
||||
<else />
|
||||
<volist name="records" id="data">
|
||||
<tr data-id="<?=$data['id']?>">
|
||||
<td class="base_game_id" data-value="{$data.base_game_id}">{$data.game_name}</td>
|
||||
<td>{$data.partner_name}</td>
|
||||
<td class="base_quota" data-value="{$data.base_quota}">{$data.base_quota}</td>
|
||||
<td class="rate" data-value="{$data.rate}">{$data.rate}%</td>
|
||||
<td>{$data.provide_quota}</td>
|
||||
<td>
|
||||
<div class="partakebtn">
|
||||
<a class="edit-setting">编辑</a>
|
||||
<a class="delete-btn">删除</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</volist>
|
||||
</empty>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="page">
|
||||
<if condition="$role_export_check eq true ">
|
||||
<a class="sch-btn export-btn"
|
||||
href="{:U(CONTROLLER_NAME.'/'.ACTION_NAME,array_merge(['export'=>1],I('get.')))}" target="_blank">导出</a>
|
||||
</if>
|
||||
{$_page|default=''}
|
||||
</div>
|
||||
|
||||
<div class="common_settings">
|
||||
<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
|
||||
<form class="addShortcutIcon">
|
||||
<input type="hidden" name="title" value="{$m_title}">
|
||||
<input type="hidden" name="url" value="Query/withdraw">
|
||||
</form>
|
||||
<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
|
||||
</div>
|
||||
|
||||
<div id="add-box" class="layer-box" style="display: none;">
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<div class="form-group">
|
||||
<label>用户账号</label>
|
||||
<div class="form-item" style="width:200px">
|
||||
<select name="base_game_id" class="select_gallery" style="width:220px;">
|
||||
<option value="0">游戏名称</option>
|
||||
<?php foreach($baseGames as $baseGame):?>
|
||||
<option value="<?=$baseGame['id']?>"><?=$baseGame['name']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>初始额度</label>
|
||||
<div class="form-item" style="width:200px">
|
||||
<input type="text" class="form-input" name="base_quota" style="width:200px" value="" placeholder="请输入初始额度">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>奖金池比例</label>
|
||||
<div class="form-item" style="width:200px">
|
||||
<input type="text" class="form-input" name="rate" style="width:155px" value="" placeholder="请输入奖金池比例"> %
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label></label>
|
||||
<a id="add-submit" href="javascript:;" class="add-submit btn">确定</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</block>
|
||||
|
||||
<block name="script">
|
||||
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
|
||||
<script type="text/javascript" src="__STATIC__/layer/extend/layer.ext.js" ></script>
|
||||
<script src="__STATIC__/jquery.cookie.js" charset="utf-8"></script>
|
||||
<script>
|
||||
<volist name=":I('get.')" id="vo">
|
||||
Think.setValue('{$key}',"{$vo}");
|
||||
</volist>
|
||||
$(".select_gallery").select2();
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
//导航高亮
|
||||
highlight_subnav("{:U('TestingResource/gameSettings')}");
|
||||
$(function(){
|
||||
// 添加全部选项
|
||||
if ('all' == "{:I('row', 0)}") {
|
||||
$("#pagechange").prepend("<option value='all' selected>全部</option>");
|
||||
} else {
|
||||
$("#pagechange").prepend("<option value='all'>全部</option>");
|
||||
}
|
||||
|
||||
$('.time-select').each(function(){
|
||||
laydate.render({
|
||||
elem: this,
|
||||
type: 'date'
|
||||
});
|
||||
});
|
||||
//搜索功能
|
||||
$("#search").click(function(){
|
||||
|
||||
var url = $(this).attr('url');
|
||||
var query = $('.jssearch').find('input').serialize();
|
||||
query += "&"+$('.jssearch').find('select').serialize();
|
||||
//query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
|
||||
query = query.replace(/^&/g,'');
|
||||
if( url.indexOf('?')>0 ){
|
||||
url += '&' + query;
|
||||
}else{
|
||||
url += '?' + query;
|
||||
}
|
||||
window.location.href = url;
|
||||
});
|
||||
//回车自动提交
|
||||
$('.jssearch').find('input').keyup(function(event){
|
||||
if(event.keyCode===13){
|
||||
$("#search").click();
|
||||
}
|
||||
});
|
||||
function getIds() {
|
||||
var ids = [];
|
||||
$('.ids:checked').each(function() {
|
||||
ids.push($(this).val());
|
||||
})
|
||||
return ids;
|
||||
}
|
||||
$('.delete-btn').on({
|
||||
click: function() {
|
||||
var id = $(this).parents('tr').eq(0).attr('data-id');
|
||||
$.ajax({
|
||||
url: '{:U("deleteGameSetting")}',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {id: id},
|
||||
success: function(result) {
|
||||
if (result.status == 1) {
|
||||
layer.msg(result.message)
|
||||
setTimeout(function() {
|
||||
window.location.href = window.location.href
|
||||
}, 200)
|
||||
} else {
|
||||
layer.msg(result.message)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
function setSettingForm(baseGameId, baseQuota, rate) {
|
||||
console.log(baseGameId)
|
||||
var box = $('#add-box')
|
||||
box.find('[name=base_game_id]').val(baseGameId)
|
||||
box.find('[name=base_quota]').val(baseQuota)
|
||||
box.find('[name=rate]').val(rate)
|
||||
}
|
||||
|
||||
$('.edit-setting').click(function () {
|
||||
var tr = $(this).parents('tr').eq(0);
|
||||
var baseGameId = tr.find('.base_game_id').attr('data-value');
|
||||
var baseQuota = tr.find('.base_quota').attr('data-value');
|
||||
var rate = tr.find('.rate').attr('data-value');
|
||||
|
||||
setSettingForm(baseGameId, baseQuota, rate);
|
||||
|
||||
var box = $('#add-box')
|
||||
layer.open({
|
||||
title: '新增',
|
||||
type: 1,
|
||||
content: box,
|
||||
area: ['500px', '300px'],
|
||||
zIndex: 250,
|
||||
})
|
||||
$(".select_gallery").select2();
|
||||
});
|
||||
|
||||
function isNumber(num){
|
||||
if(!num) {
|
||||
return false
|
||||
}
|
||||
var strPreg = /^\d+$/
|
||||
if(!strPreg.test(num)) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
$('#add-btn').click(function () {
|
||||
var box = $('#add-box')
|
||||
|
||||
setSettingForm(0, '', '');
|
||||
|
||||
layer.open({
|
||||
title: '新增',
|
||||
type: 1,
|
||||
content: box,
|
||||
area: ['500px', '300px'],
|
||||
zIndex: 250,
|
||||
})
|
||||
$(".select_gallery").select2();
|
||||
});
|
||||
$('.add-submit').on({
|
||||
click: function() {
|
||||
var box = $('#add-box')
|
||||
var baseGameId = box.find('[name=base_game_id]').val()
|
||||
var baseQuota = box.find('[name=base_quota]').val()
|
||||
var rate = box.find('[name=rate]').val()
|
||||
|
||||
if (!isNumber(baseQuota)) {
|
||||
return layer.msg('初始额度只能为正整数')
|
||||
}
|
||||
if (!isNumber(rate)) {
|
||||
return layer.msg('奖金池比例只能为正整数')
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: '{:U("saveGameSetting")}',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: { base_game_id: baseGameId, base_quota: baseQuota, rate: rate },
|
||||
success: function(result) {
|
||||
if (result.status == 1) {
|
||||
layer.msg(result.message)
|
||||
setTimeout(function() {
|
||||
window.location.href = window.location.href
|
||||
}, 200)
|
||||
} else {
|
||||
layer.msg(result.message)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
</block>
|
@ -0,0 +1,463 @@
|
||||
<extend name="Public/base"/>
|
||||
<block name="css">
|
||||
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="__CSS__/promote.css" type="text/css"/>
|
||||
<script src="__STATIC__/laydate/laydate.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="__STATIC__/webuploader/webuploader.css" media="all">
|
||||
<style>
|
||||
.select2-container--open {
|
||||
z-index: 1001;
|
||||
}
|
||||
.select2-container--default .select2-selection--single {
|
||||
color: #000;
|
||||
resize: none;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
|
||||
box-shadow: 0px 3px 3px #F7F8F9 inset;height:35px;
|
||||
height:28px;border-radius:3px;font-size:12px;
|
||||
}
|
||||
.select2-container--default .select2-selection--single .select2-selection__rendered {
|
||||
line-height:35px;
|
||||
line-height:28px;
|
||||
}
|
||||
.select2-container--default .select2-selection--single .select2-selection__arrow {
|
||||
height:26px;
|
||||
}
|
||||
.select2-container--default .select2-search--dropdown .select2-search__field {
|
||||
height:26px;line-height:26px;font-size:12px;
|
||||
}
|
||||
.select2-results__option[aria-selected] {font-size:12px;}
|
||||
.textarea-style {
|
||||
width: 200px;
|
||||
height: 80px;
|
||||
border-radius: 5px;
|
||||
padding: 5px;
|
||||
}
|
||||
.mustmark {
|
||||
color: #FF0000;
|
||||
font-style: normal;
|
||||
margin: 0 3px;
|
||||
}
|
||||
.clearfix:after {
|
||||
content: "\20";
|
||||
display: block;
|
||||
height: 0;
|
||||
clear: both;
|
||||
}
|
||||
.clearfix {
|
||||
*zoom: 1;
|
||||
}
|
||||
</style>
|
||||
</block>
|
||||
<block name="body">
|
||||
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
|
||||
<script type="text/javascript" src="__JS__/select2.min.js"></script>
|
||||
<script type="text/javascript" src="__JS__/jquery.form.js"></script>
|
||||
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
|
||||
|
||||
<script src="__STATIC__/md5.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="__STATIC__/webuploader/webuploader.js"></script>
|
||||
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
|
||||
<script type="text/javascript" src="__STATIC__/layer/extend/layer.ext.js"></script>
|
||||
<div class="cf main-place top_nav_list navtab_list">
|
||||
<h3 class="page_title">测试账号</h3>
|
||||
</div>
|
||||
<div class="cf top_nav_list">
|
||||
<!-- 高级搜索 -->
|
||||
<div class="fl button_list">
|
||||
<div class="tools">
|
||||
<empty name="show_status">
|
||||
|
||||
<a class="fr" id="apply" href="javascript:;"><span class="button_icon button_icon9"></span>批量申请后续</a>
|
||||
<a class="fr" id="add-test-user" href="javascript:;"><span class="button_icon button_icon1"></span>新增测试账号</a>
|
||||
<!-- <a class="fr" id="batch_freeze"><span class="button_icon button_icon5 "></span>批量锁定</a>-->
|
||||
</empty>
|
||||
</div>
|
||||
</div>
|
||||
<div class="jssearch fl cf search_list">
|
||||
<div class="input-list search-title-box">
|
||||
<label>搜索:</label>
|
||||
</div>
|
||||
<div class="input-list input-list-promote search_label_rehab">
|
||||
<select id="game_id" name="game_id" class="select_gallery" style="width:120px;">
|
||||
<option value="0">请选游戏</option>
|
||||
<?php foreach($games as $game):?>
|
||||
<option game-id="<?=$game['id']?>" value="<?=$game['id']?>"><?=$game['game_name']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-list input-list-promote search_label_rehab">
|
||||
<select id="server_id" name="server_id" class="select_gallery" style="width:120px;">
|
||||
<option value="">请选择区服</option>
|
||||
<?php foreach($servers as $server):?>
|
||||
<option server-id="<?=$server['server_id']?>" value="<?=$server['server_id']?>">
|
||||
<?=$server['server_name']?>
|
||||
</option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-list">
|
||||
<input type="text" name="account" placeholder="测试账号" class="" value="" style="width: 150px">
|
||||
</div>
|
||||
<div class="input-list">
|
||||
<input type="text" name="role_name" placeholder="角色名称" class="" value="" style="width: 150px">
|
||||
</div>
|
||||
<div class="input-list input-list-promote search_label_rehab">
|
||||
<input type="text" readonly name="create_time_start" class="time-select" value="{:I('create_time_start')}"
|
||||
placeholder="创建开始时间"/>
|
||||
-
|
||||
<div class="input-append date" id="datetimepicker" style="display:inline-block">
|
||||
<input type="text" readonly name="create_time_end" class="time-select" value="{:I('create_time_end')}"
|
||||
placeholder="创建结束时间"/>
|
||||
<span class="add-on"><i class="icon-th"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-list">
|
||||
<a class="sch-btn" href="javascript:;" id="search" url="{:U('TestingResource/index')}">搜索</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 数据列表 -->
|
||||
<div class="data_list">
|
||||
<div class="">
|
||||
<table>
|
||||
<!-- 表头 -->
|
||||
<thead>
|
||||
<tr>
|
||||
<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>
|
||||
<th>状态</th>
|
||||
<th>创建时间</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<!-- 列表 -->
|
||||
<tbody>
|
||||
<empty name ="records">
|
||||
<td colspan="99" class="text-center">aOh! 暂时还没有内容!</td>
|
||||
<else />
|
||||
<volist name="records" id="record">
|
||||
<tr data-id="<?=$record['id']?>" data-binding-id="{$record.binding_id}" data-other-quota="{$record.other_quota}">
|
||||
<td>
|
||||
<input class="ids" type="radio" value="{$record['id']}" name="role_id">
|
||||
</td>
|
||||
<td>{$record.game_name}</td>
|
||||
<td>{$record.server_name}</td>
|
||||
<td>{$record.user_account}</td>
|
||||
<td>{$record.user_phone}</td>
|
||||
<td>{$record.role_name}</td>
|
||||
<td>{$record.bind_user_account}</td>
|
||||
<td>
|
||||
{$record.bind_role_name}
|
||||
</td>
|
||||
<td>{$record.base_quota}</td>
|
||||
<td>{$record.other_quota}</td>
|
||||
<td>{$record.quota}</td>
|
||||
<td>{$record.verify_amount}</td>
|
||||
<td>{$record.provide_amount}</td>
|
||||
<td>{$record.today_amount}</td>
|
||||
<td>{$record.apply_amount}</td>
|
||||
<td>{$record.status}</td>
|
||||
<td>
|
||||
<?=substr($record['create_time'], 0, 10)?>
|
||||
<br>
|
||||
<?=substr($record['create_time'], 10)?>
|
||||
</td>
|
||||
<td>
|
||||
<a href="javascript:;" class="set-quota-btn">设置额外额度</a>
|
||||
<?php if($record['binding_id'] > 0):?>
|
||||
<a href="javascript:;" style="color: #f56c6c" class="unbind-btn">解绑角色</a>
|
||||
<?php endif;?>
|
||||
</td>
|
||||
</tr>
|
||||
</volist>
|
||||
</empty>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="page">
|
||||
<if condition="$role_export_check eq true ">
|
||||
<a class="sch-btn export-btn"
|
||||
href="{:U(CONTROLLER_NAME.'/'.ACTION_NAME,array_merge(['export'=>1],I('get.')))}" target="_blank">导出</a>
|
||||
</if>
|
||||
{$_page|default=''}
|
||||
</div>
|
||||
|
||||
<div class="common_settings">
|
||||
<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
|
||||
<form class="addShortcutIcon">
|
||||
<input type="hidden" name="title" value="{$m_title}">
|
||||
<input type="hidden" name="url" value="Query/withdraw">
|
||||
</form>
|
||||
<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
|
||||
</div>
|
||||
|
||||
<div id="add-box" class="layer-box" style="display: none;">
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<div class="form-group">
|
||||
<label>用户账号</label>
|
||||
<div class="form-item" style="width: 400px;">
|
||||
<textarea name="accounts" placeholder="用户账号以英文逗号(,)隔开" class="form-input" id="" cols="50" rows="10"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label></label>
|
||||
<a id="add-submit" href="javascript:;" class="add-submit btn">确定</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div id="other-quota-box" class="layer-box" style="display: none;">
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="id" value="">
|
||||
<div class="form-group">
|
||||
<label>额外额度</label>
|
||||
<div class="form-item" style="width: 280px;">
|
||||
<input type="text" class="form-input" name="other_quota" value="" style="width:250px">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label></label>
|
||||
<a id="quota-submit" href="javascript:;" class="add-submit btn">确定</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</block>
|
||||
|
||||
<block name="script">
|
||||
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
|
||||
<script type="text/javascript" src="__STATIC__/layer/extend/layer.ext.js" ></script>
|
||||
<script src="__STATIC__/jquery.cookie.js" charset="utf-8"></script>
|
||||
<script>
|
||||
<volist name=":I('get.')" id="vo">
|
||||
Think.setValue('{$key}',"{$vo}");
|
||||
</volist>
|
||||
$(".select_gallery").select2();
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
//导航高亮
|
||||
highlight_subnav("{:U('TestingResource/index')}");
|
||||
$(function(){
|
||||
// 添加全部选项
|
||||
if ('all' == "{:I('row', 0)}") {
|
||||
$("#pagechange").prepend("<option value='all' selected>全部</option>");
|
||||
} else {
|
||||
$("#pagechange").prepend("<option value='all'>全部</option>");
|
||||
}
|
||||
|
||||
$('.time-select').each(function(){
|
||||
laydate.render({
|
||||
elem: this,
|
||||
type: 'date'
|
||||
});
|
||||
});
|
||||
//搜索功能
|
||||
$("#search").click(function(){
|
||||
|
||||
var url = $(this).attr('url');
|
||||
var query = $('.jssearch').find('input').serialize();
|
||||
query += "&"+$('.jssearch').find('select').serialize();
|
||||
//query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
|
||||
query = query.replace(/^&/g,'');
|
||||
if( url.indexOf('?')>0 ){
|
||||
url += '&' + query;
|
||||
}else{
|
||||
url += '?' + query;
|
||||
}
|
||||
window.location.href = url;
|
||||
});
|
||||
//回车自动提交
|
||||
$('.jssearch').find('input').keyup(function(event){
|
||||
if(event.keyCode===13){
|
||||
$("#search").click();
|
||||
}
|
||||
});
|
||||
function getIds() {
|
||||
var ids = [];
|
||||
$('.ids:checked').each(function() {
|
||||
ids.push($(this).val());
|
||||
})
|
||||
return ids;
|
||||
}
|
||||
$('#add-test-user').click(function () {
|
||||
var box = $('#add-box')
|
||||
layer.open({
|
||||
title: '新增',
|
||||
type: 1,
|
||||
content: box,
|
||||
area: ['700px', '380px'],
|
||||
zIndex: 250,
|
||||
})
|
||||
})
|
||||
function isNumber(num){
|
||||
if(!num) {
|
||||
return false
|
||||
}
|
||||
var strPreg = /^\d+$/
|
||||
if(!strPreg.test(num)) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
$('.set-quota-btn').click(function () {
|
||||
var box = $('#other-quota-box')
|
||||
var tr = $(this).parents('tr').eq(0)
|
||||
var id = tr.attr('data-id')
|
||||
var otherQuota = tr.attr('data-other-quota')
|
||||
box.find('[name=id]').val(id)
|
||||
box.find('[name=other_quota]').val(otherQuota)
|
||||
layer.open({
|
||||
title: '设置额外额度',
|
||||
type: 1,
|
||||
content: box,
|
||||
area: ['500px', '200px'],
|
||||
zIndex: 250,
|
||||
})
|
||||
})
|
||||
$('#quota-submit').on({
|
||||
click: function() {
|
||||
var box = $('#other-quota-box')
|
||||
var id = box.find('[name=id]').val()
|
||||
var otherQuota = box.find('[name=other_quota]').val()
|
||||
if (!isNumber(otherQuota)) {
|
||||
return layer.msg('额外额度只能为正整数')
|
||||
}
|
||||
$.ajax({
|
||||
url: "{:U('setOtherQuota')}",
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
data: { id: id, other_quota: otherQuota },
|
||||
success: function (result) {
|
||||
if (result.status == 0) {
|
||||
layer.msg(result.message);
|
||||
} else {
|
||||
layer.msg(result.message, function(){
|
||||
window.location.href = window.location.href
|
||||
})
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
$('.unbind-btn').click(function () {
|
||||
var tr = $(this).parents('tr').eq(0)
|
||||
var bindingId = tr.attr('data-binding-id')
|
||||
layer.confirm('确定要解绑吗?', {
|
||||
// closeBtn:0,
|
||||
title: '解绑',
|
||||
btn: ['确定'] //按钮
|
||||
}, function(){
|
||||
$.ajax({
|
||||
async: false,
|
||||
url: "{:U('unbindRole')}",
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
data: { binding_id: bindingId },
|
||||
success: function (result) {
|
||||
if (result.status == 0) {
|
||||
layer.msg(result.message);
|
||||
} else {
|
||||
layer.msg(result.message, function(){
|
||||
window.location.href = window.location.href
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
$('#add-submit').on({
|
||||
click: function () {
|
||||
var box = $('#add-box')
|
||||
var accounts = box.find('[name=accounts]').val()
|
||||
console.log(accounts)
|
||||
$.ajax({
|
||||
async: false,
|
||||
url: "{:U('addTestingUsers')}",
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
data: { accounts: accounts },
|
||||
success: function (result) {
|
||||
if (result.status == 0) {
|
||||
layer.msg(result.message);
|
||||
} else {
|
||||
var message = '成功' + result.data.successCount + '个, 失败' + result.data.errorCount + '个, 已存在' + result.data.existCount + '个。'
|
||||
layer.confirm(message, {
|
||||
btn: ['确定'] //按钮
|
||||
}, function(){
|
||||
location.reload();
|
||||
})
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
$('#apply').click(function () {
|
||||
var title = '添加测试资源申请'
|
||||
var url = "{:U('TestingResource/apply', '', '')}"
|
||||
|
||||
var id = $('input[name=role_id]:checked').val()
|
||||
id = id == undefined ? 0 : id;
|
||||
if (id > 0) {
|
||||
url += '/id/' + id
|
||||
} else {
|
||||
return layer.msg('请选择测试账号角色')
|
||||
}
|
||||
|
||||
layer.open({
|
||||
title: title,
|
||||
type: 2,
|
||||
content: [url , 'no'],
|
||||
area: ['1000px', '600px'],
|
||||
zIndex: 250,
|
||||
scrollbar: false,
|
||||
})
|
||||
})
|
||||
|
||||
$("#game_id").change(function () {
|
||||
$.ajax({
|
||||
url: "{:U('getServers')}",
|
||||
type: "post",
|
||||
data: { game_id: $("#game_id option:selected").attr('game-id') },
|
||||
dataType: 'json',
|
||||
success: function (result ) {
|
||||
if (result.status == 1) {
|
||||
var servers = result.data.servers
|
||||
var str = "<option value=''>请选择区服</option>"
|
||||
for (var i in servers){
|
||||
str += "<option value='"+servers[i].server_id+"'>"+servers[i].server_name+"</option>"
|
||||
}
|
||||
$("#server_id").empty()
|
||||
$("#server_id").append(str)
|
||||
$("#server_id").select2()
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
});
|
||||
</script>
|
||||
</block>
|
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace Base\Repository;
|
||||
|
||||
use Base\Tool\Registry;
|
||||
|
||||
class GameRepository
|
||||
{
|
||||
public function getBaseGames($isRefresh = false)
|
||||
{
|
||||
$baseGames = Registry::get('base_games');
|
||||
if ($isRefresh || is_null($baseGames)) {
|
||||
$baseGames = M('base_game', 'tab_')->where('1=1')->select();
|
||||
Registry::set('base_games', $baseGames);
|
||||
}
|
||||
return $baseGames;
|
||||
}
|
||||
|
||||
public function getBaseGameByGameId($gameId, array $baseGames = null)
|
||||
{
|
||||
if (is_null($baseGames)) {
|
||||
return M('base_game', 'tab_')->where('android_game_id=' . $gameId . ' or ios_game_id=' . $gameId)->find();
|
||||
}
|
||||
foreach ($baseGames as $baseGame) {
|
||||
if ($baseGame['android_game_id'] == $gameId || $baseGame['ios_game_id'] == $gameId) {
|
||||
return $baseGame;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getChoiceGames(array $visibleGameIds = null, $fields = ['id', 'game_name'])
|
||||
{
|
||||
$map = [];
|
||||
$map['_string'] = '1=1';
|
||||
if (is_null($visibleGameIds)) {
|
||||
|
||||
} elseif (count($visibleGameIds) > 0) {
|
||||
$map['_string'] = ' and id in (' . implode(',', $visibleGameIds) . ')';
|
||||
} else {
|
||||
$map['_string'] = ' and 1=0';
|
||||
}
|
||||
return M('game', 'tab_')->field($fields)->where($map)->select();
|
||||
}
|
||||
|
||||
public function getServersByGameId($gameId, $fields = ['id', 'server_name', 'server_id'])
|
||||
{
|
||||
$map = [];
|
||||
$map['game_id'] = $gameId;
|
||||
return M('server', 'tab_')
|
||||
->field($fields)
|
||||
->where($map)
|
||||
->order('server_id asc')
|
||||
->select();
|
||||
}
|
||||
}
|
@ -0,0 +1,432 @@
|
||||
<?php
|
||||
|
||||
namespace Base\Repository;
|
||||
|
||||
use Base\Tool\Registry;
|
||||
use Base\Service\PromoteService;
|
||||
|
||||
class TestingResourceRepository
|
||||
{
|
||||
public static $provideStatusList = [
|
||||
'0' => '待发放',
|
||||
'1' => '已发放',
|
||||
'2' => '异常',
|
||||
];
|
||||
|
||||
public static $verifyStatusList = [
|
||||
'0' => '未审核',
|
||||
'1' => '审核通过',
|
||||
'2' => '审核拒绝',
|
||||
];
|
||||
|
||||
public function getProvideStatusText($provideStatus)
|
||||
{
|
||||
return self::$provideStatusList[$provideStatus] ?? '未知';
|
||||
}
|
||||
|
||||
public function getVerifyStatusText($verifyStatus)
|
||||
{
|
||||
return self::$verifyStatusList[$verifyStatus] ?? '未知';
|
||||
}
|
||||
|
||||
public function getGameRoleId($gameId, $roleId)
|
||||
{
|
||||
return $gameId . '#' . $roleId;
|
||||
}
|
||||
|
||||
public function getGameSettings($isRefresh = false)
|
||||
{
|
||||
$settings = Registry::get('testing_game_settings');
|
||||
if ($isRefresh || is_null($settings)) {
|
||||
$settings = M('testing_game_setting', 'tab_')->where('1=1')->select();
|
||||
Registry::set('testing_game_settings', $settings);
|
||||
}
|
||||
return $settings;
|
||||
}
|
||||
|
||||
public function getGameSetting($baseGameId)
|
||||
{
|
||||
return M('testing_game_setting', 'tab_')->where(['base_game_id' => $baseGameId])->find();
|
||||
}
|
||||
|
||||
public function getGameSettingByGameId($gameId)
|
||||
{
|
||||
$gameRepository = new GameRepository();
|
||||
$baseGame = $gameRepository->getBaseGameByGameId($gameId);
|
||||
$baseGameId = $baseGame ? $baseGame['id'] : 0;
|
||||
return $this->getGameSetting($baseGameId);
|
||||
}
|
||||
|
||||
public function getHadSettingGameIds()
|
||||
{
|
||||
$baseGameIds = M('testing_game_setting', 'tab_')->getField('base_game_id', true);
|
||||
if (empty($baseGameIds)) {
|
||||
return [];
|
||||
}
|
||||
$baseGames = M('base_game', 'tab_')->where(['id' => ['in', $baseGameIds]])->select();
|
||||
return array_merge(array_column($baseGames, 'android_game_id'), array_column($baseGames, 'ios_game_id'));
|
||||
}
|
||||
|
||||
public function getBatchesQuery($params, $promote = null)
|
||||
{
|
||||
$gameId = $params['game_id'] ?? 0;
|
||||
$serverId = $params['server_id'] ?? '';
|
||||
$createTimeStart = $params['create_time_start'] ?? '';
|
||||
$createTimeEnd = $params['create_time_end'] ?? '';
|
||||
$verifyStatus = $params['verify_status'] ?? -1;
|
||||
$provideStatus = $params['provide_status'] ?? -1;
|
||||
$account = $params['account'] ?? '';
|
||||
|
||||
$conditions = [];
|
||||
$conditions['_string'] = '1=1';
|
||||
|
||||
if (!is_null($promote)) {
|
||||
$promoteService = new PromoteService();
|
||||
$subSql = M('user', 'tab_')
|
||||
->where('id=tab_testing_resource_batch.user_id and promote_id in (' . $promoteService->subInSql($promote) . ')')
|
||||
->select(false);
|
||||
|
||||
$conditions['_string'] .= ' and exists (' . $subSql . ')';
|
||||
}
|
||||
|
||||
if ($createTimeStart) {
|
||||
$conditions['_string'] .= ' and create_time >=' . strtotime($createTimeStart . ' 00:00:00');
|
||||
}
|
||||
if ($createTimeEnd) {
|
||||
$conditions['_string'] .= ' and create_time <=' . strtotime($createTimeEnd . ' 23:59:59');
|
||||
}
|
||||
if ($verifyStatus != -1) {
|
||||
$conditions['verify_status'] = $verifyStatus;
|
||||
}
|
||||
if ($provideStatus != -1) {
|
||||
$conditions['provide_status'] = $provideStatus;
|
||||
}
|
||||
if ($gameId) {
|
||||
$conditions['game_id'] = $gameId;
|
||||
}
|
||||
if ($serverId) {
|
||||
$conditions['server_id'] = $serverId;
|
||||
}
|
||||
if ($account) {
|
||||
$user = M('user', 'tab_')->field(['id'])->where('account like "' . $account . '%"')->find();
|
||||
if ($user) {
|
||||
$conditions['user_id'] = $user['id'];
|
||||
} else {
|
||||
$conditions['_string'] .= ' and 1<>1';
|
||||
}
|
||||
}
|
||||
return M('testing_resource_batch', 'tab_')->where($conditions)->order('create_time desc');
|
||||
}
|
||||
|
||||
private function getBatchesRelations($batches)
|
||||
{
|
||||
$roles = [];
|
||||
$applyPromotes = [];
|
||||
$users = [];
|
||||
$promotes = [];
|
||||
if (count($batches) > 0) {
|
||||
$gameRoleIds = [];
|
||||
foreach ($batches as $batch) {
|
||||
$gameRoleIds[] = $this->getGameRoleId($batch['game_id'], $batch['role_id']);
|
||||
}
|
||||
$roles = M('user_play_info', 'tab_')
|
||||
->field(['id', 'game_name', 'server_name', 'role_name', 'game_role_id', 'user_account'])
|
||||
->where(['game_role_id' => ['in', $gameRoleIds]])
|
||||
->select();
|
||||
$roles = index_by_column('game_role_id', $roles);
|
||||
|
||||
$users = M('user', 'tab_')->field(['id', 'account', 'phone', 'promote_id'])->where(['id' => ['in', array_column($batches, 'user_id')]])->select();
|
||||
$users = index_by_column('id', $users);
|
||||
|
||||
$applyPromotes = M('promote', 'tab_')->field(['id', 'account'])->where(['id' => ['in', array_column($batches, 'apply_promote_id')]])->select();
|
||||
$applyPromotes = index_by_column('id', $applyPromotes);
|
||||
|
||||
if (count($users) > 0) {
|
||||
$promotes = M('promote', 'tab_')->field(['id', 'account'])->where(['id' => ['in', array_column($users, 'promote_id')]])->select();
|
||||
$promotes = index_by_column('id', $promotes);
|
||||
}
|
||||
}
|
||||
return [
|
||||
'roles' => $roles,
|
||||
'applyPromotes' => $applyPromotes,
|
||||
'users' => $users,
|
||||
'promotes' => $promotes,
|
||||
];
|
||||
}
|
||||
|
||||
public function makeBatchesRecords($batches)
|
||||
{
|
||||
$result = $this->getBatchesRelations($batches);
|
||||
$roles = $result['roles'];
|
||||
$applyPromotes = $result['applyPromotes'];
|
||||
$users = $result['users'];
|
||||
$promotes = $result['promotes'];
|
||||
|
||||
$records = [];
|
||||
foreach ($batches as $batch) {
|
||||
$roleKey = $this->getGameRoleId($batch['game_id'], $batch['role_id']);
|
||||
$role = isset($roles[$roleKey]) ? $roles[$roleKey] : null;
|
||||
$user = $users[$batch['user_id']] ?? null;
|
||||
$applyPromote = $applyPromotes[$batch['apply_promote_id']] ?? null;
|
||||
$promote = $user && isset($promotes[$user['promote_id']]) ? $promotes[$user['promote_id']] : null;
|
||||
$records[] = [
|
||||
'id' => $batch['id'],
|
||||
'batch_no' => substr($batch['batch_no'], 14),
|
||||
'create_time' => date('Y-m-d H:i:s', $batch['create_time']),
|
||||
'game_name' => $role ? $role['game_name'] : '--',
|
||||
'server_name' => $role ? $role['server_name'] : '--',
|
||||
'role_name' => $role ? $role['role_name'] : '--',
|
||||
'user_account' => $role ?$role['user_account'] : '--',
|
||||
'user_phone' => $user ? $user['phone'] : '',
|
||||
'apply_promote_account' => $applyPromote ? $applyPromote['account'] : '',
|
||||
'promote_account' => $promote['account'],
|
||||
// 'history_provide_amount' => 0.00,
|
||||
'apply_amount' => $batch['apply_amount'],
|
||||
'provide_amount' => $batch['provide_amount'],
|
||||
'verify_status' => $batch['verify_status'],
|
||||
'verify_status_text' => $this->getVerifyStatusText($batch['verify_status']),
|
||||
'verify_time' => $batch['verify_time'] == 0 ? '--' : date('Y-m-d H:i:s', $batch['verify_time']),
|
||||
'provide_status' => $batch['provide_status'],
|
||||
'provide_status_text' => $this->getProvideStatusText($batch['provide_status']),
|
||||
'provide_time' => $batch['provide_time'] == 0 ? '--' : date('Y-m-d H:i:s', $batch['provide_time']),
|
||||
'content' => $content,
|
||||
];
|
||||
}
|
||||
return $records;
|
||||
}
|
||||
|
||||
|
||||
private function statByRoles($roles)
|
||||
{
|
||||
$bindingOrWhere = [];
|
||||
foreach ($roles as $role) {
|
||||
$bindingOrWhere[] = '(role_id="' . $role['role_id'] . '" and game_id=' . $role['game_id'] . ')';
|
||||
}
|
||||
$userIds = array_unique(array_column($roles, 'user_id'));
|
||||
|
||||
$users = [];
|
||||
$bindings = [];
|
||||
$bindingRoles = [];
|
||||
$applyRecords = [];
|
||||
if (count($roles) > 0) {
|
||||
$users = M('user', 'tab_')->field(['id', 'phone', 'lock_status'])->where(['id' => ['in', $userIds]])->select();
|
||||
$users = index_by_column('id', $users);
|
||||
$bindingRows = M('testing_binding', 'tab_')->where(['_string' => implode(' or ', $bindingOrWhere)])->select();
|
||||
$bindingRoleIds = [];
|
||||
foreach ($bindingRows as $bindingRow) {
|
||||
$bindings[$this->getGameRoleId($bindingRow['game_id'], $bindingRow['role_id'])] = $bindingRow;
|
||||
$bindingRoleIds[] = $this->getGameRoleId($bindingRow['game_id'], $bindingRow['bind_role_id']);
|
||||
}
|
||||
if (count($bindings) > 0) {
|
||||
$bindingRoles = M('user_play_info', 'tab_')
|
||||
->field(['id', 'role_id', 'role_name', 'user_account', 'game_id', 'game_role_id'])
|
||||
->where(['game_role_id' => ['in', $bindingRoleIds]])
|
||||
->select();
|
||||
$bindingRoles = index_by_column('game_role_id', $bindingRoles);
|
||||
}
|
||||
|
||||
$verifyItems = M('testing_resource_batch', 'tab_')
|
||||
->field('sum(apply_amount) amount, game_id, role_id')
|
||||
->where([
|
||||
'verify_status' => 0,
|
||||
'_string' => implode(' or ', $bindingOrWhere)
|
||||
])
|
||||
->group('game_id,role_id')->select();
|
||||
$verifyRecords = [];
|
||||
foreach ($verifyItems as $item) {
|
||||
$verifyRecords[$this->getGameRoleId($item['game_id'], $item['role_id'])] = $item['amount'] ;
|
||||
}
|
||||
|
||||
$provideItems = M('testing_resource_batch', 'tab_')
|
||||
->field('sum(provide_amount) amount, game_id, role_id')
|
||||
->where([
|
||||
'verify_status' => 1,
|
||||
'_string' => implode(' or ', $bindingOrWhere)
|
||||
])
|
||||
->group('game_id,role_id')->select();
|
||||
$provideRecords = [];
|
||||
foreach ($provideItems as $item) {
|
||||
$provideRecords[$this->getGameRoleId($item['game_id'], $item['role_id'])] = $item['amount'] ;
|
||||
}
|
||||
|
||||
$todayProvideItems = M('testing_resource_batch', 'tab_')
|
||||
->field('sum(provide_amount) amount, game_id, role_id')
|
||||
->where([
|
||||
'verify_status' => 1,
|
||||
'_string' => implode(' or ', $bindingOrWhere),
|
||||
'provide_time' => ['egt', strtotime(date('Y-m-d 00:00:00'))],
|
||||
'provide_time' => ['elt', strtotime(date('Y-m-d 23:59:59'))],
|
||||
])
|
||||
->group('game_id,role_id')->select();
|
||||
$todayProvideRecords = [];
|
||||
foreach ($todayProvideItems as $item) {
|
||||
$todayProvideRecords[$this->getGameRoleId($item['game_id'], $item['role_id'])] = $item['amount'] ;
|
||||
}
|
||||
|
||||
$applyItems = M('testing_resource_batch', 'tab_')
|
||||
->field('sum(apply_amount) amount, game_id, role_id')
|
||||
->where([
|
||||
'_string' => implode(' or ', $bindingOrWhere),
|
||||
])
|
||||
->group('game_id,role_id')->select();
|
||||
$applyRecords = [];
|
||||
foreach ($applyItems as $item) {
|
||||
$applyRecords[$this->getGameRoleId($item['game_id'], $item['role_id'])] = $item['amount'] ;
|
||||
}
|
||||
|
||||
}
|
||||
$spendItems = [];
|
||||
if (count($bindingRoles) > 0) {
|
||||
$spendOrWhere = [];
|
||||
foreach ($bindingRoles as $bindingRole) {
|
||||
$spendOrWhere[] = '(game_player_id="' . $bindingRole['role_id'] . '" and game_id=' . $bindingRole['game_id'] . ')';
|
||||
}
|
||||
$spendCondition = [
|
||||
'pay_status' => 1,
|
||||
'_string' => '(' . implode(' or ', $spendOrWhere) . ')',
|
||||
];
|
||||
$spendList = M('spend', 'tab_')->field('sum(pay_amount) amount, game_id, game_player_id')->where($spendCondition)->group('game_id,game_player_id')->select();
|
||||
foreach ($spendList as $item) {
|
||||
$spendItems[$this->getGameRoleId($item['game_id'], $item['game_player_id'])] = $item['amount'];
|
||||
}
|
||||
}
|
||||
$gameSettings = $this->getGameSettings();
|
||||
return [
|
||||
'users' => $users,
|
||||
'spendItems' => $spendItems,
|
||||
'bindings' => $bindings,
|
||||
'bindingRoles' => $bindingRoles,
|
||||
'applyRecords' => $applyRecords,
|
||||
'provideRecords' => $provideRecords,
|
||||
'verifyRecords' => $verifyRecords,
|
||||
'todayProvideRecords' => $todayProvideRecords,
|
||||
'gameSettings' => $gameSettings,
|
||||
];
|
||||
}
|
||||
|
||||
public function makeTestingUserRecords($roles)
|
||||
{
|
||||
$result = $this->statByRoles($roles);
|
||||
$users = $result['users'];
|
||||
$spendItems = $result['spendItems'];
|
||||
$gameSettings = $result['gameSettings'];
|
||||
$bindings = $result['bindings'];
|
||||
$bindingRoles = $result['bindingRoles'];
|
||||
$applyRecords = $result['applyRecords'];
|
||||
$provideRecords = $result['provideRecords'];
|
||||
$verifyRecords = $result['verifyRecords'];
|
||||
$todayProvideRecords = $result['todayProvideRecords'];
|
||||
|
||||
$gameSettings = index_by_column('base_game_id', $gameSettings);
|
||||
$gameRepository = new GameRepository();
|
||||
$baseGames = $gameRepository->getBaseGames();
|
||||
|
||||
$records = [];
|
||||
foreach ($roles as $role) {
|
||||
$user = $users[$role['user_id']] ?? null;
|
||||
$binding = $bindings[$role['game_role_id']] ?? null;
|
||||
$bindingRole = null;
|
||||
if ($binding) {
|
||||
$bindGameRoleId = $this->getGameRoleId($binding['game_id'], $binding['bind_role_id']);
|
||||
$bindingRole = $bindingRoles[$bindGameRoleId] ? $bindingRoles[$bindGameRoleId] : null;
|
||||
}
|
||||
$baseGame = $gameRepository->getBaseGameByGameId($role['game_id'], $baseGames);
|
||||
$gameSetting = null;
|
||||
if ($baseGame && isset($gameSettings[$baseGame['id']])) {
|
||||
$gameSetting = $gameSettings[$baseGame['id']];
|
||||
}
|
||||
|
||||
$spendQuota = $bindingRole && isset($spendItems[$bindingRole['game_role_id']]) ? $spendItems[$bindingRole['game_role_id']] : 0;
|
||||
$quota = $gameSetting ? round($spendQuota * $gameSetting['rate'] / 100, 2) : 0;
|
||||
|
||||
$records[] = [
|
||||
'id' => $role['id'],
|
||||
'game_name' => $role['game_name'],
|
||||
'server_name' => $role['server_name'],
|
||||
'server_id' => $role['server_id'],
|
||||
'role_id' => $role['role_id'],
|
||||
'user_account' => $role['user_account'],
|
||||
'user_phone' => $user ? $user['phone'] : '',
|
||||
'role_name' => $role['role_name'],
|
||||
'binding_id' => $binding ? $binding['id'] : 0,
|
||||
'bind_user_account' => $bindingRole ? $bindingRole['user_account'] : '',
|
||||
'bind_role_name' => $bindingRole ? $bindingRole['role_name'] : '',
|
||||
'base_quota' => $gameSetting ? $gameSetting['base_quota'] : 0,
|
||||
'other_quota' => intval($role['testing_other_quota']),
|
||||
'quota' => $quota,
|
||||
'verify_amount' => $verifyRecords[$role['game_role_id']] ?? 0,
|
||||
'provide_amount' => $provideRecords[$role['game_role_id']] ?? 0,
|
||||
'today_amount' => $todayProvideRecords[$role['game_role_id']] ?? 0,
|
||||
'apply_amount' => $applyRecords[$role['game_role_id']] ?? 0,
|
||||
'status' => $user && $user['lock_status'] == 1 ? '正常' : '锁定',
|
||||
'create_time' => date('Y-m-d H:i:s', $role['create_time'])
|
||||
];
|
||||
}
|
||||
return $records;
|
||||
}
|
||||
|
||||
public function getTestingUsersQuery($params, array $promote = null)
|
||||
{
|
||||
$createTimeStart = $params['create_time_start'] ?? '';
|
||||
$createTimeEnd = $params['create_time_end'] ?? '';
|
||||
$gameId = $params['game_id'] ?? 0;
|
||||
$serverId = $params['server_id'] ?? '';
|
||||
$account = $params['account'] ?? '';
|
||||
$roleName = $params['role_name'] ?? '';
|
||||
|
||||
$conditions = [];
|
||||
$subConditions = [
|
||||
'_string' => '1=1'
|
||||
];
|
||||
|
||||
$strCondition = '1=1';
|
||||
|
||||
$promoteService = new PromoteService();
|
||||
if ($promote) {
|
||||
$visibleGameIds = $promoteService->getVisibleGameIds($promote);
|
||||
if (count($visibleGameIds) > 0) {
|
||||
$strCondition .= ' and game_id in (' . implode(',', $visibleGameIds) . ')';
|
||||
} else {
|
||||
$strCondition .= ' and 1=0';
|
||||
}
|
||||
$strCondition .= ' and promote_id in (' . $promoteService->subInSql($promote) . ')';
|
||||
}
|
||||
|
||||
$gameIds = $this->getHadSettingGameIds();
|
||||
if (!empty($gameIds)) {
|
||||
$strCondition .= ' and game_id in ('. implode(',', $gameIds) . ')';
|
||||
} else {
|
||||
$strCondition .= ' and 1=0';
|
||||
}
|
||||
|
||||
if ($createTimeStart) {
|
||||
$strCondition .= ' and create_time >=' . strtotime($createTimeStart . ' 00:00:00');
|
||||
}
|
||||
if ($createTimeEnd) {
|
||||
$strCondition .= ' and create_time <=' . strtotime($createTimeEnd . ' 23:59:59');
|
||||
}
|
||||
|
||||
$subSql = M('testing_user', 'tab_')->field(['user_id'])->where($subConditions)->select(false);
|
||||
$strCondition .= ' and user_id in (' . $subSql . ')';
|
||||
|
||||
if ($account) {
|
||||
$user = M('user', 'tab_')->field(['id'])->where('account like "' . $account . '%"')->find();
|
||||
if ($user) {
|
||||
$conditions['user_id'] = $user['id'];
|
||||
} else {
|
||||
$strCondition .= ' and 1<>1';
|
||||
}
|
||||
}
|
||||
if ($gameId) {
|
||||
$conditions['game_id'] = $gameId;
|
||||
}
|
||||
if ($serverId) {
|
||||
$conditions['server_id'] = $serverId;
|
||||
}
|
||||
if ($roleName) {
|
||||
$conditions['role_name'] = ['like', $roleName . '%'];
|
||||
}
|
||||
$conditions['_string'] = $strCondition;
|
||||
return M('user_play_info', 'tab_')->where($conditions)->order('create_time desc');
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue