修改bug

master
ELF 5 years ago
parent 02d862cb7a
commit f056143dee

@ -90,6 +90,7 @@ class PromoteService {
$orderTime = isset($params['order_time']) ? $params['order_time'] : ''; $orderTime = isset($params['order_time']) ? $params['order_time'] : '';
$balanceCoinMode = isset($params['balance_coin_mode']) ? $params['balance_coin_mode'] : 0; $balanceCoinMode = isset($params['balance_coin_mode']) ? $params['balance_coin_mode'] : 0;
$type = isset($params['type']) ? $params['type'] : 0; $type = isset($params['type']) ? $params['type'] : 0;
$shiftIds = isset($params['shift_ids']) && $params['shift_ids'] ? $params['shift_ids'] : [];
if ($fromPromoteId == $toPromoteId) { if ($fromPromoteId == $toPromoteId) {
return [ return [
@ -123,7 +124,8 @@ class PromoteService {
'create_time' => time(), 'create_time' => time(),
'create_promote_id' => session('promote_auth.pid'), 'create_promote_id' => session('promote_auth.pid'),
'status' => 0, 'status' => 0,
'type' => $type 'type' => $type,
'shift_ids' => json_encode($shiftIds)
]; ];
if (M('ShiftTask')->add($data)) { if (M('ShiftTask')->add($data)) {
@ -176,8 +178,8 @@ class PromoteService {
$firstMap = ['parent_id' => $fromPromote['id']]; $firstMap = ['parent_id' => $fromPromote['id']];
$secondMap = ['chain' => ['like', $fromPromote['chain'] . $fromPromote['id'] . '/%']]; $secondMap = ['chain' => ['like', $fromPromote['chain'] . $fromPromote['id'] . '/%']];
if ($task['shift_ids'] != '') {
$shiftIds = json_decode($task['shift_ids'], true) ?? []; $shiftIds = json_decode($task['shift_ids'], true) ?? [];
if (count($shiftIds) > 0) {
$firstMap['id'] = ['in', $shiftIds]; $firstMap['id'] = ['in', $shiftIds];
$secondMap['id'] = ['in', $shiftIds]; $secondMap['id'] = ['in', $shiftIds];
} }
@ -206,11 +208,7 @@ class PromoteService {
public function shiftRemoveCoin($promote, $task) public function shiftRemoveCoin($promote, $task)
{ {
$shiftIds = null;
if ($task['shift_ids'] != '') {
$shiftIds = json_decode($task['shift_ids'], true) ?? []; $shiftIds = json_decode($task['shift_ids'], true) ?? [];
}
$topPromote = $this->getTopPromote($promote); $topPromote = $this->getTopPromote($promote);
$coinRecordService = new PromoteCoinRecordService(); $coinRecordService = new PromoteCoinRecordService();
$promoteCoinService = new PromoteCoinService(); $promoteCoinService = new PromoteCoinService();
@ -218,7 +216,7 @@ class PromoteService {
$topBalancePlus = 0; $topBalancePlus = 0;
$map = ['chain' => $promote['chain'] . $chain['id'] . '/%']; $map = ['chain' => $promote['chain'] . $chain['id'] . '/%'];
if ($shiftIds != null) { if (count($shiftIds) > 0) {
$map['id'] = ['in', $shiftIds]; $map['id'] = ['in', $shiftIds];
} }
$subPromotes = M('promote', 'tab_')->field(['id', 'balance_coin'])->where($map)->select(); $subPromotes = M('promote', 'tab_')->field(['id', 'balance_coin'])->where($map)->select();

@ -88,13 +88,23 @@
<a href="javascript:;" style="color: red;" class="unfreeze-btn editbtn">解冻</a> <a href="javascript:;" style="color: red;" class="unfreeze-btn editbtn">解冻</a>
</if> </if>
<a href="javascript:;" class="reset-password-btn editbtn">重置密码</a> <a href="javascript:;" class="reset-password-btn editbtn">重置密码</a>
<?php if(in_array($record['id'], $hasChildList)):?> <?php if(in_array($record['id'], $hasChildList)):?>
<?php if(!in_array($record['id'], $hasShiftList)):?> <?php if(!in_array($record['id'], $hasShiftList)):?>
<a href="javascript:;" class="shift-btn editbtn">渠道迁移</a> <a href="javascript:;" class="shift-btn editbtn" data-promote-shift-type="1">渠道迁移</a>
<?php else:?> <?php else:?>
<a href="javascript:;" style="color: red;" class="cancel-shift-btn editbtn">取消渠道迁移</a> <a href="javascript:;" style="color: red;" data-promote-shift-type="1" class="cancel-shift-btn editbtn">取消渠道迁移</a>
<?php endif;?>
<?php endif;?> <?php endif;?>
<?php if(I('promote_type', 0) == 2):?>
<?php if(!in_array($record['id'], $hasShiftList)):?>
<a href="javascript:;" class="shift-btn editbtn" data-promote-shift-type="2">换组</a>
<?php else:?>
<a href="javascript:;" style="color: red;" data-promote-shift-type="2" class="cancel-shift-btn editbtn">取消换组</a>
<?php endif;?> <?php endif;?>
<?php endif;?>
<?php if(in_array($record['id'], $hasPlayerList)):?> <?php if(in_array($record['id'], $hasPlayerList)):?>
<?php if(!in_array($record['id'], $hasShiftPlayerList)):?> <?php if(!in_array($record['id'], $hasShiftPlayerList)):?>
<a href="javascript:;" class="shift-player-btn editbtn">玩家迁移</a> <a href="javascript:;" class="shift-player-btn editbtn">玩家迁移</a>
@ -125,7 +135,7 @@
setValue('row','{:I("get.row",10)}'); setValue('row','{:I("get.row",10)}');
</script> </script>
<div id="shift-box" class="layer-box" style="display: none;"> <div id="shift-box" class="layer-box" style="display: none;">
<form action="{:U('Promote/mychlid',array('row'=>I('get.row')))}" method="post" enctype="multipart/form-data"> <form method="post" enctype="multipart/form-data">
<input type="hidden" name="promote_id" value=""> <input type="hidden" name="promote_id" value="">
<div class="form-group"> <div class="form-group">
<label>账号(真实姓名)</label> <label>账号(真实姓名)</label>
@ -136,7 +146,7 @@
<div class="form-group"> <div class="form-group">
<label>转移至推广账号</label> <label>转移至推广账号</label>
<div class="form-item"> <div class="form-item">
<select name="to_promote_id" class="reselect select_gallery" style="width: 220px;" > <select id="promote-to-promote" name="to_promote_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择推广账号</option> <option value="0">请选择推广账号</option>
</select> </select>
</div> </div>
@ -161,7 +171,7 @@
</form> </form>
</div> </div>
<div id="shift-player-box" class="layer-box" style="display: none;"> <div id="shift-player-box" class="layer-box" style="display: none;">
<form action="{:U('Promote/mychlid',array('row'=>I('get.row')))}" method="post" enctype="multipart/form-data"> <form method="post" enctype="multipart/form-data">
<input type="hidden" name="promote_id" value=""> <input type="hidden" name="promote_id" value="">
<div class="form-group"> <div class="form-group">
<label>账号(真实姓名)</label> <label>账号(真实姓名)</label>
@ -172,7 +182,7 @@
<div class="form-group"> <div class="form-group">
<label>转移至推广账号</label> <label>转移至推广账号</label>
<div class="form-item"> <div class="form-item">
<select name="to_promote_id" class="reselect select_gallery" style="width: 220px;" > <select id="player-to-promote" name="to_promote_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择推广账号</option> <option value="0">请选择推广账号</option>
</select> </select>
</div> </div>
@ -207,22 +217,38 @@ $(function(){
} else if (promoteType == 1) { } else if (promoteType == 1) {
level = 3 level = 3
} else if (promoteType == 2) { } else if (promoteType == 2) {
level = 4 level = 3
} }
$.ajax({
url: "{:U('Promote/getSubPromotes')}", getSubPromotes({level: level}, function(response) {
data: {level: level},
type: 'post',
dataType: 'json',
success: function(response) {
var options = '<option value="0">请选择推广账号</option>' var options = '<option value="0">请选择推广账号</option>'
for (var i in response.data.promotes) { for (var i in response.data.promotes) {
var promote = response.data.promotes[i] var promote = response.data.promotes[i]
options += '<option value="' + promote.id + '">' + promote.account + '(' + promote.real_name + ')' + '</option>' options += '<option value="' + promote.id + '">' + promote.account + '(' + promote.real_name + ')' + '</option>'
} }
$('select[name=to_promote_id]').html(options) $('#promote-to-promote').html(options)
})
getSubPromotes({level: 0}, function(response) {
var options = '<option value="0">请选择推广账号</option>'
for (var i in response.data.promotes) {
var promote = response.data.promotes[i]
options += '<option value="' + promote.id + '">' + promote.account + '(' + promote.real_name + ')' + '</option>'
}
$('#player-to-promote').html(options)
})
function getSubPromotes(data, successCallback) {
$.ajax({
url: "{:U('Promote/getSubPromotes')}",
data: data,
type: 'post',
dataType: 'json',
success: function(response) {
successCallback(response)
} }
}) })
}
$('#shift-player-order-time').datetimepicker({ $('#shift-player-order-time').datetimepicker({
format: 'yyyy-mm-dd', format: 'yyyy-mm-dd',
@ -306,10 +332,22 @@ $(function(){
} }
}) })
function getShiftTypeName(shiftType) {
var shiftTypeName = ''
if (shiftType == 1) {
shiftTypeName = '渠道迁移'
} else if (shiftType == 2) {
shiftTypeName = '换组'
}
return shiftTypeName
}
$('.cancel-shift-btn').on({ $('.cancel-shift-btn').on({
click: function() { click: function() {
var id = $(this).parents('tr').eq(0).attr('data-id') var id = $(this).parents('tr').eq(0).attr('data-id')
layer.confirm('是否要取消渠道迁移?', {icon: 3, title:'提示'}, function(index){ var shiftType = $(this).attr('data-promote-shift-type')
var shiftTypeName = getShiftTypeName(shiftType)
layer.confirm('是否要取消' + shiftTypeName, {icon: 3, title:'提示'}, function(index){
$.ajax({ $.ajax({
url: "{:U('Promote/cancelShift')}", url: "{:U('Promote/cancelShift')}",
data: {promote_id: id, type: 1}, data: {promote_id: id, type: 1},
@ -346,6 +384,9 @@ $(function(){
$('.shift-btn').on({ $('.shift-btn').on({
click: function() { click: function() {
var shiftType = $(this).attr('data-promote-shift-type')
var shiftTypeName = getShiftTypeName(shiftType)
console.log(shiftTypeName)
var box = $('#shift-box') var box = $('#shift-box')
var id = $(this).parents('tr').eq(0).attr('data-id') var id = $(this).parents('tr').eq(0).attr('data-id')
var account = $(this).parents('tr').eq(0).find('td.account').html() var account = $(this).parents('tr').eq(0).find('td.account').html()
@ -353,7 +394,7 @@ $(function(){
box.find('.show-account').html(account + (realName == '' ? '' : '(' + realName + ')')) box.find('.show-account').html(account + (realName == '' ? '' : '(' + realName + ')'))
box.find('[name=promote_id]').val(id) box.find('[name=promote_id]').val(id)
layer.open({ layer.open({
title: '渠道迁移', title: shiftTypeName,
type: 1, type: 1,
content: box, content: box,
area: ['600px', '350px'], area: ['600px', '350px'],

Loading…
Cancel
Save