游戏统计新增会长和公司

master
chenzhi 5 years ago
parent a643e88ffb
commit 54f2e0abcd

@ -191,6 +191,10 @@ class AjaxController extends ThinkController{
foreach ($data as &$item) { foreach ($data as &$item) {
$item['nickname'] = $item['account'] . ($item['nickname'] ? "({$item['nickname']})" : ""); $item['nickname'] = $item['account'] . ($item['nickname'] ? "({$item['nickname']})" : "");
} }
if($company_id <= 0){
array_unshift($data,["id"=>0,"nickname"=>"官方渠道","account"=>"官方渠道","company_id"=>0]);
}
$this->ajaxReturn(['code'=>1, 'msg'=>'获取成功', 'data'=>$data]); $this->ajaxReturn(['code'=>1, 'msg'=>'获取成功', 'data'=>$data]);
} }

@ -2,7 +2,8 @@
namespace Admin\Controller; namespace Admin\Controller;
class FinancePromoteController extends AdminController class FinancePromoteController extends AdminController
{ {
public function _initialize(Type $var = null) public $COMPANY_NAME = "万盟天下科技";
public function _initialize()
{ {
parent::_initialize(); parent::_initialize();
// echo "<pre>"; // echo "<pre>";
@ -114,7 +115,7 @@ class FinancePromoteController extends AdminController
} else { } else {
$v['company_belong']='内团'; $v['company_belong']='内团';
} }
if(empty($v['company_name'])) $v['company_name']= "万盟天下科技"; if(empty($v['company_name'])) $v['company_name']= $this->COMPANY_NAME;
if(empty($v['p_id'])) $v['p_id']= "0"; if(empty($v['p_id'])) $v['p_id']= "0";
if(!array_key_exists('cash_count',$v)) $v['cash_count']=0; if(!array_key_exists('cash_count',$v)) $v['cash_count']=0;
if(!array_key_exists('balance_coin_count',$v)) $v['balance_coin_count']=0; if(!array_key_exists('balance_coin_count',$v)) $v['balance_coin_count']=0;
@ -308,7 +309,7 @@ class FinancePromoteController extends AdminController
foreach($senddata as $k=>$v){ foreach($senddata as $k=>$v){
$v['company_belong']?$v['company_belong']='外团':$v['company_belong']='内团'; $v['company_belong']?$v['company_belong']='外团':$v['company_belong']='内团';
if(empty($v['company_name'])) $v['company_name']= "万盟天下科技"; if(empty($v['company_name'])) $v['company_name']= $this->COMPANY_NAME;
if(empty($v['promote_account'])) $v['promote_account']= "官方渠道"; if(empty($v['promote_account'])) $v['promote_account']= "官方渠道";
if(!array_key_exists('cash_count',$v)) $v['cash_count']=0; if(!array_key_exists('cash_count',$v)) $v['cash_count']=0;
if(!array_key_exists('balance_coin_count',$v)) $v['balance_coin_count']=0; if(!array_key_exists('balance_coin_count',$v)) $v['balance_coin_count']=0;
@ -585,16 +586,26 @@ class FinancePromoteController extends AdminController
->field("s.game_id,s.game_name,p.partner as partner_name, ->field("s.game_id,s.game_name,p.partner as partner_name,
SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END) as cash_count, SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END) as cash_count,
SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END) as balance_coin_count, SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END) as balance_coin_count,
SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as inside_cash_count") SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as inside_cash_count,
IFNULL(if(substring_index(substring_index(promote.`chain`,'/',2),'/',-1)='',s.promote_id,substring_index(substring_index(promote.`chain`,'/',2),'/',-1)),0) p_id,
IFNULL(company_name,'{$this->COMPANY_NAME}') company_name")
->join('LEFT JOIN tab_game as g ON s.game_id=g.id') ->join('LEFT JOIN tab_game as g ON s.game_id=g.id')
->join("tab_promote promote ON s.promote_id = promote.id","left")
->join("tab_promote_company company ON promote.company_id = company.id","left")
->join('LEFT JOIN tab_partner as p ON g.partner_id=p.id') ->join('LEFT JOIN tab_partner as p ON g.partner_id=p.id')
->order("p_id asc,cash_count desc")
->where($map) ->where($map)
->group('s.game_id'); ->group('p_id,game_id');
if ($row != 0) { if ($row != 0) {
$query = $query->page($page,$row); $query = $query->page($page,$row);
} }
$data = $query->select(); $data = $query->select(false);
// dump($data);die(); $data = M()
->table("(".$data.") a")
->field("a.*,IFNULL(promote.account,'官方渠道') account")
->join("tab_promote promote ON a.p_id = promote.id","left")
->select();
return $data; return $data;
} }
private function totalGameStatisticsData($map, $join = true) private function totalGameStatisticsData($map, $join = true)
@ -621,27 +632,15 @@ class FinancePromoteController extends AdminController
$map['pay_way'] = $_REQUEST['pay_way']; $map['pay_way'] = $_REQUEST['pay_way'];
$this->assign('pay_way', $map['pay_way']); $this->assign('pay_way', $map['pay_way']);
} }
if (!empty($_REQUEST['pay_order_number'])) { if (!empty($_REQUEST['pay_order_number'])) {
$map['pay_order_number'] = $_REQUEST['pay_order_number']; $map['pay_order_number'] = $_REQUEST['pay_order_number'];
} }
// if (!empty(I('partner_id'))&&empty(I("game_id"))) {
// $wherePartner = I('partner_id');
// $gameId = M("game","tab_")->field("id")->where("partner_id={$wherePartner}")->select();
// $gameId = implode(',',array_column($gameId,'id'));
// $map['tab_spend.game_id'] = ['in',$gameId];
// }
if (!empty(I("game_id"))) { if (!empty(I("game_id"))) {
$map['tab_spend.game_id'] = I("game_id"); $map['tab_spend.game_id'] = I("game_id");
} }
if (isset($_REQUEST['game_name']) || isset($_REQUEST['game_type']) || isset($_REQUEST['partner_id'])) { if (isset($_REQUEST['game_name']) || isset($_REQUEST['game_type']) || isset($_REQUEST['partner_id'])) {
$map["tab_spend.game_id"] = array("in",implode(',', array_column(getGameidByPartnerNameType($_REQUEST['partner_id'],$_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) ); $map["tab_spend.game_id"] = array("in",implode(',', array_column(getGameidByPartnerNameType($_REQUEST['partner_id'],$_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) );
} }
// if (isset($_REQUEST['game_name']) || isset($_REQUEST['game_type'])) {
// $map["tab_spend.game_id"] = array("in",implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) );
// }
if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) { if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) {
$map['pay_time'] = ['between', [strtotime($_REQUEST['time_start']), strtotime($_REQUEST['time_end']) + 86399]]; $map['pay_time'] = ['between', [strtotime($_REQUEST['time_start']), strtotime($_REQUEST['time_end']) + 86399]];
} elseif (isset($_REQUEST['time_start'])) { } elseif (isset($_REQUEST['time_start'])) {
@ -649,7 +648,6 @@ class FinancePromoteController extends AdminController
} elseif (isset($_REQUEST['time_end'])) { } elseif (isset($_REQUEST['time_end'])) {
$map['pay_time'] = ['LT', strtotime($_REQUEST['time_end']) + 86399]; $map['pay_time'] = ['LT', strtotime($_REQUEST['time_end']) + 86399];
} }
if ($_REQUEST['promote_id'] != '') { if ($_REQUEST['promote_id'] != '') {
if ($_REQUEST['promote_id'] == 0 || $_REQUEST['promote_type'] == 2) { if ($_REQUEST['promote_id'] == 0 || $_REQUEST['promote_type'] == 2) {
$map['tab_spend.promote_id'] = $_REQUEST['promote_id']; $map['tab_spend.promote_id'] = $_REQUEST['promote_id'];
@ -725,8 +723,6 @@ class FinancePromoteController extends AdminController
$count = count($count); $count = count($count);
$page = set_pagination($count,$row); $page = set_pagination($count,$row);
// $map['pay_game_status'] = 1;
$total_cost = D('spend')->sumSpend($map, 'cost');//订单金额合计 $total_cost = D('spend')->sumSpend($map, 'cost');//订单金额合计
$total_pay_amount = D('spend')->sumSpend($map, 'pay_amount');//实付金额合计 $total_pay_amount = D('spend')->sumSpend($map, 'pay_amount');//实付金额合计
@ -888,7 +884,7 @@ class FinancePromoteController extends AdminController
$pmap['company_id'] = $_REQUEST['company_id']; $pmap['company_id'] = $_REQUEST['company_id'];
//获取公司名称 //获取公司名称
if($pmap['company_id'] == 0){ if($pmap['company_id'] == 0){
$title .= "万盟天下科技-"; $title .= "{$this->COMPANY_NAME}-";
}else{ }else{
$gfflg = false; $gfflg = false;
$title .= (M('promote_company',"tab_")->field("company_name")->where("id = '{$pmap['company_id']}'")->find()['company_name'] . "-"); $title .= (M('promote_company',"tab_")->field("company_name")->where("id = '{$pmap['company_id']}'")->find()['company_name'] . "-");
@ -921,9 +917,10 @@ class FinancePromoteController extends AdminController
$t_in = implode(',', array_column($promoter_ids, 'id')); $t_in = implode(',', array_column($promoter_ids, 'id'));
} }
$map[$field] = ['in',$t_in]; $map[$field] = ['in',$t_in];
}else{
$map[$field] = ['in',"-1"];
} }
} }
//判断是否有推广员 //判断是否有推广员
$level = 1; $level = 1;
if ($_REQUEST['promote_id'] != '') { if ($_REQUEST['promote_id'] != '') {
@ -939,7 +936,6 @@ class FinancePromoteController extends AdminController
} }
} }
} }
// dd($map);
$_POST['promote_level'] = $level; $_POST['promote_level'] = $level;
} }

@ -95,6 +95,23 @@
<div class="input-list search-title-box"> <div class="input-list search-title-box">
<a class="sch-btn" href="javascript:history.go(-1)" style="background:#fff;color: #000;border: #000 solid 1px;width: 100px">返回</a> <a class="sch-btn" href="javascript:history.go(-1)" style="background:#fff;color: #000;border: #000 solid 1px;width: 100px">返回</a>
</div> </div>
<div class="input-list input-list-resway search_label_rehab">
<select id="company_id" name="company_id" class="select_gallery" style="width:150px;">
<option value="">请选择推广公司</option>
<volist name=":getPromoteCompany()" id="vo">
<option value="{$vo.id}" <if condition="I('company_id') && $vo.id eq I('company_id')">selected
</if> >{$vo.company_name}</option>
</volist>
</select>
</div>
<div class="input-list search_item input-list-gamenoticestatus">
<select name="promote_id" style="color:#444" class="select_gallery" id="promote_id">
<option value="">请选择会长</option>
<option value="0" <?php if ($_POST['promote_id'] == 0):?>selected<?php endif;?>>官方渠道</option>
<option value="UC" <?php if ($_POST['promote_id'] == 'UC'):?>selected<?php endif;?>>UC用户</option>
</select>
</div>
<div class="input-list input-list-server search_label_rehab"> <div class="input-list input-list-server search_label_rehab">
<select id="partner_id" name="partner_id" class="select_gallery" style="width:120px;"> <select id="partner_id" name="partner_id" class="select_gallery" style="width:120px;">
<option value="">请选择合作公司</option> <option value="">请选择合作公司</option>
@ -126,10 +143,10 @@
</div> </div>
</div> </div>
<input type="hidden" name="from" value="{$_GET['from']}"/> <!-- <input type="hidden" name="from" value="{$_GET['from']}"/> -->
<input type="hidden" name="promote_id" value="{$_GET['promote_id']}"/> <!-- <input type="hidden" name="promote_id" value="{$_GET['promote_id']}"/> -->
<input type="hidden" name="promote_type" value="{$_GET['promote_type']}"/> <input type="hidden" name="promote_type" value="{$_GET['promote_type']}"/>
<input type="hidden" name="company_id" value="{$_GET['company_id']}"/> <!-- <input type="hidden" name="company_id" value="{$_GET['company_id']}"/> -->
<input type="hidden" name="company_belong" value="{$_GET['company_belong']}"/> <input type="hidden" name="company_belong" value="{$_GET['company_belong']}"/>
<div class="input-list"> <div class="input-list">
@ -150,6 +167,8 @@
<!-- 表头 --> <!-- 表头 -->
<thead> <thead>
<tr> <tr>
<th>推广公司</th>
<th>会长账号</th>
<th>合作公司</th> <th>合作公司</th>
<th >游戏</th> <th >游戏</th>
@ -180,11 +199,13 @@
<notemtpy name = "data"> <notemtpy name = "data">
<volist name="data" id="data"> <volist name="data" id="data">
<tr> <tr>
<td >{$data.company_name}</td>
<td >{$data.account}</td>
<td >{$data.partner_name}</td> <td >{$data.partner_name}</td>
<td >{$data.game_name}</td> <td >{$data.game_name}</td>
<td >{$data.cash_count}</td> <td >{$data.cash_count}</td>
<td class="coin-detail" data-pay_type="0" style="color: #0066cc;cursor: pointer" data-url="{:U('FinancePromote/gameCoinDetail',array_merge(I('get.'),['pay_way'=>0,'game_id'=>$data['game_id'],p=>1,row=>10]))}">{$data.balance_coin_count}</td> <td class="coin-detail" data-pay_type="0" style="color: #0066cc;cursor: pointer" data-url="{:U('FinancePromote/gameCoinDetail',array_merge(I('get.'),['pay_way'=>0,'promote_id'=>$data['p_id'],'game_id'=>$data['game_id'],p=>1,row=>10]))}">{$data.balance_coin_count}</td>
<td class="coin-detail" data-pay_type="-1" style="color: #0066cc;cursor: pointer" data-url="{:U('FinancePromote/gameCoinDetail',array_merge(I('get.'),['pay_way'=>-1,'game_id'=>$data['game_id'],p=>1,row=>10]))}"> <td class="coin-detail" data-pay_type="-1" style="color: #0066cc;cursor: pointer" data-url="{:U('FinancePromote/gameCoinDetail',array_merge(I('get.'),['pay_way'=>-1,'promote_id'=>$data['p_id'],'game_id'=>$data['game_id'],p=>1,row=>10]))}">
{$data.inside_cash_count} {$data.inside_cash_count}
</td> </td>
<td >{$data.all_cash_count}</td> <td >{$data.all_cash_count}</td>
@ -194,7 +215,7 @@
</tr> </tr>
</volist> </volist>
<tr> <tr>
<td colspan="2" ><span>总计</span></td> <td colspan="4" ><span>总计</span></td>
<td ><span><if condition="$sumCash neq ''">{$sumCash}<else/>0</if></span></td> <td ><span><if condition="$sumCash neq ''">{$sumCash}<else/>0</if></span></td>
<td><if condition="$sumBalance neq ''">{$sumBalance}<else/>0</if></td> <td><if condition="$sumBalance neq ''">{$sumBalance}<else/>0</if></td>
<td><if condition="$sumInside neq ''">{$sumInside}<else/>0</if></td> <td><if condition="$sumInside neq ''">{$sumInside}<else/>0</if></td>
@ -250,7 +271,7 @@
}); });
$('.page a:eq(1)').click(function () { $('.page a').click(function () {
var href = $(this).attr('href'); var href = $(this).attr('href');
$(this).removeAttr('href'); $(this).removeAttr('href');
window.location.replace(href) window.location.replace(href)
@ -348,6 +369,35 @@
} }
}) })
} }
var promote_id = "{:I('promote_id')}";
var company_id = "{:I('company_id')}";
function getPromotersByCompanyid() {
var company_id = $("#company_id option:selected").val();
if(!company_id){
company_id = -1;
}
$.ajax({
url: "{:U('Ajax/getPromotersByCompanyid')}",
type: "get",
data: { company_id:company_id},
dataType: 'json',
success: function (response) {
str = '<option value="">请选择会长</option>';
data = response.data;
for (var i in data) {
str += "<option value='" + data[i].id + "' " + (promote_id && data[i].id == promote_id ? 'selected' : '') + ">" + data[i].nickname + "</option>"
}
$("#promote_id").empty();
$("#promote_id").append(str);
$("#promote_id").select2();
}
})
}
getPromotersByCompanyid();
$("#company_id").change(function(){
getPromotersByCompanyid();
})
// $("#game_name, #game_type").change(function(){ // $("#game_name, #game_type").change(function(){
// get_partnet_list(); // get_partnet_list();
// }); // });

@ -244,7 +244,7 @@
highlight_subnav('{:U("FinancePromote/index")}'); highlight_subnav('{:U("FinancePromote/index")}');
$(function(){ $(function(){
$('.page a:eq(1)').click(function () { $('.page a').click(function () {
var href = $(this).attr('href'); var href = $(this).attr('href');
$(this).removeAttr('href'); $(this).removeAttr('href');
window.location.replace(href) window.location.replace(href)

@ -307,7 +307,7 @@
window.location.replace(url); window.location.replace(url);
// window.location.href = url; // window.location.href = url;
}); });
$('.page a:eq(1)').click(function () { $('.page a').click(function () {
var href = $(this).attr('href'); var href = $(this).attr('href');
$(this).removeAttr('href'); $(this).removeAttr('href');
window.location.replace(href) window.location.replace(href)

Loading…
Cancel
Save