Merge branch 'release' of wmtx/platform into master

版本更新
master
廖金灵 4 years ago committed by Gogs
commit 81d6240c42

2
.gitignore vendored

@ -10,4 +10,4 @@ Uploads/
.vscode
/vendor/
/Application/Admin/Controller/device_data_foldline.txt
/Application/Admin/Controller/access_data_launch.txt
/Application/Admin/Controller/access_data_launch.txt

@ -46,7 +46,6 @@ class CompanyGameRatioController extends AdminController
if(isset($params['company_belong'])){
$pwhere = " and p.company_belong = {$params['company_belong']}";
}
if(isset($params['company_id'])){
$where['m.company_id'] = $params['company_id'];
@ -69,6 +68,21 @@ class CompanyGameRatioController extends AdminController
}
}
$isMarketAdmin = isMarketAdmin();
if($isMarketAdmin) {
$userAuth = session('user_auth');
$adminId = $userAuth['uid'];
$companyIds = M('promote', 'tab_')->where(['admin_id' => $adminId, 'level' => 1])->getField('company_id', true);
$companyIds = array_unique($companyIds);
$marketCondition = '';
if (count($companyIds) > 0) {
$marketCondition = 'm.company_id in(' . implode(',', $companyIds) . ')';
} else {
$marketCondition = '1<>1';
}
$where['_string'] = isset($where['_string']) ? $where['_string'] . ' and ' . $marketCondition : $marketCondition;
}
if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) {
$time_start = strtotime($_REQUEST['time_start']);
$time_end = strtotime($_REQUEST['time_end'])+ 86399;

@ -593,8 +593,10 @@ class CompanyStatementController extends ThinkController
$StatementInfo = M("company_statement_info","tab_");
$company_info = $va['company_info'];
$LackStatement = M("company_lack_statement_info","tab_");
$no_pool_money = 300;
//统一比例字段
if($k == "up" || $k=="ups"){
$no_pool_money = 500;
foreach ($va['statement_info'] as $key => &$value) {
if($company_info['pay_type'] == 2){
$value["ratio"] = $value["second_ratio"];
@ -614,7 +616,7 @@ class CompanyStatementController extends ThinkController
}
//创建基础未满基础信息
if($va['statement_money'] < 300){
if($va['statement_money'] < $no_pool_money){
$lackcompany =[
"company_id"=>$company_info['id'],
"company_type"=>$v['company_type'],
@ -649,8 +651,8 @@ class CompanyStatementController extends ThinkController
array_multisort($last_names,SORT_DESC,SORT_STRING,$va['statement_info']);
}
}
if($va['statement_money'] < 300){
//依旧小于300存旧版
if($va['statement_money'] < $no_pool_money){
//依旧小于不结算金额存旧版
if($lackcompany['pay_amount'] > 0){
$lask_id = $LackStatement->add($lackcompany);
$v['create_lack_ids'][] =$lask_id;

@ -14,16 +14,6 @@ class FinancialSummaryController extends AdminController
"outer_count"=>"外团",
"outer_branch_count"=>"外团-分发",
"other_group_count"=>"无归属团",
// "inside_count"=>"内团",
// "outer_count"=>"外团",
"gfwx_count"=>"官方-微信",
"gfzfb_count"=>"官方-支付宝",
"sqzfb_count"=>"双乾-支付宝",
"sqkj_count"=>"双乾-快捷",
"wx_count"=>"微信",
"zfb_count"=>"支付宝",
"kj_count"=>"快捷",
"ybzf_count"=>"易宝支付",
);
public function _initialize()
{
@ -43,6 +33,9 @@ class FinancialSummaryController extends AdminController
//获取指定年份数据
public function getYearData()
{
$Channel = D("PaymentMerchant")->Channel;
$Ways = D("PaymentMerchant")->Ways;
$senddata = array(
"income"=>[
"count"=>['0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00','0.00']
@ -65,10 +58,16 @@ class FinancialSummaryController extends AdminController
//将商户插入到默认数组中
foreach ($merchant_data as $key => $value) {
$identifier = (string)$value['identifier'];
$this->keyname[$identifier] = $value['name'];
}
//其他信息插入默认
foreach ($Channel as $key => $value) {
$this->keyname["c".$key] = $value;
}
foreach ($Ways as $key => $value) {
$this->keyname["w".$key] = $value;
}
$data = [];
//初始化数据
@ -110,7 +109,6 @@ class FinancialSummaryController extends AdminController
$data[$v['key_name']]["money"][((int)$v['count_month']-1)] = $v['sum_money'];
# code...
}
foreach ($senddata as $k => $v) {
foreach ($v as $ke => $va) {
if($ke !='count'){
@ -127,7 +125,6 @@ class FinancialSummaryController extends AdminController
}
ksort($senddata[$k]['count']);
}
$this->assign('data', $senddata);
}
//获取历史年份

@ -21,7 +21,8 @@ class FinancialSummarySetController extends \Think\Controller
//初始化
$this->beginThismonth = mktime(0,0,0,date('m')-1,1,date('Y'));
$this->endThismonth = mktime(0,0,0,date('m'),1,date('Y'))-1;
$temp = strtotime(date('Y-m-01 00:00:00',strtotime('-1 month')));
$temp = strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01');
$this->year= date('Y',$temp);
$this->month= date('m',$temp);
$this->date = $this->year."-".$this->month;
@ -32,7 +33,7 @@ class FinancialSummarySetController extends \Think\Controller
$this->SpendModel = M("Spend",'tab_');
$this->GameSupersignModel = M("GameSupersign",'tab_');
$this->CoinPayOrderModel = M("CoinPayOrder",'tab_');//会长充值平台币表
$this->TestOrderModel = M("TestOrder",'tab_');//测试订单录入
}
/**
@ -52,6 +53,7 @@ class FinancialSummarySetController extends \Think\Controller
$this->month= $tarry[1];
$this->beginThismonth=mktime(0,0,0,$tarry[1],1,$tarry[0]);
$this->endThismonth=mktime(0,0,0,$tarry[1]-0+1,1,$tarry[0])-1;
$this->reCount();
$this->setFinancialSummary();
}
@ -85,16 +87,23 @@ class FinancialSummarySetController extends \Think\Controller
if($countRes > 0){
die("error:Repeated statistics,msg:{$this->date}已经聚合过");
}
//按收入类型
echo "{$this->date}开始统计".PHP_EOL;
echo "--收入类型统计中".PHP_EOL;
$this->setIncomeMoney();
//按合作方类型
echo "--合作方类型统计中".PHP_EOL;
$this->setPromoteMoney();
//支付渠道/支付类型
$this->setPayWayMoney();
//按支付商户
//
echo "--支付渠道统计中".PHP_EOL;
$this->setChannelMoney();
echo "--支付类型统计中".PHP_EOL;
$this->setPaywayMoney();
echo "--支付商户统计中".PHP_EOL;
$this->setMerchantMoney();
//存入数据
echo "--数据保存".PHP_EOL;
$this->addDb();
$t2 = microtime(true);
@ -116,7 +125,7 @@ class FinancialSummarySetController extends \Think\Controller
{
$map = array(
"pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"payed_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"pay_status"=>1
);
$res = $this->SpendModel
@ -145,7 +154,7 @@ class FinancialSummarySetController extends \Think\Controller
"sort"=>3,
);
$map = array(
"create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"payed_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"pay_status"=>1
);
$temparr['sum_money'] = $this->DepositModel->field("IFNULL(sum(pay_amount),0) pay_amount")->where($map)->find()['pay_amount'];
@ -190,7 +199,7 @@ class FinancialSummarySetController extends \Think\Controller
}
//获取现金充值
$map = array(
"pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"payed_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"pay_status"=>1,
"pay_way"=>array("GT",0)
);
@ -201,24 +210,31 @@ class FinancialSummarySetController extends \Think\Controller
->find()['pay_amount'];
//获取平台币充值
$map1 = array(
"create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"payed_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"pay_status"=>1
);
if($testlist) $map1['user_id']=array("in",$testlist);
$deposit = $this->DepositModel->field("IFNULL(sum(pay_amount),0) pay_amount")->where($map1)->find()['pay_amount'];
$temparr['sum_money'] = number_format(($cash_spend*100+$deposit*100)/100, 2, '.', '');
//测试订单录入
$map2 = array(
"pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth))
);
$test_pay_amount = $this->TestOrderModel->where($map2)->field("IFNULL(sum(pay_amount),0) pay_amount")->find()['pay_amount'];
$temparr['sum_money'] = number_format(($cash_spend*100 + $deposit*100 + $test_pay_amount*100 )/100, 2, '.', '');
$this->adddata[]=$temparr;
}
//奖罚收入
protected function getRewardRecordIncome()
{
$map = array(
"reward_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"confirm_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
);
$rrres = M("RewardRecord","tab_")
$rrres = M("RewardDetail","tab_")
->field("
IFNULL(SUM(CASE WHEN reward_type = 1 THEN money ELSE 0 END),0) as reward_count,
IFNULL(SUM(CASE WHEN reward_type = 2 THEN money ELSE 0 END),0) as fine_count
IFNULL(SUM(CASE WHEN type = 1 THEN amount ELSE 0 END),0) as reward_count,
IFNULL(SUM(CASE WHEN type = 2 THEN amount ELSE 0 END),0) as fine_count
")
->where($map)
->find();
@ -242,7 +258,7 @@ class FinancialSummarySetController extends \Think\Controller
public function setPromoteMoney()
{
$map = array(
"pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"payed_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"pay_status"=>1
);
$res = $this->SpendModel
@ -326,159 +342,174 @@ class FinancialSummarySetController extends \Think\Controller
"sum_money"=>number_format($other_group_nobind_count/100, 2, '.', '')
);
}
/**
* 获取类型为4,5的数据/按支付渠道类型,支付类型类型
*/
public function setPayWayMoney()
{
$moneyarry=[
"wx"=>0,
"zfb"=>0,
"gfzfb"=>0,
"sqzfb"=>0,
"sqkj"=>0,
"ybzf"=>0,
];
$this->getSpendPayWay($moneyarry);
$this->getGameSupersignPayWay($moneyarry);
$this->getDepositPayWay($moneyarry);
$this->getCoinPayOrderPayWay($moneyarry);
//统计数据
$moneyarry['zfb'] = ($moneyarry['gfzfb']-0+$moneyarry['sqzfb']);
$this->adddata[] = array(
"key_name"=>'gfwx_count',
"type"=>4,"sort"=>1,
"sum_money"=>number_format($moneyarry['wx']/100, 2, '.', '')
);
$this->adddata[] = array(
"key_name"=>'gfzfb_count',
"type"=>4,"sort"=>2,
"sum_money"=>number_format($moneyarry['gfzfb']/100, 2, '.', '')
);
$this->adddata[] = array(
"key_name"=>'sqzfb_count',
"type"=>4,"sort"=>3,
"sum_money"=>number_format($moneyarry['sqzfb']/100, 2, '.', '')
);
$this->adddata[] = array(
"key_name"=>'sqkj_count',
"type"=>4,"sort"=>4,
"sum_money"=>number_format($moneyarry['sqkj']/100, 2, '.', '')
);
$this->adddata[] = array(
"key_name"=>'wx_count',
"type"=>5,"sort"=>1,
"sum_money"=>number_format($moneyarry['wx']/100, 2, '.', '')
);
$this->adddata[] = array(
"key_name"=>'zfb_count',
"type"=>5,"sort"=>2,
"sum_money"=>number_format($moneyarry['zfb']/100, 2, '.', '')
);
$this->adddata[] = array(
"key_name"=>'kj_count',
"type"=>5,"sort"=>3,
"sum_money"=>number_format($moneyarry['sqkj']/100, 2, '.', '')
);
$this->adddata[] = array(
"key_name"=>'ybzf_count',
"type"=>4,"sort"=>5,
"sum_money"=>number_format($moneyarry['ybzf']/100, 2, '.', '')
);
$this->adddata[] = array(
"key_name"=>'ybzf_count',
"type"=>5,"sort"=>4,
"sum_money"=>number_format($moneyarry['ybzf']/100, 2, '.', '')
);
echo 'success';
public function setChannelMoney(){
$Channel = $this->getChannelCount($Channel);
foreach( $Channel as $k=>$v){
$this->adddata[] = array(
"key_name"=>$k,
"type"=>4,
"sort"=>$k,
"sum_money"=>number_format($v, 2, '.', '')
);
}
}
//获取spend表
protected function getSpendPayWay(&$moneyarry){
//获取Channel
protected function getChannelCount(){
$map = array(
"pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"pay_status"=>1,
"pay_way"=>array("IN","1,2,3,9,15,17")
"s.payed_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"s.pay_status"=>1,
"s.merchant_id"=>["GT","0"]
);
$dbres=$this->SpendModel
->field("
IFNULL(SUM(CASE WHEN pay_way = 2 THEN pay_amount ELSE 0 END),0) as wxsm_count,
IFNULL(SUM(CASE WHEN pay_way = 3 THEN pay_amount ELSE 0 END),0) as wxapp_count,
IFNULL(SUM(CASE WHEN pay_way = 1 THEN pay_amount ELSE 0 END),0) as zfbgf_count,
IFNULL(SUM(CASE WHEN pay_way = 9 THEN pay_amount ELSE 0 END),0) as zfbsq_count,
IFNULL(SUM(CASE WHEN pay_way = 15 THEN pay_amount ELSE 0 END),0) as kjsq_count,
IFNULL(SUM(CASE WHEN pay_way = 17 THEN pay_amount ELSE 0 END),0) as ybzf_count
")
$spres=$this->SpendModel
->alias("s")
->field("SUM(s.pay_amount) pay_amount,p.channel")
->where($map)
->find();
$moneyarry['wx'] += ($dbres['wxsm_count']*100+$dbres['wxapp_count']*100);
$moneyarry['gfzfb'] += $dbres['zfbgf_count']*100;
$moneyarry['sqzfb'] += $dbres['zfbsq_count']*100;
$moneyarry['sqkj'] += $dbres['kjsq_count']*100;
$moneyarry['ybzf'] += $dbres['ybzf_count']*100;
->group("p.channel")
->join("left join tab_payment_merchant p ON p.id = s.merchant_id")
->select();
//超级签
$ss_map = [
"s.pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"s.pay_status"=>1
];
$ssres=$this->GameSupersignModel
->alias("s")
->field("SUM(s.pay_price) pay_amount,p.channel")
->join("left join tab_payment_merchant p ON p.id = s.merchant_id")
->group("p.channel")
->where($ss_map)
->select();
//玩家购买平台币
$dp_map =[
"s.payed_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"s.pay_status"=>1
];
$dpres=$this->DepositModel
->alias("s")
->field("SUM(s.pay_amount) pay_amount,p.channel")
->join("left join tab_payment_merchant p ON p.id = s.merchant_id")
->group("p.channel")
->where($dp_map)
->select();
//会长充值平台币
$co_map =[
"s.pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"s.order_status"=>array("EGT",1)
];
$cores=$this->CoinPayOrderModel
->alias("s")
->field("SUM(s.pay_amount) pay_amount,p.channel")
->join("left join tab_payment_merchant p ON p.id = s.merchant_id")
->group("p.channel")
->where($co_map)
->select();
//测试的订单
$to_map =[
"s.pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"s.merchant_id"=>["GT","0"]
];
$tores=$this->TestOrderModel
->alias("s")
->field("SUM(s.pay_amount) pay_amount,p.channel")
->join("left join tab_payment_merchant p ON p.id = s.merchant_id")
->group("p.channel")
->where($to_map)
->select();
$dbres = array_merge($spres,$ssres,$dpres,$cores,$tores);
$Channel = [];
foreach ($dbres as $k=>$v){
$Channel["c".$v['channel']] += $v['pay_amount'];
}
return $Channel;
}
//获取超级签购买
protected function getGameSupersignPayWay(&$moneyarry)
{
$map = array(
"pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"pay_status"=>1
);
$dbres=$this->GameSupersignModel
->field("
IFNULL(SUM(CASE WHEN pay_way = 2 THEN pay_price ELSE 0 END),0) as wx_count,
IFNULL(SUM(CASE WHEN pay_way = 1 THEN pay_price ELSE 0 END),0) as zfb_count,
IFNULL(SUM(CASE WHEN pay_way = 17 THEN pay_price ELSE 0 END),0) as ybzf_count
")
->where($map)
->find();
$moneyarry['wx'] += $dbres['wx_count']*100;
$moneyarry['gfzfb'] += $dbres['zfb_count']*100;
$moneyarry['ybzf'] += $dbres['ybzf_count']*100;
public function setPaywayMoney(){
$Ways = $this->getPaywayCount();
foreach($Ways as $k=>$v){
$this->adddata[] = array(
"key_name"=>$k,
"type"=>5,
"sort"=>$k,
"sum_money"=>number_format($v, 2, '.', '')
);
}
}
//玩家购买平台币
protected function getDepositPayWay(&$moneyarry)
{
//获取Channel
protected function getPaywayCount(){
$map = array(
"create_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"pay_status"=>1,
"pay_way"=>array("IN","1,2,3,9,15,17")
"s.payed_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"s.pay_status"=>1,
"s.merchant_id"=>["GT","0"]
);
$dbres=$this->DepositModel
->field("
IFNULL(SUM(CASE WHEN pay_way = 2 THEN pay_amount ELSE 0 END),0) as wxsm_count,
IFNULL(SUM(CASE WHEN pay_way = 3 THEN pay_amount ELSE 0 END),0) as wxapp_count,
IFNULL(SUM(CASE WHEN pay_way = 1 THEN pay_amount ELSE 0 END),0) as zfbgf_count,
IFNULL(SUM(CASE WHEN pay_way = 9 THEN pay_amount ELSE 0 END),0) as zfbsq_count,
IFNULL(SUM(CASE WHEN pay_way = 15 THEN pay_amount ELSE 0 END),0) as kjsq_count,
IFNULL(SUM(CASE WHEN pay_way = 17 THEN pay_amount ELSE 0 END),0) as ybzf_count
")
$spres=$this->SpendModel
->alias("s")
->field("SUM(s.pay_amount) pay_amount,s.merchant_way")
->where($map)
->find();
$moneyarry['wx'] += ($dbres['wxsm_count']*100+$dbres['wxapp_count']*100);
$moneyarry['gfzfb'] += $dbres['zfbgf_count']*100;
$moneyarry['sqzfb'] += $dbres['zfbsq_count']*100;
$moneyarry['sqkj'] += $dbres['kjsq_count']*100;
$moneyarry['ybzf'] += $dbres['ybzf_count']*100;
}
//会长充值平台币
protected function getCoinPayOrderPayWay(&$moneyarry)
{
$map= array(
"pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"order_status"=>array("EGT",1)
);
$dbres= $this->CoinPayOrderModel
->field("
IFNULL(SUM(CASE WHEN pay_way = 2 THEN pay_amount ELSE 0 END),0) as wx_count,
IFNULL(SUM(CASE WHEN pay_way = 1 THEN pay_amount ELSE 0 END),0) as zfb_count,
IFNULL(SUM(CASE WHEN pay_way = 17 THEN pay_amount ELSE 0 END),0) as ybzf_count
")
->where($map)
->find();
$moneyarry['wx'] += $dbres['wx_count']*100;
$moneyarry['gfzfb'] += $dbres['zfb_count']*100;
$moneyarry['ybzf'] += $dbres['ybzf_count']*100;
->group("s.merchant_way")
->select();
//超级签
$ss_map = [
"s.pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"s.pay_status"=>1
];
$ssres=$this->GameSupersignModel
->alias("s")
->field("SUM(s.pay_price) pay_amount,s.merchant_way")
->group("s.merchant_way")
->where($ss_map)
->select();
//玩家购买平台币
$dp_map =[
"s.payed_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"s.pay_status"=>1
];
$dpres=$this->DepositModel
->alias("s")
->field("SUM(s.pay_amount) pay_amount,s.merchant_way")
->group("s.merchant_way")
->where($dp_map)
->select();
//会长充值平台币
$co_map =[
"s.pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"s.order_status"=>array("EGT",1)
];
$cores=$this->CoinPayOrderModel
->alias("s")
->field("SUM(s.pay_amount) pay_amount,s.merchant_way")
->group("s.merchant_way")
->where($co_map)
->select();
//测试的订单
$to_map =[
"s.pay_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"s.merchant_id"=>["GT","0"]
];
$tores=$this->TestOrderModel
->alias("s")
->field("SUM(s.pay_amount) pay_amount,s.merchant_way")
->group("s.merchant_way")
->where($to_map)
->select();
$dbres = array_merge($spres,$ssres,$dpres,$cores,$tores);
$Ways = [];
foreach ($dbres as $k=>$v){
$Ways["w".$v['merchant_way']] += $v['pay_amount'];
}
return $Ways;
}
public function addDb()
{
foreach ($this->adddata as $k=> &$v) {
@ -513,13 +544,13 @@ class FinancialSummarySetController extends \Think\Controller
->select(false);
//平台币充值金额计算
$coinData = M('pay_info','tab_')
->join("inner join tab_deposit on tab_pay_info.order_id=tab_deposit.pay_order_number")
->join("left join tab_test_white_list on tab_test_white_list.user_id=tab_pay_info.user_id")
$coinData = M('deposit','tab_')
// ->join("inner join tab_deposit on tab_pay_info.order_id=tab_deposit.pay_order_number")
->join("left join tab_test_white_list on tab_test_white_list.user_id=tab_deposit.user_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 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=0 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")
->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,
0 offcial_amount,0 spread_amount,0 supersign_amount,0 test_order_amount,merchant_id,name,channel,identifier,payed_time,0 game_id,main_name,merchant_way,merchant.account")
->where(['pay_status'=>1,'tab_deposit.pay_way'=>['egt',1],'merchant.status'=>1,'merchant.type'=>1])
->where($map)
->group("merchant_id")
@ -528,8 +559,8 @@ class FinancialSummarySetController extends \Think\Controller
$officalData = M('deposit','tab_')
->join("left join tab_test_white_list on tab_test_white_list.user_id=tab_deposit.user_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 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=2 THEN pay_amount ELSE 0 END) as offcial_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 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")
->where(['pay_status'=>1,'tab_deposit.pay_way'=>['egt',1],'merchant.status'=>1,'merchant.type'=>1])
->where($map)

@ -351,6 +351,14 @@ class MarketPercentageController extends ThinkController
$data[$key]['wait_commission'] = substr(number_format($value['wait_performance_commission'] + $value['wait_achievement_commission'], 4, '.', ''),0,-2);
$data[$key]['extend_commission'] = $data[$key]['commission'] - $data[$key]['wait_commission'];
//两个起提流水都没达到时,不展示税后毛利
$sum_amount = $value['performance_revenue'] + $value['appraisal_bonuses'];
if ($sum_amount<$market_percentage['performance_revenue']&&$sum_amount<$market_percentage['appraisal_bonuses']) {
$data[$key]['company_profit'] = "0.00";
$value['company_profit'] = "0.00";
}
if ($market_percentage['time'] == 1) {
if ($month == '07') {
@ -461,9 +469,11 @@ class MarketPercentageController extends ThinkController
$sum['achievement_bonus'] += $data[$key]['achievement_bonus'];
$sum['commission'] += $data[$key]['commission'];
$sum['extend_commission'] += $data[$key]['extend_commission'];
$sum['company_profit'] += $data[$key]['company_profit'];
}
$sum['wait_commission'] = '-------';
$sum['pay_time'] = '总计';
if ($_REQUEST['export']) {
@ -487,8 +497,31 @@ class MarketPercentageController extends ThinkController
$line = $key+2;
// $develop_commission_ratio = $value['develop_commission_ratio']/100;
$data[$key]['pay_time'] = '`'.$data[$key]['pay_time'];
$data[$key]['performance_commission'] = "=ROUND(J{$line}*(F{$line}/100)+J{$line}*(G{$line}/100),2)";
$data[$key]['achievement_bonus'] = "=ROUND(J{$line}*(H{$line}/100)+J{$line}*(I{$line}/100),2)";
$data[$key]['performance_commission'] = "=ROUND(";
$data[$key]['achievement_bonus'] = "=ROUND(";
if ($value['performance_revenue'] != "0.00") {
$data[$key]['performance_commission'] .= "J{$line}*(F{$line}/100)";
$data[$key]['achievement_bonus'] .= "J{$line}*(H{$line}/100)";
}
if ($value['appraisal_bonuses'] != "0.00") {
if ($data[$key]['performance_commission'] == "=ROUND(") {
$data[$key]['performance_commission'] .= "J{$line}*(G{$line}/100),2)";
} else {
$data[$key]['performance_commission'] .= "+J{$line}*(G{$line}/100),2)";
}
if ($data[$key]['achievement_bonus'] == "=ROUND(") {
$data[$key]['achievement_bonus'] .= "J{$line}*(I{$line}/100),2)";
} else {
$data[$key]['achievement_bonus'] .= "+J{$line}*(I{$line}/100),2)";
}
} else {
$data[$key]['performance_commission'] .= ",2)";
$data[$key]['achievement_bonus'] .= ",2)";
}
// $data[$key]['performance_commission'] = "=ROUND(J{$line}*(F{$line}/100)+J{$line}*(G{$line}/100),2)";
// $data[$key]['achievement_bonus'] = "=ROUND(J{$line}*(H{$line}/100)+J{$line}*(I{$line}/100),2)";
$data[$key]['commission'] = "=ROUND(K{$line}+L{$line},2)";
}

@ -1010,6 +1010,18 @@ class TimingController extends AdminController {
$sum_amount = $value['performance_revenue'] + $value['appraisal_bonuses'];
$market_percentage = json_decode($value['market_percentage'],true);//业绩提成
if ($value['performance_revenue']=='0.00') {
$market_percentage['develop_commission_ratio'] = 0;
$market_percentage['appraisal_bonuses_ratio'] = 0;
}
if ($value['appraisal_bonuses']=='0.00') {
$market_percentage['maintain_commission_ratio'] = 0;
$market_percentage['maintain_appraisal_bonuses_ratio'] = 0;
}
// echo "{$value['nickname']}:{$value['pay_time']}\n";
// dump($market_percentage);
$all_data[$key]['performance_commission'] =
number_format($value['company_profit']*($market_percentage['develop_commission_ratio']/100) +
$value['company_profit']*($market_percentage['maintain_commission_ratio']/100), 2, '.', '');

@ -0,0 +1,23 @@
<?php
namespace Admin\Model;
use Think\Model;
class PaymentMerchantModel extends Model
{
protected $tablePrefix = 'tab_';
public $Ways=[
"1"=>"支付宝",
"2"=>"微信",
"4"=>"快捷支付"
];
public $Channel=[
"1"=>"支付宝",
"2"=>"微信",
"3"=>"易宝支付",
"4"=>"双乾支付",
"5"=>"汇付宝支付"
];
}

@ -174,7 +174,7 @@
</tbody>
</table>
<table style="margin-top: 30px;">
<caption class="" style="text-align: left;font-size: 20px;font-weight: 600;">照支付类型</caption>
<caption class="" style="text-align: left;font-size: 20px;font-weight: 600;">支付渠道</caption>
<thead>
<tr>
<th>序号</th><th>流水类型</th><th>1月</th><th>2月</th><th>3月</th><th>4月</th><th>5月</th><th>6月</th><th>7月</th><th>8月</th><th>9月</th><th>10月</th><th>11月</th><th>12月</th><th>年度合计</th>
@ -199,7 +199,7 @@
</tbody>
</table>
<table style="margin-top: 30px;">
<caption class="" style="text-align: left;font-size: 20px;font-weight: 600;">支付类型类型</caption>
<caption class="" style="text-align: left;font-size: 20px;font-weight: 600;">支付类型</caption>
<thead>
<tr>
<th>序号</th><th>流水类型</th><th>1月</th><th>2月</th><th>3月</th><th>4月</th><th>5月</th><th>6月</th><th>7月</th><th>8月</th><th>9月</th><th>10月</th><th>11月</th><th>12月</th><th>年度合计</th>
@ -224,7 +224,7 @@
</tbody>
</table>
<table style="margin-top: 30px;">
<caption class="" style="text-align: left;font-size: 20px;font-weight: 600;">支付商户类型</caption>
<caption class="" style="text-align: left;font-size: 20px;font-weight: 600;">支付商户</caption>
<thead>
<tr>
<th>序号</th><th>流水类型</th><th>1月</th><th>2月</th><th>3月</th><th>4月</th><th>5月</th><th>6月</th><th>7月</th><th>8月</th><th>9月</th><th>10月</th><th>11月</th><th>12月</th><th>年度合计</th>

@ -8,7 +8,7 @@
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">新增推广员</h3>
<h3 class="page_title">新增会长</h3>
<p class="description_text">说明:此功是创建推广员时所需填写信息</p>
</div>

@ -385,25 +385,27 @@
<td>{$statemnt_info[0]['fine']|default="0"}</td>
<td>{$statemnt_info[0]['sum_money']|default="0"}</td>
<td>
<a href="javascript:;" class="apply" data-id="{$s.id}">查看详情</a>
<a href="javascript:;" class="apply" data-company="{$data['company_id']}" data-id="{$statemnt_info[0]['relation_game_id']}" data-start="{$data['statement_begin_time']}" data-end="{$data['statement_end_time']}">查看详情</a>
</td>
</tr>
<volist name="statemnt_info" id="s" index="key">
<if condition="$key egt 1">
<td>{$s['game_name']}</td>
<td>{$s['game_type']}</td>
<td>{$s['statement_begin_time']|default="无"}-{$statemnt_info[0]['statement_end_time']|default="无"}</td>
<td>{$s['pay_amount']|default="0"}</td>
<td>{$s['ratio']|default="0"}</td>
<td>{$s['increment_ratio']|default="0"}</td>
<td>{$s['reward']|default="0"}</td>
<td>{$s['fine']|default="0"}</td>
<td>{$s['sum_money']|default="0"}</td>
<td>
<a href="javascript:;" class="apply" data-id="{$s.id}">查看详情</a>
</td>
<tr >
<td>{$s['game_name']}</td>
<td>{$s['game_type']}</td>
<td>{$s['statement_begin_time']|default="无"}-{$statemnt_info[0]['statement_end_time']|default="无"}</td>
<td>{$s['pay_amount']|default="0"}</td>
<td>{$s['ratio']|default="0"}</td>
<td>{$s['increment_ratio']|default="0"}</td>
<td>{$s['reward']|default="0"}</td>
<td>{$s['fine']|default="0"}</td>
<td>{$s['sum_money']|default="0"}</td>
<td>
<a href="javascript:;" class="apply" data-company="{$data['company_id']}" data-id="{$s['relation_game_id']}" data-start="{$s['statement_begin_time']}" data-end="{$s['statement_end_time']}">查看详情</a>
</td>
</tr>
</if>
</volist>

@ -258,9 +258,7 @@ class ExcelPaymentController extends BaseController
$val['ratio'] = $val['ratio']*100;
$val['increment_ratio'] = $val['increment_ratio']*100;
if($is_export){
//J3*(K3+L3)+M3-N3
$val['sum_money'] = "=J{$line}*(K{$line}+L{$line})+M{$line}-N{$line}";
// $val['sum_money'] = "=J{$line}*(K{$line}+L{$line})+M{$line}-N{$line}";
}else{
$count['platform_amount'] += $val['pay_amount'];
$count['sum_money'] += $val['sum_money'];
@ -309,12 +307,16 @@ class ExcelPaymentController extends BaseController
}
public function getAccountMoney(){
Vendor("Alipay2020/Fund");
$fund = new \Fund();
$money = $fund->account();
if($money !== -1){
$money = $money['amount'];
if(empty(C("ALI_PAYMENT"))){
$money = "测试站无法查看";
}else{
$money = "--";
$fund = new \Fund(C("ALI_PAYMENT"));
$money = $fund->account();
if($money !== -1){
$money = $money['amount'];
}else{
$money = "--";
}
}
$this->assign("money",$money);
}
@ -333,41 +335,44 @@ class ExcelPaymentController extends BaseController
{
$id = $_REQUEST['id'];
$remark = $_REQUEST['remark'];
if (empty(C("ALI_PAYMENT"))) {
$this->ajaxReturn(["success"=>"配置错误,无法打款","data"=>[]]);
}
Vendor("Alipay2020/Fund");
$fund = new \Fund();
$dbres = M("ExcelStatementInfo","tab_")->where("id='{$id}'")->find();
$company_info = json_decode($dbres['company_info'],true);
$fund = new \Fund(C("ALI_PAYMENT"));
$dbres = M("ExcelStatementInfo", "tab_")->where("id='{$id}'")->find();
$company_info = json_decode($dbres['company_info'], true);
if($dbres['pay_status'] != 1){
if ($dbres['pay_status'] != 1) {
//执行打款
$title = $remark;
$amount = $dbres['statement_money'];
$payres = $fund->transfer($company_info['ali_account'],$company_info['ali_user'],$dbres['statement_num'],$amount, $title);
$payres = $fund->transfer($company_info['ali_account'], $company_info['ali_user'], $dbres['statement_num'], $amount, $title);
$resultCode = $payres->code;
$savedata = ["id"=>$dbres['id']];
if(!empty($resultCode)&&$resultCode == 10000){
if (!empty($resultCode)&&$resultCode == 10000) {
$savedata["pay_status"]=1;
} else {
$savedata["pay_status"]=-1;
}
$payres = json_decode( json_encode($payres),true);
$payres = json_decode(json_encode($payres), true);
$payres["remark"] = $remark;
$savedata["pay_info"] = json_encode($payres,JSON_UNESCAPED_UNICODE);
$savedata["pay_info"] = json_encode($payres, JSON_UNESCAPED_UNICODE);
$savedata["pay_time"]=time();
$pu = [
"mobile"=>$this->admininfo['mobile'],
"real_name"=>$this->admininfo['real_name'],
"time"=>date("Y-m-d H:i:s")
];
$savedata['payment_user'] = json_encode($pu,JSON_UNESCAPED_UNICODE);
$savedata['payment_user'] = json_encode($pu, JSON_UNESCAPED_UNICODE);
}
M("ExcelStatementInfo","tab_")->save($savedata);
M("ExcelStatementInfo", "tab_")->save($savedata);
$this->ajaxReturn(["success"=>"打款成功","data"=>[]]);
}
/**
* 打款详情

@ -406,13 +406,18 @@ class PaymentController extends BaseController
}
public function getAccountMoney(){
Vendor("Alipay2020/Fund");
$fund = new \Fund();
$money = $fund->account();
if($money !== -1){
$money = $money['amount'];
if(empty(C("ALI_PAYMENT"))){
$money = "测试站无法查看";
}else{
$money = "--";
$fund = new \Fund(C("ALI_PAYMENT"));
$money = $fund->account();
if($money !== -1){
$money = $money['amount'];
}else{
$money = "--";
}
}
$this->assign("money",$money);
}
//以下打款流程
@ -430,39 +435,34 @@ class PaymentController extends BaseController
{
$id = $_REQUEST['id'];
$remark = $_REQUEST['remark'];
if(empty(C("ALI_PAYMENT"))){
$this->ajaxReturn(["success"=>"配置错误,无法打款","data"=>[]]);
}
Vendor("Alipay2020/Fund");
$fund = new \Fund();
$dbres = M("company_statement_info","tab_")->where("id='{$id}'")->find();
$company_info = json_decode($dbres['company_info'],true);
if($dbres['pay_status'] != 1 && $dbres['verify_status'] == 1){
$fund = new \Fund(C("ALI_PAYMENT"));
$dbres = M("company_statement_info", "tab_")->where("id='{$id}'")->find();
$company_info = json_decode($dbres['company_info'], true);
if ($dbres['pay_status'] != 1 && $dbres['verify_status'] == 1) {
//执行打款
$title = "信息服务费";
$amount = $dbres['statement_money'];
$payres = $fund->transfer($company_info['ali_account'],$company_info['ali_user'],$dbres['statement_num'],$amount, $title);
$payres = $fund->transfer($company_info['ali_account'], $company_info['ali_user'], $dbres['statement_num'], $amount, $title);
$resultCode = $payres->code;
$savedata = ["id"=>$dbres['id']];
if(!empty($resultCode)&&$resultCode == 10000){
if (!empty($resultCode)&&$resultCode == 10000) {
$savedata["pay_status"]=1;
} else {
$savedata["pay_status"]=-1;
}
$payres = json_decode( json_encode($payres),true);
$payres = json_decode(json_encode($payres), true);
$payres["remark"] = $remark;
$savedata["pay_info"] = json_encode($payres,JSON_UNESCAPED_UNICODE);
$savedata["pay_info"] = json_encode($payres, JSON_UNESCAPED_UNICODE);
$savedata["pay_type"]=2;
$savedata["pay_time"]=time();
}
M("company_statement_info","tab_")->save($savedata);
$this->ajaxReturn(["success"=>"打款成功","data"=>[]]);
# code...
}
/**
* 执行最后聚合表统计

@ -6,14 +6,25 @@ require_once "aop/request/AlipayFundTransOrderQueryRequest.php";
require_once "aop/request/AlipayFundAccountQueryRequest.php";
class Fund {
private $appCertPath = __DIR__ . "/cert/appCertPublicKey_2021001150621489.crt";
private $alipayCertPath = __DIR__ . "/cert/alipayCertPublicKey_RSA2.crt";
private $rootCertPath = __DIR__ . "/cert/alipayRootCert.crt";
private $gatewayUrl = "https://openapi.alipay.com/gateway.do";
private $appId = "2021001150621489";
private $alipayUserId = '2088731986604211'; // pid
private $rsaPrivateKey = 'MIIEogIBAAKCAQEAokaztliXge4pDoNWVVdYNSq6N+Be7xNU2LBKANhhdPfSny1VdCBgn7bbuSXA38ubkVZ8xZ/oFcPHa0LMZ5Ki9hRntU+Ry7vJN5kKwqP1CX8rCVWj2Jx2IuTUNdFA1TzCSLV1UMNvIIkFTFnkJUR++YWoQ2EBDYuQsccSbveZ4U5bHf4xopNhQ42a3lwVyuJaBC3q/m4pLVkBIxupP7HSgc3M/ZP0EBHRoq65wHrRsW70A3JPYCmKaw+9W0qeM2fmSXjhU0U7TS1QyyWLwaYgkFZySFscGYVgG6L1dzdVkSbQxlcp/3kEBQXnwTgdODBCdoNrDBZyIteMOlzfZ2MK/QIDAQABAoIBACkqSFJ8fMqgENg2pwL1KlIqaZzdFRgOzlo9tjgqq+ZRK6PniyLvR7OcXnbERf4/l1IyH2q+mtBSntbt1g58G0zTdk9/RNvq4itxblJb50Ame1Nd3zeG0U0ewVp5n7m4NQzew0jemuUk/SwWLZLqok9IAZw+EldOTUFb36g4tVd68Z6uJ5fpUhzMI/HZrFq2wYnH4SwhFJQbHVGadPzB4yWD4jvT4zaAZI1MeXugDjnpRYLIqd5r+fJv2mRbRgDBb2fWW7R+5xaMsZATARkFoXhy0CbZu3fOEELiKPfgxMy4MgqEmJwE7hSg8hD8z63wC03nY2JY5IOY3DdzFZRQo6ECgYEA6sQUO933kW8hHVy0VcI0aLp5LUykl05BEb5MSvKB61ghxZzQDREQNsMlkIggL1ENSW2cNS12yqxeEPdEx89ekJ2gLocOtho5Ufg49rj0wK/fp55Xu412SF06NSSLk636C0j1dK3CP+T3JSH2cBLpqJK9n9moLo2kODDibm2JhEkCgYEAsPQmElDYFMhNIKNmNgLfXimUDPswKLpHyYCfiBMHaArAV+LB6lDynxTsBdFEqbTpXeZiGG0HtlR+YjaCj0ujdKoMaeNY+SCZ+VxsioBAP+SWIj2UKg8Xi6YqW9zQnGZis17CeHCAq27OHz69m8udVk55OlzhTuyI9lEnVc6PqRUCgYAELxptNreC0Ag3Db/pB10HwMsIE6WbTLm8JzgU3d2S5C815mWO1g8D6tZwjPyF21vxQxLVn8nOMuQ6SS3gocF9slF4gs+wTydWXqYlP4adKIVD536IySyifYbcC5qxNxiNuu8k9TPRD7OX5dMOjEe9yV+3yZlFuyCCH9zpOuqIgQKBgHu8/rJoHfHKb0SXfm3ebFvoL0M0k2SnfnOFogkBZXh3rDDIvFkh6cccVj9rKtyRSW8EHyx9cZsqUoZTH9EcT1zRXITfGeR7y6/31V60eDk1m1auQOF4VDqvI4fBTY9QeUx8wvh9kzxN640lzmkXZRppHZSWRmduOAgmj58NJqBRAoGAY0qXaL0nDAehVpoxVUDmFdPuallq9oEz5z5Q29A0IXm/dHkbbHEtEdE/MU9WPn3yOIwwGkF21q3cormt4oyi2ro4OlFSKmpQzMtg/I5Tj5XbOz13FYA60IhjYwqZ2pW/l8oEg6ZAIo2vNSjqJudQS/16Q8xu8Gxzl9E9e3LZBeE=';
public $appCertPath = __DIR__ . "/cert/appCertPublicKey_2021001150621489.crt";
public $alipayCertPath = __DIR__ . "/cert/alipayCertPublicKey_RSA2.crt";
public $rootCertPath = __DIR__ . "/cert/alipayRootCert.crt";
public $gatewayUrl = "https://openapi.alipay.com/gateway.do";
public $appId = "";
public $alipayUserId = ''; // pid
public $rsaPrivateKey = '';
public $is_init = false;
public function __construct($config)
{
if(empty($config)){
return false;
}
$this->appId = $config['appId'];
$this->alipayUserId = $config['alipayUserId'];
$this->rsaPrivateKey = $config['rsaPrivateKey'];
$this->is_init = true;
}
public function transfer($aliAccount, $realName, $orderId, $amount, $title='') {
$aop = new AopCertClient ();

Loading…
Cancel
Save