|
|
|
@ -59,10 +59,11 @@ class GameMarginSetController extends Controller {
|
|
|
|
|
private function setGameMargin()
|
|
|
|
|
{
|
|
|
|
|
$this->getAllGameSpend();
|
|
|
|
|
$this->getJuheStatement();
|
|
|
|
|
$this->getPuStatement();
|
|
|
|
|
// $this->getJuheStatement();
|
|
|
|
|
// $this->getPuStatement();
|
|
|
|
|
|
|
|
|
|
//上游
|
|
|
|
|
$this->getCpStatement();
|
|
|
|
|
dd($this->adddata);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -311,6 +312,54 @@ class GameMarginSetController extends Controller {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//获取cp结算单
|
|
|
|
|
private function getCpStatement()
|
|
|
|
|
{
|
|
|
|
|
$where = [
|
|
|
|
|
"company_belong"=>9,
|
|
|
|
|
"withdraw_type"=>1,
|
|
|
|
|
"statement_begin_time"=>$this->beginThismonth,
|
|
|
|
|
"statement_end_time"=>$this->endThismonth
|
|
|
|
|
];
|
|
|
|
|
$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) {
|
|
|
|
|
var_dump($val['game_name']);
|
|
|
|
|
//获取真实游戏名
|
|
|
|
|
$games = $this->OPName2GName($val['game_name'],$v['company_id']);
|
|
|
|
|
var_dump($games);
|
|
|
|
|
foreach ($games as $game) {
|
|
|
|
|
if( !array_key_exists($game,$this->adddata) ){
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
$statement_money = round( $this->adddata[$game]['pay_amount'] / $val['pay_amount'] * $val['sum_money'],2);
|
|
|
|
|
if( array_key_exists("cp_statement_amount",$this->adddata[$game]) ){
|
|
|
|
|
$this->adddata[$game]['cp_statement_amount'] += $statement_money;
|
|
|
|
|
}else{
|
|
|
|
|
$this->adddata[$game]['cp_statement_amount'] = $statement_money;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//原包名还原游戏名
|
|
|
|
|
private function OPName2GName($OPName,$company_id)
|
|
|
|
|
{
|
|
|
|
|
$where = [
|
|
|
|
|
"partner_id"=>$company_id,
|
|
|
|
|
"_string"=>"original_package_name = '{$OPName}' OR relation_game_name = '{$OPName}'"
|
|
|
|
|
];
|
|
|
|
|
$game = M("Game","tab_")->field("relation_game_name")->where($where)->group("relation_game_name")->select();
|
|
|
|
|
if($game){
|
|
|
|
|
return array_column($game,"relation_game_name");
|
|
|
|
|
}else{
|
|
|
|
|
return [$OPName];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|