@ -15,7 +15,7 @@ class PayMerchantController extends ThinkController
const WAY_EXPRESS = 4;
const WAY_EXPRESS = 4;
public function index($p = 0) {
public function index($p = 0) {
if(!array_key_exists("timestart",$_REQUEST)){
if(!array_key_exists("timestart",$_REQUEST)& & !$_REQUEST['type'] ){
$this->redirect(ACTION_NAME, array('timestart' => date('Y-m-d',strtotime('-30 day')),"timeend"=>date('Y-m-d')));
$this->redirect(ACTION_NAME, array('timestart' => date('Y-m-d',strtotime('-30 day')),"timeend"=>date('Y-m-d')));
}
}
$page = intval($p);
$page = intval($p);
@ -50,12 +50,16 @@ class PayMerchantController extends ThinkController
$map['main_name'] = $_REQUEST['main_name'];
$map['main_name'] = $_REQUEST['main_name'];
}
}
if ($_REQUEST['pay_way']) {
$data_map['pay_way'] = [$_REQUEST['type'],$_REQUEST['pay_way']];
}
//游戏充值金额
//游戏充值金额
$data = M("spend use index(pay_channel)","tab_")
$data = M("spend use index(pay_channel)","tab_")
->field("SUM(CASE WHEN merchant.id is not null and tab_test_white_list.user_id is null THEN pay_amount ELSE 0 END) as cash_amount,
->field("SUM(CASE WHEN merchant.id is not null and tab_test_white_list.user_id is null THEN pay_amount ELSE 0 END) as cash_amount,
SUM(CASE WHEN merchant.id is not null and tab_test_white_list.user_id is not null THEN pay_amount ELSE 0 END) as test_amount,
SUM(CASE WHEN merchant.id is not null and tab_test_white_list.user_id is not null THEN pay_amount ELSE 0 END) as test_amount,
0 coin_amount,0 offcial_amount,0 spread_amount,0 supersign_amount,0 test_order_amount,merchant_id,name,channel,identifier,
0 coin_amount,0 offcial_amount,0 spread_amount,0 supersign_amount,0 test_order_amount,merchant_id,name,channel,identifier,
payed_time,game_id,main_name,merchant_way,merchant.account")
payed_time,game_id,main_name,merchant_way,merchant.account,tab_spend.pay_way ")
->join("left join tab_test_white_list on tab_spend.user_id=tab_test_white_list.user_id")
->join("left join tab_test_white_list on tab_spend.user_id=tab_test_white_list.user_id")
->join("left join tab_payment_merchant merchant on merchant.id=tab_spend.merchant_id")
->join("left join tab_payment_merchant merchant on merchant.id=tab_spend.merchant_id")
->where(['pay_status'=>1,'tab_spend.pay_way'=>['egt',1],'merchant.status'=>1,'merchant.type'=>1])
->where(['pay_status'=>1,'tab_spend.pay_way'=>['egt',1],'merchant.status'=>1,'merchant.type'=>1])
@ -70,7 +74,7 @@ class PayMerchantController extends ThinkController
->join("left join tab_payment_merchant merchant on merchant.id=tab_deposit.merchant_id")
->join("left join tab_payment_merchant merchant on merchant.id=tab_deposit.merchant_id")
->field("0 cash_amount,SUM(CASE WHEN merchant.id is not null and pay_source=2 and tab_test_white_list.user_id is not null THEN pay_amount ELSE 0 END) as test_amount,
->field("0 cash_amount,SUM(CASE WHEN merchant.id is not null and pay_source=2 and tab_test_white_list.user_id is not null THEN pay_amount ELSE 0 END) as test_amount,
SUM(CASE WHEN merchant.id is not null and tab_test_white_list.user_id is null and pay_source=2 THEN pay_amount ELSE 0 END) as coin_amount,
SUM(CASE WHEN merchant.id is not null and tab_test_white_list.user_id is null and pay_source=2 THEN pay_amount ELSE 0 END) as coin_amount,
0 offcial_amount,0 spread_amount,0 supersign_amount,0 test_order_amount,merchant_id,name,channel,identifier,payed_time,game_id,main_name,merchant_way,merchant.account")
0 offcial_amount,0 spread_amount,0 supersign_amount,0 test_order_amount,merchant_id,name,channel,identifier,payed_time,game_id,main_name,merchant_way,merchant.account,tab_deposit.pay_way ")
->where(['pay_status'=>1,'tab_deposit.pay_way'=>['egt',1],'merchant.status'=>1,'merchant.type'=>1])
->where(['pay_status'=>1,'tab_deposit.pay_way'=>['egt',1],'merchant.status'=>1,'merchant.type'=>1])
->where($map)
->where($map)
->group("merchant_id,merchant_way")
->group("merchant_id,merchant_way")
@ -82,7 +86,7 @@ class PayMerchantController extends ThinkController
->join("left join tab_payment_merchant merchant on merchant.id=tab_deposit.merchant_id")
->join("left join tab_payment_merchant merchant on merchant.id=tab_deposit.merchant_id")
->field("0 cash_amount,SUM(CASE WHEN merchant.id is not null and pay_source=0 and tab_test_white_list.user_id is not null THEN pay_amount ELSE 0 END) as test_amount,
->field("0 cash_amount,SUM(CASE WHEN merchant.id is not null and pay_source=0 and tab_test_white_list.user_id is not null THEN pay_amount ELSE 0 END) as test_amount,
0 as coin_amount,SUM(CASE WHEN merchant.id is not null and tab_test_white_list.user_id is null and pay_source=0 THEN pay_amount ELSE 0 END) as offcial_amount,
0 as coin_amount,SUM(CASE WHEN merchant.id is not null and tab_test_white_list.user_id is null and pay_source=0 THEN pay_amount ELSE 0 END) as offcial_amount,
0 spread_amount,0 supersign_amount,0 test_order_amount,merchant_id,name,channel,identifier,payed_time,0 as game_id,main_name,merchant_way,merchant.account")
0 spread_amount,0 supersign_amount,0 test_order_amount,merchant_id,name,channel,identifier,payed_time,0 as game_id,main_name,merchant_way,merchant.account,tab_deposit.pay_way ")
->where(['pay_status'=>1,'tab_deposit.pay_way'=>['egt',1],'merchant.status'=>1,'merchant.type'=>1])
->where(['pay_status'=>1,'tab_deposit.pay_way'=>['egt',1],'merchant.status'=>1,'merchant.type'=>1])
->where($map)
->where($map)
->group("merchant_id,merchant_way")
->group("merchant_id,merchant_way")
@ -98,7 +102,7 @@ class PayMerchantController extends ThinkController
$spreadData = M("coin_pay_order","tab_")
$spreadData = M("coin_pay_order","tab_")
->field("0 cash_amount,0 test_amount,0 coin_amount,0 offcial_amount,
->field("0 cash_amount,0 test_amount,0 coin_amount,0 offcial_amount,
SUM(CASE WHEN merchant.id is not null THEN pay_amount ELSE 0 END) as spread_amount,0 supersign_amount,
SUM(CASE WHEN merchant.id is not null THEN pay_amount ELSE 0 END) as spread_amount,0 supersign_amount,
0 test_order_amount,merchant_id,name,channel,identifier,pay_time payed_time,0 game_id,main_name,merchant_way,merchant.account")
0 test_order_amount,merchant_id,name,channel,identifier,pay_time payed_time,0 game_id,main_name,merchant_way,merchant.account,tab_coin_pay_order.pay_way ")
->join("left join tab_payment_merchant merchant on merchant.id=tab_coin_pay_order.merchant_id")
->join("left join tab_payment_merchant merchant on merchant.id=tab_coin_pay_order.merchant_id")
->where(['order_status'=>1,'tab_coin_pay_order.pay_way'=>['egt',1],'merchant.status'=>1,'merchant.type'=>1])
->where(['order_status'=>1,'tab_coin_pay_order.pay_way'=>['egt',1],'merchant.status'=>1,'merchant.type'=>1])
->where($map)
->where($map)
@ -111,7 +115,7 @@ class PayMerchantController extends ThinkController
SUM(CASE WHEN merchant.id is not null and tab_test_white_list.user_id is not null THEN pay_price ELSE 0 END) as test_amount,
SUM(CASE WHEN merchant.id is not null and tab_test_white_list.user_id is not null THEN pay_price ELSE 0 END) as test_amount,
0 coin_amount,0 offcial_amount,0 spread_amount,
0 coin_amount,0 offcial_amount,0 spread_amount,
SUM(CASE WHEN merchant.id is not null and tab_test_white_list.user_id is null THEN pay_price ELSE 0 END) as supersign_amount,
SUM(CASE WHEN merchant.id is not null and tab_test_white_list.user_id is null THEN pay_price ELSE 0 END) as supersign_amount,
0 test_order_amount,merchant_id,name,channel,identifier,pay_time payed_time,game_id,main_name,merchant_way,merchant.account")
0 test_order_amount,merchant_id,name,channel,identifier,pay_time payed_time,game_id,main_name,merchant_way,merchant.account,tab_game_supersign.pay_way ")
->join("left join tab_payment_merchant merchant on merchant.id=tab_game_supersign.merchant_id")
->join("left join tab_payment_merchant merchant on merchant.id=tab_game_supersign.merchant_id")
->join("left join tab_test_white_list on tab_test_white_list.user_id=tab_game_supersign.user_id")
->join("left join tab_test_white_list on tab_test_white_list.user_id=tab_game_supersign.user_id")
->where(['pay_status'=>1,'tab_game_supersign.pay_way'=>['egt',1],'merchant.status'=>1,'merchant.type'=>1])
->where(['pay_status'=>1,'tab_game_supersign.pay_way'=>['egt',1],'merchant.status'=>1,'merchant.type'=>1])
@ -124,7 +128,7 @@ class PayMerchantController extends ThinkController
->where(['tab_test_order.pay_way'=>['egt',1]])
->where(['tab_test_order.pay_way'=>['egt',1]])
->field('0 cash_amount,0 test_amount,0 coin_amount,0 offcial_amount,0 spread_amount,0 supersign_amount,
->field('0 cash_amount,0 test_amount,0 coin_amount,0 offcial_amount,0 spread_amount,0 supersign_amount,
SUM(CASE WHEN merchant.id is not null THEN pay_amount ELSE 0 END) as test_order_amount,merchant_id,name,
SUM(CASE WHEN merchant.id is not null THEN pay_amount ELSE 0 END) as test_order_amount,merchant_id,name,
channel,identifier,pay_time payed_time,game_id,main_name,merchant_way,merchant.account')
channel,identifier,pay_time payed_time,game_id,main_name,merchant_way,merchant.account,tab_test_order.pay_way ')
->join("left join tab_payment_merchant merchant on merchant.id=tab_test_order.merchant_id")
->join("left join tab_payment_merchant merchant on merchant.id=tab_test_order.merchant_id")
->where(['merchant.status'=>1,'merchant.type'=>1])
->where(['merchant.status'=>1,'merchant.type'=>1])
->where($map)
->where($map)
@ -142,7 +146,7 @@ class PayMerchantController extends ThinkController
name,channel,identifier")
name,channel,identifier")
->page($p, $row)
->page($p, $row)
->where("name is not null and merchant_way !=0")
->where("name is not null and merchant_way !=0")
// ->where($ map)
->where($data_ map)
->group("merchant_id,merchant_way")
->group("merchant_id,merchant_way")
->select();
->select();
} else {
} else {
@ -153,6 +157,7 @@ class PayMerchantController extends ThinkController
sum(test_order_amount) test_order_amount,merchant_id,account,merchant_way,main_name,
sum(test_order_amount) test_order_amount,merchant_id,account,merchant_way,main_name,
name,channel,identifier")
name,channel,identifier")
->where("name is not null and merchant_way !=0")
->where("name is not null and merchant_way !=0")
->where($data_map)
->group("merchant_id,merchant_way")
->group("merchant_id,merchant_way")
->select();
->select();
}
}
@ -160,6 +165,7 @@ class PayMerchantController extends ThinkController
$count = M()->table("({$sql})a")
$count = M()->table("({$sql})a")
->field("merchant_id")
->field("merchant_id")
->where("name is not null and merchant_way !=0")
->where("name is not null and merchant_way !=0")
->where($data_map)
// ->where($map)
// ->where($map)
->group("merchant_id,merchant_way")
->group("merchant_id,merchant_way")
->select(false);
->select(false);
@ -178,6 +184,7 @@ class PayMerchantController extends ThinkController
sum(spread_amount) spread_amount,sum(supersign_amount) supersign_amount,
sum(spread_amount) spread_amount,sum(supersign_amount) supersign_amount,
sum(test_order_amount) test_order_amount,merchant_id")
sum(test_order_amount) test_order_amount,merchant_id")
->where("name is not null and merchant_way !=0")
->where("name is not null and merchant_way !=0")
->where($data_map)
// ->where($map)
// ->where($map)
->find();
->find();
@ -197,6 +204,7 @@ class PayMerchantController extends ThinkController
->field("sum(cash_amount+test_amount+coin_amount+offcial_amount+spread_amount+supersign_amount+test_order_amount) sum_amount,
->field("sum(cash_amount+test_amount+coin_amount+offcial_amount+spread_amount+supersign_amount+test_order_amount) sum_amount,
merchant_id,name,merchant_way")
merchant_id,name,merchant_way")
->where("name is not null and merchant_way !=0")
->where("name is not null and merchant_way !=0")
->where($data_map)
// ->where($map)
// ->where($map)
->group("merchant_id,merchant_way")
->group("merchant_id,merchant_way")
->select();
->select();