公会统计6

master
chenzhi 5 years ago
parent b743cd73e1
commit cb99c63223

@ -30,35 +30,11 @@ class FinancePromoteController extends AdminController
} }
$senddata = []; $senddata = [];
//获取各会长的现金充值 //获取各会长的充值方式
$cash = self::getJoinPromoteData(array("pay_way"=>array("GT",0)),$istimeselect); $cash = self::getJoinPromoteData([],$istimeselect);
foreach($cash as $k=>$v){ foreach($cash as $k=>$v){
$v['cash_count'] = $v['pay_amount'];
unset($v['pay_amount']);
$senddata[$v['p_id']] = $v; $senddata[$v['p_id']] = $v;
} }
//平台币直充支出
$balance = self::getJoinPromoteData(array("pay_way"=>array("EQ",0)),$istimeselect);
foreach($balance as $k=>$v){
if(array_key_exists($v['p_id'],$senddata)){
$senddata[$v['p_id']]['balance_coin_count']= $v['pay_amount'];
}else{
$v['balance_coin_count'] = $v['pay_amount'];
unset($v['pay_amount']);
$senddata[$v['p_id']] = $v;
};
}
//平台币内充
$bind = self::getJoinPromoteData(array("pay_way"=>array("LT",0)),$istimeselect);
foreach($bind as $k=>$v){
if(array_key_exists($v['p_id'],$senddata)){
$senddata[$v['p_id']]['bind_coin_count']= $v['pay_amount'];
}else{
$v['bind_coin_count'] = $v['pay_amount'];
unset($v['pay_amount']);
$senddata[$v['p_id']] = $v;
};
}
//内冲 //内冲
$inside = self::getJoinPromoteData([],$istimeselect,"promote_coin"); $inside = self::getJoinPromoteData([],$istimeselect,"promote_coin");
foreach($inside as $k=>$v){ foreach($inside as $k=>$v){
@ -133,7 +109,11 @@ class FinancePromoteController extends AdminController
} }
$map['s.pay_status']=1; $map['s.pay_status']=1;
$field= "sum(pay_amount) pay_amount,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_id,0) company_id,company_name"; $field= "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 = -1 THEN pay_amount ELSE 0 END) as bind_coin_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_id,0) company_id,company_name";
return M() return M()
->table("tab_spend s") ->table("tab_spend s")
->field($field) ->field($field)
@ -182,34 +162,10 @@ class FinancePromoteController extends AdminController
} }
$senddata = []; $senddata = [];
//获取各会长的现金充值 //获取各会长的现金充值
$cash = self::promoteUserData(array("pay_way"=>array("GT",0)),$istimeselect); $cash = self::promoteUserData([],$istimeselect);
foreach($cash as $k=>$v){ foreach($cash as $k=>$v){
$v['cash_count'] = $v['pay_amount'];
unset($v['pay_amount']);
$senddata[$v['promote_id']] = $v; $senddata[$v['promote_id']] = $v;
} }
//平台币直充支出
$balance = self::promoteUserData(array("pay_way"=>array("EQ",0)),$istimeselect);
foreach($balance as $k=>$v){
if(array_key_exists($v['promote_id'],$senddata)){
$senddata[$v['promote_id']]['balance_coin_count']= $v['pay_amount'];
}else{
$v['balance_coin_count'] = $v['pay_amount'];
unset($v['pay_amount']);
$senddata[$v['promote_id']] = $v;
};
}
//平台币内充
$bind = self::promoteUserData(array("pay_way"=>array("LT",0)),$istimeselect);
foreach($bind as $k=>$v){
if(array_key_exists($v['promote_id'],$senddata)){
$senddata[$v['promote_id']]['bind_coin_count']= $v['pay_amount'];
}else{
$v['bind_coin_count'] = $v['pay_amount'];
unset($v['pay_amount']);
$senddata[$v['promote_id']] = $v;
};
}
$inside = self::promoteUserData([],$istimeselect,"promote_coin"); $inside = self::promoteUserData([],$istimeselect,"promote_coin");
foreach($inside as $k=>$v){ foreach($inside as $k=>$v){
if(array_key_exists($v['promote_id'],$senddata)){ if(array_key_exists($v['promote_id'],$senddata)){
@ -295,7 +251,10 @@ class FinancePromoteController extends AdminController
$map['s.pay_time']=$istimeselect; $map['s.pay_time']=$istimeselect;
} }
$map['s.pay_status']=1; $map['s.pay_status']=1;
$field= "sum(pay_amount) pay_amount,IFNULL(company_id,0) company_id,company_name,promote_id"; $field= "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 = -1 THEN pay_amount ELSE 0 END) as bind_coin_count,
IFNULL(company_id,0) company_id,company_name,promote_id";
return M() return M()
->table("tab_spend s") ->table("tab_spend s")
->field($field) ->field($field)
@ -669,6 +628,17 @@ class FinancePromoteController extends AdminController
} }
$map['s.promote_id'] = $_REQUEST['promote_id']; $map['s.promote_id'] = $_REQUEST['promote_id'];
} }
//检索
if (isset($_REQUEST['sn'])) {
$pmap['order_number'] = array("LIKE","%".$_REQUEST['sn']."%");
$map['sn'] = array("LIKE","%".$_REQUEST['sn']."%");
}
if (isset($_REQUEST['type'])) {
if($_REQUEST['type'] == 2){
$pmap['op_id'] =0;//肯定false
}
$map['s.type'] =$_REQUEST['type'];
}
// //
$senddata = []; $senddata = [];
@ -679,47 +649,72 @@ class FinancePromoteController extends AdminController
if($istimeselect){ if($istimeselect){
$pmap['create_time'] = $istimeselect; $pmap['create_time'] = $istimeselect;
} }
$admininside = M("provide_user p","tab_")
->field("order_number,user_account,amount,balance")
->join("left join tab_user as u on u.id = p.user_id")
->page($page, $row)
->where($pmap)
->select();
foreach ($admininside as $k => $v) {
$temp = [
"sn"=>$v['order_number'],
"op_type"=>"收入",
"op_sty"=>"后台发放玩家",
""
];
# code...
}
$admincount = M("provide_user p","tab_")->field("sum(amount) amount,count(*) count")->where($pmap)->find(); $admincount = M("provide_user p","tab_")->field("sum(amount) amount,count(*) count")->where($pmap)->find();
$count = $admincount["count"]?:0; $count = $admincount["count"]?:0;
$total_cost = $admincount["amount"]?:0; $total_cost = $admincount["amount"]?:0;
if($count >0){
$admininside = M("provide_user p","tab_")
->field("order_number,user_account,amount,balance,create_time")
->join("left join tab_user as u on u.id = p.user_id")
->page($page, $row)
->where($pmap)
->select();
foreach ($admininside as $k => $v) {
$temp = [
"sn"=>$v['order_number'],
"op_type"=>"收入",
"op_sty"=>"后台发放玩家",
"account"=>"管理员",
"op_num"=>$v['amount'],
"balance_coin"=>$v['balance']?:'0.00',
"mark"=>"后台发放平台币",
"create_time"=>date("Y-m-d H:i:s",$v['create_time'])
];
$senddata[] = $temp;
}
}
}else{ }else{
if($istimeselect){ if($istimeselect){
$map['s.create_time']=$istimeselect; $map['s.create_time']=$istimeselect;
} }
$map['s.status']=1; $map['s.status']=1;
$map['s.source_id']=0; $map['s.source_id']=0;
$field= "num,sn,promote.balance_coin,account,s.type";
$ininside = M("promote_coin s","tab_")
->field($field)
->where($map)
->page($page, $row)
->join("tab_promote promote ON s.promote_id = promote.id","left")
->select();
$ininsidecount = M("promote_coin s","tab_") $ininsidecount = M("promote_coin s","tab_")
->field("SUM(CASE WHEN s.type = 1 THEN num ELSE 0 END) as pay_amount,SUM(CASE WHEN s.type = 2 THEN num ELSE 0 END) as back_amount,count(*) count") ->field("SUM(CASE WHEN s.type = 1 THEN num ELSE 0 END) as pay_amount,SUM(CASE WHEN s.type = 2 THEN num ELSE 0 END) as back_amount,count(*) count")
->where($map) ->where($map)
->find(); ->find();
$count = $ininsidecount["count"]?:0; $count = $ininsidecount["count"]?:0;
$total_cost = ($ininsidecount["pay_amount"]-$ininsidecount["back_amount"]); $total_cost = ($ininsidecount["pay_amount"]-$ininsidecount["back_amount"]);
if ($count >0) {
$field= "num,sn,promote.balance_coin,account,s.type,remark,s.create_time";
$ininside = M("promote_coin s", "tab_")
->field($field)
->where($map)
->page($page, $row)
->join("tab_promote promote ON s.promote_id = promote.id", "left")
->select();
foreach ($ininside as $k => $v) {
$temp = [
"sn"=>$v['sn'],
"op_type"=>($v['type'] == 1) ? "收入":"支出",
"op_sty"=>($v['type'] == 1) ? "后台发放":"后台回收",
"account"=>"管理员",
"op_num"=>$v['num']?:'0.00',
"balance_coin"=>$v['balance_coin'],
"mark"=>$v["remark"]?:"后台发放平台币",
"create_time"=>date("Y-m-d H:i:s",$v['create_time'])
];
$senddata[] = $temp;
}
}
} }
$this->assign('total_cost', $total_cost);
$page = set_pagination($count,$row);
if($page) {$this->assign('_page', $page);}
$this->assign('data',$senddata);
$this->display();
} }

@ -30,8 +30,11 @@
<div class="jssearch fl cf search_list"> <div class="jssearch fl cf search_list">
<!--游戏类型搜索END--> <!--游戏类型搜索END-->
<input type="hidden" name="game_id" value="{$_GET['game_id']}"/>
<input type="hidden" name="game_name" value="{$_GET['game_name']}"/> <input type="hidden" name="promote_id" value="{$_GET['promote_id']}"/>
<input type="hidden" name="time_start" value="{$_GET['time_start']}"/>
<input type="hidden" name="time_end" value="{$_GET['time_end']}"/>
<input type="hidden" name="pay_way" value="{$_GET['pay_way']}"/>
<div class="input-list"> <div class="input-list">
<input type="text" name="pay_order_number" placeholder="请输入支付订单号" class="" value="{:I('pay_order_number')}" style="width: 180px"/>&nbsp; <input type="text" name="pay_order_number" placeholder="请输入支付订单号" class="" value="{:I('pay_order_number')}" style="width: 180px"/>&nbsp;
@ -45,8 +48,25 @@
<input type="text" name="user_nickname" placeholder="请输入角色名称" class="" value="{:I('user_nickname')}" style="width: 180px"/>&nbsp; <input type="text" name="user_nickname" placeholder="请输入角色名称" class="" value="{:I('user_nickname')}" style="width: 180px"/>&nbsp;
</div> </div>
<if condition="$_GET['game_id']">
<input type="hidden" name="game_id" value="{$_GET['game_id']}"/>
<else/>
<div class="input-list input-list-game search_label_rehab">
<select id="game_name" name="game_name" class="select_gallery" >
<option value="">游戏名称</option>
</select>
</div>
<div class="input-list input-list-game search_label_rehab">
<select id="game_type" name="game_type" class="select_gallery" >
<option value="">请选择设备类型</option>
<option value="1" <?php echo I('game_type') == 1 ? "selected" : ''?>>安卓</option>
<option value="2" <?php echo I('game_type') == 2 ? "selected" : ''?>>苹果</option>
</select>
</div>
</if>
<div class="input-list"> <div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('Finance/coinDetail','model='.$model['name'].'&row='.I('row'),false)}" <a class="sch-btn" href="javascript:;" id="search" url="{:U('FinancePromote/gameCoinDetail','model='.$model['name'].'&row='.I('row'),false)}"
style="">搜索</a> style="">搜索</a>
<if condition="$_GET['all'] neq 1"> <if condition="$_GET['all'] neq 1">
<a class="sch-btn" href="{:U('Export/coinDetail', <a class="sch-btn" href="{:U('Export/coinDetail',
@ -125,22 +145,44 @@
<script> <script>
$(function(){ $(function(){
//搜索功能 //搜索功能
$("#search").click(function(){ $("#search").click(function(){
console.log(222); console.log(222);
var url = $(this).attr('url'); var url = $(this).attr('url');
var query = $('.jssearch').find('input').serialize(); var query = $('.jssearch').find('input').serialize();
query += "&" + $('.jssearch').find('select').serialize(); query += "&" + $('.jssearch').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,''); query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
query = query.replace(/^&/g,''); query = query.replace(/^&/g,'');
if ( url.indexOf('?')>0 ){ if ( url.indexOf('?')>0 ){
url += '&' + query; url += '&' + query;
} else { } else {
url += '?' + query; url += '?' + query;
}
window.parent.reloadIframe(url);
parent.document.getElementsByTagName('iframe').src = url;
console.log(url);
});
function get_game_list()
{
var game_name = "{:I('game_name')}";
$.ajax({
url:"{:U('Finance/getGameList')}",
type:"post",
data:{partner_id:$("#partner_id option:selected").val(), sdk_type:$("#sdk_version1 option:selected").val()},
dataType:'json',
success:function(data){
var str = "<option value=''>请选择游戏</option>";
for (var i in data){
str += "<option value='"+data[i].game_name+"'"+(game_name && data[i].game_name == game_name?'selected':'')+">"+data[i].game_name+"</option>"
}
// console.log(str);
$("#game_name").empty();
$("#game_name").append(str);
// $("#server_id").select2();
}
})
} }
window.parent.reloadIframe(url); get_game_list();
parent.document.getElementsByTagName('iframe').src = url;
console.log(url);
});
}); });
</script> </script>

@ -212,9 +212,11 @@
<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_type'=>1,'promote_id'=>$data['p_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_type'=>1,'promote_id'=>$data['p_id'],p=>1,row=>10]))}">
{$data.bind_coin_count} {$data.bind_coin_count}
</td> </td>
<td class="coin-detail" data-pay_type="-2" style="color: #0066cc;cursor: pointer" data-url="{:U('FinancePromote/insideCoinDetail',array_merge(I('get.'),['promote_type'=>1,'promote_id'=>$data['p_id'],p=>1,row=>10]))}">
{$data.inside_cash_count}
</td> </td>
<td><span class='ljzc' <!-- <td><span class='ljzc'
data-value="{$data['id']}"><a>{$data.inside_cash_count}</a></span></td> data-value="{$data['id']}"><a>{$data.inside_cash_count}</a></span></td> -->
<td>{$data.allcount}</td> <td>{$data.allcount}</td>
@ -289,6 +291,10 @@
}); });
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
function reloadIframe(url) {
$("iframe").attr('src', url);
// document.getElementsByTagName('iframe').src=url;
}
$(function () { $(function () {
$(".coin-detail").click(function () { $(".coin-detail").click(function () {
var pay_type = $(this).data('pay_type'); var pay_type = $(this).data('pay_type');

@ -30,24 +30,22 @@
<div class="jssearch fl cf search_list"> <div class="jssearch fl cf search_list">
<!--游戏类型搜索END--> <!--游戏类型搜索END-->
<input type="hidden" name="game_id" value="{$_GET['game_id']}"/> <input type="hidden" name="promote_id" value="{$_GET['promote_id']}"/>
<input type="hidden" name="game_name" value="{$_GET['game_name']}"/> <input type="hidden" name="time_start" value="{$_GET['time_start']}"/>
<input type="hidden" name="time_end" value="{$_GET['time_end']}"/>
<div class="input-list"> <div class="input-list">
<input type="text" name="pay_order_number" placeholder="请输入支付订单号" class="" value="{:I('pay_order_number')}" style="width: 180px"/>&nbsp; <input type="text" name="sn" placeholder="请输入支付订单号" class="" value="{:I('sn')}" style="width: 250px"/>&nbsp;
</div> </div>
<div class="input-list"> <div class="input-list input-list-game search_label_rehab">
<select id="type" name="type" class="select_gallery" >
<input type="text" name="user_account" placeholder="请输入玩家账号" class="" value="{:I('user_account')}" style="width: 180px"/>&nbsp; <option value="">操作类型</option>
</div> <option value="1" <?php echo I('type') == 1 ? "selected" : ''?>>收入</option>
<div class="input-list"> <option value="2" <?php echo I('type') == 2 ? "selected" : ''?>>支出</option>
</select>
<input type="text" name="user_nickname" placeholder="请输入角色名称" class="" value="{:I('user_nickname')}" style="width: 180px"/>&nbsp;
</div> </div>
<div class="input-list"> <div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('Finance/coinDetail','model='.$model['name'].'&row='.I('row'),false)}" <a class="sch-btn" href="javascript:;" id="search" url="{:U('FinancePromote/insideCoinDetail','model='.$model['name'].'&row='.I('row'),false)}"style="">搜索</a>
style="">搜索</a>
<if condition="$_GET['all'] neq 1"> <if condition="$_GET['all'] neq 1">
<a class="sch-btn" href="{:U('Export/coinDetail', <a class="sch-btn" href="{:U('Export/coinDetail',
array( array(
@ -71,17 +69,14 @@
<!-- 表头 --> <!-- 表头 -->
<thead> <thead>
<tr> <tr>
<th >支付订单号</th> <th >流水号</th>
<th>充值时间</th> <th>操作类型</th>
<th >玩家账号</th> <th >操作方式</th>
<th >游戏名称</th> <th >对手账号类型</th>
<th >游戏区服</th> <th >平台币数量</th>
<th >角色名称</th> <th >平台币余额</th>
<th >订单金额</th> <th >交易说明</th>
<th >实付金额</th> <th >交易时间</th>
<th >充值方式</th>
<th ><if condition="$pay_way eq -1">绑定币余额<else/>平台币余额</if></th>
</tr> </tr>
</thead> </thead>
@ -89,28 +84,19 @@
<tbody> <tbody>
<volist name="data" id="data"> <volist name="data" id="data">
<tr> <tr>
<td >{$data.pay_order_number}</td> <td >{$data.sn}</td>
<td >{$data.pay_time}</td> <td >{$data.op_type}</td>
<td >{$data.user_account}</td> <td >{$data.op_sty}</td>
<td >{$data.game_name}</td> <td >{$data.account}</td>
<td >{$data.server_name}</td> <td >{$data.op_num}</td>
<td >{$data.game_player_name}</td> <td >{$data.balance_coin}</td>
<td >{$data.cost}</td> <td >{$data.mark}</td>
<td >{$data.pay_amount}</td> <td >{$data.create_time}</td>
<td >{$data.pay_way}</td>
<if condition="$pay_way eq -1">
<td >{$data.bind_balance}</td>
<else/>
<td >{$data.balance}</td>
</if>
</tr> </tr>
</volist> </volist>
<tr> <tr>
<td colspan="6" ><span>总计</span></td> <td><span>累计平台币数量:</span></td>
<td ><span><if condition="$total_cost neq ''">{$total_cost}<else/>0</if></span></td> <td colspan='7'><span><if condition="$total_cost neq ''">{$total_cost}<else/>0</if></span></td>
<td><if condition="$total_pay_amount neq ''">{$total_pay_amount}<else/>0</if></td>
<td colspan="2"> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

@ -202,12 +202,9 @@
<td>{:get_promote_name($data['promote_id'])}</td> <td>{:get_promote_name($data['promote_id'])}</td>
<td>{$data.cash_count}</td> <td>{$data.cash_count}</td>
<td><span class='ljzc' <td>{$data.balance_coin_count}</td>
data-value="{$data['id']}"><a>{$data.balance_coin_count}</a></span></td> <td>{$data.bind_coin_count}</td>
<td><span class='ljzc' data-value="{$data['id']}"><a>{$data.bind_coin_count}</a></span> <td>{$data.inside_cash_count}</td>
</td>
<td><span class='ljzc'
data-value="{$data['id']}"><a>{$data.inside_cash_count}</a></span></td>
<td>{$data.allcount}</td> <td>{$data.allcount}</td>

Loading…
Cancel
Save