Merge branch 'feature/add_item_other' of wmtx/platform into master

市场业绩重算只重算上个月提交
master
廖金灵 4 years ago committed by Gogs
commit 22f8e85b1d

@ -841,7 +841,8 @@ class TimingController extends AdminController {
public function test() { public function test() {
// $this->getSpecialComplement(strtotime(date("Y-m-1",strtotime("2020-07"))),strtotime(date("Y-m-t",strtotime("2020-07")))+86399,2259); // $this->getSpecialComplement(strtotime(date("Y-m-1",strtotime("2020-07"))),strtotime(date("Y-m-t",strtotime("2020-07")))+86399,2259);
dump(D("CompanyGameRatio")->getPromoteCompanyGameRatio(64,(string)211,1596211200,1598889599,1)); // dump(D("CompanyGameRatio")->getPromoteCompanyGameRatio(64,(string)211,1596211200,1598889599,1));
$this->createMarketBonus("all");
} }
@ -990,10 +991,12 @@ class TimingController extends AdminController {
$belong_map = []; $belong_map = [];
$month_time[] = date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01')); $month_time[] = date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01'));
$month_time[] = date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-2).'-01')); // $month_time[] = date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-2).'-01'));
$map['pay_time'] = ['in',$month_time]; $map['pay_time'] = ['in',$month_time];
$spend_map['pay_time'] = ['elt',strtotime(date('Y-m-t 23:59:59', strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01')))]; $spend_map['pay_time'] = ['elt',strtotime(date('Y-m-t 23:59:59', strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01')))];
$time_end = strtotime(date('Y-m-t',strtotime($month_time)));
} else { } else {
$month_time = $map['pay_time']; $month_time = $map['pay_time'];
$time_start = strtotime(date('Y-m-1',strtotime($map['pay_time']))); $time_start = strtotime(date('Y-m-1',strtotime($map['pay_time'])));
@ -1038,6 +1041,11 @@ class TimingController extends AdminController {
} }
} }
if (!$value['end_time']) {
$value['end_time'] = $time_end;
}
$value['game_ids'] = implode(',',$value['game_ids']); $value['game_ids'] = implode(',',$value['game_ids']);
if (!$spend_map['_string']) { if (!$spend_map['_string']) {
@ -1169,7 +1177,7 @@ class TimingController extends AdminController {
->join("left join tab_promote_company company on promote.company_id = company.id") ->join("left join tab_promote_company company on promote.company_id = company.id")
->join("left join ({$data}) auth on auth.uid=market_admin_id") ->join("left join ({$data}) auth on auth.uid=market_admin_id")
->where(['develop_type'=>['egt',1],'group_id'=>['in',['11','12','21']]]) ->where(['develop_type'=>['egt',1],'group_id'=>['in',['11','12','21']]])
// ->where(['company_id'=>313,'spend.promote_id'=>4359,'relation_game_id'=>191]) // ->where(['company_id'=>278,'spend.promote_id'=>3917,'relation_game_id'=>213])
// ->order("is_settlement ASC") // ->order("is_settlement ASC")
->select(); ->select();
@ -1243,7 +1251,7 @@ class TimingController extends AdminController {
} elseif($value['is_settlement'] == '1') { } elseif($value['is_settlement'] == '1') {
if ($ck == 0) { if ($ck == 0) {
// echo 1;
if ($cv['begin_time'] >= $begin_pay_time) { if ($cv['begin_time'] >= $begin_pay_time) {
$promote_data[$key]['promote_amount'] += $this->getCompanyGameRadio($value['admin_id'],$value['promote_id'],$value['company_id'],$value['relation_game_id'],$begin_pay_time,$cv['begin_time']-1,$value['pay_amount']); $promote_data[$key]['promote_amount'] += $this->getCompanyGameRadio($value['admin_id'],$value['promote_id'],$value['company_id'],$value['relation_game_id'],$begin_pay_time,$cv['begin_time']-1,$value['pay_amount']);
@ -1255,15 +1263,17 @@ class TimingController extends AdminController {
if (!$company_belong_game[$ck+1]) { if (!$company_belong_game[$ck+1]) {
// dump($end_pay_time);
// dump($cv['end_time']);
if ($end_pay_time > $cv['end_time']) { if ($end_pay_time > $cv['end_time']) {
// echo 2;
$promote_data[$key]['promote_amount'] += $this->getCompanyGameRadio($value['admin_id'],$value['promote_id'],$value['company_id'],$value['relation_game_id'],$cv['end_time']+86400,$end_pay_time,$value['pay_amount']); $promote_data[$key]['promote_amount'] += $this->getCompanyGameRadio($value['admin_id'],$value['promote_id'],$value['company_id'],$value['relation_game_id'],$cv['end_time']+86400,$end_pay_time,$value['pay_amount']);
} }
} }
if ($ck > 1) { if ($ck > 1) {
// echo 3;
if (($cv['begin_time'] - $company_belong_game[$ck-1]['end_time'] + 86399) > 1) { if (($cv['begin_time'] - $company_belong_game[$ck-1]['end_time'] + 86399) > 1) {
$promote_data[$key]['promote_amount'] += $this->getCompanyGameRadio($value['admin_id'],$value['promote_id'],$value['company_id'],$value['relation_game_id'],$company_belong_game[$ck-1]['end_time'] + 86400,$cv['begin_time']-1,$value['pay_amount']); $promote_data[$key]['promote_amount'] += $this->getCompanyGameRadio($value['admin_id'],$value['promote_id'],$value['company_id'],$value['relation_game_id'],$company_belong_game[$ck-1]['end_time'] + 86400,$cv['begin_time']-1,$value['pay_amount']);
@ -1271,12 +1281,17 @@ class TimingController extends AdminController {
} }
if (!in_array($value['relation_game_id'],$ungame_ids)) { if (!in_array($value['relation_game_id'],$ungame_ids)) {
// echo 4;
if (($cv['end_time']+86399) > $end_pay_time) { if (($cv['end_time']+86399) > $end_pay_time) {
$cv['end_time'] = $end_pay_time; $cv['end_time'] = $end_pay_time;
} else { } else {
$cv['end_time'] = $cv['end_time']+86399; $cv['end_time'] = $cv['end_time']+86399;
} }
if ($cv['begin_time'] < $begin_pay_time) {
$cv['begin_time'] = $begin_pay_time;
}
// dump($promote_data[$key]['promote_amount']); // dump($promote_data[$key]['promote_amount']);
// dump(date($cv['begin_time'])."-".date($cv['end_time'])); // dump(date($cv['begin_time'])."-".date($cv['end_time']));
$promote_data[$key]['promote_amount'] += $this->getCompanyGameRadio($value['admin_id'],$value['promote_id'],$value['company_id'],$value['relation_game_id'],$cv['begin_time'],$cv['end_time'],$value['pay_amount']); $promote_data[$key]['promote_amount'] += $this->getCompanyGameRadio($value['admin_id'],$value['promote_id'],$value['company_id'],$value['relation_game_id'],$cv['begin_time'],$cv['end_time'],$value['pay_amount']);
@ -1430,11 +1445,12 @@ class TimingController extends AdminController {
$pay_time = date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01')); $pay_time = date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01'));
$map['pay_time'] = date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01')); $map['pay_time'] = date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01'));
} }
// dump(date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01')));die();
if ($pay_time == 'all') { if ($pay_time == 'all') {
$end = date("Y-m",time()); $end = date("Y-m",time());
$start = '2019-08'; $start = date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01'));
$i = 0; $i = 0;
do { do {
$date = date('Y-m', strtotime($start . ' + ' . $i . ' month')); $date = date('Y-m', strtotime($start . ' + ' . $i . ' month'));
@ -1443,8 +1459,8 @@ class TimingController extends AdminController {
$this->insertAllUserBonus($date); $this->insertAllUserBonus($date);
} while ($date < date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01'))); } while ($date < date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01')));
// $map['pay_time'] = []; $map['pay_time'] = date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01'));;
unset($map['pay_time']); // unset($map['pay_time']);
} else{ } else{
M("market_altogether","tab_")->where(['pay_time'=>$pay_time])->delete(); M("market_altogether","tab_")->where(['pay_time'=>$pay_time])->delete();
$this->insertAllUserBonus($pay_time); $this->insertAllUserBonus($pay_time);
@ -1484,7 +1500,7 @@ class TimingController extends AdminController {
// dump($market_percentage); // dump($market_percentage);
$settleup_marketorder = M("settleup_marketorder","tab_") $settleup_marketorder = M("settleup_marketorder","tab_")
->where(['admin_id'=>$value['admin_id'],'pay_time'=>$value['pay_time']]) ->where(['admin_id'=>$value['admin_id'],'pay_time'=>$value['pay_time'],'is_settlement'=>1])
->select(); ->select();
$all_data[$key]['performance_commission'] = 0; $all_data[$key]['performance_commission'] = 0;

Loading…
Cancel
Save