Merge branch 'dev_zyx' into dev

master
zhengchanglong 5 years ago
commit cd70dd7dd8

@ -1501,8 +1501,6 @@ function getPartner() {
function getGameList($partner_id) {
if ($partner_id) {
$map['partner_id'] = $partner_id;
} else {
return [];
}
$data = M('game','tab_')->field("id,game_name")->where($map)->select();

@ -5305,7 +5305,7 @@ if ($key == 'model'){
array('cash_count','游戏现金流水'),
array('balance_coin_count','平台币流水'),
array('inside_cash_count','内冲流水'),
array('all_cash_count','总流水'),
array('all_count','总流水'),
);
$map = [];
@ -5313,38 +5313,50 @@ if ($key == 'model'){
$map['count_date']=I('count_date');
}
if (!empty(I('game_id'))) {
$map['game_id']=I('game_id');
}
if (!empty(I('collaborate_id'))) {
$map['collaborate_id']=I('collaborate_id');
}
if (empty(I('game_id'))) {
$field = "count_date,sum(cash_count) as cash_count,sum(balance_coin_count) as balance_coin_count,
sum(inside_cash_count) as inside_cash_count,sum(cash_count+balance_coin_count+inside_cash_count) as all_cash_count";
$allField = "cash_count+balance_coin_count+inside_cash_count";
$InsideField = "inside_cash_count";
} else {
$field = "count_date,sum(cash_count) as cash_count,sum(balance_coin_count) as balance_coin_count,
sum(bind_coin_count) as inside_cash_count,sum(cash_count+balance_coin_count+bind_coin_count) as all_cash_count";
$allField = "cash_count+balance_coin_count+bind_coin_count";
$InsideField = "bind_coin_count";
}
$group = "count_date";
// if (!empty(I('game_id'))) {
// $map['game_id']=I('game_id');
// }
// if (!empty(I('collaborate_id'))) {
// $map['collaborate_id']=I('collaborate_id');
// }
//
// if (empty(I('game_id'))) {
// $field = "count_date,sum(cash_count) as cash_count,sum(balance_coin_count) as balance_coin_count,
// sum(inside_cash_count) as inside_cash_count,sum(cash_count+balance_coin_count+inside_cash_count) as all_cash_count";
// $allField = "cash_count+balance_coin_count+inside_cash_count";
// $InsideField = "inside_cash_count";
// } else {
// $field = "count_date,sum(cash_count) as cash_count,sum(balance_coin_count) as balance_coin_count,
// sum(bind_coin_count) as inside_cash_count,sum(cash_count+balance_coin_count+bind_coin_count) as all_cash_count";
// $allField = "cash_count+balance_coin_count+bind_coin_count";
// $InsideField = "bind_coin_count";
// }
// $group = "count_date";
// $order = "id DESC";
// $xlsData = D("spend_count")->getSpendCountData($map,$field,$group,$order);
//
// $sumCash = D("spend_count")->sumSpendCountField($map,"cash_count");
// $sumBalance = D("spend_count")->sumSpendCountField($map,"balance_coin_count");
// $sumInside = D("spend_count")->sumSpendCountField($map,$InsideField);
// $sumAll = D("spend_count")->sumSpendCountField($map,$allField);
$order = "id DESC";
$xlsData = D("spend_count")->getSpendCountData($map,$field,$group,$order);
$xlsData = M('spend_month_count','tab_')
->field("cash_count,balance_coin_count,inside_cash_count,all_count,count_date")
->where($map)
->order($order)
->select();
$sumCash = D("spend_count")->sumSpendCountField($map,"cash_count");
$sumBalance = D("spend_count")->sumSpendCountField($map,"balance_coin_count");
$sumInside = D("spend_count")->sumSpendCountField($map,$InsideField);
$sumAll = D("spend_count")->sumSpendCountField($map,$allField);
$sumData = M('spend_month_count','tab_')
->field("sum(cash_count) as cash_count,sum(balance_coin_count) as balance_coin_count,sum(inside_cash_count) as inside_cash_count,sum(all_count) as all_count,count_date")
->where($map)
->order($order)
->find();
$sumData = [['count_date'=>'总计',
'cash_count'=>$sumCash,
'balance_coin_count'=>$sumBalance,
'inside_cash_count'=>$sumInside,
'all_cash_count'=>$sumAll]];
'cash_count'=>$sumData['cash_count'],
'balance_coin_count'=>$sumData['balance_coin_count'],
'inside_cash_count'=>$sumData['inside_cash_count'],
'all_count'=>$sumData['all_count']]];
$xlsData = array_merge($xlsData,$sumData);
$this->exportExcel($xlsName, $xlsCell, $xlsData);
@ -5384,6 +5396,10 @@ if ($key == 'model'){
$map['game_id'] = I("game_id");
}
if (!empty(I('partner_id'))) {
$map['partner_id']=I('collaborate_id');
}
if (I('sign') == 2&&empty(I('root_id'))) {
$map['_string'] = "parent_id >0 or root_id>0";
@ -5405,9 +5421,9 @@ if ($key == 'model'){
}
$map['bind_coin_count'] = ['neq',0];
$insideData = D("spend_count")->getSpendCountData($map,"game_id,bind_coin_count as count","promote_id,count_date,game_id");
unset($map['bind_coin_count']);
$map['inside_cash_count'] = ['neq',0];
$insideData = D("spend_count")->getSpendCountData($map,"game_id,inside_cash_count as count","promote_id,count_date");
unset($map['inside_cash_count']);
//内充流水与绑定流水数据
$insideDataSum = [];
foreach ($insideData as $key => $value) {
@ -5420,7 +5436,7 @@ if ($key == 'model'){
$field = "count_date,sum(cash_count) as cash_count,sum(balance_coin_count) as balance_coin_count,
sum(bind_coin_count) as inside_cash_count,sum(cash_count+balance_coin_count+bind_coin_count) as all_cash_count,game_name,partner_name";
sum(inside_cash_count) as inside_cash_count,sum(cash_count+balance_coin_count) as all_cash_count,game_id,game_name,partner_name";
$group = "game_id";
$order = "id DESC";
@ -5432,8 +5448,8 @@ if ($key == 'model'){
$sumCash = D("spend_count")->sumSpendCountField($map,"cash_count");
$sumBalance = D("spend_count")->sumSpendCountField($map,"balance_coin_count");
$sumInside = D("spend_count")->sumSpendCountField($map,"bind_coin_count");
$sumAll = D("spend_count")->sumSpendCountField($map,"cash_count+balance_coin_count+bind_coin_count");
$sumInside = number_format(array_sum($insideDataSum),2,'.','');
$sumAll = D("spend_count")->sumSpendCountField($map,"cash_count+balance_coin_count") + array_sum($insideDataSum);
$sumData = [['game_name'=>'总计',
'cash_count'=>$sumCash,
@ -5455,6 +5471,7 @@ if ($key == 'model'){
array('pay_order_number','支付订单号'),
array('pay_time','充值时间'),
array('user_account','玩家账号'),
array('user_nickname','玩家昵称'),
array('game_name','游戏名称'),
array('promote_account','所属推广员'),
array('spend_ip','充值ip'),
@ -5503,13 +5520,13 @@ if ($key == 'model'){
$map['game_id'] = I("game_id");
}
if (!empty(I('user_account'))) {
$map['user_account'] = I("user_account");
$map['user_account'] = array('like','%'.I("user_account").'%');
}
if (!empty(I('user_nickname'))) {
$map['user_nickname'] = I("user_nickname");
$map['user_nickname'] = array('like',I("user_nickname").'%');
}
$field = "pay_order_number,FROM_UNIXTIME(pay_time) as pay_time,user_account,game_name,promote_account,spend_ip,server_name,game_player_name,pay_amount,cost,pay_way";
$field = "pay_order_number,FROM_UNIXTIME(pay_time) as pay_time,user_account,user_nickname,game_name,promote_account,spend_ip,server_name,game_player_name,pay_amount,cost,pay_way";
$group = "";
$order = "pay_time DESC";
$xlsData = D('spend')->getSpendData($map,$field,$group,$order);

@ -16,17 +16,19 @@ class FinanceController extends ThinkController
$row=10;
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
// var_dump($row);die();
$map = [];
if(!empty(I('count_date'))){
$map['count_date']=I('count_date');
}
if (!empty(I('game_id'))) {
$map['game_id']=I('game_id');
}
if (!empty(I('partner_id'))) {
$map['partner_id']=I('collaborate_id');
}
// if (!empty(I('game_id'))) {
// $map['game_id']=I('game_id');
// }
// if (!empty(I('partner_id'))) {
// $map['partner_id']=I('collaborate_id');
// }
// $data = M("spend_count","tab_")
// ->field("count_date,cash_count,balance_coin_count,inside_cash_count,all_cash_count")
@ -34,61 +36,89 @@ class FinanceController extends ThinkController
// ->page($page,$row)
// ->group("count_date")
// ->select();
if (empty(I('game_id'))) {
$field = "count_date,sum(cash_count) as cash_count,sum(balance_coin_count) as balance_coin_count,
sum(inside_cash_count) as inside_cash_count,sum(cash_count+balance_coin_count) as all_cash_count";
$InsideField = "inside_cash_count";
$map['inside_cash_count'] = ['neq',0];
$insideData = D("spend_count")->getSpendCountData($map,"count_date,inside_cash_count as count","promote_id,count_date");
unset($map['inside_cash_count']);
} else {
$field = "count_date,sum(cash_count) as cash_count,sum(balance_coin_count) as balance_coin_count,
sum(bind_coin_count) as inside_cash_count,sum(cash_count+balance_coin_count) as all_cash_count";
$InsideField = "bind_coin_count";
$map['bind_coin_count'] = ['neq',0];
$insideData = D("spend_count")->getSpendCountData($map,"count_date,bind_coin_count as count","promote_id,count_date,game_id");
unset($map['bind_coin_count']);
}
//内充流水与绑定流水数据
$insideDataSum = [];
foreach ($insideData as $key => $value) {
if (isset($insideDataSum[$value['count_date']])) {
$insideDataSum[$value['count_date']] = $insideDataSum[$value['count_date']] + $value['count'];
} else {
$insideDataSum[$value['count_date']] = $value['count'];
}
}
// if (empty(I('game_id'))) {
// $field = "count_date,sum(cash_count) as cash_count,sum(balance_coin_count) as balance_coin_count,
// sum(inside_cash_count) as inside_cash_count,sum(cash_count+balance_coin_count) as all_cash_count";
// $InsideField = "inside_cash_count";
// $map['inside_cash_count'] = ['neq',0];
// $insideData = D("spend_count")->getSpendCountData($map,"count_date,inside_cash_count as count","promote_id,count_date");
// unset($map['inside_cash_count']);
// } else {
// $field = "count_date,sum(cash_count) as cash_count,sum(balance_coin_count) as balance_coin_count,
// sum(bind_coin_count) as inside_cash_count,sum(cash_count+balance_coin_count) as all_cash_count";
// $InsideField = "bind_coin_count";
// $map['bind_coin_count'] = ['neq',0];
// $insideData = D("spend_count")->getSpendCountData($map,"count_date,bind_coin_count as count","promote_id,count_date,game_id");
// unset($map['bind_coin_count']);
// }
// //内充流水与绑定流水数据
// $insideDataSum = [];
// foreach ($insideData as $key => $value) {
// if (isset($insideDataSum[$value['count_date']])) {
// $insideDataSum[$value['count_date']] = $insideDataSum[$value['count_date']] + $value['count'];
// } else {
// $insideDataSum[$value['count_date']] = $value['count'];
// }
// }
// var_dump($insideDataSum);
// var_dump(array_sum($insideDataSum));
// echo D("spend_count")->_sql();
// var_dump($insideData);die();
$group = "count_date";
// $group = "count_date";
// $order = "id DESC";
// $data = D("spend_count")->getSpendCountData($map,$field,$group,$order,$page,$row);
//
// foreach ($data as $key => $value) {
// $data[$key]['all_cash_count'] = $value['all_cash_count'] + $insideDataSum[$value['count_date']];
// $data[$key]['inside_cash_count'] = $insideDataSum[$value['count_date']];
// }
//
// $sumCash = D("spend_count")->sumSpendCountField($map,"cash_count");
// $sumBalance = D("spend_count")->sumSpendCountField($map,"balance_coin_count");
// $sumInside = array_sum($insideDataSum);
// $allField = "cash_count+balance_coin_count";
// $sumAll = D("spend_count")->sumSpendCountField($map,$allField)+array_sum($insideDataSum);
//
// $count = D("spend_count")->getSpendCountData($map,$field,$group,'');
$order = "id DESC";
$data = D("spend_count")->getSpendCountData($map,$field,$group,$order,$page,$row);
$data = M('spend_month_count','tab_')
->field("cash_count,balance_coin_count,inside_cash_count,all_count,count_date")
->where($map)
->page($page,$row)
->order($order)
->select();
foreach ($data as $key => $value) {
$data[$key]['all_cash_count'] = $value['all_cash_count'] + $insideDataSum[$value['count_date']];
$data[$key]['inside_cash_count'] = $insideDataSum[$value['count_date']];
}
$count = M('spend_month_count','tab_')
->field("cash_count,balance_coin_count,inside_cash_count,all_count,count_date")
->where($map)
->order($order)
->select();
$sumCash = D("spend_count")->sumSpendCountField($map,"cash_count");
$sumBalance = D("spend_count")->sumSpendCountField($map,"balance_coin_count");
$sumInside = array_sum($insideDataSum);
$allField = "cash_count+balance_coin_count";
$sumAll = D("spend_count")->sumSpendCountField($map,$allField)+array_sum($insideDataSum);
$sumData = M('spend_month_count','tab_')
->field("sum(cash_count) as cash_count,sum(balance_coin_count) as balance_coin_count,sum(inside_cash_count) as inside_cash_count,sum(all_count) as all_count,count_date")
->where($map)
->order($order)
->find();
$count = D("spend_count")->getSpendCountData($map,$field,$group,$order);
// echo D("spend_count")->_sql();die();
$count = count($count);
$page = set_pagination($count,$row);
// var_dump($page);die();
if($page) {$this->assign('_page', $page);}
$this->meta_title = '月结统计';
$this->assign('sumCash',$sumCash);
$this->assign('sumBalance',$sumBalance);
$this->assign('sumInside',$sumInside);
$this->assign('sumAll',$sumAll);
// $this->assign('sumCash',$sumCash);
// $this->assign('sumBalance',$sumBalance);
// $this->assign('sumInside',$sumInside);
// $this->assign('sumAll',$sumAll);
$this->assign('sumData',$sumData);
$this->assign('data',$data);
@ -106,6 +136,10 @@ class FinanceController extends ThinkController
$map['count_date']=I('count_date');
}
if (!empty(I('root_name'))) {
$map['promote_account'] = array('like','%'.I("root_name").'%');
}
if (!empty(I("game_id"))) {
$map['game_id'] = I("game_id");
}
@ -119,6 +153,12 @@ class FinanceController extends ThinkController
}
}
// if (!empty(I('partner_id'))) {
// $map['partner_id']=I('collaborate_id');
// }
if (I('sign') == 2&&empty(I('root_id'))) {
$map['_string'] = "parent_id >0 or root_id>0";
@ -139,9 +179,9 @@ class FinanceController extends ThinkController
$map['_string'] = "promote_id = {$promote_id}";
}
$map['bind_coin_count'] = ['neq',0];
$insideData = D("spend_count")->getSpendCountData($map,"game_id,bind_coin_count as count","promote_id,count_date,game_id");
unset($map['bind_coin_count']);
$map['inside_cash_count'] = ['neq',0];
$insideData = D("spend_count")->getSpendCountData($map,"game_id,inside_cash_count as count","promote_id,count_date");
unset($map['inside_cash_count']);
//内充流水与绑定流水数据
$insideDataSum = [];
foreach ($insideData as $key => $value) {
@ -151,16 +191,14 @@ class FinanceController extends ThinkController
$insideDataSum[$value['game_id']] = $value['count'];
}
}
// var_dump($insideDataSum);die();
$field = "count_date,sum(cash_count) as cash_count,sum(balance_coin_count) as balance_coin_count,
sum(bind_coin_count) as inside_cash_count,sum(cash_count+balance_coin_count+bind_coin_count) as all_cash_count,game_name,game_id,partner_name";
sum(inside_cash_count) as inside_cash_count,sum(cash_count+balance_coin_count) as all_cash_count,game_name,game_id,partner_name";
$group = "game_id";
$order = "id DESC";
$data = D("spend_count")->getSpendCountData($map,$field,$group,$order,$page,$row);
// echo D("spend_count")->_sql();die();
// echo D("spend_count")->_sql();die();
foreach ($data as $key => $value) {
$data[$key]['inside_cash_count'] = number_format($insideDataSum[$value['game_id']],2,'.','');
@ -168,8 +206,8 @@ class FinanceController extends ThinkController
$sumCash = D("spend_count")->sumSpendCountField($map,"cash_count");
$sumBalance = D("spend_count")->sumSpendCountField($map,"balance_coin_count");
$sumInside = D("spend_count")->sumSpendCountField($map,"bind_coin_count");
$sumAll = D("spend_count")->sumSpendCountField($map,"cash_count+balance_coin_count+bind_coin_count");
$sumInside = number_format(array_sum($insideDataSum),2,'.','');
$sumAll = D("spend_count")->sumSpendCountField($map,"cash_count+balance_coin_count") + array_sum($insideDataSum);
$count = D("spend_count")->getSpendCountData($map,$field,$group,$order);
@ -179,6 +217,7 @@ class FinanceController extends ThinkController
$this->meta_title = '每月情况查看详情';
$this->assign('from',I('from'));
$this->assign('sumCash',$sumCash);
$this->assign('sumBalance',$sumBalance);
$this->assign('sumInside',$sumInside);
@ -242,7 +281,7 @@ class FinanceController extends ThinkController
$map['user_nickname'] = array('like',I("user_nickname").'%');
}
// var_dump($map);die();
$field = "pay_order_number,FROM_UNIXTIME(pay_time) as pay_time,user_account,game_name,promote_account,spend_ip,server_name,game_player_name,pay_amount,cost,pay_way";
$field = "pay_order_number,FROM_UNIXTIME(pay_time) as pay_time,user_account,user_nickname,game_name,promote_account,spend_ip,server_name,game_player_name,pay_amount,cost,pay_way";
$group = "";
$order = "pay_time DESC";
$data = D('spend')->getSpendData($map,$field,$group,$order,$page,$row);
@ -482,7 +521,6 @@ class FinanceController extends ThinkController
if (I('partner_id')) {
$map['partner_id'] = I('partner_id');
}
$data = M('game','tab_')->field("id,game_name")->where($map)->select();
$this->ajaxReturn($data,'json');

@ -60,6 +60,8 @@ class SpendCountSetController extends \Think\Controller
$this->setGameCount();
//执行用户表统计
$this->setUserCount();
//执行月份统计
$this->setMonthCount();
//执行
$this->model->commit();
$this->usermodel->commit();
@ -74,7 +76,6 @@ class SpendCountSetController extends \Think\Controller
{
$this->getCashData();
$this->getBalanceData();
$this->getBingData();
$this->getInsideData();
$this->getRoot();
# code...
@ -122,7 +123,7 @@ class SpendCountSetController extends \Think\Controller
$map = array(
"pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"spend.pay_status"=>1,
"pay_way"=> array("LT",1)
"pay_way"=> array("EQ",0)
);
$field = "IFNULL(game.partner_id,0) partner_id,partner.partner partner_name,
spend.promote_id,spend.promote_account,spend.game_id,spend.game_name,
@ -168,29 +169,33 @@ class SpendCountSetController extends \Think\Controller
# code...
}
//获取绑定币充值
public function getBingData()
public function getInsideData()
{
if(!$this->continue){
die("api error");
}
$bindRes = M()
->table("tab_bind_recharge bind")
->field("IFNULL(game.partner_id,0) partner_id,partner.partner partner_name,
bind.game_id,bind.game_name,bind.promote_id,bind.promote_account,
IFNULL(promote.parent_id,0) parent_id,promote.parent_name,sum(real_amount) bind_coin_count,
'{$this->date}' as count_date,'{$this->nowdata}' as create_time")
->where(array(
"bind.create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"bind.pay_status"=>1
))
->join("tab_promote promote ON bind.promote_id = promote.id","left")
->join("tab_game game ON bind.game_id = game.id","left")
->join("tab_partner partner ON partner.id = game.partner_id","left")
->group('bind.promote_id,bind.game_id')
->select();
//聚合表
if(!empty($bindRes)){
for ($i=0; $i < count($bindRes); $i++) {
$map = array(
"pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"spend.pay_status"=>1,
"pay_way"=> array("LT",0)
);
$field = "IFNULL(game.partner_id,0) partner_id,partner.partner partner_name,
spend.promote_id,spend.promote_account,spend.game_id,spend.game_name,
IFNULL(promote.parent_id,0) parent_id,promote.parent_name,sum(pay_amount) inside_cash_count,
'{$this->date}' as count_date,'{$this->nowdata}' as create_time";
$balanceRes = M()
->table("tab_spend spend")
->field($field)
->where($map)
->join("tab_promote promote ON spend.promote_id = promote.id","left")
->join("tab_game game ON spend.game_id = game.id","left")
->join("tab_partner partner ON partner.id = game.partner_id","left")
->group('spend.promote_id,spend.game_id')
->select();
//集中两个表
if(!empty($balanceRes)){
for ($i=0; $i < count($balanceRes); $i++) {
# code...
$tempmap = array(
"game_id"=>$balanceRes[$i]['game_id'],
@ -200,13 +205,13 @@ class SpendCountSetController extends \Think\Controller
$dbres = $this->model->where($tempmap)->find();
if(!$dbres){
//不存在
$tempdbres =$this->model->add($bindRes[$i]);
$tempdbres = $this->model->add($balanceRes[$i]);
if(!$tempdbres){
$this->model->rollback();
die("error");
}
}else{
$dbres["bind_coin_count"] = $bindRes[$i]['bind_coin_count'];
$dbres["inside_cash_count"] = $balanceRes[$i]['inside_cash_count'];
$tempdbres = $this->model->save($dbres);
if(!$tempdbres){
$this->model->rollback();
@ -216,50 +221,7 @@ class SpendCountSetController extends \Think\Controller
}
}
}
//获取内充流水
public function getInsideData()
{
if(!$this->continue){
die("api error");
}
$insideRes = M()
->table("tab_deposit deposit")
->field("promote_id,promote_account,IFNULL(promote.parent_id,0) parent_id,parent_name,sum(pay_amount) inside_cash_count,'{$this->date}' as count_date,'{$this->nowdata}' as create_time")
->where(array(
"deposit.create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"pay_status"=>1
))
->join("tab_promote promote ON deposit.promote_id = promote.id","left")
->group('promote_id')
->select();
//聚合表
if(!empty($insideRes)){
for ($i=0; $i < count($insideRes); $i++) {
# code...
$tempmap = array(
"promote_id"=>$insideRes[$i]['promote_id'],
"count_date"=>$this->date
);
$dbres = $this->model->where($tempmap)->find();
if(!$dbres){
//不存在
$tempdbres = $this->model->add($insideRes[$i]);
if(!$tempdbres){
$this->model->rollback();
die("error");
}
}else{
$savedata = array("inside_cash_count"=>$insideRes[$i]['inside_cash_count']);
$tempdbres = $this->model->where($tempmap)->save($savedata);
if(!$tempdbres){
$this->model->rollback();
die("error");
}
}
}
}
// return true;
}
public function getRoot()
{
if(!$this->continue){
@ -291,6 +253,8 @@ class SpendCountSetController extends \Think\Controller
}
}
}
/** --------以下为设定角色聚合---------- **/
/**
* 获取角色聚合
*/
@ -300,10 +264,9 @@ class SpendCountSetController extends \Think\Controller
$this->getRootUser();
$this->getParentUser();
$this->getPromoteUser();
$this->getInsideData2();
$this->getUserInsideData();
}
/** --------以下为辅助函数---------- **/
//获取会长信息
public function getRootUser()
{
@ -424,51 +387,162 @@ class SpendCountSetController extends \Think\Controller
}
# code...
}
//处理inside_cash_count
public function getInsideData2()
//渠道角色统计仅计算推广员的平台币发放与收回
public function getUserInsideData()
{
if(!$this->continue) die("api error");
// if(!$this->continue) die("api error");
//获取发送给推广员的数据
$insideRes = M()
->table("tab_deposit deposit")
->field("promote_id,promote_account,IFNULL(promote.parent_id,0) parent_id,parent_name,sum(pay_amount) inside_cash_count,'{$this->date}' as count_date,'{$this->nowdata}' as create_time")
->table("tab_promote_coin")
->field("*")
->where(array(
"deposit.create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"pay_status"=>1
"create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"source_id"=>0,
"status"=>1
))
->join("tab_promote promote ON deposit.promote_id = promote.id","left")
->group('promote_id')
->select();
//聚合表
if(!empty($insideRes)){
for ($i=0; $i < count($insideRes); $i++) {
# code...
$tempmap = array(
"promote_id"=>$insideRes[$i]['promote_id'],
"count_date"=>$this->date
);
$dbres = M("spend_user_count","tab_")->where($tempmap)->find();
//修正数据
if($dbres['root_id'] > 0 && $dbres['parent_id'] > 0){//是推广员
//修正root
$this->setInsideCount($dbres['root_id'],$insideRes[$i]['inside_cash_count']);
//修正Parent
$this->setInsideCount($dbres['parent_id'],$insideRes[$i]['inside_cash_count']);
//修正自己
$this->setInsideCount($dbres['promote_id'],$insideRes[$i]['inside_cash_count']);
}elseif($dbres['root_id'] == 0 && $dbres['parent_id'] > 0){//是组长
//修正root
$this->setInsideCount($dbres['parent_id'],$insideRes[$i]['inside_cash_count']);
//修正Parent
$this->setInsideCount($dbres['promote_id'],$insideRes[$i]['inside_cash_count']);
}else{//是会长
//修正root
$this->setInsideCount($dbres['promote_id'],$insideRes[$i]['inside_cash_count']);
if($insideRes[$i]['type'] > 1){
$insideRes[$i]['num'] = ( 0- $insideRes[$i]['num']);
}
$this->createUserCount($insideRes[$i]['promote_id'],$insideRes[$i]['num']);
}
}
}
//建立user表空数据
protected function createUserCount($promote_id,$inside_cash_count)
{
$promote = M("Promote","tab_")->field("id,account,parent_id,parent_name,grand_id,grand_account")->where("id='".$promote_id."'")->find();
if(empty($promote)){
return false;
}
$temprootarr=array(
"parent_id"=>0,
"root_id"=>0,
"inside_cash_count"=>$inside_cash_count,
"all_count"=>$inside_cash_count,
"count_date"=>$this->date,
"create_time"=>$this->nowdata
);
$tempparentarr=array(
"root_id"=>0,
"inside_cash_count"=>$inside_cash_count,
"all_count"=>$inside_cash_count,
"count_date"=>$this->date,
"create_time"=>$this->nowdata
);
$temppromotearr=array(
"inside_cash_count"=>$inside_cash_count,
"all_count"=>$inside_cash_count,
"count_date"=>$this->date,
"create_time"=>$this->nowdata
);
if($promote["parent_id"] == 0){
//会长
$dbres = M("spend_user_count","tab_")->where(array(
"promote_id"=>$promote["id"],
"count_date"=>$this->date
))->find();
if(empty($dbres)){
$temprootarr["promote_id"]= $promote['id'];
$temprootarr["promote_account"]= $promote['account'];
$this->usermodel->add($temprootarr);
}else{
//叠加
$this->setInsideCount($promote['id'],$inside_cash_count);
}
}elseif($promote["parent_id"] > 0 && $promote["grand_id"] == 0){
//是组长
//添加会长
$dbres = M("spend_user_count","tab_")->where(array(
"promote_id"=>$promote["parent_id"],
"count_date"=>$this->date
))->find();
if(empty($dbres)){
$temprootarr["promote_id"]= $promote['parent_id'];
$temprootarr["promote_account"]= $promote['parent_name'];
$this->usermodel->add($temprootarr);
}else{
//叠加
$this->setInsideCount($promote['parent_id'],$inside_cash_count);
}
//添加自己
$dbres = M("spend_user_count","tab_")->where(array(
"promote_id"=>$promote["id"],
"count_date"=>$this->date
))->find();
if(empty($dbres)){
$tempparentarr['promote_id']=$promote['id'];
$tempparentarr['promote_account']=$promote['account'];
$tempparentarr['parent_id']=$promote["parent_id"];
$tempparentarr['parent_name']=$promote["parent_name"];
$this->usermodel->add($tempparentarr);
}else{
//叠加
$this->setInsideCount($promote['id'],$inside_cash_count);
}
}else{
//推广员
//添加会长
$dbres = M("spend_user_count","tab_")->where(array(
"promote_id"=>$promote["grand_id"],
"count_date"=>$this->date
))->find();
if(empty($dbres)){
$temprootarr["promote_id"]= $promote['grand_id'];
$temprootarr["promote_account"]= $promote['grand_account'];
$this->usermodel->add($temprootarr);
}else{
//叠加
$this->setInsideCount($promote['grand_id'],$inside_cash_count);
}
//添加组长
$dbres = M("spend_user_count","tab_")->where(array(
"promote_id"=>$promote["parent_id"],
"count_date"=>$this->date
))->find();
if(empty($dbres)){
$tempparentarr["promote_id"]= $promote['parent_id'];
$tempparentarr["promote_account"]= $promote['parent_name'];
$tempparentarr['parent_id']=$promote["grand_id"];
$tempparentarr['parent_name']=$promote["grand_account"];
$this->usermodel->add($tempparentarr);
}else{
//叠加
$this->setInsideCount($promote['parent_id'],$inside_cash_count);
}
$dbres = M("spend_user_count","tab_")->where(array(
"promote_id"=>$promote["id"],
"count_date"=>$this->date
))->find();
if(empty($dbres)){
$temppromotearr['promote_id']=$promote['id'];
$temppromotearr['promote_account']=$promote['account'];
$temppromotearr['parent_id']=$promote["parent_id"];
$temppromotearr['parent_name']=$promote["parent_name"];
$temppromotearr['root_id']=$promote['grand_id'];
$temppromotearr['root_name']=$promote['grand_account'];
$this->usermodel->add($temppromotearr);
}else{
//叠加
$this->setInsideCount($promote['id'],$inside_cash_count);
}
//添加自己
}
// return true;
# code...
}
//按角色修正inside_cash_count数据
public function setInsideCount($promote_id,$inside_cash_count)
@ -480,11 +554,68 @@ class SpendCountSetController extends \Think\Controller
$dbres = M("spend_user_count","tab_")->where($tempmap)->find();
$savedata = array("inside_cash_count"=>$inside_cash_count-0+$dbres['inside_cash_count'],"all_count"=>$inside_cash_count-0+$dbres['all_count']);
$tempdbres = $this->usermodel->where($tempmap)->save($savedata);
if(!$tempdbres){
if($tempdbres === false){
dump($dbres);
dump($savedata);
$this->usermodel->rollback();
die("setInsideCount error");
}
# code...
}
/** --------以下为设定月份聚合---------- **/
public function setMonthCount()
{
$initdata = $this->getMonthInit();
$balance = $this->getBalanceUser();
$bind = $this->getBindUser();
$initdata["inside_cash_count"] = $initdata["inside_cash_count"]-$balance-$bind;
$initdata["all_count"] = $initdata["inside_cash_count"]-0+$initdata["balance_coin_count"]-0+$initdata["cash_count"];
$initdata["count_date"] = $this->date;
$initdata["create_time"] = $this->nowdata;
M("spend_month_count","tab_")->add($initdata);
# code...
}
//获取除了内充的
protected function getMonthInit()
{
$tempmap = array(
"count_date"=>$this->date,
"parent_id"=>0
);
return M("spend_user_count","tab_")->field("sum(cash_count) cash_count,sum(balance_coin_count) balance_coin_count,sum(inside_cash_count) inside_cash_count")->where($tempmap)->find();
}
//设置 后台发放平台币给玩家 及 回收玩家 的最终值
protected function getBalanceUser()
{
$map = array(
"create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"status"=>1
);
$add = M("provide_user","tab_")->field("sum(amount) amount")->where($map)->find()['amount'];
$add || $add=0;
$jq = M("user_coin","tab_")->field("sum(num) num")->where(array(
"create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth))
))->find()['num'];
$jq || $jq=0;
return $add-$jq;
}
//设置 后台发放绑币给玩家 及 回收玩家绑币 的最终值
protected function getBindUser()
{
$map = array(
"create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"status"=>1
);
$add = M("provide","tab_")->field("sum(amount) amount")->where($map)->find()['amount'];
$add || $add=0;
$jq = M("deduct_bind_record","tab_")->field("sum(quantity) quantity")->where(array(
"create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth))
))->find()['quantity'];
$jq || $jq=0;
return $add-$jq;
}
}

@ -39,12 +39,37 @@
<!-- 高级搜索 -->
<div class="jssearch fl cf search_list">
<!--游戏类型搜索END-->
<div class="input-list input-list-server search_label_rehab">
<select id="partner_id" name="partner_id" class="select_gallery" style="width:120px;">
<option value="">请选择合作方</option>
<volist name=":getPartner()" id="vo">
<option partner-id="{$vo.id}" value="{$vo.id}" <if condition="$vo.id eq $_GET['partner_id']">selected=selected</if>>{$vo.partner}</option>
</volist>
</select>
</div>
<div class="input-list input-list-game search_label_rehab">
<select id="game_id" name="game_id" class="select_gallery" style="width:120px;">
<option value="">请选择游戏</option>
<volist name=":getGameList($_GET['partner_id'])" id="vo">
<option value="{$vo.id}" <if condition="$vo.id eq $_GET['game_id']">selected=selected</if>>{$vo.game_name}</option>
</volist>
</select>
</div>
<input type="hidden" name="count_date" value="{$_GET['count_date']}"/>
<input type="hidden" name="parent_id" value="{$_GET['parent_id']}"/>
<input type="hidden" name="root_id" value="{$_GET['root_id']}"/>
<input type="hidden" name="sign" value="{$_GET['sign']}"/>
<input type="hidden" name="from" value="{$_GET['from']}"/>
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('Finance/gameFinance','model='.$model['name'].'&row='.I('row'),false)}"
style="width: 100px;border: #3C95C8 solid 1px;">搜索</a>
<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="{:U('Export/exportGameFinance',
array('count_date'=>$_GET['count_date'],'root_id'=>$_GET['root_id'],'parent_id'=>$_GET['parent_id'],'promote_id'=>$_GET['promote_id'],'game_id'=>$_REQUEST['game_id'],false))}" style="width: 100px;border: #3C95C8 solid 1px;">导出</a>
array('count_date'=>$_GET['count_date'],'root_id'=>$_GET['root_id'],'parent_id'=>$_GET['parent_id'],'promote_id'=>$_GET['promote_id'],'game_id'=>$_REQUEST['game_id'],'partner_id'=>$_REQUEST['partner_id'],false))}" style="width: 100px;border: #3C95C8 solid 1px;">导出</a>
</div>
</div>
</div>
@ -64,7 +89,7 @@
<th >平台币流水</th>
<th >绑定币流水</th>
<th >内充消耗</th>
<th >总流水</th>
@ -95,7 +120,8 @@
<td >
<a href="{:U('Finance/gameFinanceDetail',
array('count_date'=>$_REQUEST['count_date'],'game_id'=>$data['game_id'],
'game_name'=>$data['game_name'],'root_id'=>$_REQUEST['root_id'],'parent_id'=>$_REQUEST['parent_id'],'promote_id'=>$_REQUEST['promote_id']))}" >查看</a>
'game_name'=>$_REQUEST['game_id']?$data['game_name']:'','root_id'=>$_REQUEST['root_id'],
'parent_id'=>$_REQUEST['parent_id'],'promote_id'=>$_REQUEST['promote_id'],'sign'=>$_REQUEST['sign'],'from'=>$_REQUEST['from']))}" >查看</a>
</td>
</tr>
</volist>
@ -107,7 +133,9 @@
<td><if condition="$sumAll neq ''">{$sumAll}<else/>0</if></td>
<td>
<a href="{:U('Finance/gameFinanceDetail',
array('count_date'=>$_REQUEST['count_date'],'root_id'=>$_GET['root_id'],'parent_id'=>$_REQUEST['parent_id'],'promote_id'=>$_REQUEST['promote_id'],'game_id'=>$_REQUEST['game_id']))}" >查看</a>
array('count_date'=>$_REQUEST['count_date'],'root_id'=>$_GET['root_id'],'partner_id'=>$_REQUEST['partner_id'],
'parent_id'=>$_REQUEST['parent_id'],'promote_id'=>$_REQUEST['promote_id'],'game_id'=>$_REQUEST['game_id'],'game_name'=>'1',
'sign'=>$_REQUEST['sign'],'from'=>$_REQUEST['from']))}" >查看</a>
</td>
</tr>
</notemtpy>
@ -130,7 +158,20 @@
<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>
<volist name=":I('get.')" id="vo">
Think.setValue('{$key}',"{$vo}");
</volist>
</script>
<script type="text/javascript">
$('.page a').click(function () {
var href = $(this).attr('href');
$(this).removeAttr('href');
window.location.replace(href)
console.log(href)
});
//导航高亮
highlight_subnav('{:U('Finance/index')}');
$(function(){
@ -153,7 +194,7 @@
}else{
url += '?' + query;
}
window.location.href = url;
window.location.replace(url);
});
//回车自动提交
@ -176,20 +217,21 @@
});
});
$("#game_id").change(function(){
$("#partner_id").change(function(){
$.ajax({
url:"{:U('Ajax/getSpendServer')}",
url:"{:U('Finance/getGameList')}",
type:"post",
data:{game_id:$("#game_id option:selected").attr('game-id')},
data:{partner_id:$("#partner_id option:selected").attr('partner-id')},
dataType:'json',
success:function(data){
str = "<option value=''>请选择区服</option>";
var str = "<option value=''>请选择游戏</option>";
for (var i in data){
str += "<option value='"+data[i].server_name+"'>"+data[i].server_name+"</option>"
str += "<option value='"+data[i].id+"'>"+data[i].game_name+"</option>"
}
$("#server_id").empty();
$("#server_id").append(str);
$("#server_id").select2();
// console.log(str);
$("#game_id").empty();
$("#game_id").append(str);
// $("#server_id").select2();
}
})

@ -78,6 +78,8 @@
<th >玩家账号</th>
<th >玩家昵称</th>
<th >游戏名称</th>
<th >所属推广员</th>
@ -113,6 +115,7 @@
<td >{$data.pay_order_number}</td>
<td >{$data.pay_time}</td>
<td >{$data.user_account}</td>
<td >{$data.user_nickname}</td>
<td >{$data.game_name}</td>
<td >{$data.promote_account}</td>
<td >{$data.spend_ip}</td>
@ -125,7 +128,7 @@
</volist>
<tr>
<td ><span>总计</span></td>
<td colspan="10" ><span><if condition="$sum_amount neq ''">{$sum_amount}<else/>0</if></span></td>
<td colspan="11" ><span><if condition="$sum_amount neq ''">{$sum_amount}<else/>0</if></span></td>
</tr>
</notemtpy>
@ -147,11 +150,23 @@
<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>
<volist name=":I('get.')" id="vo">
Think.setValue('{$key}',"{$vo}");
</volist>
</script>
<script type="text/javascript">
//导航高亮
highlight_subnav('{:U('Finance/index')}');
$(function(){
$('.page a').click(function () {
var href = $(this).attr('href');
$(this).removeAttr('href');
window.location.replace(href)
console.log(href)
});
//搜索功能
$("#search").click(function(){
var starttime = $.trim($('#time-start').val());
@ -170,7 +185,7 @@
}else{
url += '?' + query;
}
window.location.href = url;
window.location.replace(url);
});
//回车自动提交

@ -30,7 +30,7 @@
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">组长月结统计</h3>
<h3 class="page_title">会长->组长月结统计</h3>
<p class="description_text"></p>
</div>
@ -49,7 +49,7 @@
<input type="hidden" name="count_date" value="{$_GET['count_date']}"/>
<div class="input-list">
<input type="text" name="root_name" placeholder="请输入长账号搜索" class="" value="{:I('root_name')}"/>&nbsp;
<input type="text" name="root_name" placeholder="请输入长账号搜索" class="" value="{:I('root_name')}"/>&nbsp;
</div>
<div class="input-list">
@ -67,13 +67,13 @@
<!-- 表头 -->
<thead>
<tr>
<th >长渠道</th>
<th >长渠道</th>
<th>游戏现金流水</th>
<th >平台币流水</th>
<th >内充流水</th>
<th >内充发放</th>
<th >总流水</th>
@ -102,8 +102,8 @@
<td >{$data.inside_cash_count}</td>
<td >{$data.all_count}</td>
<td ><if condition="$data['promote_id'] neq $_GET['root_id']">
<a href="{:U('Finance/gameFinance',array('parent_id'=>$data['promote_id'],'count_date'=>$_GET['count_date']))}" >游戏查看</a>
<a href="{:U('Finance/getPromoteUser',array('count_date'=>$_GET['count_date'],'parent_id'=>$data['promote_id'],'root_id'=>$_GET['root_id']))}" >渠道查看</a>
<a href="{:U('Finance/gameFinance',array('sign'=>1,'parent_id'=>$data['promote_id'],'root_id'=>$_GET['root_id'],'count_date'=>$_GET['count_date'],'from'=>'getParentUser'))}" >游戏查看</a>
<a href="{:U('Finance/getPromoteUser',array('count_date'=>$_GET['count_date'],'parent_id'=>$data['promote_id'],'root_id'=>$_GET['root_id'],'root_name'=>$_GET['root_name'],'root_name1'=>$_GET['root_name1']))}" >推广员渠道</a>
<else/>
-------
</if></td>
@ -115,7 +115,7 @@
<td ><span>{$sumData.inside_cash_count}</span></td>
<td ><span>{$sumData.all_count}</span></td>
<td >
<a href="{:U('Finance/gameFinance',array('count_date'=>$_GET['count_date'],'root_id'=>$_GET['root_id']))}" >游戏查看</a>
<a href="{:U('Finance/gameFinance',array('sign'=>1,'count_date'=>$_GET['count_date'],'root_id'=>$_GET['root_id'],'parent_id'=>$_GET['root_name']?$data['promote_id']:'','from'=>'getParentUser'))}" >游戏查看</a>
<!-- <a href="{:U('Finance/getPromoteUser',array('count_date'=>$_GET['count_date'],'root_id'=>$_GET['root_id'],'sign'=>1))}" >渠道查看</a>-->
</td>
</tr>
@ -139,11 +139,24 @@
<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>
<volist name=":I('get.')" id="vo">
Think.setValue('{$key}',"{$vo}");
</volist>
</script>
<script type="text/javascript">
//导航高亮
highlight_subnav('{:U('Finance/index')}');
$(function(){
$('.page a').click(function () {
var href = $(this).attr('href');
$(this).removeAttr('href');
window.location.replace(href)
console.log(href)
});
//搜索功能
$("#search").click(function(){
var starttime = $.trim($('#time-start').val());
@ -162,7 +175,7 @@
}else{
url += '?' + query;
}
window.location.href = url;
window.location.replace(url);
});
//回车自动提交

@ -30,7 +30,7 @@
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">推广员月结统计</h3>
<h3 class="page_title">会长->组长->推广员月结统计</h3>
<p class="description_text"></p>
</div>
@ -65,7 +65,7 @@
<th >平台币流水</th>
<th >内充流水</th>
<th >内充发放</th>
<th >总流水</th>
@ -94,7 +94,7 @@
<td >{$data.inside_cash_count}</td>
<td >{$data.all_count}</td>
<td ><if condition="$data['promote_id'] neq $_GET['parent_id']">
<a href="{:U('Finance/gameFinance',array('promote_id'=>$data['promote_id'],'count_date'=>$_GET['count_date']))}" >游戏查看</a>
<a href="{:U('Finance/gameFinance',array('promote_id'=>$data['promote_id'],'count_date'=>$_GET['count_date'],'from'=>'getPromoteUser'))}" >游戏查看</a>
<else/>
-------
</if></td>
@ -105,7 +105,7 @@
<td ><span>{$sumData.balance_coin_count}</span></td>
<td ><span>{$sumData.inside_cash_count}</span></td>
<td ><span>{$sumData.all_count}</span></td>
<td ><a href="{:U('Finance/gameFinance',array('count_date'=>$_GET['count_date'],'parent_id'=>$_GET['parent_id'],'sign'=>3))}" >游戏查看</a>
<td ><a href="{:U('Finance/gameFinance',array('count_date'=>$_GET['count_date'],'parent_id'=>$_GET['parent_id'],'sign'=>3,'from'=>'getPromoteUser'))}" >游戏查看</a>
</tr>
</notemtpy>
@ -127,11 +127,23 @@
<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>
<volist name=":I('get.')" id="vo">
Think.setValue('{$key}',"{$vo}");
</volist>
</script>
<script type="text/javascript">
//导航高亮
highlight_subnav('{:U('Finance/index')}');
$(function(){
$('.page a').click(function () {
var href = $(this).attr('href');
$(this).removeAttr('href');
window.location.replace(href)
console.log(href)
});
//搜索功能
$("#search").click(function(){
var starttime = $.trim($('#time-start').val());
@ -150,7 +162,7 @@
}else{
url += '?' + query;
}
window.location.href = url;
window.location.replace(url);
});
//回车自动提交

@ -74,7 +74,7 @@
<th >平台币流水</th>
<th >内充流水</th>
<th >内充发放</th>
<th >总流水</th>
@ -102,8 +102,8 @@
<td >{$data.balance_coin_count}</td>
<td >{$data.inside_cash_count}</td>
<td >{$data.all_count}</td>
<td ><a href="{:U('Finance/gameFinance',array('root_id'=>$data['promote_id'],'count_date'=>$_GET['count_date']))}" >游戏查看</a>
<a href="{:U('Finance/getParentUser',array('count_date'=>$_GET['count_date'],'root_name'=>$_GET['root_name'],'root_id'=>$data['promote_id']))}" >渠道查看</a></td>
<td ><a href="{:U('Finance/gameFinance',array('root_id'=>$data['promote_id'],'count_date'=>$_GET['count_date'],'from'=>'getRootUser','sign'=>1))}" >游戏查看</a>
<a href="{:U('Finance/getParentUser',array('count_date'=>$_GET['count_date'],'root_id'=>$data['promote_id']))}" >组长渠道</a></td>
</volist>
<tr>
<td ><span>总计</span></td>
@ -111,7 +111,7 @@
<td ><span>{$sumData.balance_coin_count}</span></td>
<td ><span>{$sumData.inside_cash_count}</span></td>
<td ><span>{$sumData.all_count}</span></td>
<td ><a href="{:U('Finance/gameFinance',array('count_date'=>$_GET['count_date'],'sign'=>1))}" >游戏查看</a>
<td ><a href="{:U('Finance/gameFinance',array('count_date'=>$_GET['count_date'],'sign'=>1,'root_id'=>$_GET['root_name']?$data['promote_id']:'','from'=>'getRootUser'))}" >游戏查看</a>
<!-- <a href="{:U('Finance/getParentUser',array('count_date'=>$_GET['count_date'],'root_name'=>$_GET['root_name'],'sign'=>1))}" >渠道查看</a></td>-->
</tr>
</notemtpy>
@ -134,11 +134,32 @@
<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>
<volist name=":I('get.')" id="vo">
Think.setValue('{$key}',"{$vo}");
</volist>
</script>
<script type="text/javascript">
//导航高亮
highlight_subnav('{:U('Finance/index')}');
$(function(){
$('.page a').click(function () {
var href = $(this).attr('href');
$(this).removeAttr('href');
window.location.replace(href)
console.log(href)
});
// $('#pagechange').removeAttr('onchange');
//
// $('#pagechange').change(function () {
// var val = $(this).val();
// var href = location.search;
// console.log(val);
// console.log(href);
// });
//搜索功能
$("#search").click(function(){
var starttime = $.trim($('#time-start').val());
@ -157,7 +178,7 @@
}else{
url += '?' + query;
}
window.location.href = url;
window.location.replace(url);
});
//回车自动提交
@ -198,6 +219,8 @@
}
})
});
var game_id = "{:I('game_name')}";
var game_server = "{:I('server_id')}";
if(game_id){

@ -48,22 +48,22 @@
</volist>
</select>
</div>
<div class="input-list input-list-server search_label_rehab">
<select id="partner_id" name="partner_id" class="select_gallery" style="width:120px;">
<option value="">请选择合作方</option>
<volist name=":getPartner()" id="vo">
<option partner-id="{$vo.id}" value="{$vo.id}" <if condition="$vo.id eq $_GET['partner_id']">selected=selected</if>>{$vo.partner}</option>
</volist>
</select>
</div>
<div class="input-list input-list-game search_label_rehab">
<select id="game_id" name="game_id" class="select_gallery" style="width:120px;">
<option value="">请选择游戏</option>
<volist name=":getGameList($_GET['partner_id'])" id="vo">
<option value="{$vo.id}" <if condition="$vo.id eq $_GET['game_id']">selected=selected</if>>{$vo.game_name}</option>
</volist>
</select>
</div>
<!-- <div class="input-list input-list-server search_label_rehab">-->
<!-- <select id="partner_id" name="partner_id" class="select_gallery" style="width:120px;">-->
<!-- <option value="">请选择合作方</option>-->
<!-- <volist name=":getPartner()" id="vo">-->
<!-- <option partner-id="{$vo.id}" value="{$vo.id}" <if condition="$vo.id eq $_GET['partner_id']">selected=selected</if>>{$vo.partner}</option>-->
<!-- </volist>-->
<!-- </select>-->
<!-- </div>-->
<!-- <div class="input-list input-list-game search_label_rehab">-->
<!-- <select id="game_id" name="game_id" class="select_gallery" style="width:120px;">-->
<!-- <option value="">请选择游戏</option>-->
<!-- <volist name=":getGameList($_GET['partner_id'])" id="vo">-->
<!-- <option value="{$vo.id}" <if condition="$vo.id eq $_GET['game_id']">selected=selected</if>>{$vo.game_name}</option>-->
<!-- </volist>-->
<!-- </select>-->
<!-- </div>-->
<input type="hidden" name="" value="" class="sortBy">
<div class="input-list">
@ -79,6 +79,7 @@
<!-- 数据列表 -->
<div class="data_list">
<empty name="show_status">
<div class="">
<table>
<!-- 表头 -->
@ -93,7 +94,7 @@
<th >平台币流水</th>
<th ><if condition="$_GET['game_id'] neq ''">绑定币流水<else/>内充流水</if></th>
<th >内充流水</th>
<th >总流水</th>
@ -119,25 +120,25 @@
<td >{$data.cash_count}</td>
<td >{$data.balance_coin_count}</td>
<td >{$data.inside_cash_count}</td>
<td >{$data.all_cash_count}</td>
<td >{$data.all_count}</td>
<td >
<a href="{:U('Finance/gameFinance',
array('count_date'=>$data['count_date'],'game_id'=>$_GET['game_id'],'collaborate_id'=>$_GET['collaborate_id'],'sign'=>1))}" >游戏查看</a>
array('sign'=>$_GET['count_date']?1:'','count_date'=>$data['count_date'],'game_id'=>$_GET['game_id'],'partner_id'=>$_GET['partner_id'],'from'=>'index'))}" >游戏查看</a>
<a href="{:U('Finance/getRootUser',
array('count_date'=>$data['count_date'])
array('sign'=>$_GET['count_date']?1:'','count_date'=>$data['count_date'],'game_id'=>$_GET['game_id'],'partner_id'=>$_GET['partner_id'])
,false)}" >渠道查看</a>
</td>
</tr>
</volist>
<tr>
<td><span>总计</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="$sumInside neq ''">{$sumInside}<else/>0</if></td>
<td><if condition="$sumAll neq ''">{$sumAll}<else/>0</if></td>
<td ><span><if condition="$sumData.cash_count neq ''">{$sumData.cash_count}<else/>0</if></span></td>
<td><if condition="$sumData.balance_coin_count neq ''">{$sumData.balance_coin_count}<else/>0</if></td>
<td><if condition="$sumData.inside_cash_count neq ''">{$sumData.inside_cash_count}<else/>0</if></td>
<td><if condition="$sumData.all_count neq ''">{$sumData.all_count}<else/>0</if></td>
<td>
<a href="{:U('Finance/gameFinance',array('sign'=>1,'game_id'=>$_GET['game_id']))}" >游戏查看</a>
<a href="{:U('Finance/getRootUser')}" >渠道查看</a>
<a href="{:U('Finance/gameFinance',array('sign'=>1,'game_id'=>$_GET['game_id'],'count_date'=>$_GET['count_date'],'partner_id'=>$_GET['partner_id'],'from'=>'index'))}" >游戏查看</a>
<a href="{:U('Finance/getRootUser',array('sign'=>1,'count_date'=>$_GET['count_date'],'game_id'=>$_GET['game_id'],'partner_id'=>$_GET['partner_id']))}" >渠道查看</a>
</td>
</tr>
</notemtpy>
@ -145,13 +146,12 @@
</tbody>
</table>
</div>
</empty>
</div>
<div class="page">
<a class="sch-btn" href="{:U('Export/exportFinanceIndex',
array('count_date'=>$_GET['count_date'],'game_id'=>$_GET['game_id'],'collaborate_id'=>$_GET['collaborate_id'])
,false)}">导出</a>
{$_page|default=''}
</div>
</block>
<block name="script">
@ -162,6 +162,11 @@
<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>
<volist name=":I('get.')" id="vo">
Think.setValue('{$key}',"{$vo}");
</volist>
</script>
<script type="text/javascript">
//导航高亮
highlight_subnav('{:U('Finance/index')}');
@ -215,7 +220,7 @@
data:{partner_id:$("#partner_id option:selected").attr('partner-id')},
dataType:'json',
success:function(data){
var str = "<option value=''>请选择区服</option>";
var str = "<option value=''>请选择游戏</option>";
for (var i in data){
str += "<option value='"+data[i].id+"'>"+data[i].game_name+"</option>"
}

@ -205,8 +205,7 @@ CREATE TABLE `tab_spend_count` (
`partner_name` varchar(50) DEFAULT NULL COMMENT '合作方名称',
`cash_count` decimal(10,2) DEFAULT '0.00' COMMENT '现金流水',
`balance_coin_count` decimal(10,2) DEFAULT '0.00' COMMENT '平台币流水',
`bind_coin_count` decimal(10,2) DEFAULT '0.00' COMMENT '绑定币流水',
`inside_cash_count` decimal(10,2) DEFAULT '0.00' COMMENT '内充流水(仅对用户与月份唯一)',
`inside_cash_count` decimal(10,2) DEFAULT '0.00' COMMENT '内充流水/绑定币流水',
`count_date` varchar(30) DEFAULT '' COMMENT '统计月份',
`create_time` int(11) DEFAULT NULL COMMENT '添加时间',
PRIMARY KEY (`id`) USING BTREE,
@ -227,11 +226,23 @@ CREATE TABLE `tab_spend_user_count` (
`cash_count` decimal(10,2) DEFAULT '0.00' COMMENT '现金流水',
`balance_coin_count` decimal(10,2) DEFAULT '0.00' COMMENT '平台币流水',
`inside_cash_count` decimal(10,2) DEFAULT '0.00' COMMENT '内充流水',
`all_count` decimal(10,2) DEFAULT '0.00' COMMENT '内充流水',
`all_count` decimal(10,2) DEFAULT '0.00' COMMENT '流水',
`count_date` varchar(30) DEFAULT '' COMMENT '统计月份',
`create_time` int(11) DEFAULT NULL COMMENT '添加时间',
PRIMARY KEY (`id`) USING BTREE,
KEY `promote_id` (`promote_id`) USING BTREE,
KEY `parent_id` (`parent_id`) USING BTREE,
KEY `count_date` (`count_date`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='流水角色聚合表';
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='流水角色聚合表';
CREATE TABLE `tab_spend_month_count` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键',
`cash_count` decimal(10,2) DEFAULT '0.00' COMMENT '现金流水',
`balance_coin_count` decimal(10,2) DEFAULT '0.00' COMMENT '平台币流水',
`inside_cash_count` decimal(10,2) DEFAULT '0.00' COMMENT '内充流水',
`all_count` decimal(10,2) DEFAULT '0.00' COMMENT '流水和',
`count_date` varchar(30) DEFAULT '' COMMENT '统计月份',
`create_time` int(11) DEFAULT NULL COMMENT '添加时间',
PRIMARY KEY (`id`) USING BTREE,
KEY `count_date` (`count_date`) USING BTREE
) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='流水月份聚合表';
Loading…
Cancel
Save