diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index d5757619a..834f8dca5 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -3522,11 +3522,14 @@ class ExportController extends Controller // } $map = " 1=1 "; $game_map = ""; - if (isset($_REQUEST['game_name']) && isset($_REQUEST['server_name'])) { + if (isset($_REQUEST['game_name']) && isset($_REQUEST['server_id'])) { $game_ids = implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')); $map .= " AND game_id in ({$game_ids})"; $game_map = " AND EXISTS (SELECT upi.user_id FROM tab_user_play_info as upi where upi.game_id in ({$game_ids}) AND upi.user_id = u.id "; - if (isset($_REQUEST['server_name'])) $game_map .= " AND upi.server_name = '{$_REQUEST['server_name']}' "; + if (isset($_REQUEST['server_id'])) { + $game_map .= " AND upi.server_id = '{$_REQUEST['server_id']}' "; + $map .= " AND server_id = '{$_REQUEST['server_id']}' "; + }; $game_map .= ") "; } else if (isset($_REQUEST['game_name'])) { $game_ids = implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')); diff --git a/Application/Admin/Controller/PlatformController.class.php b/Application/Admin/Controller/PlatformController.class.php index 0774439ec..dc5d31e2c 100644 --- a/Application/Admin/Controller/PlatformController.class.php +++ b/Application/Admin/Controller/PlatformController.class.php @@ -432,7 +432,7 @@ class PlatformController extends ThinkController unset($_REQUEST['game_name']); } if (isset($_REQUEST['server_id'])) { - $play_info_map .= " and upi.server_name = '{$_REQUEST['server_id']}' "; + $play_info_map .= " and upi.server_id = '{$_REQUEST['server_id']}' "; } $today = total(1); @@ -489,6 +489,7 @@ class PlatformController extends ThinkController ->group('tp1.id') ->order('register_time') ->select(); + // dd($tdata);die(); $tmdata = []; foreach($data as $k=>$v){ @@ -497,19 +498,18 @@ class PlatformController extends ThinkController $v['mounth'] = 0; $tmdata[$v['id']] = $v; } - foreach ($tdata as $k => $v) { - - $tmdata[$v['id']]['today'] = $v['today']; - $tmdata[$v['id']]['week'] = $v['week']; - $tmdata[$v['id']]['mounth'] = $v['mounth']; - - if (!$tmdata[$v['id']]['promote_account']) { - $tmdata[$v['id']]['promote_account'] = $v['promote_account']; - $tmdata[$v['id']]['count'] = 0; + if(!empty($tdata)){ + foreach ($tdata as $k => $v) { + $tmdata[$v['id']]['today'] = $v['today']; + $tmdata[$v['id']]['week'] = $v['week']; + $tmdata[$v['id']]['mounth'] = $v['mounth']; + if (!$tmdata[$v['id']]['promote_account']) { + $tmdata[$v['id']]['promote_account'] = $v['promote_account']; + $tmdata[$v['id']]['count'] = 0; + } } - - } + $data = []; foreach($tmdata as $k => $v){ $data[] = $v; @@ -519,7 +519,8 @@ class PlatformController extends ThinkController unset($map['tp1.chain']); unset($tmap['tp1.chain']); unset($tmap['tp1.chain']); - $map['promote_id'] = 0; + $map['u.promote_id'] = 0; + $tmap['u.promote_id'] = 0; $authorityData['count'] = 0; //如果有官方渠道权限 @@ -527,7 +528,8 @@ class PlatformController extends ThinkController if ($user_auth_promote_ids == 'all' || in_array('0', explode(",", $user_auth_promote_ids))) { //官方渠道数据添加 $authorityData = M('user', 'tab_')->alias('u') - ->field('date_format(FROM_UNIXTIME(register_time),"%Y-%m-%d") AS time,count(id) as count') + ->field('date_format(FROM_UNIXTIME(register_time),"%Y-%m-%d") AS time,count(u.id) as count') + ->join($play_info_map ? "tab_user_play_info as upi on upi.user_id = u.id " . $play_info_map : false) ->where($map) ->find(); $tauthorityData = M('user', 'tab_')->alias('u') @@ -536,6 +538,7 @@ class PlatformController extends ThinkController count(IF(register_time ' . $week . ',1,null)) as week, count(IF(register_time ' . $mounth . ',1,null)) as mounth') ->where($tmap) + ->join($play_info_map ? "tab_user_play_info as upi on upi.user_id = u.id " . $play_info_map : false) ->find(); $authorityData['today'] = $tauthorityData['today']; $authorityData['week'] = $tauthorityData['week']; diff --git a/Application/Admin/Controller/PromoteGameRatioController.class.php b/Application/Admin/Controller/PromoteGameRatioController.class.php index 635d62fde..7952b4fa2 100644 --- a/Application/Admin/Controller/PromoteGameRatioController.class.php +++ b/Application/Admin/Controller/PromoteGameRatioController.class.php @@ -146,6 +146,10 @@ class PromoteGameRatioController extends ThinkController if (empty($promoteGameRatio)) { $this->error('参数异常'); } + + $promoteId = $promoteGameRatio['promote_id']; + $this->isWithdraw($promoteId, $save['begin_time']);//是否存在开始时间后已提现数据 + if ($promoteGameRatio['status'] == 1) { $save['last_ratio'] = $promoteGameRatio['ratio']; $save['last_ratio_status'] = 1; @@ -161,6 +165,7 @@ class PromoteGameRatioController extends ThinkController } $promoteId = intval($params['promote_id']); $gameId = intval($params['game_id']); + $this->isWithdraw($promoteId, $save['begin_time']);//是否存在开始时间后已提现数据 $promote = M('promote', 'tab_')->find($promoteId); if (empty($promote) || $promote['level'] != 1) { @@ -217,6 +222,26 @@ class PromoteGameRatioController extends ThinkController } } + private function isWithdraw($promoteId, $beginTime) + { + $promote = M('promote', 'tab_')->find($promoteId); + if (empty($promote)) { + $this->error("数据异常"); + } + if ($promote['level'] != 1) { + $this->error("该推广员不是会长账号,无法执行此操作"); + } + + $withdrawMap['promote_id'] = $promoteId; + $withdrawMap['status'] = ['neq', -2]; + $withdrawMap['settlement_end_time'] = ['egt', $beginTime]; + $withdraw = M('withdraw', 'tab_')->where($withdrawMap)->order('create_time desc')->find(); + if (!empty($withdraw) && $withdraw['status'] != -2) { + $time = date('Y-m-d', $withdraw['create_time']); + $this->error("{$time}之前的订单已经申请提现, 无法变更分成比例,请重新选择开始时间"); + } + } + public function setStatus($status) { $params = I('post.'); @@ -228,6 +253,7 @@ class PromoteGameRatioController extends ThinkController if (empty($status) || !in_array($status, [-1, 1])) { $this->error('操作失败'); } + $time = time(); $map['id'] = ['in', $ids]; $map['status'] = 0; @@ -240,6 +266,32 @@ class PromoteGameRatioController extends ThinkController } $result = D(self::MODEL_NAME)->where($map)->save($save); if ($result) { + if ($status == 1) { + foreach ($ids as $id) { + $promoteGameRatio = D(self::MODEL_NAME)->find($id); + if (!empty($promoteGameRatio)) { + if ($promoteGameRatio['begin_time'] <= strtotime(date('Y-m-d', time()))) { + $promoteId = $promoteGameRatio['promote_id']; + $promoteMap['chain'] = ['like', "/{$promoteId}/%"]; + $promoteIds = M('promote', 'tab_')->where($promoteMap)->getField('id', true); + $promoteIds[] = $promoteId; + + $spendMap['promote_id'] = ['in', $promoteIds]; + $spendMap['game_id'] = $promoteGameRatio['game_id']; + if ($promoteGameRatio['end_time'] > 0) { + $spendMap['pay_time'] = ['between', [$promoteGameRatio['begin_time'], $promoteGameRatio['end_time'] + 3600 * 24 - 1]]; + } else { + $spendMap['pay_time'] = ['egt', $promoteGameRatio['begin_time']]; + } + $spendMap['pay_status'] = 1; + $spendMap['selle_status'] = 0; + + $spendSave['selle_ratio'] = $promoteGameRatio['ratio']; + M('spend', 'tab_')->where($spendMap)->save($spendSave); + } + } + } + } $this->success('操作成功'); } else { $this->error('操作失败'); diff --git a/Application/Admin/Controller/StatisticsController.class.php b/Application/Admin/Controller/StatisticsController.class.php index 5bb786fd6..467be7f9c 100644 --- a/Application/Admin/Controller/StatisticsController.class.php +++ b/Application/Admin/Controller/StatisticsController.class.php @@ -1035,11 +1035,14 @@ class StatisticsController extends ThinkController { $map = " 1=1 "; $game_map = ""; - if (isset($_REQUEST['game_name']) && isset($_REQUEST['server_name'])) { + if (isset($_REQUEST['game_name']) && isset($_REQUEST['server_id'])) { $game_ids = implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')); $map .= " AND game_id in ({$game_ids})"; $game_map = " AND EXISTS (SELECT upi.user_id FROM tab_user_play_info as upi where upi.game_id in ({$game_ids}) AND upi.user_id = u.id "; - if (isset($_REQUEST['server_name'])) $game_map .= " AND upi.server_name = '{$_REQUEST['server_name']}' "; + if (isset($_REQUEST['server_id'])) { + $game_map .= " AND upi.server_id = '{$_REQUEST['server_id']}' "; + $map .= " AND server_id = '{$_REQUEST['server_id']}' "; + }; $game_map .= ") "; } else if (isset($_REQUEST['game_name'])) { $game_ids = implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')); diff --git a/Application/Admin/View/Platform/promote_statistics.html b/Application/Admin/View/Platform/promote_statistics.html index 78e9e9ea8..bc83d84e4 100644 --- a/Application/Admin/View/Platform/promote_statistics.html +++ b/Application/Admin/View/Platform/promote_statistics.html @@ -286,14 +286,15 @@ $("#game_id").change(function(){ $.ajax({ - url:"{:U('Ajax/getUserServer')}", + url:"{:U('getSpendServer')}", type:"post", data:{game_id:$("#game_id option:selected").attr('game-id')}, dataType:'json', success:function(data){ + console.log(data) str = ""; for (var i in data){ - str += "" + str += "" } $("#server_id").empty(); $("#server_id").append(str); @@ -306,14 +307,15 @@ var game_server = "{:I('server_id')}"; if(game_id){ $.ajax({ - url:"{:U('Ajax/getUserServer')}", + url:"{:U('getSpendServer')}", type:"post", - data:{game_id:game_id,type:2}, + data:{game_name:game_id}, dataType:'json', success:function(data){ + console.log(data) str = ""; for (var i in data){ - str += "" + str += "" } $("#server_id").empty(); $("#server_id").append(str); diff --git a/Application/Admin/View/Promote/linkInfo.html b/Application/Admin/View/Promote/linkInfo.html index d51494153..11a562686 100644 --- a/Application/Admin/View/Promote/linkInfo.html +++ b/Application/Admin/View/Promote/linkInfo.html @@ -32,9 +32,9 @@
说明:下载链接信息解析
+说明:链接归属信息解析
@@ -53,10 +53,10 @@