|
|
@ -104,145 +104,148 @@ class SpendCountSetController extends \Think\Controller
|
|
|
|
//获取游戏现金流水
|
|
|
|
//获取游戏现金流水
|
|
|
|
protected function getCashData()
|
|
|
|
protected function getCashData()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(!$this->continue){
|
|
|
|
$this->createGameCount("cash_count");
|
|
|
|
die("api error");
|
|
|
|
// if(!$this->continue){
|
|
|
|
}
|
|
|
|
// die("api error");
|
|
|
|
$map = array(
|
|
|
|
// }
|
|
|
|
"pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
|
|
|
|
// $map = array(
|
|
|
|
"spend.pay_status"=>1,
|
|
|
|
// "pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
|
|
|
|
"pay_way"=>array("GT",0)
|
|
|
|
// "spend.pay_status"=>1,
|
|
|
|
);
|
|
|
|
// "pay_way"=>array("GT",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,
|
|
|
|
// $field = "IFNULL(game.partner_id,0) partner_id,partner.partner partner_name,
|
|
|
|
IFNULL(promote.parent_id,0) parent_id,promote.parent_name,sum(pay_amount) cash_count,
|
|
|
|
// spend.promote_id,spend.promote_account,spend.game_id,spend.game_name,
|
|
|
|
'{$this->date}' as count_date,'{$this->nowdata}' as create_time";
|
|
|
|
// IFNULL(promote.parent_id,0) parent_id,promote.parent_name,sum(pay_amount) cash_count,
|
|
|
|
//获取现金
|
|
|
|
// '{$this->date}' as count_date,'{$this->nowdata}' as create_time";
|
|
|
|
$cashRes = M()
|
|
|
|
// //获取现金
|
|
|
|
->table("tab_spend spend")
|
|
|
|
// $cashRes = M()
|
|
|
|
->field($field)
|
|
|
|
// ->table("tab_spend spend")
|
|
|
|
->where($map)
|
|
|
|
// ->field($field)
|
|
|
|
->join("tab_promote promote ON spend.promote_id = promote.id","left")
|
|
|
|
// ->where($map)
|
|
|
|
->join("tab_game game ON spend.game_id = game.id","left")
|
|
|
|
// ->join("tab_promote promote ON spend.promote_id = promote.id","left")
|
|
|
|
->join("tab_partner partner ON partner.id = game.partner_id","left")
|
|
|
|
// ->join("tab_game game ON spend.game_id = game.id","left")
|
|
|
|
->group('spend.promote_id,spend.game_id')
|
|
|
|
// ->join("tab_partner partner ON partner.id = game.partner_id","left")
|
|
|
|
->select();
|
|
|
|
// ->group('spend.promote_id,spend.game_id')
|
|
|
|
if(!empty($cashRes)){
|
|
|
|
// ->select();
|
|
|
|
$dbres = $this->model->addAll($cashRes);
|
|
|
|
// if(!empty($cashRes)){
|
|
|
|
if(!$dbres){
|
|
|
|
// $dbres = $this->model->addAll($cashRes);
|
|
|
|
$this->model->rollback();
|
|
|
|
// if(!$dbres){
|
|
|
|
die("error");
|
|
|
|
// $this->model->rollback();
|
|
|
|
}
|
|
|
|
// die("error");
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
|
|
|
|
// }
|
|
|
|
# code...
|
|
|
|
# code...
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//获取平台币聚合
|
|
|
|
//获取平台币聚合
|
|
|
|
protected function getBalanceData()
|
|
|
|
protected function getBalanceData()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(!$this->continue){
|
|
|
|
$this->createGameCount("balance_coin_count");
|
|
|
|
die("api error");
|
|
|
|
// if(!$this->continue){
|
|
|
|
}
|
|
|
|
// die("api error");
|
|
|
|
$map = array(
|
|
|
|
// }
|
|
|
|
"pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
|
|
|
|
// $map = array(
|
|
|
|
"spend.pay_status"=>1,
|
|
|
|
// "pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
|
|
|
|
"pay_way"=> array("EQ",0)
|
|
|
|
// "spend.pay_status"=>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,
|
|
|
|
// $field = "IFNULL(game.partner_id,0) partner_id,partner.partner partner_name,
|
|
|
|
IFNULL(promote.parent_id,0) parent_id,promote.parent_name,sum(pay_amount) balance_coin_count,
|
|
|
|
// spend.promote_id,spend.promote_account,spend.game_id,spend.game_name,
|
|
|
|
'{$this->date}' as count_date,'{$this->nowdata}' as create_time";
|
|
|
|
// IFNULL(promote.parent_id,0) parent_id,promote.parent_name,sum(pay_amount) balance_coin_count,
|
|
|
|
$balanceRes = M()
|
|
|
|
// '{$this->date}' as count_date,'{$this->nowdata}' as create_time";
|
|
|
|
->table("tab_spend spend")
|
|
|
|
// $balanceRes = M()
|
|
|
|
->field($field)
|
|
|
|
// ->table("tab_spend spend")
|
|
|
|
->where($map)
|
|
|
|
// ->field($field)
|
|
|
|
->join("tab_promote promote ON spend.promote_id = promote.id","left")
|
|
|
|
// ->where($map)
|
|
|
|
->join("tab_game game ON spend.game_id = game.id","left")
|
|
|
|
// ->join("tab_promote promote ON spend.promote_id = promote.id","left")
|
|
|
|
->join("tab_partner partner ON partner.id = game.partner_id","left")
|
|
|
|
// ->join("tab_game game ON spend.game_id = game.id","left")
|
|
|
|
->group('spend.promote_id,spend.game_id')
|
|
|
|
// ->join("tab_partner partner ON partner.id = game.partner_id","left")
|
|
|
|
->select();
|
|
|
|
// ->group('spend.promote_id,spend.game_id')
|
|
|
|
//集中两个表
|
|
|
|
// ->select();
|
|
|
|
if(!empty($balanceRes)){
|
|
|
|
// //集中两个表
|
|
|
|
|
|
|
|
// if(!empty($balanceRes)){
|
|
|
|
|
|
|
|
|
|
|
|
for ($i=0; $i < count($balanceRes); $i++) {
|
|
|
|
// for ($i=0; $i < count($balanceRes); $i++) {
|
|
|
|
# code...
|
|
|
|
// # code...
|
|
|
|
$tempmap = array(
|
|
|
|
// $tempmap = array(
|
|
|
|
"game_id"=>$balanceRes[$i]['game_id'],
|
|
|
|
// "game_id"=>$balanceRes[$i]['game_id'],
|
|
|
|
"promote_id"=>$balanceRes[$i]['promote_id'],
|
|
|
|
// "promote_id"=>$balanceRes[$i]['promote_id'],
|
|
|
|
"count_date"=>$this->date
|
|
|
|
// "count_date"=>$this->date
|
|
|
|
);
|
|
|
|
// );
|
|
|
|
$dbres = $this->model->where($tempmap)->find();
|
|
|
|
// $dbres = $this->model->where($tempmap)->find();
|
|
|
|
if(!$dbres){
|
|
|
|
// if(!$dbres){
|
|
|
|
//不存在
|
|
|
|
// //不存在
|
|
|
|
$tempdbres = $this->model->add($balanceRes[$i]);
|
|
|
|
// $tempdbres = $this->model->add($balanceRes[$i]);
|
|
|
|
if(!$tempdbres){
|
|
|
|
// if(!$tempdbres){
|
|
|
|
$this->model->rollback();
|
|
|
|
// $this->model->rollback();
|
|
|
|
die("error");
|
|
|
|
// die("error");
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}else{
|
|
|
|
// }else{
|
|
|
|
$dbres["balance_coin_count"] = $balanceRes[$i]['balance_coin_count'];
|
|
|
|
// $dbres["balance_coin_count"] = $balanceRes[$i]['balance_coin_count'];
|
|
|
|
$tempdbres = $this->model->save($dbres);
|
|
|
|
// $tempdbres = $this->model->save($dbres);
|
|
|
|
if(!$tempdbres){
|
|
|
|
// if(!$tempdbres){
|
|
|
|
$this->model->rollback();
|
|
|
|
// $this->model->rollback();
|
|
|
|
die("error");
|
|
|
|
// die("error");
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
# code...
|
|
|
|
# code...
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//获取绑定币充值
|
|
|
|
//获取绑定币充值
|
|
|
|
protected function getInsideData()
|
|
|
|
protected function getInsideData()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(!$this->continue){
|
|
|
|
$this->createGameCount("inside_cash_count");
|
|
|
|
die("api error");
|
|
|
|
// if(!$this->continue){
|
|
|
|
}
|
|
|
|
// die("api error");
|
|
|
|
$map = array(
|
|
|
|
// }
|
|
|
|
"pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
|
|
|
|
// $map = array(
|
|
|
|
"spend.pay_status"=>1,
|
|
|
|
// "pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
|
|
|
|
"pay_way"=> array("LT",0)
|
|
|
|
// "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,
|
|
|
|
// $field = "IFNULL(game.partner_id,0) partner_id,partner.partner partner_name,
|
|
|
|
IFNULL(promote.parent_id,0) parent_id,promote.parent_name,sum(pay_amount) inside_cash_count,
|
|
|
|
// spend.promote_id,spend.promote_account,spend.game_id,spend.game_name,
|
|
|
|
'{$this->date}' as count_date,'{$this->nowdata}' as create_time";
|
|
|
|
// IFNULL(promote.parent_id,0) parent_id,promote.parent_name,sum(pay_amount) inside_cash_count,
|
|
|
|
$balanceRes = M()
|
|
|
|
// '{$this->date}' as count_date,'{$this->nowdata}' as create_time";
|
|
|
|
->table("tab_spend spend")
|
|
|
|
// $balanceRes = M()
|
|
|
|
->field($field)
|
|
|
|
// ->table("tab_spend spend")
|
|
|
|
->where($map)
|
|
|
|
// ->field($field)
|
|
|
|
->join("tab_promote promote ON spend.promote_id = promote.id","left")
|
|
|
|
// ->where($map)
|
|
|
|
->join("tab_game game ON spend.game_id = game.id","left")
|
|
|
|
// ->join("tab_promote promote ON spend.promote_id = promote.id","left")
|
|
|
|
->join("tab_partner partner ON partner.id = game.partner_id","left")
|
|
|
|
// ->join("tab_game game ON spend.game_id = game.id","left")
|
|
|
|
->group('spend.promote_id,spend.game_id')
|
|
|
|
// ->join("tab_partner partner ON partner.id = game.partner_id","left")
|
|
|
|
->select();
|
|
|
|
// ->group('spend.promote_id,spend.game_id')
|
|
|
|
//集中两个表
|
|
|
|
// ->select();
|
|
|
|
if(!empty($balanceRes)){
|
|
|
|
// //集中两个表
|
|
|
|
|
|
|
|
// if(!empty($balanceRes)){
|
|
|
|
|
|
|
|
|
|
|
|
for ($i=0; $i < count($balanceRes); $i++) {
|
|
|
|
// for ($i=0; $i < count($balanceRes); $i++) {
|
|
|
|
# code...
|
|
|
|
// # code...
|
|
|
|
$tempmap = array(
|
|
|
|
// $tempmap = array(
|
|
|
|
"game_id"=>$balanceRes[$i]['game_id'],
|
|
|
|
// "game_id"=>$balanceRes[$i]['game_id'],
|
|
|
|
"promote_id"=>$balanceRes[$i]['promote_id'],
|
|
|
|
// "promote_id"=>$balanceRes[$i]['promote_id'],
|
|
|
|
"count_date"=>$this->date
|
|
|
|
// "count_date"=>$this->date
|
|
|
|
);
|
|
|
|
// );
|
|
|
|
$dbres = $this->model->where($tempmap)->find();
|
|
|
|
// $dbres = $this->model->where($tempmap)->find();
|
|
|
|
if(!$dbres){
|
|
|
|
// if(!$dbres){
|
|
|
|
//不存在
|
|
|
|
// //不存在
|
|
|
|
$tempdbres = $this->model->add($balanceRes[$i]);
|
|
|
|
// $tempdbres = $this->model->add($balanceRes[$i]);
|
|
|
|
if(!$tempdbres){
|
|
|
|
// if(!$tempdbres){
|
|
|
|
$this->model->rollback();
|
|
|
|
// $this->model->rollback();
|
|
|
|
die("error");
|
|
|
|
// die("error");
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}else{
|
|
|
|
// }else{
|
|
|
|
$dbres["inside_cash_count"] = $balanceRes[$i]['inside_cash_count'];
|
|
|
|
// $dbres["inside_cash_count"] = $balanceRes[$i]['inside_cash_count'];
|
|
|
|
$tempdbres = $this->model->save($dbres);
|
|
|
|
// $tempdbres = $this->model->save($dbres);
|
|
|
|
if(!$tempdbres){
|
|
|
|
// if(!$tempdbres){
|
|
|
|
$this->model->rollback();
|
|
|
|
// $this->model->rollback();
|
|
|
|
die("error");
|
|
|
|
// die("error");
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public function createGameCount($type)
|
|
|
|
protected function createGameCount($type)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$map = array(
|
|
|
|
$map = array(
|
|
|
|
"pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
|
|
|
|
"pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
|
|
|
@ -294,8 +297,8 @@ class SpendCountSetController extends \Think\Controller
|
|
|
|
die("error");
|
|
|
|
die("error");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
$dbres["inside_cash_count"] = $balanceRes[$i]['inside_cash_count'];
|
|
|
|
$dbres[$type] = $balanceRes[$i][$type];
|
|
|
|
$tempdbres = $this->model->save($dbres);
|
|
|
|
$tempdbres = $this->gamemodel->save($dbres);
|
|
|
|
if(!$tempdbres){
|
|
|
|
if(!$tempdbres){
|
|
|
|
$this->model->rollback();
|
|
|
|
$this->model->rollback();
|
|
|
|
die("error");
|
|
|
|
die("error");
|
|
|
|