|
|
|
@ -2,7 +2,8 @@
|
|
|
|
|
namespace Admin\Controller;
|
|
|
|
|
class FinancePromoteController extends AdminController
|
|
|
|
|
{
|
|
|
|
|
public function _initialize(Type $var = null)
|
|
|
|
|
public $COMPANY_NAME = "万盟天下科技";
|
|
|
|
|
public function _initialize()
|
|
|
|
|
{
|
|
|
|
|
parent::_initialize();
|
|
|
|
|
// echo "<pre>";
|
|
|
|
@ -114,7 +115,7 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
} else {
|
|
|
|
|
$v['company_belong']='内团';
|
|
|
|
|
}
|
|
|
|
|
if(empty($v['company_name'])) $v['company_name']= "万盟天下科技";
|
|
|
|
|
if(empty($v['company_name'])) $v['company_name']= $this->COMPANY_NAME;
|
|
|
|
|
if(empty($v['p_id'])) $v['p_id']= "0";
|
|
|
|
|
if(!array_key_exists('cash_count',$v)) $v['cash_count']=0;
|
|
|
|
|
if(!array_key_exists('balance_coin_count',$v)) $v['balance_coin_count']=0;
|
|
|
|
@ -308,7 +309,7 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
foreach($senddata as $k=>$v){
|
|
|
|
|
|
|
|
|
|
$v['company_belong']?$v['company_belong']='外团':$v['company_belong']='内团';
|
|
|
|
|
if(empty($v['company_name'])) $v['company_name']= "万盟天下科技";
|
|
|
|
|
if(empty($v['company_name'])) $v['company_name']= $this->COMPANY_NAME;
|
|
|
|
|
if(empty($v['promote_account'])) $v['promote_account']= "官方渠道";
|
|
|
|
|
if(!array_key_exists('cash_count',$v)) $v['cash_count']=0;
|
|
|
|
|
if(!array_key_exists('balance_coin_count',$v)) $v['balance_coin_count']=0;
|
|
|
|
@ -585,16 +586,26 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
->field("s.game_id,s.game_name,p.partner as partner_name,
|
|
|
|
|
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 inside_cash_count")
|
|
|
|
|
SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as inside_cash_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_name,'{$this->COMPANY_NAME}') company_name")
|
|
|
|
|
->join('LEFT JOIN tab_game as g ON s.game_id=g.id')
|
|
|
|
|
->join("tab_promote promote ON s.promote_id = promote.id","left")
|
|
|
|
|
->join("tab_promote_company company ON promote.company_id = company.id","left")
|
|
|
|
|
->join('LEFT JOIN tab_partner as p ON g.partner_id=p.id')
|
|
|
|
|
->order("p_id asc,cash_count desc")
|
|
|
|
|
->where($map)
|
|
|
|
|
->group('s.game_id');
|
|
|
|
|
->group('p_id,game_id');
|
|
|
|
|
if ($row != 0) {
|
|
|
|
|
$query = $query->page($page,$row);
|
|
|
|
|
}
|
|
|
|
|
$data = $query->select();
|
|
|
|
|
// dump($data);die();
|
|
|
|
|
$data = $query->select(false);
|
|
|
|
|
$data = M()
|
|
|
|
|
->table("(".$data.") a")
|
|
|
|
|
->field("a.*,IFNULL(promote.account,'官方渠道') account")
|
|
|
|
|
->join("tab_promote promote ON a.p_id = promote.id","left")
|
|
|
|
|
->select();
|
|
|
|
|
|
|
|
|
|
return $data;
|
|
|
|
|
}
|
|
|
|
|
private function totalGameStatisticsData($map, $join = true)
|
|
|
|
@ -621,27 +632,15 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
$map['pay_way'] = $_REQUEST['pay_way'];
|
|
|
|
|
$this->assign('pay_way', $map['pay_way']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty($_REQUEST['pay_order_number'])) {
|
|
|
|
|
$map['pay_order_number'] = $_REQUEST['pay_order_number'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if (!empty(I('partner_id'))&&empty(I("game_id"))) {
|
|
|
|
|
// $wherePartner = I('partner_id');
|
|
|
|
|
// $gameId = M("game","tab_")->field("id")->where("partner_id={$wherePartner}")->select();
|
|
|
|
|
// $gameId = implode(',',array_column($gameId,'id'));
|
|
|
|
|
// $map['tab_spend.game_id'] = ['in',$gameId];
|
|
|
|
|
// }
|
|
|
|
|
if (!empty(I("game_id"))) {
|
|
|
|
|
$map['tab_spend.game_id'] = I("game_id");
|
|
|
|
|
}
|
|
|
|
|
if (isset($_REQUEST['game_name']) || isset($_REQUEST['game_type']) || isset($_REQUEST['partner_id'])) {
|
|
|
|
|
$map["tab_spend.game_id"] = array("in",implode(',', array_column(getGameidByPartnerNameType($_REQUEST['partner_id'],$_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) );
|
|
|
|
|
}
|
|
|
|
|
// if (isset($_REQUEST['game_name']) || isset($_REQUEST['game_type'])) {
|
|
|
|
|
// $map["tab_spend.game_id"] = array("in",implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) );
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) {
|
|
|
|
|
$map['pay_time'] = ['between', [strtotime($_REQUEST['time_start']), strtotime($_REQUEST['time_end']) + 86399]];
|
|
|
|
|
} elseif (isset($_REQUEST['time_start'])) {
|
|
|
|
@ -649,7 +648,6 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
} elseif (isset($_REQUEST['time_end'])) {
|
|
|
|
|
$map['pay_time'] = ['LT', strtotime($_REQUEST['time_end']) + 86399];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($_REQUEST['promote_id'] != '') {
|
|
|
|
|
if ($_REQUEST['promote_id'] == 0 || $_REQUEST['promote_type'] == 2) {
|
|
|
|
|
$map['tab_spend.promote_id'] = $_REQUEST['promote_id'];
|
|
|
|
@ -725,8 +723,6 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
$count = count($count);
|
|
|
|
|
$page = set_pagination($count,$row);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// $map['pay_game_status'] = 1;
|
|
|
|
|
$total_cost = D('spend')->sumSpend($map, 'cost');//订单金额合计
|
|
|
|
|
$total_pay_amount = D('spend')->sumSpend($map, 'pay_amount');//实付金额合计
|
|
|
|
|
|
|
|
|
@ -888,7 +884,7 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
$pmap['company_id'] = $_REQUEST['company_id'];
|
|
|
|
|
//获取公司名称
|
|
|
|
|
if($pmap['company_id'] == 0){
|
|
|
|
|
$title .= "万盟天下科技-";
|
|
|
|
|
$title .= "{$this->COMPANY_NAME}-";
|
|
|
|
|
}else{
|
|
|
|
|
$gfflg = false;
|
|
|
|
|
$title .= (M('promote_company',"tab_")->field("company_name")->where("id = '{$pmap['company_id']}'")->find()['company_name'] . "-");
|
|
|
|
@ -921,9 +917,10 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
$t_in = implode(',', array_column($promoter_ids, 'id'));
|
|
|
|
|
}
|
|
|
|
|
$map[$field] = ['in',$t_in];
|
|
|
|
|
}else{
|
|
|
|
|
$map[$field] = ['in',"-1"];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//判断是否有推广员
|
|
|
|
|
$level = 1;
|
|
|
|
|
if ($_REQUEST['promote_id'] != '') {
|
|
|
|
@ -939,7 +936,6 @@ class FinancePromoteController extends AdminController
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// dd($map);
|
|
|
|
|
$_POST['promote_level'] = $level;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|