现在下游外团分析

master
chenzhi 4 years ago
parent f07b29714b
commit c7c4b52c89

@ -16,7 +16,7 @@ class GameMarginSetController extends Controller {
private $month;//月份 private $month;//月份
private $year;//年份 private $year;//年份
private $adddata;//要添加的数据 private $adddata;//要添加的数据
// public $taskid=false; private $inSideCompanyIds;
// public $result=''; // public $result='';
/** /**
* 更新某月数据 * 更新某月数据
@ -58,14 +58,27 @@ class GameMarginSetController extends Controller {
private function setGameMargin() private function setGameMargin()
{ {
$this->getInsideCompanyid();
$this->getAllGameSpend(); $this->getAllGameSpend();
// $this->getJuheStatement();
// $this->getPuStatement();
//上游
$this->getCpStatement(); $this->getCpStatement();
$this->getJuheStatement();
$this->getPuStatement();
$this->getPcStatement();
dd($this->adddata); dd($this->adddata);
}
/**
* 内部公司
*/
private function getInsideCompanyid()
{
$res = M("PromoteCompany","tab_")->where("is_inside = 1")->field("id")->select();
if($res){
$res = array_column($res,"id");
$res[] = 0;
}else{
$res = [0];
}
$this->inSideCompanyIds = implode(",",$res);
} }
//获取期间所有有流水的游戏 //获取期间所有有流水的游戏
private function getAllGameSpend() private function getAllGameSpend()
@ -326,10 +339,8 @@ class GameMarginSetController extends Controller {
foreach ($res as $v) { foreach ($res as $v) {
$sinfo = json_decode($v['statement_info'],true); $sinfo = json_decode($v['statement_info'],true);
foreach ($sinfo as $val) { foreach ($sinfo as $val) {
var_dump($val['game_name']);
//获取真实游戏名 //获取真实游戏名
$games = $this->OPName2GName($val['game_name'],$v['company_id']); $games = $this->cpOPName2GName($val['game_name'],$v['company_id']);
var_dump($games);
foreach ($games as $game) { foreach ($games as $game) {
if( !array_key_exists($game,$this->adddata) ){ if( !array_key_exists($game,$this->adddata) ){
continue; continue;
@ -345,9 +356,8 @@ class GameMarginSetController extends Controller {
} }
} }
} }
//结算包名还原游戏名
//原包名还原游戏名 private function cpOPName2GName($OPName,$company_id)
private function OPName2GName($OPName,$company_id)
{ {
$where = [ $where = [
"partner_id"=>$company_id, "partner_id"=>$company_id,
@ -360,6 +370,35 @@ class GameMarginSetController extends Controller {
return [$OPName]; return [$OPName];
} }
} }
//获取下游内团
private function getPcStatement()
{
$where = [
"company_belong"=>0,
"withdraw_type"=>1,
"statement_begin_time"=>$this->beginThismonth,
"statement_end_time"=>$this->endThismonth,
"company_id"=>["NOT IN",$this->inSideCompanyIds]
];
$res = M("company_statement","tab_")->where($where)->select();
if($res){
foreach ($res as $v) {
$sinfo = json_decode($v['statement_info'],true);
foreach ($sinfo as $val) {
//奖罚不算
if( !array_key_exists($val['game_name'],$this->adddata) ){
continue;
}
if( array_key_exists("pc_pay_amount",$this->adddata[$val['game_name']]) ){
$this->adddata[$val['game_name']]['pc_pay_amount'] += $val['pay_amount'];
$this->adddata[$val['game_name']]['pc_statement_amount'] += $val['sum_money'];
}else{
$this->adddata[$val['game_name']]['pc_pay_amount'] = $val['pay_amount'];
$this->adddata[$val['game_name']]['pc_statement_amount'] = $val['sum_money'];
}
}
}
}
}
} }

Loading…
Cancel
Save