master
ELF 3 years ago
parent 42d8883456
commit c35223b3a2

@ -123,4 +123,185 @@ class GameRebateController extends ThinkController
$servers = $gameRepository->getServersByBaseGameId($gameId);
return $this->ajaxReturn(['status' => 1, 'message' => '获取成功', 'data' => ['servers' => $servers]]);
}
public function simulateSpendList()
{
$params = I('get.');
$isExport = $params['is_export'] ?? 0;
$page = $params['page'] ?? 0;
$limit = $params['limit'] ?? 0;
$baseGameId = $params['base_game_id'] ?? 0;
$serverId = $params['server_id'] ?? '';
$roleName = $params['role_name'] ?? '';
$userAccount = $params['user_account'] ?? '';
$reviewStatus = $params['review_status'] ?? -1;
$sendStatus = $params['send_status'] ?? -1;
$reviewerId = $params['reviewer_id'] ?? 0;
$reviewType = $params['review_type'] ?? -1;
$where = [
'_string' => '1=1',
];
if ($baseGameId != 0) {
$where['base_game_id'] = $baseGameId;
}
if ($userAccount != '') {
$where['user_account'] = ['like', $userAccount . '%'];
}
if ($roleName != '') {
$where['role_name'] = ['like', $roleName . '%'];
}
if ($serverId != '') {
$where['server_id'] = $serverId;
}
if ($reviewStatus != -1) {
$where['review_status'] = $reviewStatus;
}
if ($sendStatus != -1) {
$where['send_status'] = $sendStatus;
}
if ($reviewerId != 0) {
$where['reviewer_id'] = $reviewerId;
}
if ($reviewType != -1) {
$where['review_type'] = $reviewType;
}
if (I('review_time_start', '') != '') {
$where['_string'] .= ' and review_time>=' . strtotime(I('review_time_start') . ' 00:00:00');
}
if (I('review_time_end', '') != '') {
$where['_string'] .= ' and review_time<=' . strtotime(I('review_time_end') . ' 23:59:59');
}
if (I('create_time_start', '') != '') {
$where['_string'] .= ' and create_time>=' . strtotime(I('create_time_start') . ' 00:00:00');
}
if (I('create_time_end', '') != '') {
$where['_string'] .= ' and create_time<=' . strtotime(I('create_time_end') . ' 23:59:59');
}
/* if ($promote) {
$promoteService = new PromoteService();
$subSql = M('user', 'tab_')->field(['id'])->where(['_string' => 'promote_id in(' . $promoteService->subInSql($promote) . ')'])->select(false);
$where['_string'] .= ' and user_id in(' . $subSql . ')';
} */
$query = M('simulate_spend', 'tab_')->where($where);
$count = 0;
$records = [];
if ($isExport == 1 || $limit == 'all') {
$records = $query->order('create_time desc')->select();
$count = count($records);
} else {
$countQuery = clone $query;
$records = $query->order('create_time desc')->page($page, $limit)->select();
$count = $countQuery->count();
}
if (count($records) > 0) {
$users = [];
$userIds = array_column($records, 'user_id');
$users = M('user', 'tab_')->field(['id', 'promote_account'])->where(['id' => ['in', $userIds]])->select();
$users = index_by_column('id', $users);
foreach ($records as $key => $record) {
$user = $users[$record['user_id']];
$payAmount = 0; /** @todo */
$records[$key]['pay_amount'] = $payAmount;
$records[$key]['total_amount'] = $payAmount + $record['amount'];
$records[$key]['promote_account'] = $user['promote_account'];
$records[$key]['status_text'] = $this->reviewStatusList[$record['status']];
$records[$key]['review_time'] = $record['review_time'] > 0 ? date('Y-m-d H:i:s', $record['review_time']) : '--';
$records[$key]['create_time'] = $record['create_time'] > 0 ? date('Y-m-d H:i:s', $record['create_time']) : '--';
}
if ($isExport) {
$field = [
'order_no' => '订单号',
'base_game_name' => '游戏名称',
'server_name' => '区服',
'user_account' => '玩家账号',
'role_id' => '角色ID',
'role_name' => '角色名称',
'promote_account' => '所属推广员',
'pay_amount' => '当前累充金额',
'amount' => '模拟发放金额',
'total_amount' => '可触发返利功能金额',
'create_time' => '添加时间',
'status_text' => '审核状态',
'review_time' => '审核时间',
'reviewer_username' => '审核人',
'remark' => '备注',
];
addOperationLog(['op_type'=>3,'key'=>getNowDate(),'op_name'=>'导出转区转游模拟发放记录','url'=>U('GameRebate/simulateSpendList'),'menu'=>'推广员-发放福利管理-' . '导出转区转游模拟发放记录']);
data2csv($records, '转区转游模拟发放', $field);
exit;
}
}
$page = set_pagination($count, $params['limit'] == 'all' ? 99999999 : $params['limit']);
if($page) {
$this->assign('_page', $page);
}
$admins = M('ucenter_member', 'sys_')->field(['id', 'username'])->select();
$baseGames = M('base_game', 'tab_')->select();
$gameRepository = new GameRepository();
$this->assign('servers', $gameRepository->getServersByBaseGameId($baseGameId));
$this->assign('admins', $admins);
$this->assign('baseGames', $baseGames);
$this->assign('reviewStatusList', []);
$this->assign('records', $records);
$this->display('records');
}
public function addSimulateSpend()
{
$params = I('post.');
try {
$adminInfo = $_SESSION['onethink_admin']['user_auth'];
$handler = [];
$handler['id'] = $adminInfo['uid'];
$handler['username'] = $adminInfo['username'];
$service = new GameRebateService();
$service->addSimulateSpend($params, $handler);
$this->ajaxReturn([
'status' => 1,
'message' => '保存成功'
]);
} catch (\Exception $e) {
$this->ajaxReturn([
'status' => 0,
'message' => $e->getMessage()
]);
}
}
public function reviewSimulateSpend()
{
$ids = I('ids', []);
$status = I('status', 0);
try {
$adminInfo = $_SESSION['onethink_admin']['user_auth'];
$handler = [];
$handler['id'] = $adminInfo['uid'];
$handler['username'] = $adminInfo['username'];
$service = new GameRebateService();
$service->reviewSimulateSpend($ids, $status, $handler);
$this->ajaxReturn([
'status' => 1,
'message' => '操作成功'
]);
} catch (\Exception $e) {
$this->ajaxReturn([
'status' => 0,
'message' => $e->getMessage()
]);
}
}
}

@ -0,0 +1,622 @@
<!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: 3px;
cursor: pointer;
display: inline-block;
margin-left: 10px;
padding: 0px 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($baseGames 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>
<div class="clearfix" style="margin-top: 10px;">
<div class="form-group fl">
<p class="static-input">角色名称: --</p>
</div>
<div class="form-group fl">
<p class="static-input">当前累充: --</p>
</div>
<div class="form-group fl">
<input type="text" name="amount" class="txt normal_txt" placeholder="请输入模拟发放金额" value="">
</div>
<div class="form-group fl">
<input type="text" name="remark" class="txt normal_txt" placeholder="请输入备注" value="">
</div>
<div class="form-group fl">
<button id="add-row" class="add-row" type="button">增加</button>
</div>
</div>
</form>
</div>
</div>
</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: { game_id: globalGameId, 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)
}
function getUserRoles(bindRoleId, gameId, callback) {
$.ajax({
url: "{:U('getUserRoles')}",
type: "post",
data: { role_id: bindRoleId, game_id: gameId },
dataType: 'json',
success: function(result){
if (result.status == 1) {
var roles = result.data.roles
callback(roles)
} else {
layer.msg(result.message)
}
}
})
}
$('#bind_role_id').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 bindRoleId = $('#bind_role_id').val()
if (bindRoleId == '') {
return layer.msg('请输入角色ID')
}
getUserRoles(bindRoleId, gameId, function(roles) {
if (roles.length == 0) {
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('roles')}"
})
} 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,394 @@
<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--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;
}
.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="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="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="user_account" class="" placeholder="玩家账号" value="{:I('user_account')}"/>&nbsp;
</div>
<div class="input-list">
<input type="text" name="role_name" class="" placeholder="角色名" value="{:I('role_name')}"/>&nbsp;
</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">
<input type="text" readonly name="review_time_start" class="time-select" value="{:I('review_time_start')}"
placeholder="审核开始时间"/>
-
<div class="input-append date" id="datetimepicker" style="display:inline-block">
<input type="text" readonly name="review_time_end" class="time-select" value="{:I('review_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="review_status" class="select_gallery" style="width:120px;">
<option value="-1">请选择审核状态</option>
<?php foreach($reviewStatusList as $key => $name):?>
<option value="<?=$key?>">
<?=$name?>
</option>
<?php endforeach;?>
</select>
</div>
<div class="input-list input-list-promote search_label_rehab">
<select name="send_status" class="select_gallery" style="width:120px;">
<option value="-1">请选择发放状态</option>
<?php foreach($sendStatusList as $key => $name):?>
<option value="<?=$key?>">
<?=$name?>
</option>
<?php endforeach;?>
</select>
</div>
<div class="input-list input-list-promote search_label_rehab">
<select name="reviewer_id" class="select_gallery" style="width:120px;">
<option value="0">请选择审核人</option>
<?php foreach($admins as $admin):?>
<option value="<?=$admin['id']?>">
<?=$admin['username']?>
</option>
<?php endforeach;?>
</select>
</div>
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('GameRebate/simulateSpendList')}">搜索</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="review-agree-btn">审批通过</a>
<a class="butn" id="review-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>订单号</th>
<th>游戏名称</th>
<th>区服</th>
<th>账号</th>
<th>角色ID</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="data">
<tr data-id="<?=$data['id']?>">
<td>
<?php if($data['status'] == 0):?>
<input class="ids" type="checkbox" value="{$data['id']}" name="ids[]">
<?php else:?>
<input class="ids disabled" disabled="disabled" type="checkbox" value="{$data['id']}" name="ids[]">
<?php endif;?>
</td>
<td>{$data.order_no}</td>
<td>{$data.base_game_name}</td>
<td>{$data.server_name}</td>
<td>{$data.user_account}</td>
<td>{$data.role_id}</td>
<td>{$data.role_name}</td>
<td>{$data.promote_account}</td>
<td>{$data.pay_amount}</td>
<td>{$data.amount}</td>
<td>{$data.total_amount}</td>
<td>{$data.create_time}</td>
<td>
<span class="status-{$data.status}">{$data.status_text}</span>
</td>
<td>{$data.review_time}</td>
<td>{$data.reviewer_username}</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>
</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('GameRebate/simulateSpendList')}");
$(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 sdate = Date.parse($("input[name='send_time_start']").val()) / 1000;
var edate = Date.parse($("input[name='send_time_end']").val()) / 1000;
if (sdate > edate) {
layer.msg('开始时间必须小于等于结束时间');
return false;
}
if ((edate - sdate) > 2592000) {
layer.msg('时间间隔不能超过31天请重新选择日期');
return false;
}
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();
}
});
$("#game_id").change(function () {
$.ajax({
url: "{:U('getServers')}",
type: "post",
data: { game_id: $("#game_id").val() },
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()
}
}
})
})
$('#review-agree-btn').on({
click:function () {
var ids = getIds()
if (ids.length == 0) {
return layer.msg('请选择要操作的记录')
}
layer.confirm('确定要审核通过这些记录吗?', {
title: '审核通过',
btn: ['确定']
}, function(){
verify(ids, 1)
})
}
})
$('#review-refuse-btn').on({
click:function () {
var ids = getIds()
if (ids.length == 0) {
return layer.msg('请选择要操作的记录')
}
layer.confirm('确定要审核拒绝这些记录吗?', {
title: '审核拒绝',
btn: ['确定']
}, function(){
verify(ids, 2)
})
}
})
function verify(ids, status) {
$.ajax({
url: "{:U('reviewSimulateSpend')}",
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 getIds() {
var ids = [];
$('.ids:checked').each(function() {
ids.push($(this).val());
})
return ids;
}
});
$(".export-btn").on("click",function(e){
e.preventDefault();
window.location.href=$(this).attr("href")
})
</script>
</block>

@ -309,4 +309,68 @@ class GameRebateService
]);
return $fields;
}
public function addSimulateSpend($params, $handler = null)
{
$baseGameId = $params['base_game_id'] ?? 0;
$roleId = $params['role_id'] ?? '';
$amount = $params['amount'] ?? 0;
$remark = $params['remark'] ?? '';
if ($baseGameId == 0) {
throw new \Exception('请选择游戏');
}
if ($roleId == 0) {
throw new \Exception('请输入角色ID');
}
if ($amount <= 0) {
throw new \Exception('金额必须大于0');
}
$baseGame = M('base_game', 'tab_')->where(['id' => $baseGameId])->find();
if ($baseGame == null) {
throw new \Exception('游戏不存在');
}
$gameIds = [$baseGame['android_game_id'], $baseGame['ios_game_id']];
$role = M('user_play_info', 'tab_')->where(['role_id' => $roleId, 'game_id' => ['in', $gameIds]])->find();
if ($role == null) {
throw new \Exception('角色不存在');
}
$data = [
'user_id' => $role['user_id'],
'user_account' => $role['user_account'],
'base_game_id' => $baseGame['id'],
'base_game_name' => $baseGame['name'],
'role_id' => $role['role_id'],
'role_name' => $role['role_name'],
'server_id' => $role['server_id'],
'server_name' => $role['server_name'],
'order_no' => '',
'create_time' => time(),
'amount' => $amount,
'remark' => $remark
];
M('simulate_spend', 'tab_')->add($data);
}
public function reviewSimulateSpend(array $ids, $status, $handler)
{
if (!in_array($status, [1, 2])) {
throw new \Exception('状态异常');
}
if (count($ids) == 0) {
throw new \Exception('请选择要操作的记录');
}
$orders = M('simulate_spend', 'tab_')->field(['id'])->where(['review_status' => 0, 'id' => ['in', $ids]])->select();
if (count($orders) != count($ids)) {
throw new \Exception('含有不存在的记录或者已审核的记录');
}
M('simulate_spend', 'tab_')->where(['status' => 0, 'id' => ['in', $ids]])->save([
'status' => $status,
'review_time' => time(),
'reviewer_id' => $handler['id'],
'reviewer_username' => $handler['username'],
]);
}
}
Loading…
Cancel
Save