修改bug

master
ELF 5 years ago
parent 02d862cb7a
commit f056143dee

@ -90,6 +90,7 @@ class PromoteService {
$orderTime = isset($params['order_time']) ? $params['order_time'] : '';
$balanceCoinMode = isset($params['balance_coin_mode']) ? $params['balance_coin_mode'] : 0;
$type = isset($params['type']) ? $params['type'] : 0;
$shiftIds = isset($params['shift_ids']) && $params['shift_ids'] ? $params['shift_ids'] : [];
if ($fromPromoteId == $toPromoteId) {
return [
@ -123,7 +124,8 @@ class PromoteService {
'create_time' => time(),
'create_promote_id' => session('promote_auth.pid'),
'status' => 0,
'type' => $type
'type' => $type,
'shift_ids' => json_encode($shiftIds)
];
if (M('ShiftTask')->add($data)) {
@ -176,8 +178,8 @@ class PromoteService {
$firstMap = ['parent_id' => $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];
$secondMap['id'] = ['in', $shiftIds];
}
@ -206,11 +208,7 @@ class PromoteService {
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);
$coinRecordService = new PromoteCoinRecordService();
$promoteCoinService = new PromoteCoinService();
@ -218,7 +216,7 @@ class PromoteService {
$topBalancePlus = 0;
$map = ['chain' => $promote['chain'] . $chain['id'] . '/%'];
if ($shiftIds != null) {
if (count($shiftIds) > 0) {
$map['id'] = ['in', $shiftIds];
}
$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>
</if>
<a href="javascript:;" class="reset-password-btn editbtn">重置密码</a>
<?php if(in_array($record['id'], $hasChildList)):?>
<?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:?>
<a href="javascript:;" style="color: red;" data-promote-shift-type="1" class="cancel-shift-btn editbtn">取消渠道迁移</a>
<?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;" class="cancel-shift-btn editbtn">取消渠道迁移</a>
<a href="javascript:;" style="color: red;" data-promote-shift-type="2" class="cancel-shift-btn editbtn">取消换组</a>
<?php endif;?>
<?php endif;?>
<?php if(in_array($record['id'], $hasPlayerList)):?>
<?php if(!in_array($record['id'], $hasShiftPlayerList)):?>
<a href="javascript:;" class="shift-player-btn editbtn">玩家迁移</a>
@ -125,7 +135,7 @@
setValue('row','{:I("get.row",10)}');
</script>
<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="">
<div class="form-group">
<label>账号(真实姓名)</label>
@ -136,7 +146,7 @@
<div class="form-group">
<label>转移至推广账号</label>
<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>
</select>
</div>
@ -161,7 +171,7 @@
</form>
</div>
<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="">
<div class="form-group">
<label>账号(真实姓名)</label>
@ -172,7 +182,7 @@
<div class="form-group">
<label>转移至推广账号</label>
<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>
</select>
</div>
@ -207,23 +217,39 @@ $(function(){
} else if (promoteType == 1) {
level = 3
} else if (promoteType == 2) {
level = 4
level = 3
}
$.ajax({
url: "{:U('Promote/getSubPromotes')}",
data: {level: level},
type: 'post',
dataType: 'json',
success: 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>'
}
$('select[name=to_promote_id]').html(options)
getSubPromotes({level: level}, 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>'
}
$('#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({
format: 'yyyy-mm-dd',
language:"zh-CN",
@ -306,22 +332,34 @@ $(function(){
}
})
function getShiftTypeName(shiftType) {
var shiftTypeName = ''
if (shiftType == 1) {
shiftTypeName = '渠道迁移'
} else if (shiftType == 2) {
shiftTypeName = '换组'
}
return shiftTypeName
}
$('.cancel-shift-btn').on({
click: function() {
var id = $(this).parents('tr').eq(0).attr('data-id')
layer.confirm('是否要取消渠道迁移?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "{:U('Promote/cancelShift')}",
data: {promote_id: id, type: 1},
type: 'post',
dataType: 'json',
success: function(response) {
layer.msg(response.msg, {time: 1000}, function() {
window.location.href = window.location.href
})
}
})
})
var shiftType = $(this).attr('data-promote-shift-type')
var shiftTypeName = getShiftTypeName(shiftType)
layer.confirm('是否要取消' + shiftTypeName, {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "{:U('Promote/cancelShift')}",
data: {promote_id: id, type: 1},
type: 'post',
dataType: 'json',
success: function(response) {
layer.msg(response.msg, {time: 1000}, function() {
window.location.href = window.location.href
})
}
})
})
}
})
@ -346,19 +384,22 @@ $(function(){
$('.shift-btn').on({
click: function() {
var box = $('#shift-box')
var id = $(this).parents('tr').eq(0).attr('data-id')
var account = $(this).parents('tr').eq(0).find('td.account').html()
var realName = $(this).parents('tr').eq(0).find('td.real-name').html()
box.find('.show-account').html(account + (realName == '' ? '' : '(' + realName + ')'))
box.find('[name=promote_id]').val(id)
layer.open({
title: '渠道迁移',
var shiftType = $(this).attr('data-promote-shift-type')
var shiftTypeName = getShiftTypeName(shiftType)
console.log(shiftTypeName)
var box = $('#shift-box')
var id = $(this).parents('tr').eq(0).attr('data-id')
var account = $(this).parents('tr').eq(0).find('td.account').html()
var realName = $(this).parents('tr').eq(0).find('td.real-name').html()
box.find('.show-account').html(account + (realName == '' ? '' : '(' + realName + ')'))
box.find('[name=promote_id]').val(id)
layer.open({
title: shiftTypeName,
type: 1,
content: box,
area: ['600px', '350px'],
zIndex: 250,
})
})
}
})

Loading…
Cancel
Save