公会统计6

master
chenzhi 5 years ago
parent b743cd73e1
commit cb99c63223

@ -30,34 +30,10 @@ class FinancePromoteController extends AdminController
}
$senddata = [];
//获取各会长的现金充值
$cash = self::getJoinPromoteData(array("pay_way"=>array("GT",0)),$istimeselect);
//获取各会长的充值方式
$cash = self::getJoinPromoteData([],$istimeselect);
foreach($cash as $k=>$v){
$v['cash_count'] = $v['pay_amount'];
unset($v['pay_amount']);
$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");
@ -133,7 +109,11 @@ class FinancePromoteController extends AdminController
}
$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()
->table("tab_spend s")
->field($field)
@ -182,34 +162,10 @@ class FinancePromoteController extends AdminController
}
$senddata = [];
//获取各会长的现金充值
$cash = self::promoteUserData(array("pay_way"=>array("GT",0)),$istimeselect);
$cash = self::promoteUserData([],$istimeselect);
foreach($cash as $k=>$v){
$v['cash_count'] = $v['pay_amount'];
unset($v['pay_amount']);
$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");
foreach($inside as $k=>$v){
if(array_key_exists($v['promote_id'],$senddata)){
@ -295,7 +251,10 @@ class FinancePromoteController extends AdminController
$map['s.pay_time']=$istimeselect;
}
$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()
->table("tab_spend s")
->field($field)
@ -669,6 +628,17 @@ class FinancePromoteController extends AdminController
}
$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 = [];
@ -679,8 +649,12 @@ class FinancePromoteController extends AdminController
if($istimeselect){
$pmap['create_time'] = $istimeselect;
}
$admincount = M("provide_user p","tab_")->field("sum(amount) amount,count(*) count")->where($pmap)->find();
$count = $admincount["count"]?:0;
$total_cost = $admincount["amount"]?:0;
if($count >0){
$admininside = M("provide_user p","tab_")
->field("order_number,user_account,amount,balance")
->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)
@ -690,36 +664,57 @@ class FinancePromoteController extends AdminController
"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'])
];
# code...
$senddata[] = $temp;
}
}
$admincount = M("provide_user p","tab_")->field("sum(amount) amount,count(*) count")->where($pmap)->find();
$count = $admincount["count"]?:0;
$total_cost = $admincount["amount"]?:0;
}else{
if($istimeselect){
$map['s.create_time']=$istimeselect;
}
$map['s.status']=1;
$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_")
->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)
->find();
$count = $ininsidecount["count"]?:0;
$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">
<!--游戏类型搜索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">
<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;
</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">
<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>
<if condition="$_GET['all'] neq 1">
<a class="sch-btn" href="{:U('Export/coinDetail',
@ -141,6 +161,28 @@
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();
}
})
}
get_game_list();
});
</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]))}">
{$data.bind_coin_count}
</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><span class='ljzc'
data-value="{$data['id']}"><a>{$data.inside_cash_count}</a></span></td>
<!-- <td><span class='ljzc'
data-value="{$data['id']}"><a>{$data.inside_cash_count}</a></span></td> -->
<td>{$data.allcount}</td>
@ -289,6 +291,10 @@
});
</script>
<script type="text/javascript">
function reloadIframe(url) {
$("iframe").attr('src', url);
// document.getElementsByTagName('iframe').src=url;
}
$(function () {
$(".coin-detail").click(function () {
var pay_type = $(this).data('pay_type');

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

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

Loading…
Cancel
Save