master
ELF 5 years ago
parent 9c59ba06e2
commit ecf460e7c9

@ -825,6 +825,32 @@ class PromoteService {
return $chain == '' ? 1 : count(explode('/', $chain));
}
public function getIdsByChain($chain)
{
$chain = trim($chain, '/');
return $chain == '' ? [] : explode('/', $chain);
}
public function isSub($promote, $parent)
{
$chainList = $this->getIdsByChain($promote['chain']);
if (in_array($parent['id'], $chainList)) {
return true;
}
return false;
}
public function isSubOrSelf($promote, $parent)
{
if ($promote['id'] == $parent['id']) {
return true;
} elseif ($this->isSub($promote, $parent)) {
return true;
} else {
return false;
}
}
/**
* 获取最上级的推广员
*/

@ -51,6 +51,7 @@ class GameCatClient
}
$params['appId'] = $this->appIds[$deviceType] ?? $this->appIds['andriod'];
$params['channelId'] = $this->channelIds[$deviceType] ?? $this->channelIds['andriod'];
$params['timestamp'] = time();
$params[self::SIGN_NAME] = $this->sign($params);
try {

@ -62,7 +62,10 @@ class TestingResourceController extends BaseController
list($roles, $pagination, $count) = $this->paginate($query);
$roleIds = array_column($roles, 'id');
$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 = [];
@ -71,25 +74,44 @@ class TestingResourceController extends BaseController
if (count($roles) > 0) {
$users = M('user', 'tab_')->field(['id', 'phone'])->where(['id' => ['in', $userIds]])->select();
$uesrs = index_by_column('id', $users);
$bindings = M('testing_binding', 'tab_')->where(['role_id' => ['in', $roleIds]])->select();
$bindings = index_by_column('role_id', $bindings);
$bindingRoleIds = array_column($bindings, 'bind_role_id');
$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'])->where(['id' => ['in', $bindingRoleIds]])->select();
$bindingRoles = index_by_column('id', $bindingRoles);
$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);
}
}
$spendItems = [];
if (count($bindingRoles) > 0) {
M('spend', 'tab_')->where();
$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($spendOrWhere)->group('game_id,game_player_id')->select();
foreach ($spendList as $item) {
$spendItems[$this->getGameRoleId($item['game_id'], $item['game_player_id'])] = $item['amount'];
}
}
$records = [];
foreach ($roles as $role) {
$user = $users[$role['user_id']] ?? null;
$binding = $bindings[$role['id']] ?? null;
$bindingRole = $binding && $bindingRoles[$binding['bind_role_id']] ? $bindingRoles[$binding['bind_role_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;
}
$records[] = [
'id' => $role['id'],
'game_name' => $role['game_name'],
@ -103,7 +125,7 @@ class TestingResourceController extends BaseController
'bind_role_name' => $bindingRole ? $bindingRole['role_name'] : '',
'base_quota' => $binding ? $binding['base_quota'] : 0,
'other_quota' => $binding ? $binding['other_quota'] : 0,
'quota' => 0,
'quota' => $bindingRole && isset($spendItems[$bindingRole['game_role_id']]) ? $spendItems[$bindingRole['game_role_id']] : 0,
'verify_amount' => 0,
'provide_amount' => 0,
'today_amount' => 0,
@ -119,6 +141,11 @@ class TestingResourceController extends BaseController
$this->display();
}
private function getGameRoleId($gameId, $roleId)
{
return $gameId . '#' . $roleId;
}
public function addTestingUsers()
{
$loginPromote = $this->getLoginPromote();
@ -175,8 +202,12 @@ class TestingResourceController extends BaseController
$loginPromote = $this->getLoginPromote();
$promoteService = new PromoteService();
$subSql = M('user', 'tab_')
->where('id=tab_testing_resource_batch.user_id and promote_id in (' . $promoteService->subInSql($loginPromote) . ')')
->select(false);
$conditions = [
'_string' => 'promote_id in (' . $promoteService->subInSql($loginPromote) . ')',
'_string' => 'exists (' . $subSql . ')'
];
if ($verifyTimeStart) {
$conditions['verify_time'] = ['egt', strtotime($verifyTimeStart . ' 00:00:00')];
@ -195,28 +226,60 @@ class TestingResourceController extends BaseController
if ($user) {
$conditions['user_id'] = $user['id'];
} else {
$conditions['_string'] = '1<>1';
$conditions['_string'] .= ' and 1<>1';
}
}
$query = M('testing_resource_batch', 'tab_')->where($conditions)->order('create_time desc')->select();
$query = M('testing_resource_batch', 'tab_')->where($conditions)->order('create_time desc');
list($batches, $pagination, $count) = $this->paginate($query);
$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);
}
}
$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' => $batch['batch_no'],
'batch_no' => substr($batch['batch_no'], 14),
'create_time' => date('Y-m-d H:i:s', $batch['create_time']),
'game_name' => $batch['game_id'],
'server_name' => $batch['server_id'],
'role_name' => $batch['role_id'],
'user_account' => $batch['user_id'],
'user_phone' => $batch['batch_no'],
'creator_account' => $batch['batch_no'],
'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'],
'remark' => $batch['remark'],
'verify_status_text' => $batch['verify_status'],
'verify_time' => date('Y-m-d H:i:s', $batch['verify_time']),
'status_text' => $batch['status'],
@ -249,22 +312,38 @@ class TestingResourceController extends BaseController
$this->display();
}
private function getRemainQuota($gameId, $bindRoleId, $testingRoleId)
{
$totalQuota = M('spend', 'tab_')
->where(['game_id' => $gameId, 'game_player_id' => $bindRoleId])
->group('game_id,game_player_id')
->sum('pay_amount');
$usedQuota = M('testing_resource_batch', 'tab_')->where(['game_id' => $gameId, 'role_id' => $testingRoleId])->sum('provide_amount');
return round(floatval($totalQuota) - floatval($usedQuota), 2);
}
public function apply()
{
$roleId = I('role_id', 0);
$id = I('id', 0);
$role = null;
if ($roleId > 0) {
$role = M('user_play_info', 'tab_')->field(['id', 'role_id', 'user_id', 'game_id', 'server_id', 'user_account', 'role_name'])->where(['id' => $roleId])->find();
if ($id != 0) {
$role = M('user_play_info', 'tab_')
->field(['id', 'role_id', 'user_id', 'game_id', 'server_id', 'user_account', 'role_name'])
->where(['id' => $id])
->find();
}
$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(['role_id' => $roleId])->find();
$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(['id' => $binding['bind_role_id']])->find();
$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();
}
}
@ -276,13 +355,14 @@ class TestingResourceController extends BaseController
$this->assign('servers', $servers);
$this->assign('bindingRole', $bindingRole);
$this->assign('role', $role);
$this->assign('quota', $this->getRemainQuota($bindingRole['game_id'], $bindingRole['role_id'], $role['role_id']));
$this->display();
}
public function doApply()
{
$gameId = I('game_id', 0);
$roleId = I('role_id', 0);
$roleId = I('role_id', '');
$serverId = I('server_id', 0);
$userAccount = I('user_account', '');
$records = I('records', []);
@ -292,10 +372,17 @@ class TestingResourceController extends BaseController
/**
* @todo 目前仅限游戏猫
*/
if (!in_array($gameId, [229, 230])) {
return $this->ajaxReturn(['status' => 0, 'message' => '该游戏不可申请资源']);
if ($gameId == 229) {
$resources = $this->getGameCatResources('android');
} elseif ($gameId == 230) {
$resources = $this->getGameCatResources('ios');
} else {
$resources = $this->getGameCatResources();
return $this->ajaxReturn(['status' => 0, 'message' => '该游戏不可申请资源']);
}
$binding = M('testing_binding', 'tab_')->where(['game_id' => $gameId, 'role_id' => $roleId])->find();
if (is_null($binding)) {
return $this->ajaxReturn(['status' => 0, 'message' => '该角色未绑定玩家角色']);
}
$user = M('user', 'tab_')->field(['id', 'promote_id'])->where(['account' => $userAccount])->find();
@ -312,14 +399,36 @@ class TestingResourceController extends BaseController
return $this->ajaxReturn(['status' => 0, 'message' => '区服不存在']);
}
$promoteService = new PromoteService();
$role = M('user_play_info', 'tab_')
->field(['id', 'role_id'])
->where(['user_id' => $user['id'], 'game_id' => $gameId, 'server_id' => $server['server_id']])
->field(['id', 'role_id', 'promote_id'])
->where(['user_id' => $user['id'], 'game_id' => $gameId, 'server_id' => $server['server_id'], 'role_id' => $roleId])
->find();
if (is_null($role)) {
return $this->ajaxReturn(['status' => 0, 'message' => '角色不存在']);
}
$testPromote = M('promote', 'tab_')->field(['id', 'chain'])->where(['id' => $role['promote_id']])->find();
if (is_null($testPromote) || !$promoteService->isSubOrSelf($testPromote, $loginPromote)) {
return $this->ajaxReturn(['status' => 0, 'message' => '测试角色所属推广员异常']);
}
$bindingRole = M('user_play_info', 'tab_')
->field(['id', 'role_id', 'user_id', 'promote_id'])
->where(['game_id' => $gameId, 'role_id' => $binding['bind_role_id']])
->find();
if (is_null($bindingRole)) {
return $this->ajaxReturn(['status' => 0, 'message' => '绑定玩家角色不存在']);
}
$bindPromote = M('promote', 'tab_')->field(['id', 'chain'])->where(['id' => $bindingRole['promote_id']])->find();
if (is_null($bindPromote) || !$promoteService->isSubOrSelf($bindPromote, $loginPromote)) {
return $this->ajaxReturn(['status' => 0, 'message' => '绑定角色所属推广员异常']);
}
if ($testPromote['id'] != $bindPromote['id']) {
return $this->ajaxReturn(['status' => 0, 'message' => '测试账号与玩家账号所属推广员不同']);
}
$amount = 0;
foreach ($records as $key => $record) {
if (isset($resources[$record['resource_id']])) {
@ -332,6 +441,11 @@ class TestingResourceController extends BaseController
}
}
$remainQuota = $this->getRemainQuota($bindingRole['game_id'], $bindingRole['role_id'], $role['role_id']);
if ($amount > $remainQuota) {
// return $this->ajaxReturn(['status' => 0, 'message' => '额度不足']);
}
$batchNo = date('YmdHis') . substr(md5($loginPromote['id'] . strval(microtime(true)) . rand(0, 9999)), 8, 16);
try {
@ -339,21 +453,19 @@ class TestingResourceController extends BaseController
$model->startTrans();
$batch = [
'batch_id' => $batchId,
'batch_no' => $batchNo,
'user_id' => $testingUser['user_id'],
'game_id' => $gameId,
'role_id' => $roleId,
'server_id' => $serverId,
'promote_id' => $loginPromote['id'],
'amount' => $amount,
'status' => 0,
'apply_promote_id' => $loginPromote['id'],
'apply_amount' => $amount,
'provide_status' => 0,
'verify_status' => 0,
'remark' => $record['remark'],
'create_time' => time(),
'update_time' => time(),
];
$batchId = M('testing_resource_batch')->add($batch);
$batchId = M('testing_resource_batch', 'tab_')->add($batch);
$i = 1;
foreach ($records as $record) {
$orderNo = $batchNo . '_' . $i;
@ -366,24 +478,29 @@ class TestingResourceController extends BaseController
'amount' => $record['num'] * $record['value'],
'remark' => $record['remark'],
];
M('testing_resource_order')->add($order);
M('testing_resource_order', 'tab_')->add($order);
}
$model->commit();
return $this->ajaxReturn(['status' => 1, 'message' => '申请成功,等待审核']);
} catch (\Exception $e) {
$model->rollback();
return $this->ajaxReturn(['status' => 0, 'message' => '系统异常']);
return $this->ajaxReturn(['status' => 0, 'message' => '系统异常' . $e->getMessage()]);
}
}
public function bindRole()
{
$testingRoleId = I('testing_role_id', 0);
$bindRoleId = I('bind_role_id', 0);
$gameId = I('game_id', 0);
$testingRoleId = I('testing_role_id', '');
$bindRoleId = I('bind_role_id', '');
$loginPromote = $this->getLoginPromote();
$testingGameRoleId = $this->getGameRoleId($gameId, $testingRoleId);
$bindGameRoleId = $this->getGameRoleId($gameId, $bindRoleId);
$testingRole = M('user_play_info', 'tab_')
->field(['id', 'role_id', 'user_id'])
->where(['id' => $testingRoleId])
->field(['id', 'role_id', 'user_id', 'game_id', 'promote_id'])
->where(['game_role_id' => $testingGameRoleId])
->find();
if (is_null($testingRole)) {
return $this->ajaxReturn(['status' => 0, 'message' => '测试账号角色不存在']);
@ -394,34 +511,50 @@ class TestingResourceController extends BaseController
return $this->ajaxReturn(['status' => 0, 'message' => '测试账号不存在']);
}
$promoteService = new PromoteService();
$testPromote = M('promote', 'tab_')->field(['id', 'chain'])->where(['id' => $testingRole['promote_id']])->find();
if (is_null($testPromote) || !$promoteService->isSubOrSelf($testPromote, $loginPromote)) {
return $this->ajaxReturn(['status' => 0, 'message' => '测试角色所属推广员异常']);
}
$bindRole = M('user_play_info', 'tab_')
->field(['id', 'role_id', 'user_id'])
->where(['id' => $bindRoleId])
->field(['id', 'role_id', 'user_id', 'promote_id'])
->where(['game_role_id' => $bindGameRoleId])
->find();
if (is_null($bindRole)) {
return $this->ajaxReturn(['status' => 0, 'message' => '玩家角色不存在']);
}
$bindPromote = M('promote', 'tab_')->field(['id', 'chain'])->where(['id' => $bindRole['promote_id']])->find();
if (is_null($bindPromote) || !$promoteService->isSubOrSelf($bindPromote, $loginPromote)) {
return $this->ajaxReturn(['status' => 0, 'message' => '玩家账号所属推广员异常']);
}
if ($testPromote['id'] != $bindPromote['id']) {
return $this->ajaxReturn(['status' => 0, 'message' => '玩家账号与测试账号非同一推广员']);
}
$bindIsTesting = M('testing_user', 'tab_')->where(['user_id' => $bindRole['user_id']])->find();
if ($bindIsTesting) {
return $this->ajaxReturn(['status' => 0, 'message' => '该玩家账号为测试账号,无法绑定']);
}
$existBind = M('testing_binding', 'tab_')->field(['id'])->where(['bind_role_id' => $bindRoleId])->find();
$existBind = M('testing_binding', 'tab_')->field(['id'])->where(['game_id' => $gameId, 'bind_role_id' => $bindRoleId])->find();
if ($existBind) {
return $this->ajaxReturn(['status' => 0, 'message' => '该玩家角色已被绑定']);
}
$testExistBind = M('testing_binding', 'tab_')->field(['id'])->where(['role_id' => $testingRoleId])->find();
$testExistBind = M('testing_binding', 'tab_')->field(['id'])->where(['game_id' => $gameId, 'role_id' => $testingRoleId])->find();
if ($testExistBind) {
return $this->ajaxReturn(['status' => 0, 'message' => '该测试账号角色已绑定有角色']);
}
M('testing_binding', 'tab_')->add([
'game_id' => $testingRole['game_id'],
'user_id' => $testingRole['user_id'],
'role_id' => $testingRole['id'],
'role_id' => $testingRole['role_id'],
'bind_user_id' => $bindRole['user_id'],
'bind_role_id' => $bindRole['id'],
'bind_role_id' => $bindRole['role_id'],
'create_time' => time(),
'update_time' => time()
]);
@ -485,11 +618,16 @@ class TestingResourceController extends BaseController
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_name'])
->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]]);
@ -497,6 +635,14 @@ class TestingResourceController extends BaseController
private function getGameCatResources($deviceType)
{
/* return [
1 => ['ref_id' => 1, 'name' => '礼包钻石6', 'amount' => 6],
2 => ['ref_id' => 2, 'name' => '礼包钻石18', 'amount' => 18],
3 => ['ref_id' => 3, 'name' => '礼包钻石30', 'amount' => 30],
4 => ['ref_id' => 4, 'name' => '礼包钻石98', 'amount' => 98],
5 => ['ref_id' => 5, 'name' => '礼包钻石128', 'amount' => 128],
6 => ['ref_id' => 6, 'name' => '礼包钻石648', 'amount' => 648],
]; */
$resources = [];
$gameCatClient = new GameCatClient();
$result = $gameCatClient->api('get-pay-type', ['device_type' => $deviceType]);

@ -112,21 +112,25 @@
</div>
<div class="form-group fl">
<select id="role-select" name="role_id" class="select_gallery" style="width:150px" <?php if($role):?>disabled<?php endif;?>>
<option value="0">请选择角色</option>
<option value="">请选择角色</option>
<?php if($role):?>
<option value="<?=$role['id']?>" selected><?=$role['role_name']?></option>
<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>
<div class="" style="display:inline-block; margin-left: 10px;">当前可用额度1364 待审核额度0</div>
<?php else:?>
<button id="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;">
<div class="form-group fl">
<select id="resource-type-select" name="resource_type_id" style="width:150px" class="select_gallery">
@ -326,6 +330,9 @@
if (resourceId == '') {
return layer.msg('请选择资源内容')
}
if (num == '') {
return layer.msg('请输入资源数量')
}
var html = '<tr class="normal-row" data-resource-id="' + resourceId + '" data-resource-type-id="' + resourceTypeId + '" >' +
'<td>' + resourceTypeName + '</td>' +
@ -339,12 +346,29 @@
$('#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()
})
$('#resource-table').on('blur', 'input[name=num]', function() {
if($(this).val() == '') {
return layer.msg('请输入资源数量')
} else {
statQuota()
}
})
function statQuota() {
var quota = $('#quota').attr('data-quota')
var verifyQuota = 0
$('#resource-table').find('.normal-row').each(function (index, ele) {
verifyQuota += $(ele).find('.amount').html() * $(ele).find('.num').children('input').val()
})
$('#verify-quota').html(verifyQuota)
$('#quota').html(quota-verifyQuota)
}
$('#test_account').on({
blur: function() {
var gameId = $('#game-select').val()
@ -366,9 +390,9 @@
if (!isTestingAccount) {
return layer.msg('此账号非测试账号')
}
var html = "<option value='0'>请选择角色</option>";
var html = "<option value=''>请选择角色</option>";
for (var i in roles){
html += "<option value='"+roles[i].id+"'>"+roles[i].role_name+"</option>"
html += "<option value='"+roles[i].role_id+"'>"+roles[i].role_name+"</option>"
}
$("#role-select").html(html);
$("#role-select").select2();
@ -415,9 +439,9 @@
if (isTestingAccount) {
return layer.msg('此账号为测试账号,无法绑定')
}
var html = "<option value='0'>请选择角色</option>";
var html = "<option value=''>请选择角色</option>";
for (var i in roles){
html += "<option value='"+roles[i].id+"'>"+roles[i].role_name+"</option>"
html += "<option value='"+roles[i].role_id+"'>"+roles[i].role_name+"</option>"
}
$("#bind-role-select").html(html);
$("#bind-role-select").select2();
@ -455,6 +479,10 @@
});
$('#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('请选择测试账号角色')
@ -466,7 +494,7 @@
$.ajax({
url: "{:U('bindRole')}",
type: "post",
data: { bind_role_id: bindRoleId, testing_role_id: roleId},
data: { game_id: gameId, bind_role_id: bindRoleId, testing_role_id: roleId},
dataType: 'json',
success: function(result){
if (result.status == 1) {

@ -7,6 +7,16 @@
.page-list .trunk-search{
padding-top: 20px;
}
.view-detail {
width: 70px;
height: 35px;
display: block;
background: #409eff;
color: #fff;
border: none;
border-radius: 4px;
cursor: pointer;
}
</style>
</block>
@ -82,49 +92,62 @@
<div class="page-list apply-app_apply-list query-recharge-list">
<div class="trunk-content article">
<div class="tabcon trunk-list">
<table class="table normal_table zwm_tab">
<table class="table normal_table zwm_tab" >
<tr class="odd zwm_tr">
<th>批次号</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> -->
<th>发放状态</th>
<th>发放时间</th>
<th>资源内容</th>
<th>操作</th>
</tr>
<empty name="records">
<tr><td colspan="16" style="text-align: center;height: 45vh;"><img src="__IMG__/20180207/icon_wushujv2.png"/><p style="line-height: 40px;color: #A5A5A5;">暂无数据</p></td></tr>
<else />
<volist name="records" id="record" mod="2">
<tr data-id="{$record.id}" class="<eq name='mod' value='1'>odd</eq>">
<td>{$record.batch_no}</td>
<td>{$record.create_time}</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>{$record.remark}</td>
<td>{$record.verify_status_text}</td>
<td>{$record.verify_time}</td>
<td>{$record.status_text}</td>
<!-- <td>{$record.verify_status_text}</td> -->
<!-- <td>
<?=substr($record['verify_time'], 0, 10)?>
<br>
<?=substr($record['verify_time'], 10)?>
</td> -->
<td>{$record.provide_status_text}</td>
<td>{$record.provide_time}</td>
<td>
<?=substr($record['provide_time'], 0, 10)?>
<br>
<?=substr($record['provide_time'], 10)?>
</td>
<td>{$record.content}</td>
<td><button class="view-detail">操作</button></td>
</tr>
</volist>
</empty>
@ -162,89 +185,7 @@ $().ready(function(){
timepicker:false
});
$('#add').click(function(){
var url = $(this).attr('url');
window.location.href = url;
});
$('.apply').click(function(){
var id = $(this).attr('data-id');
var url = "{:U('apply','','')}"+'/id/'+id;
window.location.href = url;
});
$('.open_edit').click(function(){
var account=$(this).attr('data-account');
var password=$(this).attr('data-password');
var game_name=$(this).attr('data-game_name');
var server_name=$(this).attr('data-server_name');
var role_name=$(this).attr('data-role_name');
var support_id=$(this).attr('data-support_id');
$('#i_account').val(account);
$('#i_password').val(password);
$('#i_game_name').val(game_name);
$('#i_server_name').val(server_name);
$('#i_role_name').val(role_name);
$('#i_support_id').val(support_id);
var id_editor= '.div_editor';
//页面层
layer.open({
type: 1,
title: '新增扶持-修改',
closeBtn: 1,
area: ['600px','580px'],
//skin: 'layui-layer-bgwhite', //白色背景色
shadeClose: true,
content: $(id_editor),
})
});
$('.i_save').click(function () {
var id = $('#i_support_id').val();
var role_name =$('#i_role_name').val();
var user_password = $('#i_password').val();
if(role_name==''){
layer.msg('角色名不能为空');
return false;
}
if(user_password==''){
layer.msg('密码不能为空');
return false;
}
$.ajax({
async: false,
url:"{:U('support_edit')}",
type:"POST",
dataType:"json",
data:{id:id,role_name:role_name,user_password:user_password},
success:function(result){
if(result.status==0){
layer.msg(result.msg,{icon: 2});
}else{
layer.msg('修改成功');
setTimeout(function(){
location.reload();
},1000);
}
},
error:function(){
}
});
});
$('.i_cancel').click(function () {
location.reload();
});
$(".select_gallery").select2();
$('#edate').datetimepicker({
lang:'ch',
format:'Y-m-d',

@ -190,8 +190,8 @@
<th>角色名称</th>
<th>绑定账号</th>
<th>绑定角色</th>
<th>初始额度</th>
<th>额外额度</th>
<!-- <th>初始额度</th> -->
<!-- <th>额外额度</th> -->
<th>累计额度</th>
<th>待审核金额</th>
<th>累计发放资源</th>
@ -202,7 +202,7 @@
</tr>
<empty name="records">
<tr>
<td colspan="17" style="text-align: center;height: 45vh;"><img
<td colspan="15" style="text-align: center;height: 45vh;"><img
src="__IMG__/20180207/icon_wushujv2.png" />
<p style="line-height: 40px;color: #A5A5A5;">暂无数据</p>
</td>
@ -223,8 +223,8 @@
<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.base_quota}</td> -->
<!-- <td>{$record.other_quota}</td> -->
<td>{$record.quota}</td>
<td>{$record.verify_amount}</td>
<td>{$record.provide_amount}</td>
@ -295,10 +295,11 @@
var url = "{:U('TestingResource/apply', '', '')}"
var id = $('input[name=role_id]:checked').val()
console.log(id)
id = id == undefined ? 0 : id;
if (id > 0) {
url += '/role_id/' + id
url += '/id/' + id
} else {
return layer.msg('请选择测试账号角色')
}
layer.open({

@ -2416,10 +2416,11 @@ CREATE TABLE `tab_testing_user` (
CREATE TABLE `tab_testing_binding` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`game_id` int(11) NOT NULL COMMENT '游戏ID',
`user_id` int(11) unsigned NOT NULL COMMENT '测试用户ID',
`role_id` int(11) NOT NULL default '0' COMMENT '角色ID',
`role_id` varchar(50) NOT NULL default '' COMMENT '角色ID',
`bind_user_id` int(11) unsigned NOT NULL default 0 COMMENT '绑定用户ID',
`bind_role_id` int(11) NOT NULL default '0' COMMENT '绑定角色ID',
`bind_role_id` varchar(50) NOT NULL default '' COMMENT '绑定角色ID',
`base_quota` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '初始额度',
`other_quota` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '额外额度',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '添加时间',
@ -2451,10 +2452,11 @@ CREATE TABLE `tab_testing_resource_type` (
CREATE TABLE `tab_testing_resource_order` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`batch_id` int(11) NOT NULL COMMENT '批次ID',
`order_no` varchar(30) NOT NULL COMMENT '订单号',
`order_no` varchar(32) NOT NULL COMMENT '订单号',
`ref_id` varchar(30) NOT NULL COMMENT '测试资源ID第三方',
`ref_name` varchar(150) NOT NULL COMMENT '测试资源名称(第三方)',
`num` int(11) NOT NULL DEFAULT 0 COMMENT '申请数量',
`provide_status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '0 待发放 1 已经发放 2 拒绝 3 异常',
`amount` decimal(12, 2) not null default '0.00' comment '申请金额',
`remark` varchar(255) NOT NULL DEFAULT '' COMMENT '审核备注',
PRIMARY KEY (`id`)
@ -2466,10 +2468,9 @@ CREATE TABLE `tab_testing_resource_batch` (
`game_id` int(11) NOT NULL DEFAULT '0' COMMENT '游戏ID',
`user_id` int(11) NOT NULL DEFAULT '0' COMMENT '用户ID',
`server_id` int(11) NOT NULL DEFAULT '0' COMMENT '区服ID',
`role_id` int(11) NOT NULL DEFAULT '0' COMMENT '角色ID',
`role_id` int(11) NOT NULL DEFAULT '0' COMMENT '角色ID',
`role_id` varchar(50) NOT NULL DEFAULT '' COMMENT '角色ID',
`apply_amount` decimal(12, 2) not null default '0.00' comment '申请金额',
`provide_amount` decimal(12, 2) not null default '0.00' comment '申请金额',
`provide_amount` decimal(12, 2) not null default '0.00' comment '发放金额',
`provide_status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '0 待发放 1 已经发放 2 拒绝 3 异常',
`provide_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '审核时间',
`apply_promote_id` int(11) NOT NULL DEFAULT '0' COMMENT '申请推广员ID',
@ -2479,4 +2480,8 @@ CREATE TABLE `tab_testing_resource_batch` (
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '添加时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '最后修改时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
alter table tab_user_play_info add column `game_role_id` varchar(80) DEFAULT '' COMMENT '角色' after role_level;
update tab_user_play_info set game_role_id = concat(game_id, '#', role_id);
ALTER TABLE `tab_user_play_info` ADD INDEX `index_unique_role`(`game_role_id`);
Loading…
Cancel
Save