修改bug

master
ELF 5 years ago
parent 12016f1b34
commit 070cc2e7c2

@ -92,7 +92,7 @@ class PromoteService {
$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'] : [];
$create_promote_id = empty(session('promote_auth.pid')) ? 0 : session('promote_auth.pid');
$createPromoteId = empty(session('promote_auth.pid')) ? 0 : session('promote_auth.pid');
if ($fromPromoteId == $toPromoteId) {
return [
@ -106,6 +106,7 @@ class PromoteService {
'msg'=>'订单日期不能为空'
];
}
if ($type == 1 && $balanceCoinMode == 0) {
return [
'status' => false,
@ -113,6 +114,21 @@ class PromoteService {
];
}
if (count($shiftIds) > 15) {
return [
'status' => false,
'msg'=>'部分迁移时迁移人数不能超过15'
];
}
$shiftTask = M('shift_task', 'sys_')->field(['id'])->where(['type' => $type, 'status' => 0, 'from_promote_id'])->find();
if ($shiftTask) {
return [
'status' => false,
'msg' => '含有类似未执行迁移任务,请稍后再试'
];
}
$isFuture = false;
if (strtotime($orderTime) > strtotime(date('Y-m-d 23:59:59'))) {
$isFuture = true;
@ -124,13 +140,13 @@ class PromoteService {
'order_time' => strtotime($orderTime),
'balance_coin_mode' => $balanceCoinMode,
'create_time' => time(),
'create_promote_id' => $create_promote_id,
'create_promote_id' => $createPromoteId,
'status' => 0,
'type' => $type,
'shift_ids' => json_encode($shiftIds)
];
if (M('ShiftTask')->add($data)) {
if (M('shift_task', 'sys_')->add($data)) {
return [
'status' => true,
'msg'=>'迁移任务创建成功'

@ -874,8 +874,8 @@ class PromoteController extends BaseController
if (count($ids) > 0) {
$countList = M('promote', 'tab_')->field(['count(*)' => 'count', 'parent_id' => 'parent_id'])->where(['parent_id' => ['in', $ids]])->group('parent_id')->select();
$playerList = M('user_play', 'tab_')->field(['count(*)' => 'count', 'promote_id' => 'promote_id'])->where(['promote_id' => ['in', $ids]])->group('promote_id')->select();
$shiftList = M('shift_task', 'sys_')->field(['count(*)' => 'count', 'from_promote_id' => 'from_promote_id'])->where(['status' => 0, 'type' => 1, 'promote_id' => ['in', $ids]])->group('from_promote_id')->select();
$shiftPlayerList = M('shift_task', 'sys_')->field(['count(*)' => 'count', 'from_promote_id' => 'from_promote_id'])->where(['status' => 0, 'type' => 2, 'promote_id' => ['in', $ids]])->group('from_promote_id')->select();
$shiftList = M('shift_task', 'sys_')->field(['count(*)' => 'count', 'from_promote_id' => 'from_promote_id'])->where(['status' => 0, 'type' => 1, 'from_promote_id' => ['in', $ids]])->group('from_promote_id')->select();
$shiftPlayerList = M('shift_task', 'sys_')->field(['count(*)' => 'count', 'from_promote_id' => 'from_promote_id'])->where(['status' => 0, 'type' => 2, 'from_promote_id' => ['in', $ids]])->group('from_promote_id')->select();
$hasChildList = array_column($countList, 'parent_id');
$hasPlayerList = array_column($playerList, 'promote_id');
$hasShiftList = array_column($shiftList, 'from_promote_id');

@ -1,6 +1,9 @@
<extend name="Public/promote_base"/>
<block name="css">
<link href="__CSS__/20180207/account.css" rel="stylesheet" >
<link href="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="http://www.jq22.com/jquery/font-awesome.4.6.0.css">
<link href="__CSS__/transfer.css" rel="stylesheet" >
</block>
<block name="body">
<div class="page-list normal_list promote-mychlid-list">
@ -16,7 +19,7 @@
<form action="{:U('Promote/children',array('row'=>I('get.row')))}" method="post" enctype="multipart/form-data">
<input type="hidden" name="promote_type" value="{:I('promote_type', 0)}">
<div class="form-group fl normal_space">
<a href="{:U('Promote/addPromote', ['promote_type' => I('promote_type', 0)])}" class="submit btn"><i class="add_qudao"></i><span>添加{$promoteTypeName}</span></a>
<a href="{:U('Promote/addPromote', ['promote_type' => I('promote_type', 0)])}" class="submit btn" style="line-height: 25px"><i class="add_qudao"></i><span>添加{$promoteTypeName}</span></a>
</div>
<div class="form-group fr">
<input type="submit" class="submit normal_space" value="查询">
@ -60,7 +63,7 @@
<tr><td colspan="10" 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>">
<tr data-id="{$record.id}" data-parent-id="{$record.parent_id}" class="<eq name='mod' value='1'>odd</eq>">
<td>{$record.id}</td>
<td class="account">{$record.account}</td>
<td class="real-name">{$record.real_name}</td>
@ -137,6 +140,7 @@
<div id="shift-box" class="layer-box" style="display: none;">
<form method="post" enctype="multipart/form-data">
<input type="hidden" name="promote_id" value="">
<input type="hidden" name="parent_id" value="">
<div class="form-group">
<label>账号(真实姓名)</label>
<div class="form-item">
@ -164,6 +168,18 @@
<label class="radio-item"><input type="radio" value="2" name="balance_coin_mode"> 平台币清零</label>
</div>
</div>
<?php if(I('promote_type', 0) != 2):?>
<div class="form-group">
<label>迁移方式</label>
<div class="form-item">
<label class="radio-item"><input type="radio" value="1" name="shift_mode" checked> 全部迁移</label>
<label class="radio-item"><input type="radio" value="2" name="shift_mode"> 部分迁移</label>
</div>
</div>
<div id="shift-transfer" class="form-group" style="display: none;">
<include file="Public/transfer" />
</div>
<?php endif;?>
<div class="form-group">
<label></label>
<a id="shift-submit" href="javascript:;" class="shift-submit btn">确定</a>
@ -206,16 +222,21 @@
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script src="__STATIC__/vue.js"></script>
<script src="__JS__/transfer.js"></script>
<script type="text/javascript">
$(function(){
$(".select_gallery").select2();
var promoteType = $('input[name=promote_type]').val()
var level = 0
var subLevel = 0
if (promoteType == 0) {
level = 2
subLevel = 3
} else if (promoteType == 1) {
level = 3
subLevel = 4
} else if (promoteType == 2) {
level = 3
}
@ -238,6 +259,16 @@ $(function(){
$('#player-to-promote').html(options)
})
$('[name=shift_mode]').on({
click: function () {
if ($(this).val() == 2) {
$('#shift-transfer').show()
} else {
$('#shift-transfer').hide()
}
}
})
function getSubPromotes(data, successCallback) {
$.ajax({
url: "{:U('Promote/getSubPromotes')}",
@ -386,18 +417,27 @@ $(function(){
click: function() {
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 tr = $(this).parents('tr').eq(0)
var id = tr.attr('data-id')
var parentId = tr.attr('data-parent-id')
getSubPromotes({promote_id: id, level: subLevel}, function (response) {
vm.init()
for (var i in response.data.promotes) {
var promote = response.data.promotes[i]
vm.initList.push({id: promote.id, name: promote.account + '(' + promote.real_name + ')', type:false, isSearch:true, number:6})
}
})
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)
box.find('[name=parent_id]').val(parentId)
layer.open({
title: shiftTypeName,
type: 1,
content: box,
area: ['600px', '350px'],
area: ['600px', '600px'],
zIndex: 250,
})
}
@ -405,21 +445,38 @@ $(function(){
$('#shift-submit').on({
click: function() {
var box = $('#shift-box')
var id = box.find('[name=promote_id]').val()
var toPromoteId = box.find('[name=to_promote_id]').val()
var orderTime = box.find('[name=order_time]').val()
var balanceCoinMode = box.find('[name=balance_coin_mode]:checked').val()
if (toPromoteId == 0) {
layer.msg('请选择转移至的推广账号')
var box = $('#shift-box')
var id = box.find('[name=promote_id]').val()
var parentId = box.find('[name=parent_id]').val()
var toPromoteId = box.find('[name=to_promote_id]').val()
var orderTime = box.find('[name=order_time]').val()
var balanceCoinMode = box.find('[name=balance_coin_mode]:checked').val()
var shiftIds = []
var fromPromoteId = 0
if (toPromoteId == 0) {
layer.msg('请选择转移至的推广账号')
return
}
if (promoteType == 2) {
fromPromoteId = parentId
shiftIds = [id]
} else {
fromPromoteId = id
if ($('[name=shift_mode]:checked').val() == 2) {
shiftIds = vm.getTargetIds()
if (shiftIds.length == 0) {
layer.msg('请选择要转移的下级推广账号')
return
}
}
}
var data = {
from_promote_id: id,
from_promote_id: fromPromoteId,
to_promote_id: toPromoteId,
order_time: orderTime,
balance_coin_mode: balanceCoinMode,
type: 1,
shift_ids: shiftIds
}
$.ajax({
url: "{:U('Promote/shift')}",
@ -441,30 +498,31 @@ $(function(){
$('.shift-player-btn').on({
click: function() {
var box = $('#shift-player-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: '玩家迁移',
type: 1,
content: box,
area: ['600px', '350px'],
zIndex: 250,
})
}
})
click: function() {
var box = $('#shift-player-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: '玩家迁移',
type: 1,
content: box,
area: ['600px', '350px'],
zIndex: 250,
})
}
})
$('#shift-player-submit').on({
click: function() {
var box = $('#shift-player-box')
var box = $('#shift-player-box')
var id = box.find('[name=promote_id]').val()
var toPromoteId = box.find('[name=to_promote_id]').val()
var orderTime = box.find('[name=order_time]').val()
var balanceCoinMode = box.find('[name=balance_coin_mode]:checked').val()
var shiftIds = []
if (toPromoteId == 0) {
layer.msg('请选择转移至的推广账号')
return
@ -475,6 +533,7 @@ $(function(){
order_time: orderTime,
balance_coin_mode: balanceCoinMode,
type: 2,
shift_ids: shiftIds
}
$.ajax({
url: "{:U('Promote/shift')}",

@ -0,0 +1,48 @@
<div id="transfer-app">
<div id="transfer">
<div class="tra-left">
<div class="tra-header">
<div class="tra-header-left"><i class="tra-pointer" :class="selectIconLeft" @click="allInitSelect" aria-hidden="true"></i></div>
<div class="tra-header-center">全部成员</div>
<div class="tra-header-right">{{leftSelectNum}} / {{initNum}}</div>
</div>
<div class="tra-search">
<input type="text" class="form-control" v-model="traLeftInput"/>
<span class="fa fa-search searchicon" aria-hidden="true"></span>
</div>
<div class="tra-content" v-show="!leftEmpty">
<div class="tra-item" v-for="item in initList" v-if="item.isSearch">
<i class="tra-pointer tra-icon fa" :class="item.type ? 'fa-check-square-o':'fa-square-o'" @click="selectLeft(item.id)" aria-hidden="true"></i>
<span>{{item.name}}</span>
</div>
</div>
<div class="tra-empty-content" v-show="leftEmpty">
无数据
</div>
</div>
<div class="tra-center">
<button class="btn" type="button" @click="toRight" :disabled="leftDisabled" :class="leftDisabled ? '': 'btn-primary'"><i class="fa fa-angle-double-right" aria-hidden="true"></i></button>
<button class="btn" type="button" @click="toLeft" :disabled="rightDisabled" :class="rightDisabled ? '': 'btn-primary'"><i class="fa fa-angle-double-left" aria-hidden="true"></i></button>
</div>
<div class="tra-right">
<div class="tra-header">
<div class="tra-header-left"><i class="tra-pointer" :class="selectIconRight" @click="allTargetSelect" aria-hidden="true"></i></div>
<div class="tra-header-center">选中成员</div>
<div class="tra-header-right">{{rightSelectNum}} / {{targetNum}}</div>
</div>
<div class="tra-search">
<input type="text" class="form-control" v-model="traRightInput"/>
<span class="fa fa-search searchicon" aria-hidden="true"></span>
</div>
<div class="tra-content" v-show="!rightEmpty">
<div class="tra-item" v-for="item in targetList" v-if="item.isSearch">
<i class="tra-pointer tra-icon fa" :class="item.type ? 'fa-check-square-o':'fa-square-o'" @click="selectRight(item.id)" aria-hidden="true"></i>
<span>{{item.name}}</span>
</div>
</div>
<div class="tra-empty-content" v-show="rightEmpty">
无数据
</div>
</div>
</div>
</div>

@ -0,0 +1,128 @@
/*穿梭框*/
#transfer{
display: flex;
height: 300px;
}
.tra-left,.tra-right{
border: 1px solid #cecece;
flex: 1;
border-radius: 5px;
height: 100%;
display: flex;
flex-direction: column;
}
.tra-center{
width: 100px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.tra-center button{
margin: 10px 0;
}
.tra-header{
display: flex;
align-items: center;
height: 30px;
background: #F9FAFC;
}
.tra-header-left{
width: 50px;
text-align: center;
}
.tra-header-center{
flex: 1;
}
.tra-header-right{
width: 50px;
text-align: center;
}
.tra-icon{
width: 20px;
font-size: 16px;
}
.tra-tab{
height: 35px;
border: 1px solid #cecece;
display: flex;
border-left: 0;
border-right: 0;
align-items: center;
padding: 0 10px;
box-sizing: border-box;
}
.activeBottom{
border-bottom: 2px solid #2D8CF0!important;
transition:all 0.3s;
}
.tra-tab-pic{
width: 100px;
text-align: center;
cursor: pointer;
display: flex;
justify-content: center;
align-items: center;
height: 100%;
margin-bottom: 2px;
border-bottom: 2px solid #fff;
/*box-sizing: border-box;*/
}
.tra-search{
height: 40px;
position: relative;
display: flex;
align-items: center;
overflow: hidden;
padding: 0 5px;
box-sizing: border-box;
}
.searchicon{
position: absolute;
right: 20px;
}
.tra-content{
padding: 0 15px;
flex: 1;
overflow-y: auto;
}
.tra-empty-content{
padding: 0 15px;
flex: 1;
display: flex;
justify-content: center;
align-items: center;
}
.tra-item{
height: 25px;
display: flex;
align-items: center;
}
.tra-item span{
padding-left: 5px;
font-size: 14px;
}
.tra-pointer{
cursor: pointer;
}
/*滚动条样式*/
.tra-content::-webkit-scrollbar {
/*滚动条整体样式*/
width: 4px; /*高宽分别对应横竖滚动条的尺寸*/
height: 4px;
}
.tra-content::-webkit-scrollbar-thumb {
/*滚动条里面小方块*/
border-radius: 5px;
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
background: rgba(0, 0, 0, 0.2);
}
.tra-content::-webkit-scrollbar-track {
/*滚动条里面轨道*/
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
border-radius: 0;
background: rgba(0, 0, 0, 0.1);
}

@ -0,0 +1,217 @@
var vm = new Vue({
el:'#transfer-app',
data:{
initList:[],//初始化数据
initNum:0,//初始化数据总数
targetList:[],//目标数据
targetNum:0,//目标数据总数
leftSelectNum:0,//左侧选中数据
rightSelectNum:0,//右侧选中数据
traLeftInput:'',//左边输入框数值
traRightInput:'',//右边输入框数值
leftEmpty:false,//左侧数据为空
rightEmpty:false,//左侧数据为空
selectIconLeft:"fa fa-square-o",
selectIconRight:"fa fa-square-o",
leftDisabled:true,
rightDisabled:true,
leftActive:1,
rightActive:1
},
mounted:function(){
this.init();
},
watch:{
traLeftInput:function (newVal,oldVal) {
this.initList.map((item)=>{
if(item.name.indexOf(newVal)!=-1){
item.isSearch=true
}else{
item.isSearch=false
}
})
},
traRightInput:function (newVal,oldVal) {
this.targetList.map((item)=>{
if(item.name.indexOf(newVal)!=-1){
item.isSearch=true
}else{
item.isSearch=false
}
})
},
initList:{
handler:function (newVal,oldVal) {
var len=newVal.filter(item=>item.type);
if(len.length>0){
this.leftDisabled=false;
}else{
this.leftDisabled=true;
}
//计算初始化数据长度
this.initNum=newVal.length;
//计算选中数据长度
this.leftSelectNum=newVal.filter(item=>item.type).length;
//判断数据是否为空
if(newVal.length>0){
this.leftEmpty=false
}else{
this.leftEmpty=true
}
},
deep:true
},
targetList:{
handler:function (newVal,oldVal) {
var len=newVal.filter(item=>item.type);
if(len.length>0){
this.rightDisabled=false;
}else{
this.rightDisabled=true;
}
//计算初始化数据长度
this.targetNum=newVal.length;
//计算选中数据长度
this.rightSelectNum=newVal.filter(item=>item.type).length;
//判断数据是否为空
if(newVal.length>0){
this.rightEmpty=false;
}else{
this.rightEmpty=true;
}
},
deep:true
}
},
methods: {
init:function(){
this.getInitList();
},
allInitSelect:function () {
if(this.selectIconLeft=="fa fa-square-o"){
this.selectIconLeft="fa fa-check-square-o";
this.initList.map(item=>{item.type=true})
}else{
this.selectIconLeft="fa fa-square-o";
this.initList.map(item=>{item.type=false});
}
},//左侧全选
allTargetSelect:function () {
if(this.selectIconRight=="fa fa-square-o"){
this.selectIconRight="fa fa-check-square-o";
this.targetList.map(item=>{item.type=true})
}else{
this.selectIconRight="fa fa-square-o";
this.targetList.map(item=>{item.type=false});
}
},//右侧全选
getInitList:function () {
this.initList = [];
// this.initList=[];
this.targetList=[];
this.initList=this.sortByName(this.initList,'name');
},
selectLeft:function (id) {
this.initList.map((item)=>{
if(item.id==id){
item.type=!item.type
}
})
},
selectRight:function (id) {
this.targetList.map((item)=>{
if(item.id==id){
item.type=!item.type
}
})
},
toRight:function () {
var selArr=this.initList.filter(item=>item.type);
var noSelArr=this.initList.filter(item=>!item.type);
this.initList=noSelArr;
this.targetList=this.targetList.concat(selArr);
//对目标数据进行重新排序
if(this.rightActive==1){
this.targetList=this.sortByName(this.targetList,'name');
}else{
this.targetList=this.sortByNumber(this.targetList,'number');
}
//将目标数据设置为未选中
this.targetList.map(item=>{(item.type=false)})
},
toLeft:function () {
var selArr=this.targetList.filter(item=>item.type);
var noSelArr=this.targetList.filter(item=>!item.type);
this.targetList=noSelArr;
this.initList=this.initList.concat(selArr);
//对初始数据进行重新排序,并将设置为未选中
if(this.leftActive==1){
this.initList=this.sortByName(this.initList,'name');
}else{
this.initList=this.sortByNumber(this.initList,'number');
}
//将初始数据设置为未选中
this.initList.map(item=>{(item.type=false)})
},
changeLeftTab:function (num) {
this.leftActive=num;
if(num==1){
this.initList=this.sortByName(this.initList,'name');
}else{
this.initList=this.sortByNumber(this.initList,'number');
}
},
changeRightTab:function (num) {
this.rightActive=num;
if(num==1){
this.targetList=this.sortByName(this.targetList,'name');
}else{
this.targetList=this.sortByNumber(this.targetList,'number');
}
},
sortByName:function (arr,type) {
return arr.sort((a,b)=>{
return (a[type].localeCompare(b[type]))
})
},
sortByNumber:function (arr,type) {
return arr.sort((a,b)=>{
return (a[type]-b[type]>0)
})
},
getTargetIds() {
let ids = []
for (let i in this.targetList) {
ids.push(this.targetList[i].id)
}
return ids
},
save:function(){
if(this.targetList.length){
let result=[];
this.targetList.map(item=>{
return result.push(item.name)
})
alert('获取的值为:'+result.join(','))
}else{
alert("获取值为空")
}
}
}
});

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save