Merge branch 'release' of 47.111.118.107:wmtx/platform into feature/testing_resource_admin

master
ELF
commit f490f10ee5

@ -418,7 +418,8 @@ class ApplyController extends ThinkController
public function android_del($model = null, $ids = null)
{
echo "不允许删除";
return ;
\Think\Log ::actionLog('Apply/android_del', 'Apply', 1);
$this -> del($model, $ids);
}

@ -98,7 +98,7 @@ class CompanyGameRatioController extends AdminController
$gameres = M("game","tab_")->field("tab_game.relation_game_id,tab_game.relation_game_name,IF(tab_game.original_package_name='','未配置',tab_game.original_package_name) original_package_name,tab_game_type.type_name game_type_name")->where($gamewhere)->join("tab_game_type on tab_game.game_type_id = tab_game_type.id")->group("tab_game.relation_game_id")->select(false);
$dbres = M("company_game_ratio","tab_")
->alias('m')
->field("m.*,g.*,p.company_name,p.company_belong,IFNULL(r.settlement_type,-1) settlement_type,group_concat(ratio SEPARATOR '|') ratio,group_concat(begin_time SEPARATOR '|') begin_time,group_concat(end_time SEPARATOR '|') end_time,group_concat(m.turnover_ratio SEPARATOR '|') turnover_ratio,group_concat(m.id SEPARATOR '|') operate_id")
->field("m.*,g.*,p.company_name,p.company_belong,IFNULL(r.settlement_type,-1) settlement_type,group_concat(turnover_type ORDER BY begin_time ASC SEPARATOR '|') turnover_type,group_concat(ratio ORDER BY begin_time ASC SEPARATOR '|') ratio,group_concat(begin_time ORDER BY begin_time ASC SEPARATOR '|') begin_time,group_concat(end_time ORDER BY begin_time ASC SEPARATOR '|') end_time,group_concat(m.turnover_ratio ORDER BY begin_time ASC SEPARATOR '|') turnover_ratio,group_concat(m.id ORDER BY begin_time ASC SEPARATOR '|') operate_id")
->join("JOIN ({$gameres}) g ON m.relation_game_id = g.relation_game_id")
->join("JOIN tab_promote_company p ON ( m.company_id = p.id".$pwhere.")")
->join("left JOIN tab_company_relation r ON (r.first_company_type =2 AND r.first_company_id = m.company_id) OR (r.second_company_type =2 AND r.second_company_id = m.company_id)");
@ -112,6 +112,7 @@ class CompanyGameRatioController extends AdminController
$begin_time = explode('|',$v['begin_time']);
$end_time = explode('|',$v['end_time']);
$turnover_type = explode('|',$v['turnover_type']);
foreach ($begin_time as $tk => $tv) {
@ -119,6 +120,14 @@ class CompanyGameRatioController extends AdminController
$endtime = $end_time[$tk] ? date('Y-m-d', $end_time[$tk]) : '永久';
$v["valid"][$tk] = "{$begintime} ~ {$endtime}";
if($turnover_type[$tk] == 0) {
$v["turnover_types"][$tk] = "无";
} elseif($turnover_type[$tk] == 1) {
$v["turnover_types"][$tk] = "月流水";
} elseif($turnover_type[$tk] == 2) {
$v["turnover_types"][$tk] = "历史流水";
}
}
// $v['begin_time'] = date("Y-m-d",$v['begin_time']);
@ -245,6 +254,7 @@ class CompanyGameRatioController extends AdminController
}else{
$dbres = $dbres->page($page, $row)->select();
}
// dump($dbres);die();
foreach($dbres as $k=>&$v){
$v['settlement_type'] = $this->SettlementType[$v['settlement_type']];
$v['begin_time'] = date("Y-m-d",$v['begin_time']);
@ -252,6 +262,15 @@ class CompanyGameRatioController extends AdminController
$v["valid"] = "{$v['begin_time']} ~ {$v['end_time']}";
if($v["turnover_type"] == 0) {
$v["turnover_types"] = "无";
} elseif($v["turnover_type"] == 1) {
$v["turnover_types"] = "月流水";
} elseif($v["turnover_type"] == 2) {
$v["turnover_types"] = "历史流水";
}
$v['company_belong'] ="下游".getCompanyBlong($v['company_belong']);
$v['verify_log'] = json_decode($v['verify_log'], true);
if (isset($params['export'])) {
@ -434,6 +453,7 @@ class CompanyGameRatioController extends AdminController
"turnover_ratio"=>$v['turnover_ratio'],
"begin_time"=>$v['begin_time'],
"end_time"=>$v['end_time'],
"turnover_type"=>$v['turnover_type'],
];
$this->companyRatioTimeChange($v['company_id'],$v['relation_game_id'],$v['begin_time'],$v['end_time'],$ratiov);
@ -578,9 +598,21 @@ class CompanyGameRatioController extends AdminController
$save['end_time'] = $params['end_time'] ? strtotime($params['end_time'])+86399 : 0;
$save['remark'] = $params['remark'] ?? '';
$save['status'] = 0;
$save['turnover_type'] = $params["turnover_type"] ?? 1;
$save['verify_log']=json_encode(["create_user"=>$this->admininfo["username"],"create_time"=>date("Y-m-d H:i:s")]);
//获取旧比例
$this->getOldRatio($save);
$promote_data = M("promote_company","tab_")->where(['id'=>$save['company_id']])->find();
if ($promote_data['company_belong'] != '1' && $promote_data['company_belong'] != '2') {
$save['verify_log'] = json_decode($save['verify_log'],true);
$save['verify_log']['market_user']="AUTO";
$save['verify_log']['market_time']=date("Y-m-d H:i:s");
$save['verify_log'] = json_encode($save['verify_log']);
$save['status']=1;
}
//判断已有未审核
$where = [
"relation_game_id"=>$save['relation_game_id'],
@ -635,6 +667,7 @@ class CompanyGameRatioController extends AdminController
$save['begin_time'] = strtotime($params['begin_time']);
$save['end_time'] = $params['end_time'] ? strtotime($params['end_time'])+86399 : 0;
$save['remark'] = $params['remark'] ?? '';
$save['turnover_type'] = $params['turnover_type'] ?? 1;
$save['status'] = 0;
$save['verify_log']=json_encode(["create_user"=>$this->admininfo["username"],"create_time"=>date("Y-m-d H:i:s")]);
@ -693,9 +726,21 @@ class CompanyGameRatioController extends AdminController
$save['begin_time'] = strtotime($params['begin_time']);
$save['end_time'] = $params['end_time'] ? strtotime($params['end_time'])+86399 : 0;
$save['remark'] = $params['remark'] ?? '';
if($y['ratio'] != $save['ratio'] || $y['turnover_ratio'] != $save['turnover_ratio'] || $y['begin_time'] != $save['begin_time'] || $y['end_time'] != $save['end_time']){
$save['turnover_type'] = $params['turnover_type'] ?? 1;
if($y['ratio'] != $save['ratio'] || $y['turnover_ratio'] != $save['turnover_ratio'] || $y['begin_time'] != $save['begin_time'] || $y['end_time'] != $save['end_time'] || $y['turnover_type'] != $save['turnover_type']){
$save['status'] = 0;
$save['verify_log'] = json_encode(["create_user"=>$this->admininfo["username"],"create_time"=>date("Y-m-d H:i:s")]);
$promote_data = M("promote_company","tab_")->where(['id'=>$y['company_id']])->find();
if ($promote_data['company_belong'] != '1' && $promote_data['company_belong'] != '2') {
$save['verify_log'] = json_decode($save['verify_log'],true);
$save['verify_log']['market_user']="AUTO";
$save['verify_log']['market_time']=date("Y-m-d H:i:s");
$save['verify_log'] = json_encode($save['verify_log']);
$save['status']=1;
}
}
M("company_game_ratio_log","tab_")->save($save);
addOperationLog(['op_type'=>1,'key'=>$save['id'],'op_name'=>'修改','url'=>U('lists')]);
@ -959,6 +1004,7 @@ class CompanyGameRatioController extends AdminController
$radio = explode('|',$v['ratio']);
$turnover_ratio = explode('|',$v['turnover_ratio']);
$turnover_type = $v['turnover_types'];
$sec_row = 1;
@ -974,12 +1020,12 @@ class CompanyGameRatioController extends AdminController
if(array_key_exists("instanceof",$va)){
//存在
if($va['instanceof']=='1'){
$t['name']="月流水≥".$va['turnover'];
$t['name']="{$turnover_type[$key]}≥".$va['turnover'];
}else{
$t['name']="月流水".$va['turnover'];
$t['name']="{$turnover_type[$key]}".$va['turnover'];
}
}else{
$t['name']="月流水≥".$va['turnover'];
$t['name']="{$turnover_type[$key]}≥".$va['turnover'];
}
$sec_row++;
$v['turnover_ratios'][$key][]=$t;

@ -886,13 +886,12 @@ class CompanyStatementController extends ThinkController
//整合数据
if ($k!='complement_down' && $k != 'complement_user') {
$lsres = $LackStatement->where("company_id={$company_info['id']} and is_pool = 0")->select();
$lsres = $LackStatement->where("company_id={$company_info['id']} and is_pool = 0 and company_type = {$v['company_type']}")->select();
} else {
$lsres = $LackStatement->where("company_id={$company_info['id']} and is_pool = 0 and withdraw_type = 3")->select();
$lsres = $LackStatement->where("company_id={$company_info['id']} and is_pool = 0 and withdraw_type = 3 and company_type = {$v['company_type']}")->select();
}
$del_lack_ids = [];
if(count($lsres) > 0){
//进行聚合
foreach($lsres as $key=>$val){
@ -1438,9 +1437,12 @@ class CompanyStatementController extends ThinkController
if ($company_ids) {
$inside = M("promote_company",'tab_')->field("company_name")->where(['id'=>['in',$company_ids],'is_inside'=>1])->select();
$inside = implode(',',array_column($inside,'company_name'));
if ($inside) {
$inside = implode(',',array_column($inside,'company_name'));
$this->ajaxReturn(['status'=>0,'msg'=>$inside.'为内部公司不能添加特殊补点']);
$this->ajaxReturn(['status'=>0,'msg'=>$inside.'为内部公司不能添加特殊补点']);
}
}

@ -254,6 +254,7 @@ class CompanyStatementPoolController extends ThinkController
public function editPuPool(&$infolist,$is_export) {
$line = 1;
$count = [];
$week_line = 2;
//获取对接人
foreach($infolist as $k=>&$v){
$v['statement_info'] = json_decode($v['statement_info'],true);
@ -318,6 +319,11 @@ class CompanyStatementPoolController extends ThinkController
}
}
}
$handle_data = $this->changeDataStruct($v['statement_info'],$is_export,$week_line);
$v['statement_info'] = $handle_data;
$v['row'] = $row;
if($is_export){
if($v['withdraw_type'] != 3) {
@ -342,6 +348,8 @@ class CompanyStatementPoolController extends ThinkController
public function viewPuPool(&$infolist,$is_export){
$line = 1;
$count = [];
$week_line = 2;
//获取对接人
foreach($infolist as $k=>&$v){
$v['statement_info'] = json_decode($v['statement_info'],true);
@ -394,11 +402,22 @@ class CompanyStatementPoolController extends ThinkController
$v['statement_money'] .= "O{$line}+";
}else{
$count['platform_amount'] += $val['pay_amount'];
$count['week_money'] += $val['sum_money'];
$count['sum_money'] += $val['sum_money'];
}
}
}
$handle_data = $this->changeDataStruct($v['statement_info'],$is_export,$week_line);
$v['statement_info'] = $handle_data;
$v['row'] = $row;
if ($v['row'] == '0') {
$v['row'] = 1;
}
if($is_export){
if($v['withdraw_type'] != 3) {
$v['statement_money'] .="P{$cline}-Q{$cline},2)";
@ -410,15 +429,154 @@ class CompanyStatementPoolController extends ThinkController
if($is_export){
$count["platform_amount"] = "=ROUND(SUM(K2:K".$line."),2)";
$count["sum_money"] = "=ROUND(SUM(R2:R".$line."),2)";
$count["week_money"] = "=ROUND(SUM(R2:R".$line."),2)";
$count["sum_money"] = "=ROUND(SUM(S2:S".$line."),2)";
}
// die();
$this->assign("data",$infolist);
$this->assign("count",$count);
$this->assign("is_export",$is_export);
$this->display("CompanyStatementPool/viewPuPool");
}
//改变结构
public function changeDataStruct($statement_info = [],$is_export = 0,&$week_line = 1) {
$game_list = [];
$old_line = $week_line;
//使用时间与会长账号作为键值分离数据
foreach($statement_info as $sk=>$sv){
foreach($sv['game_list'] as $gk=>$gv){
$gv['account'] = $sv['account'];
$game_list[$gv['statement_begin_time'].'-'.$gv['statement_end_time']][$gv['account']][] = $gv;
}
}
$game_data = [];
$handle_data = [];
//处理游戏金额数据
foreach($game_list as $gk => $gv) {
foreach ($gv as $sk => $sv) {
$game_data['account'] = $sk;
$game_data['row'] = count($sv);
if ($game_data['row'] == '0') {
$game_data['row'] = 1;
}
$game_data['time_row'] = count($sv);
if ($game_data['time_row'] == '0') {
$game_data['time_row'] = 1;
}
$game_data['time'] = $gk;
$game_data['week_amount'] = 0;
//周结算金额计算
for ($i=0;;$i++) {
if ($sv[$i]['sum_money']) {
$game_data['week_amount'] += $sv[$i]['sum_money'];
} else {
break;
}
}
// $game_data['week_amount'] += $sv[0]['sum_money'];
$game_data['game_list'] = $sv;
array_push($handle_data,$game_data);
$game_data = [];
}
}
$substract = 1;
// dump($game_list);
// dump($handle_data);
//添加周结算金额,合并相同的结算时间
// dump($handle_data);
foreach($handle_data as $hk => $hv) {
if($hk > 0) {
for (;;) {
if (!$handle_data[$hk-$substract]['time']) {
$substract++;
} else {
break;
}
}
// dump($hv);
if ($hv['time'] == $handle_data[$hk-$substract]['time']&&!$is_export) {
$handle_data[$hk-$substract]['time_row'] += $handle_data[$hk]['time_row'];
if ($is_export) {
$week_line++;
$handle_data[$hk-$substract]['week_amount'] = "=ROUND(SUM(O{$old_line}:O{$week_line}),2)";
$old_line++;
} else {
$handle_data[$hk-$substract]['week_amount'] += $handle_data[$hk]['week_amount'];
}
unset($handle_data[$hk]['time']);
unset($handle_data[$hk]['time_row']);
unset($handle_data[$hk]['week_amount']);
} else {
if ($is_export) {
// dump($old_line);
if (count($hv['game_list'])>1) {
$week_line += count($hv['game_list'])-1;
}
$handle_data[$hk]['week_amount'] = "=ROUND(SUM(O{$old_line}:O{$week_line}),2)";
$old_line++;
$week_line++;
}
}
$substract = 1;
}else {
if ($is_export) {
if (count($hv['game_list'])>1) {
$week_line += count($hv['game_list'])-1;
}
$handle_data[$hk]['week_amount'] = "=ROUND(SUM(O{$old_line}:O{$week_line}),2)";
if (count($hv['game_list'])>1) {
$old_line += count($hv['game_list'])-1;
} else {
$old_line++;
}
if(count($hv['game_list'])>1) {
$week_line = $old_line + 1;
} else {
$week_line = $old_line;
}
}
}
}
// dump($handle_data);
return $handle_data?$handle_data:[];
}
//下游汇总结算查看
public function viewPcPool(&$infolist,$is_export){
$line = 1;
$count = [];
//获取对接人
@ -457,6 +615,11 @@ class CompanyStatementPoolController extends ThinkController
}
if($is_export){
// if($v['withdraw_type'] != 3) {
// $va['d_statement_money'] = "=ROUND(E{$line}*(1-H{$line})*(F{$line}+G{$line}),2)";
// } else {
// $va['d_statement_money'] = "=ROUND(E{$line}*(G{$line}),2)";
// }
if($v['withdraw_type'] != 3) {
$va['d_statement_money'] = "=ROUND(D{$line}*(1-G{$line})*(E{$line}+F{$line}),2)";
} else {
@ -478,20 +641,77 @@ class CompanyStatementPoolController extends ThinkController
}
}
}
// $game_list = [];
// $statement_info = $v['statement_info'];
// //使用时间与会长账号作为键值分离数据
// foreach($statement_info as $sk=>$sv){
//
// $sv['time'] = $sv['statement_begin_time'].'-'.$sv['statement_end_time'];
// $game_list[$sv['statement_begin_time'].'-'.$sv['statement_end_time']][] = $sv;
//
// }
//
// $handle_data = [];
// $substract = 1;
//
// //处理游戏金额数据
// foreach($game_list as $gk => $gv) {
//
// foreach ($gv as $lk => $lv){
//
// if ($lk > 0) {
//
// for (;;) {
//
// if (!$handle_data[$lk-$substract]['time']) {
// $substract++;
// } else {
// $handle_data[$lk-$substract]['row'] += 1;
// $handle_data[$lk-$substract]['week_amount'] += $lv['d_statement_money'];
// unset($lv['time']);
// break;
// }
//
// }
//
// } else {
//
// $lv['row'] = 1;
// $lv['week_amount'] = $lv['d_statement_money'];
// }
//
// array_push($handle_data,$lv);
//
// }
//
// }
//
// $handle_data = $this->changeDataStructVc($v['statement_info'],$is_export,$cline);
// $v['statement_info'] = $handle_data;
// dump($handle_data);
$v['settlement_contact'] = $Partner[$v['company_id']];
if($is_export){
if ($v['withdraw_type'] != 3) {
// $v['statement_money'] = "=ROUND(SUM(I{$cline}:I{$line})+K{$cline}-J{$cline},2)";
$v['statement_money'] = "=ROUND(SUM(H{$cline}:H{$line})+J{$cline}-I{$cline},2)";
}
}else{
$count['fine'] += $v['fine'];
$count['reward'] += $v['reward'];
$count['statement_money'] += $v['statement_money'];
}
$v['statement_count'] = count($v['statement_info']);
if($v['statement_count'] == '0'){
$v['statement_count'] = 1;
}
}
if($is_export){
@ -509,6 +729,66 @@ class CompanyStatementPoolController extends ThinkController
}
public function changeDataStructVc($statement_info,$is_export = 0,$cline) {
$game_list = [];
$nline = $cline;
//使用时间与会长账号作为键值分离数据
foreach($statement_info as $sk=>$sv){
$sv['time'] = $sv['statement_begin_time'].'-'.$sv['statement_end_time'];
$game_list[$sv['statement_begin_time'].'-'.$sv['statement_end_time']][] = $sv;
}
$handle_data = [];
$substract = 1;
//处理游戏金额数据
foreach($game_list as $gk => $gv) {
foreach ($gv as $lk => $lv){
if ($lk > 0) {
for (;;) {
if (!$handle_data[$lk-$substract]['time']) {
$nline++;
$substract++;
} else {
$handle_data[$lk-$substract]['row'] += 1;
$handle_data[$lk-$substract]['week_amount'] += $lv['d_statement_money'];
if ($is_export) {
$handle_data[$lk-$substract]['week_amount'] = "=ROUND(SUM(I{$cline}:I{$nline}),2)";
}
unset($lv['time']);
break;
}
}
} else {
$lv['row'] = 1;
$lv['week_amount'] = $lv['d_statement_money'];
$nline++;
if ($is_export) {
$lv['week_amount'] = "=ROUND(SUM(I{$cline}}:I{$nline}),2)";
}
}
array_push($handle_data,$lv);
}
}
return $handle_data;
}
//上游汇总查看及导出
public function viewCpPool(&$infolist,$is_export)
{
@ -538,19 +818,29 @@ class CompanyStatementPoolController extends ThinkController
}
}
// dump($v['statement_info']);
$cline = $line+1;
foreach($v['statement_info'] as $ke=>&$va){
// dd($va);
$line ++;
$va['company_ratio'] = 100-$va['ratio'];
if($is_export){
$va['d_statement_money'] = "=ROUND(F{$line}*G{$line},2)";
$va['d_statement_money'] = "=ROUND(F{$line}*(1-I{$line})*G{$line}*(1-J{$line}),2)";//=ROUND(F3*(1-I3)*G3*(1-J3),2)
}else{
$va['d_statement_money'] = round($va['pay_amount']*$va['ratio']/100,2);
$va['d_statement_money'] = round($va['pay_amount']*(100-$va['promote_ratio'])*$va['ratio']*(100-$va['fax_ratio'])/1000000,2);
$count['platform_amount'] += $va['pay_amount'];
$count['platform_amount2'] += $va['pay_amount'];
$count['d_statement_money'] += $va['d_statement_money'];
}
}
// $handle_data = $this->changeDataStructVc($v['statement_info'],$is_export,$cline);
// $v['statement_info'] = $handle_data;
// dump($v['statement_info']);
$v['matche_platform'] = $Partner[$v['company_id']];
if($is_export){
$v['statement_money'] = "=ROUND(SUM(K{$cline}:K{$line})+M{$cline}-L{$cline},2)";

@ -647,8 +647,8 @@ class CompanyStatementSetController extends Controller {
}
unset($tmpp);
unset($js_id);
$this->getPromoteCompanySpend($pcList,array_unique(array_keys($pcList)),$begintime,$endtime);
$this->getPromoteCompanySpend($pcList,array_unique(array_keys($pcList)),$begintime,$endtime);
//数据整合
$verify_log=json_encode(["create_user"=>"system","create_time"=>date("Y-m-d H:i:s")]);
@ -712,7 +712,8 @@ class CompanyStatementSetController extends Controller {
if(isset($v['game_list'][$t_game_id]['all_pay_amount'])){
$game_all_payment = $v['game_list'][$t_game_id]['all_pay_amount']-0;
}else{
$game_all_payment = $v['game_list'][$t_game_id]['pay_amount']-0;
// $game_all_payment = $v['game_list'][$t_game_id]['pay_amount']-0;
$game_all_payment = $v['game_list'][$t_game_id]['ratio_pay_amount']-0;
}
// dump($tratio);
@ -733,9 +734,20 @@ class CompanyStatementSetController extends Controller {
$tratio =$this->getTurnoverRatio($game_all_payment,$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
$tratio += $company_ratio;
}elseif($type == 0){
$tratio = $tmp_game_ratio['ratio'];
// $tratio = $tmp_game_ratio['ratio'];
$turnover_type = $this->getTurnoverType($t_game_id,$k,$begintime,$endtime);
if ($turnover_type == 2) {
$tratio =$this->getTurnoverRatio($game_all_payment,$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
} else {
$tratio = $tmp_game_ratio['ratio'];
}
}else{
//补点
$turnover_type = $this->getTurnoverType($t_game_id,$k,$begintime,$endtime);
if ($turnover_type == 2) {
continue;
}
$tratio1 =$this->getTurnoverRatio($game_all_payment,$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
$tratio2 =$tmp_game_ratio['ratio'];
$tratio = $tratio1-$tratio2+$company_ratio;
@ -766,8 +778,19 @@ class CompanyStatementSetController extends Controller {
$tratio =$this->getTurnoverRatio($game_all_payment,$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
$tratio += $company_ratio;
}elseif($type == 0){
$tratio = $t_game_ratio['ratio'];
// $tratio = $t_game_ratio['ratio'];
$turnover_type = $this->getTurnoverType($t_game_id,$k,$begintime,$endtime);
if ($turnover_type == 2) {
$tratio =$this->getTurnoverRatio($game_all_payment,$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
} else {
$tratio = $tmp_game_ratio['ratio'];
}
}else{
$turnover_type = $this->getTurnoverType($t_game_id,$k,$begintime,$endtime);
if ($turnover_type == 2) {
continue;
}
//补点
$tratio1 =$this->getTurnoverRatio($game_all_payment,$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
$tratio2 =$tmp_game_ratio['ratio'];
@ -849,11 +872,10 @@ class CompanyStatementSetController extends Controller {
continue;
}
if($add_data['platform_amount'] == 0){
return;
continue;
}
// dd($add_data);
//添加
if($recount && $company_id !== false){
if($recount === true && $company_id !== false){
//非重算
return $add_data;
}
@ -885,6 +907,7 @@ class CompanyStatementSetController extends Controller {
//获取推广公司推广金额
public function getPromoteCompanySpend(&$pcList,$idarr,$begintime,$endtime){
$res = [];
$all_res = [];
//获取推广员
if(count($idarr) == 0){return $res;}
$Promote = M("Promote","tab_");
@ -903,8 +926,32 @@ class CompanyStatementSetController extends Controller {
$list = $Spend->alias('s')->field('sum(s.pay_amount) pay_amount,s.game_id,g.relation_game_id,g.relation_game_name game_name')->where($spenMap)->group('game_id')
->join("left join tab_game g on s.game_id = g.id")
->select();
$allSpendMap = $spenMap;
unset($allSpendMap["s.payed_time"]);
$allspend_list = $Spend->alias('s')->field('sum(s.pay_amount) pay_amount,s.game_id,g.relation_game_id,g.relation_game_name game_name')->where($allSpendMap)->group('game_id')
->join("left join tab_game g on s.game_id = g.id")
->select();
foreach($allspend_list as $k=>$v){
try {
$all_res[$company_id]["pay_amount"] += $v['pay_amount'];
} catch (\Throwable $th) {
$all_res[$company_id]["pay_amount"] = $v['pay_amount'];
}
if(isset($all_res[$company_id][$v['relation_game_id']])){
//
$all_res[$company_id][$v['relation_game_id']]['pay_amount'] += $v['pay_amount'];
}else{
unset($v['game_id']);
$all_res[$company_id][$v['relation_game_id']]= $v;
}
}
if(empty($list)){continue;}
foreach($list as $k=>$v){
try {
$res[$company_id]["pay_amount"] += $v['pay_amount'];
} catch (\Throwable $th) {
@ -912,32 +959,72 @@ class CompanyStatementSetController extends Controller {
}
if(isset($res[$company_id][$v['relation_game_id']])){
//
$res[$company_id][$v['relation_game_id']]['pay_amount'] += $v['pay_amount'];
$res[$company_id][$v['relation_game_id']]['ratio_pay_amount'] += $v['pay_amount'];
}else{
unset($v['game_id']);
$v['ratio_pay_amount'] = $v['pay_amount'];
$res[$company_id][$v['relation_game_id']]= $v;
}
}
}
$game_ids = implode(",",array_unique(array_column($list,"relation_game_id")));
$game_ids = $this->getModuleRatioGame($company_id,$game_ids,$begintime,$endtime);
$sameGame = $this->getTheSameGame($game_ids);
if(!empty($sameGame)){
foreach ($sameGame as $k => $v) {
$temp = 0;
for ($j=0; $j < count($v); $j++) {
$temp += $res[$company_id][$v[$j]]['pay_amount'];
}
$sameGame[$k] = $temp;
}
foreach ($sameGame as $k => $v) {
$res[$company_id][$k]['all_pay_amount'] = $v;
// $game[$k]['pay_amount']= $v;
}
}
$game_ids = implode(",",array_unique(array_column($list,"relation_game_id")));
$game_ids = $this->getModuleRatioGame($company_id,$game_ids,$begintime,$endtime);
$sameGame = $this->getTheSameGame($game_ids);
if(!empty($sameGame)){
foreach ($sameGame as $k => $v) {
$temp = 0;
for ($j=0; $j < count($v); $j++) {
// $turnover_where = [
// "relation_game_id"=>$v[$j],
// "company_id"=>$company_id,
// "_string"=>"begin_time <={$endtime} AND ( end_time = 0 OR end_time >= {$begintime})"
// ];
// $turnover_type = D("CompanyGameRatio")->field("turnover_type")->where($turnover_where)->find()['turnover_type'];
$turnover_type = $this->getTurnoverType($v[$j],$company_id,$begintime,$endtime);
if ($turnover_type == 2) {
$res[$company_id][$v[$j]]['ratio_pay_amount'] = $all_res[$company_id][$v[$j]]['pay_amount'];
$temp += $all_res[$company_id][$v[$j]]['pay_amount'];
} else {
// $res[$company_id][$v[$j]]['ratio_pay_amount'] = $res[$company_id][$v[$j]]['pay_amount'];
$temp += $res[$company_id][$v[$j]]['pay_amount'];
}
}
$sameGame[$k] = $temp;
}
foreach ($sameGame as $k => $v) {
$res[$company_id][$k]['all_pay_amount'] = $v;
// $game[$k]['pay_amount']= $v;
}
}
}
foreach($res as $key=>$value){
foreach ($value as $k => $v){
if ($k!='pay_amount') {
$turnover_type = $this->getTurnoverType($k,$key,$begintime,$endtime);
if ($turnover_type == 2) {
$res[$key][$k]['ratio_pay_amount'] = $all_res[$key][$k]['pay_amount'];
}
}
}
}
foreach($res as $k=>$v){
$pcList[$k]["pay_amount"] = $v['pay_amount'];
unset($v['pay_amount']);
@ -946,6 +1033,46 @@ class CompanyStatementSetController extends Controller {
}
}
/**
* 返回结算流水类型
*/
public function getTurnoverType($relation_game_id = 0, $company_id = 0, $begin_time = 0, $end_time = 0){
$turnover_where = [
"relation_game_id"=>$relation_game_id,
"company_id"=>$company_id,
"_string"=>"begin_time <={$end_time} AND ( end_time = 0 OR end_time >= {$begin_time})"
];
$turnover_type = D("CompanyGameRatio")->field("turnover_type")->where($turnover_where)->find();
//判断特殊比例是否存在,存在直接返回结算流水类型
if (!$turnover_type) {
$company_belong = M("promote_company","tab_")->field("company_belong")->where(['id'=>$company_id])->find();
//判断公司内外团类型是否存在不存在直接返回0
if (!$company_belong) {
return 0;
} else {
$company_belong = $company_belong['company_belong'];
}
$mould_where = [
"relation_game_id"=>$relation_game_id,
"company_belong"=>$company_belong,
"_string"=>"begin_time <={$end_time} AND ( end_time = 0 OR end_time >= {$begin_time})"
];
$mould_data = M("game_ratio_mould","tab_")->where($mould_where)->find();
//判断游戏比例模板是否存在不存在直接返回0否则返回查询的类型
if ($mould_data) {
return $mould_data['turnover_type'];
} else {
return 0;
}
} else {
return $turnover_type['turnover_type'];
}
}
//获取推广公司推广金额
protected function getPuPromoteSpend(&$pcList,$idarr,$begintime,$endtime){
$res = [];
@ -977,6 +1104,23 @@ class CompanyStatementSetController extends Controller {
->join("tab_promote promote ON s.promote_id = promote.id","left")
->join("left join tab_game g on s.game_id = g.id")
->select();
$all_spendMap = $spenMap;
unset($all_spendMap['s.payed_time']);
$all_list = $Spend
->alias('s')
->field("sum(s.pay_amount) pay_amount,s.game_id,g.relation_game_id,g.relation_game_name game_name,IFNULL(if(substring_index(substring_index(promote.`chain`,'/',2),'/',-1)='',s.promote_id,substring_index(substring_index(promote.`chain`,'/',2),'/',-1)),0) p_id")
->where($all_spendMap)
->group('p_id,game_id')
->join("tab_promote promote ON s.promote_id = promote.id","left")
->join("left join tab_game g on s.game_id = g.id")
->select();
// if ($company_id == 64) {
// dump($all_list);
// }
if(empty($list)){continue;}
$game = [];
foreach($list as $k=>$v){
@ -986,15 +1130,33 @@ class CompanyStatementSetController extends Controller {
$game[$v['relation_game_id']]['pay_amount'] = $v['pay_amount'];
}
}
$allgame = [];
foreach($all_list as $k=>$v){
if(isset($allgame[$v['relation_game_id']])){
$allgame[$v['relation_game_id']]['pay_amount'] += $v['pay_amount'];
}else{
$allgame[$v['relation_game_id']]['pay_amount'] = $v['pay_amount'];
}
}
//同cp同一个原包名的共享总流水分成
$game_ids = implode(",",array_keys($game));
$game_ids = $this->getModuleRatioGame($company_id,$game_ids,$begintime,$endtime);
$sameGame = $this->getTheSameGame($game_ids);
if(!empty($sameGame)){
foreach ($sameGame as $k => $v) {
$temp = 0;
for ($j=0; $j < count($v); $j++) {
$temp += $game[$v[$j]]['pay_amount'];
for ($j=0; $j < count($v); $j++) {
$turnover_type = $this->getTurnoverType($v[$j],$company_id,$begintime,$endtime);
if ($turnover_type == 2) {
$temp += $allgame[$v[$j]]['pay_amount'];
} else {
// $res[$company_id][$v[$j]]['ratio_pay_amount'] = $res[$company_id][$v[$j]]['pay_amount'];
$temp += $game[$v[$j]]['pay_amount'];
}
// $temp += $game[$v[$j]]['pay_amount'];
}
$sameGame[$k] = $temp;
}
@ -1018,7 +1180,18 @@ class CompanyStatementSetController extends Controller {
}else{
unset($v['game_id']);
$res[$company_id][$p_account][$v['relation_game_id']]= $v;
$res[$company_id][$p_account][$v['relation_game_id']]['all_pay_amount']= $game[$v['relation_game_id']]['pay_amount'];
$turnover_type = $this->getTurnoverType($v['relation_game_id'],$company_id,$begintime,$endtime);
if ($turnover_type == 2) {
// $temp += $allgame[$v[$j]]['pay_amount'];
$res[$company_id][$p_account][$v['relation_game_id']]['all_pay_amount']= $allgame[$v['relation_game_id']]['pay_amount'];
} else {
// $res[$company_id][$v[$j]]['ratio_pay_amount'] = $res[$company_id][$v[$j]]['pay_amount'];
$res[$company_id][$p_account][$v['relation_game_id']]['all_pay_amount']= $game[$v['relation_game_id']]['pay_amount'];
}
// $res[$company_id][$p_account][$v['relation_game_id']]['all_pay_amount']= $game[$v['relation_game_id']]['pay_amount'];
$res[$company_id][$p_account][$v['relation_game_id']]['game_type_name'] = $this->getGameTypeName($v['relation_game_id']);
}
}
@ -1153,7 +1326,8 @@ class CompanyStatementSetController extends Controller {
unset($tmpp);
$this->getPuPromoteSpend($pc,array_unique(array_keys($pc)),$begintime,$endtime);
// dump($pc);die();
$StatementDb = M("CompanyStatement","tab_");
$statement_begin_time = date("Y.m.d",$begintime);
$statement_end_time = date("Y.m.d",$endtime);
@ -1216,8 +1390,20 @@ class CompanyStatementSetController extends Controller {
$tratio =$this->getTurnoverRatio($p_info['all_pay_amount'],$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
$tratio += $company_ratio;
}elseif($type == 0){
$tratio = $tmp_game_ratio['ratio'];
// $tratio =$this->getTurnoverRatio($p_info['all_pay_amount'],$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
// $tratio = $tmp_game_ratio['ratio'];
$turnover_type = $this->getTurnoverType($p_info['relation_game_id'],$k,$begintime,$endtime);
if ($turnover_type == 2) {
$tratio =$this->getTurnoverRatio($p_info['all_pay_amount'],$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
} else {
$tratio = $tmp_game_ratio['ratio'];
}
}else{
$turnover_type = $this->getTurnoverType($p_info['relation_game_id'],$k,$begintime,$endtime);
if ($turnover_type == 2) {
continue;
}
//补点
$tratio1 =$this->getTurnoverRatio($p_info['all_pay_amount'],$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
$tratio2 =$tmp_game_ratio['ratio'];
@ -1248,8 +1434,21 @@ class CompanyStatementSetController extends Controller {
$tratio =$this->getTurnoverRatio($p_info['all_pay_amount'],$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
$tratio += $company_ratio;
}elseif($type == 0){
$tratio = $tmp_game_ratio['ratio'];
$turnover_type = $this->getTurnoverType($p_info['relation_game_id'],$k,$begintime,$endtime);
if ($turnover_type == 2) {
$tratio =$this->getTurnoverRatio($p_info['all_pay_amount'],$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
} else {
$tratio = $tmp_game_ratio['ratio'];
}
}else{
$turnover_type = $this->getTurnoverType($p_info['relation_game_id'],$k,$begintime,$endtime);
if ($turnover_type == 2) {
continue;
}
//补点
$tratio1 =$this->getTurnoverRatio($p_info['all_pay_amount'],$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
$tratio2 =$tmp_game_ratio['ratio'];
@ -1318,10 +1517,12 @@ class CompanyStatementSetController extends Controller {
"statement_info"=>json_encode($v['statement_info'],JSON_UNESCAPED_UNICODE)
];
}
//无需补点不统计其他金额
if($type == 2 && $v['statement_money'] == 0){
continue ;
}
//聚合未结算数据
$lsres = $LackStatement->where("company_id='{$k}' and is_pool = 0")->select();
// dd($lsres);
$del_lack_ids = [];
if(count($lsres) > 0){
//进行聚合
@ -1354,52 +1555,48 @@ class CompanyStatementSetController extends Controller {
if($v['platform_amount'] == 0 && $v['statement_money'] == 0){
continue ;
}
if($type == 2 && $v['statement_money'] == 0){
//补点不存
if($v['platform_amount'] < 300){
//存未满
// if($lackcompany['pay_amount'] != 0){
$lask_id = $LackStatement->add($lackcompany);
$countdata['create_lack_ids'][] =$lask_id;
$countdata['lack_statement_money'] +=$lackcompany['statement_money'];
$countdata['lack_platform_amount'] +=$lackcompany['platform_amount'];
// }
}else{
if($v['platform_amount'] < 300){
//存未满
// if($lackcompany['pay_amount'] != 0){
$lask_id = $LackStatement->add($lackcompany);
$countdata['create_lack_ids'][] =$lask_id;
$countdata['lack_statement_money'] +=$lackcompany['statement_money'];
$countdata['lack_platform_amount'] +=$lackcompany['platform_amount'];
// }
}else{
// if($v['pay_amount'] != 0){
//存成功配置单号
$company =[
"pool_id"=>0,
"company_id"=>$k,
"company_type"=>2,
"company_name"=>$v['partner'],
"company_info"=>json_encode($company_info,JSON_UNESCAPED_UNICODE),
"statement_money"=>$v['statement_money'],
"pay_amount"=>$v['pay_amount'],
"platform_amount"=>$v['platform_amount'],
"fine"=>$v['fine'],
"reward"=>$v['reward'],
"statement_begin_time"=>$begintime,
"statement_end_time"=>$endtime,
"statement_info"=>json_encode($v['statement_info'],JSON_UNESCAPED_UNICODE),
"statement_num"=>"JS_".date('Ymd').date('His').$v['company_id'].sp_random_string(5)
];
if($v['is_payment'] == 1){
$company['verify_status'] = 0;
}else{
$company['verify_status'] = 2;
}
$companyid = $StatementInfo->add($company);
$countdata['info_ids'][] =$companyid;
$countdata['del_lack_ids'] =array_merge($countdata['del_lack_ids'],$del_lack_ids);
$countdata['statement_money'] +=$v['statement_money'];
$countdata['pay_amount'] +=$v['pay_amount'];
$countdata['platform_amount'] +=$v['platform_amount'];
$countdata['fine'] +=$v['fine'];
$countdata['reward'] +=$v['reward'];
// }
}
// if($v['pay_amount'] != 0){
//存成功配置单号
$company =[
"pool_id"=>0,
"company_id"=>$k,
"company_type"=>2,
"company_name"=>$v['partner'],
"company_info"=>json_encode($company_info,JSON_UNESCAPED_UNICODE),
"statement_money"=>$v['statement_money'],
"pay_amount"=>$v['pay_amount'],
"platform_amount"=>$v['platform_amount'],
"fine"=>$v['fine'],
"reward"=>$v['reward'],
"statement_begin_time"=>$begintime,
"statement_end_time"=>$endtime,
"statement_info"=>json_encode($v['statement_info'],JSON_UNESCAPED_UNICODE),
"statement_num"=>"JS_".date('Ymd').date('His').$v['company_id'].sp_random_string(5)
];
if($v['is_payment'] == 1){
$company['verify_status'] = 0;
}else{
$company['verify_status'] = 2;
}
$companyid = $StatementInfo->add($company);
$countdata['info_ids'][] =$companyid;
$countdata['del_lack_ids'] =array_merge($countdata['del_lack_ids'],$del_lack_ids);
$countdata['statement_money'] +=$v['statement_money'];
$countdata['pay_amount'] +=$v['pay_amount'];
$countdata['platform_amount'] +=$v['platform_amount'];
$countdata['fine'] +=$v['fine'];
$countdata['reward'] +=$v['reward'];
// }
}
}
}

@ -3719,7 +3719,7 @@ class ExportController extends Controller
$play_info_map = false;
if (isset($_REQUEST['server_id'])) {
$play_map = false; //有区服就不检索玩家表,有区服一定已经选择游戏了
$play_info_map = " and upi.server_id = '{$_REQUEST['server_id']}' and upi.game_name = '{$_REQUEST['game_name']}'";
$play_info_map = " and upi.server_id = '{$_REQUEST['server_id']}' and upi.game_name like '{$_REQUEST['game_name']}%'";
}
if (!empty($_REQUEST['admin_id'])) {
@ -3761,7 +3761,7 @@ class ExportController extends Controller
substring_index(substring_index(promote.`chain`,'/',2),'/',-1)),0) id")
->join("tab_promote promote ON u.promote_id = promote.id","left")
->join($play_map ? "tab_user_play as up on up.user_id = u.id " . $play_map : false)
// ->join($play_info_map ? "tab_user_play_info as upi on upi.user_id = u.id " . $play_info_map : false)
->join($play_info_map ? "tab_user_play_info as upi on upi.user_id = u.id " . $play_info_map : false)
->join('tab_game on u.fgame_id = tab_game.id')
->where($map)
->group('tab_game.relation_game_id, id')

@ -809,7 +809,6 @@ class FinanceController extends ThinkController
$aggAmount = number_format($aggData[$value['unique_code']][$deviceType], 2, '.', '');
$aggFailAmount = number_format($aggFailData[$value['unique_code']][$deviceType], 2, '.', '');
}
// if ($aggAmount != '0.00') {
if (isset($gameSets[$value['game_id']]) && isAggGame($gameSets[$value['game_id']]['pay_notify_url'])) {
$data[$key]['cash_count'] = $value['cash_count'] = 0;
$data[$key]['balance_coin_count'] = $value['balance_coin_count'] = 0;

@ -35,19 +35,47 @@ class GameRatioMouldController extends AdminController
}
$this->checkListOrCountAuthRestMap($where);
$gameres = M("game","tab_")->field("tab_game.relation_game_id,tab_game.relation_game_name,IF(tab_game.original_package_name='','未配置',tab_game.original_package_name) original_package_name,tab_game_type.type_name game_type_name")->where($gamewhere)->join("tab_game_type on tab_game.game_type_id = tab_game_type.id")->group("tab_game.relation_game_id")->select(false);
$dbres = $this->DBModel->alias('m')->join("INNER JOIN ({$gameres}) g ON m.relation_game_id = g.relation_game_id")->where($where)->order('create_time desc, id desc');
$dbres = $this->DBModel->alias('m')
->field("*,group_concat(id ORDER BY begin_time ASC SEPARATOR '|') id,group_concat(turnover_type ORDER BY begin_time ASC SEPARATOR '|') turnover_type,group_concat(ratio ORDER BY begin_time ASC SEPARATOR '|') ratio,group_concat(begin_time ORDER BY begin_time ASC SEPARATOR '|') begin_time,group_concat(end_time ORDER BY begin_time ASC SEPARATOR '|') end_time,group_concat(m.turnover_ratio ORDER BY begin_time ASC SEPARATOR '|') turnover_ratio")
->join("INNER JOIN ({$gameres}) g ON m.relation_game_id = g.relation_game_id")->where($where)->order('create_time desc, id desc');
if(isset($params['export'])){
$dbres = $dbres->select();
$dbres = $dbres->group("m.relation_game_id,company_belong")->select();
}else{
$dbres = $dbres->page($page, $row)->select();
$dbres = $dbres->page($page, $row)->group("m.relation_game_id,company_belong")->select();
}
foreach($dbres as $k=>&$v){
$begin_time = explode('|',$v['begin_time']);
$end_time = explode('|',$v['end_time']);
$id_data = explode('|',$v['id']);
$turnover_type = explode('|',$v['turnover_type']);
foreach ($begin_time as $tk => $tv) {
$begintime = date("Y-m-d",$tv);
$endtime = $end_time[$tk] ? date('Y-m-d', $end_time[$tk]) : '永久';
$v["valid"][$tk] = "{$begintime} ~ {$endtime}";
$v["ids"][$tk] = $id_data[$tk];
if($turnover_type[$tk] == 0) {
$v["turnover_types"][$tk] = "无";
} elseif($turnover_type[$tk] == 1) {
$v["turnover_types"][$tk] = "月流水";
} elseif($turnover_type[$tk] == 2) {
$v["turnover_types"][$tk] = "历史流水";
}
}
$v['create_time'] = date("Y-m-d H:i:s",$v['create_time']);
$v['company_belong'] ="下游".getCompanyBlong($v['company_belong']);
$this->readTurnoverRatio($v);
}
$this->assign('data', $dbres);
//判断导出
if(isset($_REQUEST['export'])){
@ -57,7 +85,15 @@ class GameRatioMouldController extends AdminController
$this->display("export");
exit();
}
$count = $this->DBModel->alias('m')->field("count(id) count")->join("INNER JOIN ({$gameres}) g ON m.relation_game_id = g.relation_game_id")->where($where)->find()['count'];
// $count = $this->DBModel->alias('m')->field("count(id) count")->join("INNER JOIN ({$gameres}) g ON m.relation_game_id = g.relation_game_id")->where($where)->find()['count'];
$count = $this->DBModel->alias('m')
->field("id")
->join("INNER JOIN ({$gameres}) g ON m.relation_game_id = g.relation_game_id")->where($where)->group("m.relation_game_id,company_belong")->select(false);
$count = M()->table("({$count})a")->count();
$page = set_pagination($count, $row,$params);
if($page) {
$this->assign('_page', $page);
@ -68,6 +104,109 @@ class GameRatioMouldController extends AdminController
$this->display();
}
public function companyRatioTimeChange($company_belong = 0,$relation_game_id = 0, $begin_time = 0, $end_time = 0,$ratiov=[]) {
// dump($ratiov);die();
if (!$company_belong&&$company_belong!="0" || !$relation_game_id) {
$this->error("参数错误.");
}
// dump($end_time);dump($begin_time);die();
$check_data = M("game_ratio_mould","tab_")
->where(['company_belong'=>$company_belong,'relation_game_id'=>$relation_game_id,'begin_time'=>$begin_time,'end_time'=>$end_time])
->find();
if ($check_data) {
M("game_ratio_mould","tab_")
->where(['company_belong'=>$company_belong,'relation_game_id'=>$relation_game_id,'begin_time'=>$begin_time,'end_time'=>$end_time])
->save($ratiov);
return;
}
M("game_ratio_mould","tab_")
->where("company_belong={$company_belong} and relation_game_id={$relation_game_id} and begin_time>={$begin_time} and end_time <= {$end_time} and end_time!=0")
->delete();
$data = M("game_ratio_mould","tab_")
->where(['company_belong'=>$company_belong,'relation_game_id'=>$relation_game_id])
->order("begin_time DESC")
->select();
foreach($data as $key => $value) {
if ($value['begin_time'] > $begin_time) {
if (!$end_time) {
M("game_ratio_mould","tab_")
->where(['company_belong'=>$company_belong,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']])
->delete();
continue;
}
if ($value['begin_time'] >= $end_time && $value['end_time']!=0) {
continue;
}
if ($end_time > $value['begin_time'] && ($end_time < $value['end_time']||$value['end_time']==0)) {
M("game_ratio_mould","tab_")
->where(['company_belong'=>$company_belong,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']])
->save(['begin_time'=>$end_time+1]);
} else if ($end_time > $value['begin_time'] && ($end_time >= $value['end_time']&&$value['end_time']!=0)) {
M("game_ratio_mould","tab_")
->where(['company_belong'=>$company_belong,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']])
->save(['begin_time'=>$begin_time,'end_time'=>$end_time]);
}
} else if ($value['begin_time'] <= $begin_time) {
if (!$end_time&&($value['end_time']>$begin_time||$value['end_time']==0)) {
M("game_ratio_mould","tab_")
->where(['company_belong'=>$company_belong,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']])
->save(['end_time'=>$begin_time-1]);
continue;
}else if (!$end_time) {
continue;
}
if ($begin_time >= $value['end_time']&& $value['end_time']!=0) {
continue;
}
if ($begin_time > $value['begin_time'] && ($end_time >= $value['end_time'] && $value['end_time']!=0)) {
M("game_ratio_mould","tab_")
->where(['company_belong'=>$company_belong,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']])
->save(['end_time'=>$begin_time-1]);
} else if ($begin_time > $value['begin_time'] && ($end_time < $value['end_time']||$value['end_time']==0)) {
M("game_ratio_mould","tab_")
->where(['company_belong'=>$company_belong,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']])
->save(['end_time'=>$begin_time-1]);
$dataValue = $value;
$dataValue['begin_time'] = $end_time+1;
unset($dataValue['id']);
M("game_ratio_mould","tab_")->add($dataValue);
} else if ($begin_time == $value['begin_time'] && ($end_time < $value['end_time']||$value['end_time']==0)) {
M("game_ratio_mould","tab_")
->where(['company_belong'=>$company_belong,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']])
->save(['begin_time'=>$end_time+1]);
} else if ($end_time == $value['end_time']&&$begin_time>$value['begin_time']) {
M("game_ratio_mould","tab_")
->where(['company_belong'=>$company_belong,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']])
->save(['end_time'=>$begin_time-1]);
} else if ($end_time == $value['end_time']&&$begin_time == $value['begin_time']) {
M("game_ratio_mould","tab_")
->where(['company_belong'=>$company_belong,'relation_game_id'=>$relation_game_id,'begin_time'=>$value['begin_time'],'end_time'=>$value['end_time']])
->save(['begin_time'=>$begin_time,'end_time'=>$end_time]);
}
}
}
M("game_ratio_mould","tab_")->add($ratiov);
}
public function add()
{
@ -84,18 +223,25 @@ class GameRatioMouldController extends AdminController
$save["admin_name"]=$this->admininfo["username"];
$save["admin_id"]=$this->admininfo["uid"];
$save["create_time"]=time();
$save["begin_time"] = strtotime($params["begin_time"]) ?? 0;
$save["end_time"] = $params["end_time"] ?strtotime($params["end_time"])+86399: 0;
$save["turnover_type"] = $params["turnover_type"] ?? 0;
//判断是否存在
$where = [
"relation_game_id"=>$save['relation_game_id'],
"company_belong"=>$save['company_belong']
];
$hasdb = $this->DBModel->field("count(id) count")->where($where)->find()['count'];
if($hasdb > 0){
$this->error('该游戏与该公司类型的模板已经存在,请搜索后编辑');
}
// $where = [
// "relation_game_id"=>$save['relation_game_id'],
// "company_belong"=>$save['company_belong']
// ];
// $hasdb = $this->DBModel->field("count(id) count")->where($where)->find()['count'];
// if($hasdb > 0){
// $this->error('该游戏与该公司类型的模板已经存在,请搜索后编辑');
// }
$this->companyRatioTimeChange($save['company_belong'],$save['relation_game_id'],$save["begin_time"],$save["end_time"],$save);
//保存
$id = $this->DBModel->add($save);
addOperationLog(['op_type'=>0,'key'=>$id,'op_name'=>'新增游戏分成比例模板','url'=>U('GameRatioMould/index')]);
// $id = $this->DBModel->add($save);
addOperationLog(['op_type'=>0,'key'=>$save['relation_game_id'],'op_name'=>'新增游戏分成比例模板','url'=>U('GameRatioMould/index')]);
$this->ajaxReturn(["msg"=>"添加成功","code"=>1,"url"=>U("index")]);
} else {
$game_type = M("game_type","tab_")->field("id,type_name")->where("status=1")->select();
@ -116,6 +262,7 @@ class GameRatioMouldController extends AdminController
$save['id'] = $params['id'];
$save["create_time"]=time();
$save['turnover_ratio'] = $this->setTurnoverRatio($params);
$save["turnover_type"] = $params["turnover_type"] ?? 0;
$this->DBModel->save($save);
addOperationLog(['op_type'=>1,'key'=>$save['id'],'op_name'=>'修改游戏分成比例模板','url'=>U('PromoteGameRatio/index')]);
@ -129,6 +276,10 @@ class GameRatioMouldController extends AdminController
$dbres = $this->DBModel->alias('m')->join("INNER JOIN ({$gameres}) g ON m.relation_game_id = g.relation_game_id")->where($map)->find();
$dbres['turnover_ratio'] = $dbres['turnover_ratio'] ? json_decode($dbres['turnover_ratio'], true) : $dbres['turnover_ratio'];
$dbres['company_belong'] = getCompanyBlong($dbres['company_belong']);
$dbres['begin_time'] = date("Y-m-d",$dbres['begin_time']);
$dbres['end_time'] = $dbres['end_time']==0 ? '永久' :date("Y-m-d",$dbres['end_time']);
$this->assign('data', $dbres);
$this->display();
}
@ -210,28 +361,44 @@ class GameRatioMouldController extends AdminController
}
return $save['turnover_ratio'];
}
//设置比例阶梯
protected function readTurnoverRatio(&$v){
$turnover_ratio = json_decode($v['turnover_ratio'],true);
$v['turnover_ratio'] = array(
array("ratio"=>floatval($v['ratio'])."%","name"=>"默认比例")
);
foreach($turnover_ratio as $ke=>$va){
$t=array("ratio"=>floatval($va["ratio"])."%");
if(array_key_exists("instanceof",$va)){
//存在
if($va['instanceof']=='1'){
$t['name']="月流水≥".$va['turnover'];
$radio = explode('|',$v['ratio']);
$turnover_ratio = explode('|',$v['turnover_ratio']);
$turnover_type = $v['turnover_types'];
$sec_row = 1;
foreach ($radio as $key => $value) {
$turnoverratio = json_decode($turnover_ratio[$key],true);
$v['turnover_ratios'][$key] = array(
array("ratio"=>floatval($value)."%","name"=>"默认比例")
);
foreach($turnoverratio as $ke=>$va){
$t=array("ratio"=>floatval($va["ratio"])."%");
if(array_key_exists("instanceof",$va)){
//存在
if($va['instanceof']=='1'){
$t['name']="{$turnover_type[$key]}≥".$va['turnover'];
}else{
$t['name']="{$turnover_type[$key]}".$va['turnover'];
}
}else{
$t['name']="月流水>".$va['turnover'];
$t['name']="{$turnover_type[$key]}≥".$va['turnover'];
}
}else{
$t['name']="月流水≥".$va['turnover'];
$sec_row++;
$v['turnover_ratios'][$key][]=$t;
}
$v['turnover_ratio'][]=$t;
$v['sec_row'][$key] = $sec_row;
$sec_row = 1;
}
$v['row'] = count($v['turnover_ratio']);
$v['row'] = array_sum($v['sec_row']);
}

@ -24,6 +24,7 @@ class MarketPercentageController extends ThinkController
$admin_id = $_SESSION['onethink_admin']['user_auth']['uid'];
$map['admin_id'] = $admin_id;
$map['is_settlement'] = 1;
if(is_administrator()||session('user_group_id') == 15||session('user_group_id') == 14||session('user_group_id') == 19||session('user_group_id') == 23) {
unset($map['admin_id']);
$admin_data = M("member")
@ -96,13 +97,13 @@ class MarketPercentageController extends ThinkController
if ($_REQUEST['export']) {
$data = $data->where($map)
->group("promote_id,game_name,pay_time,admin_id")
->order("pay_time DESC")
->order("pay_time DESC,company_profit DESC")
->select();
} else {
$data = $data->page($p, $row)
->where($map)
->group("promote_id,game_name,pay_time,admin_id")
->order("pay_time DESC")
->order("pay_time DESC,company_profit DESC")
->select();
}
@ -188,6 +189,184 @@ class MarketPercentageController extends ThinkController
}
public function indexuncaculate($row = 10, $p = 1){
$map = [];
// $_REQUEST['pay_time']?($map['pay_time'] = $_REQUEST['pay_time']):'';
$_REQUEST['promote_id']?($map['promote_id'] = $_REQUEST['promote_id']):'';
$_REQUEST['relation_game_id']?($map['relation_game_id'] = $_REQUEST['relation_game_id']):'';
$_REQUEST['sdk_version']?($map['sdk_version'] = $_REQUEST['sdk_version']):'';
$_REQUEST['admin_id']?($map['admin_id'] = $_REQUEST['admin_id']):'';
($_REQUEST['company_id']||$_REQUEST['company_id']=='0')?($map['company_id'] = $_REQUEST['company_id']):'';
$admin_id = $_SESSION['onethink_admin']['user_auth']['uid'];
$map['admin_id'] = $admin_id;
$map['is_settlement'] = 0;
if(is_administrator()||session('user_group_id') == 15||session('user_group_id') == 14||session('user_group_id') == 19||session('user_group_id') == 23) {
unset($map['admin_id']);
$admin_data = M("member")
->field("access.uid admin_id")
->join("left join sys_auth_group_access access on sys_member.uid = access.uid")
->join("left join sys_auth_group auth on access.group_id=auth.id")
->where(['group_id'=>['in','11,12,21']])
->select();
if ($admin_data) {
$map['admin_id'] = ['in',array_column($admin_data,'admin_id')];
}
$_REQUEST['admin_id']?($map['admin_id'] = $_REQUEST['admin_id']):'';
}
$search_date = [];
if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) {
$end = $_REQUEST['time_end'];
$start = $_REQUEST['time_start'];
$i = 0;
do {
$date = date('Y-m', strtotime($start . ' + ' . $i . ' month'));
$search_date[] = $date;
$i++;
}while ($date < date('Y-m', strtotime("{$end}")));
if ($search_date) {
$map['pay_time'] = ['in', $search_date];
}
} elseif (isset($_REQUEST['time_start'])) {
$end = date("Y-m",time());
$start = $_REQUEST['time_start'];
$i = 0;
do {
$date = date('Y-m', strtotime($start . ' + ' . $i . ' month'));
$search_date[] = $date;
$i++;
}while ($date < date('Y-m', strtotime("{$end}")));
if ($search_date) {
$map['pay_time'] = ['in', $search_date];
}
} elseif (isset($_REQUEST['time_end'])) {
$end = $_REQUEST['time_end'];
$start = '2019-08';
$i = 0;
do {
$date = date('Y-m', strtotime($start . ' + ' . $i . ' month'));
$search_date[] = $date;
$i++;
}while ($date < date('Y-m', strtotime("{$end}")));
if ($search_date) {
$map['pay_time'] = ['in', $search_date];
}
}
// dump($map);die();
// var_dump($map);die();
$data = M("settleup_marketorder","tab_")
->field("pay_time,promote_account,company_name,company_belong,member.real_name,develop_type,game_name,
sum(pay_amount) pay_amount,sum(cp_amount) cp_amount,sum(promote_amount) promote_amount,
sum(channel_amount) channel_amount, sum(company_tax) company_tax,sum(company_profit) company_profit")
->join("left join sys_member member on member.uid=admin_id");
if ($_REQUEST['export']) {
$data = $data->where($map)
->group("promote_id,game_name,pay_time,admin_id")
->order("pay_time DESC,company_profit DESC")
->select();
} else {
$data = $data->page($p, $row)
->where($map)
->group("promote_id,game_name,pay_time,admin_id")
->order("pay_time DESC,company_profit DESC")
->select();
}
$sum = M("settleup_marketorder","tab_")
->field("pay_time,promote_account,company_belong,real_name,develop_type,game_name,
sum(pay_amount) pay_amount,sum(cp_amount) cp_amount,sum(promote_amount) promote_amount,
sum(channel_amount) channel_amount, sum(company_tax) company_tax,sum(company_profit) company_profit")
->where($map)
->find();
$this->assign("sum",$sum);
foreach ($data as $key => $value) {
if ($value['company_belong'] == 0) {
$data[$key]['company_belong'] = '内团';
} else if ($value['company_belong'] == 1) {
$data[$key]['company_belong'] = '外团';
} else if ($value['company_belong'] == 2) {
$data[$key]['company_belong'] = '外团-分发联盟';
} else {
$data[$key]['company_belong'] = '无';
}
if ($value['develop_type'] == 1) {
$data[$key]['develop_type'] = '自主开发';
} else if ($value['develop_type'] == 2) {
$data[$key]['develop_type'] = '自主开发及维护';
} else if ($value['develop_type'] == 3) {
$data[$key]['develop_type'] = '只维护';
} else {
$data[$key]['develop_type'] = '无';
}
}
if ($_REQUEST['export']) {
$title = ['pay_time' => '时间',
'company_name'=>'公司名称',
'promote_account' => '会长账号',
'company_belong' => '内外团',
'real_name' => '所属市场专员',
'develop_type' => '类型',
'game_name' => '游戏名称',
'pay_amount' => '总流水',
'cp_amount' => '上游结算流水',
'promote_amount' => '下游结算流水',
'channel_amount' => '支付渠道费用',
'company_tax' => '公司税费',
'company_profit' => '税后毛利额'];
foreach ($data as $key => $value) {
$data[$key]['pay_time'] = '`'.$data[$key]['pay_time'];
}
$sum['pay_time'] = '';
$sum['promote_account'] = '';
$sum['company_belong'] = '合计';
$sum['real_name'] = '';
$sum['develop_type'] = '';
$sum['game_name'] = '';
$data = array_merge($data,[$sum]);
data2csv($data,'市场毛利统计(不结算)',$title);
}
$count = M("settleup_marketorder","tab_")
->where($map)
->group("promote_id,game_name,pay_time,admin_id")
->select(false);
$count = M()->table("({$count}) count")->count();
$page = set_pagination($count, $row);
if ($page) {
$this->assign('_page', $page);
}
$this->checkListOrCountAuthRestMap($map,[]);
$this->assign("list_data",$data);
$this->display();
}
public function marketStaffSettle($row = 10, $p = 1) {
$map = [];
@ -291,7 +470,7 @@ class MarketPercentageController extends ThinkController
->field("tab_market_altogether.*,market_percentage")
->join("left join sys_auth_group_access access on tab_market_altogether.admin_id = access.uid")
->join("left join sys_auth_group auth on access.group_id=auth.id")
->order("pay_time DESC")
->order("pay_time DESC,company_profit DESC")
->select();
} else {
$data = $data
@ -299,7 +478,7 @@ class MarketPercentageController extends ThinkController
->join("left join sys_auth_group_access access on tab_market_altogether.admin_id = access.uid")
->join("left join sys_auth_group auth on access.group_id=auth.id")
// ->page($p, $row)
->order("pay_time DESC")
->order("pay_time DESC,company_profit DESC")
->select();
}
@ -717,12 +896,12 @@ class MarketPercentageController extends ThinkController
if ($_REQUEST['export']) {
$data = $data
->order("pay_time DESC")
->order("pay_time DESC,company_profit DESC")
->select();
} else {
$data = $data
// ->page($p, $row)
->order("pay_time DESC")
->order("pay_time DESC,company_profit DESC")
->select();
}
@ -1050,13 +1229,13 @@ class MarketPercentageController extends ThinkController
if ($_REQUEST['export']) {
$data = $data
->order("pay_time DESC")
->order("pay_time DESC,company_profit DESC")
->group("admin_id")
->select();
} else {
$data = $data
// ->page($p, $row)
->order("pay_time DESC")
->order("pay_time DESC,company_profit DESC")
->group("admin_id")
->select();
}
@ -1232,4 +1411,351 @@ class MarketPercentageController extends ThinkController
}
public function companybelonggame($row = 10, $p = 1) {
if ($_REQUEST['relation_game_id']) {
$game_id = $_REQUEST['relation_game_id'];
$where['game_ids'] = ['like',"%,{$game_id},%"];
}
$where = [];
if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) {
$time_start = strtotime($_REQUEST['time_start']);
$time_end = strtotime($_REQUEST['time_end'])+ 86399;
$where["_string"] = "(begin_time BETWEEN {$time_start} AND {$time_end}) OR (end_time BETWEEN {$time_start} AND {$time_end}) OR (begin_time <= {$time_end} AND end_time >= {$time_end}) OR (begin_time >0 AND end_time = 0)";
} elseif (isset($_REQUEST['time_start'])) {
$time_start = strtotime($_REQUEST['time_start']);
$where["_string"] = "end_time >= {$time_start} OR end_time = 0";
} elseif (isset($_REQUEST['time_end'])) {
$time_end = strtotime($_REQUEST['time_end'])+ 86399;
$where["_string"] = "begin_time <= {$time_end}";
}
$data = M("company_belong_game","tab_")
->where($where)
->page($p, $row)
->order("begin_time DESC")
->select();
foreach ($data as $key => $value) {
$data[$key]["begin_time"] = date("Y.m.d",$value['begin_time']);
if($value['end_time'] == 0) {
$data[$key]["end_time"] = "永久";
} else{
$data[$key]["end_time"] = date("Y.m.d",$value['end_time']);
}
$where_game = $value['game_ids'];
if ($_REQUEST['relation_game_id']) {
$where_game = $_REQUEST['relation_game_id'];
}
$game = [];
if ($where_game) {
$game = M("game","tab_")
->field("original_package_name,relation_game_name,relation_game_id,game_type_name")
->where(['relation_game_id'=>['in',$where_game]])
->group("relation_game_id")
->select();
}
$data[$key]['row'] = count($game);
$data[$key]['game_data'] = $game;
}
$count = M("company_belong_game","tab_")
->where($where)
->count();
$page = set_pagination($count, $row);
if ($page) {
$this->assign('_page', $page);
}
$this->assign("gameList",D("Game")->getRelationGameLits());
$this->assign("data",$data);
$this->display();
}
public function addcompanybelonggame() {
if (IS_POST) {
$data = $_POST;
if (!$data['begin_time']) {
$this->ajaxReturn(['msg'=>"起始时间必填","status"=>0]);
}
if (!$data['game_ids']) {
$this->ajaxReturn(['msg'=>"请选择推广游戏","status"=>0]);
}
$data['game_ids'] = explode(',',$data['game_ids']);
$data['game_ids'] = array_merge([''],$data['game_ids'],['']);
$data['game_ids'] = implode(',',$data['game_ids']);
$data['begin_time'] = strtotime($data['begin_time']);
$data['end_time'] = strtotime($data['end_time']);
$time_start = $data['begin_time'];
if($data['end_time']) {
$time_end = $data['end_time'];
} else {
$time_end = 99999999999;
}
$last_month = strtotime(date('Y-m-t',strtotime("-2 month")));
if ($data['begin_time'] < $last_month) {
$this->ajaxReturn(['msg'=>"已经结算过的时间不能添加","status"=>0]);
}
$belong_game = M("company_belong_game","tab_")
->where("((begin_time<={$time_start} and (end_time >={$time_start} or end_time=0)) or (begin_time<={$time_end} and end_time >={$time_end}) or (end_time>={$time_start} and end_time <={$time_end}))")
->select();
if ($belong_game) {
$this->ajaxReturn(['msg'=>"重复时间段,请勿重复添加","status"=>0]);
}
M("company_belong_game","tab_")->add($data);
$this->ajaxReturn(['msg'=>"添加成功,请到对应时间段市场业绩重新结算,否则数据可能无法对上","status"=>1]);
} else {
$this->display();
}
}
public function editcompanybelonggame() {
$id = $_REQUEST["id"];
if (IS_POST) {
$data = $_POST;
if (!$data['begin_time'] && !$data['is_start']) {
$this->ajaxReturn(['msg'=>"起始时间必填","status"=>0]);
}
if (!$data['game_ids']) {
$this->ajaxReturn(['msg'=>"请选择推广游戏","status"=>0]);
}
// $data['game_ids'] = json_encode($data['game_ids']);
$data['game_ids'] = explode(',',$data['game_ids']);
foreach ($data['game_ids'] as $key => $value) {
if ($value == "0") {
unset($data['game_ids'][$key]);
}
}
$data['game_ids'] = array_merge([''],$data['game_ids'],['']);
$data['game_ids'] = implode(',',$data['game_ids']);
$time_start = strtotime($data['begin_time']);
if($data['end_time']) {
$time_end = strtotime($data['end_time']);
} else {
$time_end = 99999999999;
}
$data['begin_time'] = strtotime($data['begin_time']);
$data['end_time'] = strtotime($data['end_time']);
$company_belong_game_data = M("company_belong_game","tab_")->where(['id'=>$id])->find();
if ($data['is_start']) {
$time_start = $company_belong_game_data['begin_time'];
$data['begin_time'] = $company_belong_game_data['begin_time'];
}
$last_month = strtotime(date('Y-m-t',strtotime("-2 month")));
if ($company_belong_game_data['end_time'] > $last_month && $data['end_time'] < $last_month)
{
$time_end = $last_month;
$data['end_time'] = $last_month;
// $this->ajaxReturn(['msg'=>"过去已结算过的比例不能修改","status"=>0]);
}
$last_month_first = strtotime(date('Y-m-1',strtotime("-1 month")));
if ($company_belong_game_data['begin_time'] > $last_month && $data['begin_time'] < $last_month)
{
// $time_end = $last_month;
$data['begin_time'] = $last_month_first;
// $this->ajaxReturn(['msg'=>"过去已结算过的比例不能修改","status"=>0]);
}
if ($data['begin_time'] < $last_month && $data['end_time'] <= $last_month) {
if($company_belong_game_data['end_time']<= $last_month) {
$data['end_time'] = $company_belong_game_data['end_time'];
} else {
$data['end_time'] = $last_month;
}
}
$belong_game = M("company_belong_game","tab_")
->where("((begin_time<={$time_start} and (end_time >={$time_start} or end_time=0)) or (begin_time<={$time_end} and end_time >={$time_end}) or (end_time>={$time_start} and end_time <={$time_end})) and id != {$id}")
->select();
if ($belong_game) {
$this->ajaxReturn(['msg'=>"重复时间段,请勿重复添加","status"=>0]);
}
M("company_belong_game","tab_")->where(['id'=>$id])->save($data);
$this->ajaxReturn(['msg'=>"编辑成功,请到对应时间段市场业绩重新结算,否则数据可能无法对上","status"=>1]);
} else {
$data = M("company_belong_game","tab_")
->where(['id'=>$id])
->find();
// $data['game_ids'] = json_encode(explode(',',$data['game_ids']));
$game_ids = explode(',',$data['game_ids']);
$data['game_ids'] = explode(',',$data['game_ids']);
foreach($game_ids as $key => $value) {
if ($value == "\"") {
unset($game_ids[$key]);
} else {
$game_ids[$key] = $value-0;
}
}
$data['is_start'] = 0;
if($data['begin_time']<strtotime(date("Y-m-1",strtotime('-1 month')))) {
$data['is_start'] = 1;
}
$data['ids'] = implode(',',$game_ids);
$game_ids = json_encode(array_values($game_ids));
$data['game_ids'] = $game_ids;
$data['begin_time'] = date("Y-m-d",$data['begin_time']);
$data['end_time'] = date("Y-m-d",$data['end_time']);
if ($game_ids) {
$game = M("game","tab_")->field("relation_game_name")
->where(['relation_game_id'=>['in',$data['ids']]])
->group("relation_game_id")
->select();
$span_str = "";
foreach ($game as $key => $value) {
$span_str .= "<span style='margin-left: 15px'>{$value['relation_game_name']}</span>";
if (($key+1)%5 == 0) {
$span_str .= "<br>";
}
}
$data['span_str'] = $span_str;
}
$this->assign("data",$data);
$this->display();
}
}
public function delcompanybelonggame() {
$id = $_REQUEST["id"];
if (!$id) {
$this->ajaxReturn(['msg'=>"参数传递错误","status"=>0]);
}
$data = M("company_belong_game","tab_")
->where(['id'=>$id])
->find();
if (date("m",$data['begin_time']) < date("m",strtotime('-1 month'))) {
$this->ajaxReturn(['msg'=>"过去已结算过的比例不能删除","status"=>0]);
}
$is_del = M("company_belong_game","tab_")
->where(['id'=>$id])
->delete();
if ($is_del) {
$this->ajaxReturn(['msg'=>"删除成功,请到对应时间段市场业绩重新结算,否则数据可能无法对上","status"=>1]);
} else {
$this->ajaxReturn(['msg'=>"删除失败","status"=>0]);
}
}
public function showGame() {
$data = $_REQUEST;
if (!$data['game_ids']) {
$this->ajaxReturn(['msg'=>"请选择游戏后点击确定","status"=>0]);
}
$game_data = M("game","tab_")
->field("relation_game_name,relation_game_id,game_type_name")
->where(['relation_game_id'=>['in',$data['game_ids']]])
->group("relation_game_id")
->select();
$this->ajaxReturn(['msg'=>"选择游戏成功","status"=>1,"data"=>$game_data]);
}
//获取推广员可推广游戏
public function getPromoteGame()
{
if (IS_AJAX) {
//获取所有游戏
// $promoteId = I('id', 0, 'intval');
// $promote = M('promote', 'tab_')->field('id,account,game_ids,company_id')->where(['id'=>$promoteId])->find();
// $company = M('promote_company', 'tab_')->field('game_ids')->where(['id' => $promote['company_id']])->find();
$data = [];
$games = M('game', 'tab_')
->field('relation_game_id id,relation_game_name game_name,short')
->where(['game_status'=>1])
->group("relation_game_id")
->select();
$data['data']['game_list'] = empty($games) ? '' : $games;
$data['msg'] = '请求成功';
$data['code'] = 1;
$this->ajaxReturn($data);
exit;
}
}
}

@ -414,7 +414,7 @@ class PaymentMerchantController extends ThinkController
$query = M('payment_rule', 'tab_')->where($conditions);
$countQuery = clone $query;
$items = $query->order('id desc')->page($page, $row)->select();
$items = $query->order('start_time desc')->page($page, $row)->select();
$count = $countQuery->count();
$gameTypes = $gameService->getGameTypes(null, 'id,type_name');
@ -509,9 +509,11 @@ class PaymentMerchantController extends ThinkController
'message' => $message
]);
}
$paymentRuleService = new PaymentRuleService();
$records = $paymentRuleService->filterRecords($records);
$ids = [];
$paymentRuleService = new PaymentRuleService();
foreach ($records as $record) {
$startTime = $record['start_time'] == '' ? 0 : strtotime($record['start_time'] . ' 00:00:00');
$endTime = $record['end_time'] == '' ? PaymentRuleService::FOREVER_TIME : strtotime($record['end_time'] . ' 23:59:59');
@ -607,7 +609,7 @@ class PaymentMerchantController extends ThinkController
]);
}
$startTime = $params['start_time'] == '' ? 0 : strtotime($params['start_time'] . ' 00:00:00');
/* $startTime = $params['start_time'] == '' ? 0 : strtotime($params['start_time'] . ' 00:00:00');
$endTime = $params['end_time'] == '' ? PaymentRuleService::FOREVER_TIME : strtotime($params['end_time'] . ' 23:59:59');
if (date('Ymd', $rule['start_time']) <= date('Ymd') && $startTime != $rule['start_time']) {
@ -635,14 +637,14 @@ class PaymentMerchantController extends ThinkController
'status' => 0,
'message' => '最后生效时间在今日之前,不可修改'
]);
}
} */
$item = [
'alipay_merchant_id' => $params['alipay_merchant_id'],
'weixin_merchant_id' => $params['weixin_merchant_id'],
'express_merchant_id' => $params['express_merchant_id'],
'start_time' => $startTime,
'end_time' => $endTime,
// 'start_time' => $startTime,
// 'end_time' => $endTime,
'update_time' => time()
];
@ -675,6 +677,13 @@ class PaymentMerchantController extends ThinkController
]);
}
if ($rule['start_time'] < strtotime(date('Y-m-d 23:59:59', time()))) {
$this->ajaxReturn([
'status' => 0,
'message' => '该记录不可删除,规则开始时间包含今天或今天之前的时间。'
]);
}
M('payment_rule', 'tab_')->where(['id' => $id])->delete();
addOperationLog([
'op_type' => 2,
@ -735,6 +744,9 @@ class PaymentMerchantController extends ThinkController
$isRepat = false;
$paymentRuleService = new PaymentRuleService();
$records = $paymentRuleService->filterRecords($records);
foreach ($records as $record) {
$rules = $paymentRuleService->getTimeRepeatRules($record);
if (count($rules)) {

@ -473,7 +473,7 @@ class PlatformController extends ThinkController
$play_info_map = false;
if (isset($_REQUEST['server_id'])) {
$play_map = false; //有区服就不检索玩家表,有区服一定已经选择游戏了
$play_info_map = " and upi.server_id = '{$_REQUEST['server_id']}' and upi.game_name = '{$_REQUEST['game_name']}'";
$play_info_map = " and upi.server_id = '{$_REQUEST['server_id']}' and upi.game_name like '{$_REQUEST['game_name']}%'";
}
if (!empty($_REQUEST['admin_id'])) {
@ -515,7 +515,7 @@ class PlatformController extends ThinkController
substring_index(substring_index(promote.`chain`,'/',2),'/',-1)),0) id")
->join("tab_promote promote ON u.promote_id = promote.id","left")
->join($play_map ? "tab_user_play as up on up.user_id = u.id " . $play_map : false)
// ->join($play_info_map ? "tab_user_play_info as upi on upi.user_id = u.id " . $play_info_map : false)
->join($play_info_map ? "tab_user_play_info as upi on upi.user_id = u.id " . $play_info_map : false)
->join('tab_game on u.fgame_id = tab_game.id')
->where($map)
->group('tab_game.relation_game_id, id')

@ -68,8 +68,13 @@ class PromoteCompanyController extends ThinkController
//换成id
$g_name = $_REQUEST['game_name'];
$g_id = M("Game","tab_")->where("relation_game_name = '{$g_name}'")->field("relation_game_id")->find()['relation_game_id'];
$reg_str = "([^0-9]|^){$g_id },";
$map["game_ids"]=["EXP","REGEXP '{$reg_str}'"];
// $reg_str = "([^0-9]|^){$g_id },";
if (isset($map["_string"])) {
$map['_string'] = ' AND concat(",", game_ids, ",") like "%,' . $g_id . ',%"';
}else{
$map["_string"] = ' concat(",", game_ids, ",") like "%,' . $g_id . ',%"';
}
// $map["game_ids"]=["EXP","REGEXP '{$reg_str}'"];
}
if (isset($_REQUEST['is_sign_contact'])) {
@ -86,7 +91,7 @@ class PromoteCompanyController extends ThinkController
if(isset($map["_string"])){
$map["_string"] .= " ADN id in ($c_id)";
}else{
$map["_string"] = "id in ($c_id)";
$map["_string"] = " id in ($c_id)";
}
}
@ -107,7 +112,6 @@ class PromoteCompanyController extends ThinkController
}else{
$companyres = $companyres->page($page,$row)->select();
}
$payWays = PresidentDepositService::$payWays;
$payTypes = PresidentDepositService::$payTypes;
$statusList = PresidentDepositService::$statusList;

@ -764,7 +764,10 @@ class TimingController extends AdminController {
*/
public function getSpecialComplement($start_time=0,$end_time =0,$promote_id = 0) {
$data = M("company_statement","tab_")->where("statement_begin_time<={$start_time} and statement_end_time<={$end_time} and withdraw_type=3")->select();
$data = M("company_statement","tab_")
// ->where("statement_begin_time<={$start_time} and statement_end_time<={$end_time} and withdraw_type=3")
->where("(statement_begin_time <={$end_time} AND ( statement_end_time = 0 OR statement_end_time >= {$start_time})) and withdraw_type=3")
->select();
$return = [];
foreach ($data as $key => $value) {
@ -776,6 +779,13 @@ class TimingController extends AdminController {
foreach ($statement_info as $skey => $sval) {
$info = $sval['game_list'];
foreach ($info as $k => $v) {
$statement_begin_time = strtotime(str_replace('.','-',$v['statement_begin_time']));
$statement_end_time = strtotime(str_replace('.','-',$v['statement_end_time']))+86399;
if (date("m",$statement_begin_time)!=date("m",$start_time) || date("m",$statement_end_time)!=date("m",$end_time)) {
continue;
}
//
if (isset($return[$statement_info['promote_id'].$v['relation_game_id']])) {
$return[$value['company_id']."-".$sval['promote_id']."-".$v['relation_game_id']] = !$is_inside?$v['sum_money']:0;
@ -793,6 +803,11 @@ class TimingController extends AdminController {
foreach ($statement_info as $k => $v) {
$statement_begin_time = strtotime(str_replace('.','-',$v['statement_begin_time']));
$statement_end_time = strtotime(str_replace('.','-',$v['statement_end_time']))+86399;
if (date("m",$statement_begin_time)!=date("m",$start_time) || date("m",$statement_end_time)!=date("m",$end_time)) {
continue;
}
$amount_time['tab_spend.pay_status'] = 1;
$amount_time['pay_way'] = ['egt',0];
$amount_time['_string'] = "payed_time between {$statement_begin_time} and {$statement_end_time} and relation_game_id={$v['relation_game_id']}";
@ -825,20 +840,22 @@ class TimingController extends AdminController {
}
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));
}
// $admin_id = 0,$promote_id = 0,$company_id=0,$relation_game_id=0,$date ='',$pay_amount = 0
public function getCompanyGameRadio($admin_id = 0,$promote_id = 0,$company_id=0,$relation_game_id=0,$date ='',$pay_amount = 0) {
// $company_id=273;
public function getCompanyGameRadio($admin_id = 0,$promote_id = 0,$company_id=0,$relation_game_id=0,$begintime=0,$endtime =0,$pay_amount = 0) {
// $company_id=239;
// $relation_game_id=213;
// $pay_amount = 440;
// $date = "2020-07";
// $admin_id = 50;
// $promote_id = 3711;
$begintime = strtotime(date("Y-m-1",strtotime($date)));
$endtime = strtotime(date("Y-m-t",strtotime($date)))+86399;
// $date = "2020-08";
// $admin_id = 27;
// $promote_id = 3235;
// $begintime = strtotime(date("Y-m-1",strtotime($date)));
// $endtime = strtotime(date("Y-m-t",strtotime($date)))+86399;
$is_inside = M("PromoteCompany","tab_")->field("is_inside")->where("id='{$company_id}'")->find()['is_inside'];
@ -847,78 +864,49 @@ class TimingController extends AdminController {
return 0;
}
$company_game_ratio = M("company_game_ratio","tab_")
->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id])
->where("(end_time>={$begintime} and (end_time<={$endtime} and end_time!=0)) or (begin_time>={$begintime} and begin_time<={$endtime}) or (begin_time<={$begintime} and (end_time>={$endtime} or end_time=0))")
->order("begin_time ASC")
->select();
// $company_game_ratio = M("company_game_ratio","tab_")
// ->where(['company_id'=>$company_id,'relation_game_id'=>$relation_game_id])
// ->where("(end_time>={$begintime} and (end_time<={$endtime} and end_time!=0)) or (begin_time>={$begintime} and begin_time<={$endtime}) or (begin_time<={$begintime} and (end_time>={$endtime} or end_time=0))")
// ->order("begin_time ASC")
// ->select();
//
$company_data = M('promote_company','tab_')
->field("company_belong")
->where("id=$company_id")
->where("id={$company_id}")
->find();
//
// $game_ratio_mould = M("game_ratio_mould","tab_")
// ->where(['relation_game_id'=>$relation_game_id,'company_belong'=>$company_data['company_belong'],
// "_string"=>"begin_time <={$endtime} AND ( end_time = 0 OR end_time >= {$begintime})"])
// ->select();
$game_ratio_mould = M("game_ratio_mould","tab_")
->where(['relation_game_id'=>$relation_game_id,'company_belong'=>$company_data['company_belong']])
->find();
$company_game_ratio = D("CompanyGameRatio")->getPromoteCompanyGameRatio($company_id,(string)$relation_game_id,$begintime,$endtime,$company_data['company_belong']);
$mould = json_decode($game_ratio_mould['turnover_ratio'],true);
$company_game_ratio = $company_game_ratio[$relation_game_id];
// $mould = json_decode($company_game_ratio['turnover_ratio'],true);
$amount = 0;
if (!$company_game_ratio) {
$spend = $this->getSpendData($begintime,$endtime,$company_id,$relation_game_id,$admin_id,$promote_id);
$amount += $this->setSpendData($spend,$mould,$game_ratio_mould['ratio'],$pay_amount);
}
foreach ($company_game_ratio as $key => $value) {
$turnover_ratio = json_decode($value['turnover_ratio'],true);
if($value['begin_time'] > $begintime) {
// $spend = $this->getSpendData($begintime,$endtime,$company_id,$relation_game_id,$admin_id,$promote_id);
// $amount += $this->setSpendData($spend,$mould,$game_ratio_mould['ratio'],$pay_amount);
if ($key == 0) {
$spend = $this->getSpendData($begintime,$value['begin_time']-1,$company_id,$relation_game_id,$admin_id,$promote_id);
$amount += $this->setSpendData($spend,$mould,$game_ratio_mould['ratio'],$pay_amount);
}
if ($value['end_time']<$endtime&&($value['end_time']!=0)) {
$spend = $this->getSpendData($value['begin_time'],$value['end_time'],$company_id,$relation_game_id,$admin_id,$promote_id);
$amount += $this->setSpendData($spend,$turnover_ratio,$value['ratio'],$pay_amount);
} else {
$spend = $this->getSpendData($value['begin_time'],$endtime,$company_id,$relation_game_id,$admin_id,$promote_id);
$amount += $this->setSpendData($spend,$turnover_ratio,$value['ratio'],$pay_amount);
break;
}
} elseif ($value['begin_time']<=$begintime) {
return 0;
$value['begin_time']=$begintime;
if ($value['end_time']<$endtime&&($value['end_time']!=0)) {
$spend = $this->getSpendData($value['begin_time'],$value['end_time'],$company_id,$relation_game_id,$admin_id,$promote_id);
$amount += $this->setSpendData($spend,$turnover_ratio,$value['ratio'],$pay_amount);
} else {
$spend = $this->getSpendData($value['begin_time'],$endtime,$company_id,$relation_game_id,$admin_id,$promote_id);
$amount += $this->setSpendData($spend,$turnover_ratio,$value['ratio'],$pay_amount);
break;
}
}
}
foreach ($company_game_ratio as $key => $value) {
$turnover_ratio = json_decode($value['turnover_ratio'],true);
// dump($value);
//缺片段的情况下用模板比例补充
if ($company_game_ratio[$key+1]['begin_time'] != $value['end_time']+1 && $company_game_ratio[$key+1]) {
$spend = $this->getSpendData($value['end_time']+1,$company_game_ratio[$key+1]['begin_time']-1,$company_id,$relation_game_id,$admin_id,$promote_id);
$amount += $this->setSpendData($spend,$mould,$game_ratio_mould['ratio'],$pay_amount);
}
$spend = $this->getSpendData($value['begintime'],$value['endtime'],$company_id,$relation_game_id,$admin_id,$promote_id);
// dump($spend);
//如果最后还有缺失的片段再用模板补齐
if(!$company_game_ratio[$key+1]&&$endtime>$value['end_time']) {
$spend = $this->getSpendData($value['end_time']+1,$endtime,$company_id,$relation_game_id,$admin_id,$promote_id);
$amount += $this->setSpendData($spend,$mould,$game_ratio_mould['ratio'],$pay_amount);
}
$amount += $this->setSpendData($spend,$turnover_ratio,$value['ratio'],$pay_amount);
}
// dump($amount);die();
return $amount?$amount:0;
@ -993,9 +981,32 @@ class TimingController extends AdminController {
$map['pay_time'] = $_REQUEST['time'];
}
$spend_map = [];
$time_start = 0;
$time_end = 0;
$month_time = [];
if($_REQUEST['time'] == 'all') {
$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())-2).'-01'));
$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')))];
} else {
$month_time = $map['pay_time'];
$time_start = strtotime(date('Y-m-1',strtotime($map['pay_time'])));
$time_end = strtotime(date('Y-m-t',strtotime($map['pay_time'])));
$belong_map = "((begin_time<={$time_start} and (end_time >={$time_start} or end_time=0)) or (begin_time<={$time_end} and end_time >={$time_end}) or (end_time>={$time_start} and end_time <={$time_end}))";
}
if ($map['pay_time']) {
M("settleup_marketorder","tab_")
->where(['pay_time'=>['in',$month_time]])
->delete();
}
$data = M("auth_group")
@ -1009,10 +1020,46 @@ class TimingController extends AdminController {
->where("auth.title is not null")
->select(false);
$belong_game = M("company_belong_game","tab_")
->field("game_ids,begin_time,end_time")
->where($belong_map)
->select();
// if($belong_game) {
// unset($spend_map['pay_time']);
// }
$unsettlement = $spend_map;
foreach ($belong_game as $key => $value) {
$value['game_ids'] = explode(',',$value['game_ids']);
foreach ($value['game_ids'] as $k => $v) {
if (!$v) {
unset($value['game_ids'][$k]);
}
}
$value['game_ids'] = implode(',',$value['game_ids']);
if (!$spend_map['_string']) {
$spend_map['_string'] = "(pay_time between {$value['begin_time']} and {$value['end_time']}+86399 and relation_game_id in({$value['game_ids']}))";
} else {
$spend_map['_string'] .= " or (pay_time between {$value['begin_time']} and {$value['end_time']}+86399 and relation_game_id in({$value['game_ids']}))";
}
}
if (!$spend_map['_string']) {
$spend_map['_string'] = "relation_game_id = 0";
}
$spend = M("spend","tab_")
->field("sum(pay_amount) as pay_amount,FROM_UNIXTIME(pay_time,'%Y-%m') pay_time,
substring_index(substring_index(tab_spend.game_name,'(',1),'(',-1) game_name,game_id,relation_game_id,tab_spend.sdk_version,
CASE WHEN substring_index(substring_index(`chain`,'/',2),'/',-1) !='' THEN substring_index(substring_index(`chain`,'/',2),'/',-1) ELSE promote_id END promote_id,pay_way,market_admin_id")
CASE WHEN substring_index(substring_index(`chain`,'/',2),'/',-1) !='' THEN substring_index(substring_index(`chain`,'/',2),'/',-1) ELSE promote_id END promote_id,pay_way,market_admin_id,0 is_settlement")
->join("left join tab_promote on tab_spend.promote_id = tab_promote.id")
->join("left join tab_game game on game.id=tab_spend.game_id")
->where(['tab_spend.pay_status'=>1,'pay_way'=>['egt',0]])
@ -1020,25 +1067,34 @@ class TimingController extends AdminController {
->group("tab_spend.id")
->select(false);
// $desposit = M("deposit","tab_")
// ->field("sum(pay_amount) as pay_amount,FROM_UNIXTIME(payed_time,'%Y-%m') pay_time,
// substring_index(substring_index(tab_pay_info.game_name,'(',1),'(',-1) game_name,game_id,relation_game_id,tab_deposit.sdk_version,
// CASE WHEN substring_index(substring_index(`chain`,'/',2),'/',-1) !='' THEN substring_index(substring_index(`chain`,'/',2),'/',-1) ELSE tab_pay_info.promote_id END promote_id,tab_deposit.pay_way,market_admin_id")
// ->join("inner join tab_pay_info on tab_pay_info.order_id=tab_deposit.pay_order_number")
// ->join("left join tab_promote on tab_deposit.promote_id = tab_promote.id")
// ->join("left join tab_game game on game.id=tab_pay_info.game_id")
// ->where(['tab_deposit.pay_status'=>1,'tab_deposit.pay_way'=>['egt',1],'pay_source'=>2])
// ->where($spend_map)
// ->group("tab_deposit.id")
// ->select(false);
//
// $spend = "{$spend} UNION ALL {$desposit}";
$not_in_spend = M("spend","tab_")
->field("tab_spend.id id")
->join("left join tab_promote on tab_spend.promote_id = tab_promote.id")
->join("left join tab_game game on game.id=tab_spend.game_id")
->where(['tab_spend.pay_status'=>1,'pay_way'=>['egt',0]])
->where($spend_map)
->group("tab_spend.id")
->select(false);
$unsettlement['_string'] = "tab_spend.id not in($not_in_spend)";
$unsettlement_spend = M("spend","tab_")
->field("sum(pay_amount) as pay_amount,FROM_UNIXTIME(pay_time,'%Y-%m') pay_time,
substring_index(substring_index(tab_spend.game_name,'(',1),'(',-1) game_name,game_id,relation_game_id,tab_spend.sdk_version,
CASE WHEN substring_index(substring_index(`chain`,'/',2),'/',-1) !='' THEN substring_index(substring_index(`chain`,'/',2),'/',-1) ELSE promote_id END promote_id,pay_way,market_admin_id,1 is_settlement")
->join("left join tab_promote on tab_spend.promote_id = tab_promote.id")
->join("left join tab_game game on game.id=tab_spend.game_id")
->where(['tab_spend.pay_status'=>1,'pay_way'=>['egt',0]])
->where($unsettlement)
->group("tab_spend.id")
->select(false);
$spend = "{$spend} UNION ALL {$unsettlement_spend}";
// var_dump($desposit);die();
$payway_spend = M()->table("({$spend}) spend")
->field("sum(pay_amount) as pay_amount,pay_time,promote_id,game_name,game_id,relation_game_id,pay_way,sdk_version,market_admin_id")
->field("sum(pay_amount) as pay_amount,pay_time,promote_id,game_name,game_id,relation_game_id,pay_way,sdk_version,market_admin_id,is_settlement")
->where($map)
->group("pay_time,promote_id,game_name,pay_way,market_admin_id")
->group("pay_time,promote_id,game_name,pay_way,market_admin_id,is_settlement")
->select();
$channel_fee = [];
@ -1088,39 +1144,45 @@ class TimingController extends AdminController {
break;
}
//将时间、推广员id、游戏名、设备类型作为键值标记渠道费用
if (!$channel_fee[$value['pay_time'].$value['promote_id'].$value['game_name'].$value['market_admin_id']]) {
if (!$channel_fee[$value['pay_time'].$value['promote_id'].$value['game_name'].$value['market_admin_id'].$value['is_settlement']]) {
if (!$value['pay_way']) {
$channel_fee[$value['pay_time'].$value['promote_id'].$value['game_name'].$value['market_admin_id']] = 0;
$channel_fee[$value['pay_time'].$value['promote_id'].$value['game_name'].$value['market_admin_id'].$value['is_settlement']] = 0;
}
$channel_fee[$value['pay_time'].$value['promote_id'].$value['game_name'].$value['market_admin_id']]
$channel_fee[$value['pay_time'].$value['promote_id'].$value['game_name'].$value['market_admin_id'].$value['is_settlement']]
= $value['pay_amount'] * ($pay_rate[$value['pay_way']]/100);
} else {
$channel_fee[$value['pay_time'].$value['promote_id'].$value['game_name'].$value['market_admin_id']]
= $channel_fee[$value['pay_time'].$value['promote_id'].$value['game_name'].$value['market_admin_id']]+($value['pay_amount'] * ($pay_rate[$value['pay_way']]/100));
$channel_fee[$value['pay_time'].$value['promote_id'].$value['game_name'].$value['market_admin_id'].$value['is_settlement']]
= $channel_fee[$value['pay_time'].$value['promote_id'].$value['game_name'].$value['market_admin_id'].$value['is_settlement']]+($value['pay_amount'] * ($pay_rate[$value['pay_way']]/100));
}
}
$spend = M()->table("({$spend}) spend")
->field("sum(pay_amount) as pay_amount,pay_time,promote_id,game_name,game_id,relation_game_id,sdk_version,market_admin_id")
->field("sum(pay_amount) as pay_amount,pay_time,promote_id,game_name,game_id,relation_game_id,sdk_version,market_admin_id,is_settlement")
->where($map)
->group("pay_time,promote_id,game_name,market_admin_id")
->group("pay_time,promote_id,game_name,market_admin_id,is_settlement")
->select(false);
$promote_data = M()->table("({$spend}) spend")
->field("pay_time,company_id,company.company_name,account as promote_account,company.company_belong,develop_type,spend.promote_id,spend.game_name,game_id,relation_game_id,spend.pay_amount,auth.real_name,market_admin_id as admin_id,market_percentage,sdk_version")
->field("pay_time,company_id,company.company_name,account as promote_account,company.company_belong,develop_type,spend.promote_id,spend.game_name,game_id,relation_game_id,spend.pay_amount,auth.real_name,market_admin_id as admin_id,market_percentage,sdk_version,is_settlement")
->join("left join tab_promote promote on spend.promote_id = promote.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")
->where(['develop_type'=>['egt',1],'group_id'=>['in',['11','12','21']]])
// ->where(['company_id'=>313,'spend.promote_id'=>4359,'relation_game_id'=>191])
// ->order("is_settlement ASC")
->select();
//
// dump($tax_radio);die();
$specialPayAmount = [];
$unsettlement_amount = [];
foreach ($promote_data as $key => $value) {
if ($value['pay_time'] == date("Y-m",time())) {
continue;
}
$cp_radio = getGameCpRadio($value['game_id'],$value['pay_amount'],true);
if (!$cp_radio) {
$cp_radio = getGameCpRadio($value['game_id'],$value['pay_amount'],false);
@ -1133,21 +1195,140 @@ class TimingController extends AdminController {
// $promote_radio = getGamePromoteCompanyRadio($value['company_id'],$value['relation_game_id'],time(),$value['pay_amount'],false,$value['company_belong']);
// }
$begin_pay_time = strtotime(date("Y-m-1",strtotime($value['pay_time'])));
$end_pay_time = strtotime(date("Y-m-t",strtotime($value['pay_time'])))+86399;
$company_belong_game = M("company_belong_game","tab_")
->field("game_ids,begin_time,end_time")
->where("begin_time <={$end_pay_time} AND ( end_time = 0 OR end_time >= {$begin_pay_time})")
// ->where("((begin_time<={$begin_pay_time} and (end_time >={$begin_pay_time} or end_time=0)) or (begin_time<={$end_pay_time} and end_time >={$end_pay_time}) or (end_time>={$begin_pay_time} and end_time <={$end_pay_time}))")
->order("begin_time ASC")
->select();
$promote_data[$key]['promote_amount'] = 0;
foreach ($company_belong_game as $ck => $cv) {
$ungame_ids = explode(',',$cv['game_ids']);
if ($cv['end_time'] == 0 || !$cv['end_time']) {
$cv['end_time'] = 99999999999;
}
$use_begin = 0;
$use_end = 0;
if ($value['is_settlement'] == '0') {
if ($begin_pay_time > $cv['begin_time']) {
$use_begin = $begin_pay_time;
if ($end_pay_time > $cv['end_time']+86399) {
$use_end = $cv['end_time']+86399;
} else {
$use_end = $end_pay_time;
}
} else {
$use_begin = $cv['begin_time'];
if ($end_pay_time > $cv['end_time']) {
$use_end = $cv['end_time']+86399;
} else {
$use_end = $end_pay_time;
}
}
//下游流水
$promote_data[$key]['promote_amount'] += $this->getCompanyGameRadio($value['admin_id'],$value['promote_id'],$value['company_id'],$value['relation_game_id'],$use_begin,$use_end,$value['pay_amount']);
} elseif($value['is_settlement'] == '1') {
if ($ck == 0) {
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']);
// dump(date($begin_pay_time)."-".date($cv['begin_time']-1));
// dump($promote_data[$key]['promote_amount']);
}
}
if (!$company_belong_game[$ck+1]) {
if ($end_pay_time > $cv['end_time']) {
$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 (($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']);
}
}
if (!in_array($value['relation_game_id'],$ungame_ids)) {
if (($cv['end_time']+86399) > $end_pay_time) {
$cv['end_time'] = $end_pay_time;
} else {
$cv['end_time'] = $cv['end_time']+86399;
}
// dump($promote_data[$key]['promote_amount']);
// 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']);
// dump($promote_data[$key]['promote_amount']);
}
}
// if (!in_array($value['relation_game_id'],$ungame_ids)) {
//
// if ($begin_pay_time > $cv['begin_time']) {
// $use_begin = $begin_pay_time;
// if ($end_pay_time > $cv['end_time']+86399) {
// $use_end = $cv['end_time']+86399;
// } else {
// $use_end = $end_pay_time;
// }
// } else {
//
// $use_begin = $cv['begin_time'];
// if ($end_pay_time > $cv['end_time']) {
// $use_end = $cv['end_time']+86399;
// } else {
// $use_end = $end_pay_time;
// }
//
// }
//
// //下游流水
// $promote_data[$key]['promote_amount'] += $this->getCompanyGameRadio($value['admin_id'],$value['promote_id'],$value['company_id'],$value['relation_game_id'],$use_begin,$use_end,$value['pay_amount']);
// }
}
if (!$company_belong_game) {
$promote_data[$key]['promote_amount'] += $this->getCompanyGameRadio($value['admin_id'],$value['promote_id'],$value['company_id'],$value['relation_game_id'],$begin_pay_time,$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'],$value['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'],$value['pay_time'],$value['pay_amount'],$value['is_settlement']);
//下游流水
// $promote_data[$key]['promote_amount'] = $value['pay_amount'] * ($promote_radio * 0.01);
//特殊补点
$specialPayAmount[$value['pay_time']] = $this->getSpecialComplement(strtotime(date("Y-m-1",strtotime($value['pay_time']))),strtotime(date("Y-m-t",strtotime($value['pay_time'])))+86399,$value['promote_id']);
$specialAmount = $specialPayAmount[$value['pay_time']][$value['company_id']."-".$value['promote_id']."-".$value['relation_game_id']]?$specialPayAmount[$value['pay_time']][$value['company_id']."-".$value['promote_id']."-".$value['relation_game_id']]:0;
//渠道费用
$promote_data[$key]['channel_amount'] = $channel_fee[$value['pay_time'].$value['promote_id'].$value['game_name'].$value['admin_id']];
$promote_data[$key]['channel_amount'] = $channel_fee[$value['pay_time'].$value['promote_id'].$value['game_name'].$value['admin_id'].$value['is_settlement']];
$tax = 0;
//公司税费
foreach($tax_radio as $k => $v) {
@ -1156,13 +1337,27 @@ class TimingController extends AdminController {
}
}
$promote_data[$key]['company_tax'] = ($value['pay_amount']-$promote_data[$key]['cp_amount']- $promote_data[$key]['promote_amount'])*($tax/100);
//毛利
$promote_data[$key]['company_profit'] = $value['pay_amount']-$promote_data[$key]['cp_amount']-$promote_data[$key]['promote_amount']-$promote_data[$key]['channel_amount']-$promote_data[$key]['company_tax']-$specialAmount;
// $belong_game = M("company_belong_game","tab_")
// ->field("game_ids")
// ->where("time='{$value['pay_time']}'")
// ->find();
//
// $belong_game = array_values(explode(",",$belong_game['game_ids']));
//
// if ((in_array($value['relation_game_id'],$belong_game) && $value['company_belong'] ==1) || $value['company_belong'] !=1) {
// $promote_data[$key]['is_settlement']=1;
// } else {
// $promote_data[$key]['is_settlement']=0;
// }
$promote_data[$key]['is_settlement'] = $value['is_settlement'];
$promote_data[$key]['promote_amount'] += $specialAmount;
$promote_data[$key]['company_tax'] = ($value['pay_amount']-$promote_data[$key]['cp_amount']- $promote_data[$key]['promote_amount'])*($tax/100);
//毛利
$promote_data[$key]['company_profit'] = $value['pay_amount']-$promote_data[$key]['cp_amount']-$promote_data[$key]['promote_amount']-$promote_data[$key]['channel_amount']-$promote_data[$key]['company_tax'];
// dump($promote_data[$key]['promote_amount']);
if ($value['promote_id'] == 0) {
// $promote_data[$key]['promote_account']='官方渠道';
// $promote_data[$key]['company_id']='0';
@ -1174,7 +1369,7 @@ class TimingController extends AdminController {
unset($promote_data[$key]['market_percentage']);
$marker_data = M("settleup_marketorder","tab_")
->where(['pay_time'=>$value['pay_time'],'promote_id'=>$value['promote_id'],'game_name'=>$value['game_name'],'admin_id'=>$value['admin_id']])
->where(['pay_time'=>$value['pay_time'],'promote_id'=>$value['promote_id'],'game_name'=>$value['game_name'],'admin_id'=>$value['admin_id'],'is_settlement'=>$value['is_settlement']])
->find();
echo "日期:{$value['pay_time']},游戏:{$value['game_name']},推广员:{$value['promote_account']}\n";
echo "市场员:{$value['admin_id']} 推广员:{$value['promote_id']} 公司id{$value['company_id']} 游戏关联id{$value['relation_game_id']} 支付时间:{$value['pay_time']} 金额:{$value['pay_amount']}\n";
@ -1184,7 +1379,7 @@ class TimingController extends AdminController {
->add($promote_data[$key]);
} else {
M("settleup_marketorder","tab_")
->where(['pay_time'=>$value['pay_time'],'promote_id'=>$value['promote_id'],'game_name'=>$value['game_name'],'admin_id'=>$value['admin_id']])
->where(['pay_time'=>$value['pay_time'],'promote_id'=>$value['promote_id'],'game_name'=>$value['game_name'],'admin_id'=>$value['admin_id'],'is_settlement'=>$value['is_settlement']])
->save($promote_data[$key]);
}
@ -1244,15 +1439,19 @@ class TimingController extends AdminController {
do {
$date = date('Y-m', strtotime($start . ' + ' . $i . ' month'));
$i++;
M("market_altogether","tab_")->where(['pay_time'=>$date])->delete();
$this->insertAllUserBonus($date);
} while ($date < date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01')));
// $map['pay_time'] = [];
unset($map['pay_time']);
} else{
M("market_altogether","tab_")->where(['pay_time'=>$pay_time])->delete();
$this->insertAllUserBonus($pay_time);
}
$map['is_settlement'] = 1;
$all_data = M("settleup_marketorder","tab_")
->field("tab_settleup_marketorder.id,pay_time,promote_account,company_belong,tab_settleup_marketorder.real_name,develop_type,game_name,
sum(pay_amount) pay_amount,sum(company_profit) company_profit,group_id,market_percentage,nickname,admin_id,

@ -8,17 +8,8 @@ class CompanyGameRatioModel extends Model
{
// 数据表前缀
protected $tablePrefix = 'tab_';
/**
* 按公司获取游戏分成比例
*
* @param [type] $company_id 公司id
* @param [type] $game_ids 游戏关联id
* @param [type] $begintime 开始时间
* @param [type] $endtime 结束时间
* @param boolean $company_belong 公司内外团
* @return void
*/
public function getPromoteCompanyGameRatio($company_id,$game_ids,$begintime,$endtime,$company_belong=false){
public function getPromoteCompanyGameRatio($company_id,$game_ids,$begintime,$endtime,$company_belong=false){
//获取默认比例
if($company_belong === false){
$company_belong = M("PromoteCompany","tab_")->field("company_belong")->where("id='{$company_id}'")->find()['company_belong'];
@ -26,86 +17,185 @@ class CompanyGameRatioModel extends Model
$is_inside = M("PromoteCompany","tab_")->field("is_inside")->where("id='{$company_id}'")->find()['is_inside'];
$mwhere = [
"company_belong"=>$company_belong,
"relation_game_id"=>["in",$game_ids]
];
$m_res = M("GameRatioMould","tab_")->where($mwhere)->select();
$modul_ratio = [];
for ($i=0; $i < count($m_res); $i++) {
$modul_ratio[$m_res[$i]['relation_game_id']] = $m_res[$i];
}
unset($m_res);
//设置默认
$game_ratio = [];
$tmp_g = explode(",",$game_ids);
for ($i=0; $i < count($tmp_g); $i++) {
$game_ratio[$tmp_g[$i]] = [
["begintime"=>$begintime,"endtime"=>$endtime]
];
}
$map = [
"company_id"=>$company_id,
"relation_game_id"=>['in',$game_ids],
"_string"=>"begin_time <={$endtime} AND ( end_time = 0 OR end_time >= {$begintime})"
$game_id = $tmp_g[$i];
if ($is_inside){
$game_ratio[$game_id] = [[
"begintime" => $begintime,
"endtime"=>$endtime,
"ratio"=>0,
"turnover_ratio"=>''
]];
}else{
$game_ratio[$game_id] = $this->getGameRadio($company_id,$game_id,$company_belong,$begintime,$endtime);
}
}
return $game_ratio;
}
protected function getGameRadio($company_id,$game_id,$company_belong,$begintime,$endtime)
{
$map = [
"company_id"=>$company_id,
"relation_game_id"=>$game_id,
"_string"=>"begin_time <={$endtime} AND ( end_time = 0 OR end_time >= {$begintime})"
];
$res = $this->where($map)->order("begin_time asc")->select();
foreach($res as $k=>$v){
//获取最后一个数据
$tgr = &$game_ratio[$v['relation_game_id']];
$last_time_ratio = end($game_ratio[$v['relation_game_id']]);
if($v['end_time'] == 0 || ($v['end_time'] >= $last_time_ratio['endtime'])){
//全段
if($v['begin_time'] <= $last_time_ratio['begintime']){
$tgr[count($tgr)-1]['ratio'] = !$is_inside?$v['ratio']:0;
$tgr[count($tgr)-1]['turnover_ratio'] = !$is_inside?$v['turnover_ratio']:[];
continue;
}else{
//上分段
$tgr[count($tgr)-1]['endtime'] = $v['begin_time']-1;
$tgr[] = ['begintime'=>$v['begin_time'],"endtime"=>$last_time_ratio['endtime'],"ratio"=>!$is_inside?$v['ratio']:0,"turnover_ratio"=>!$is_inside?$v['turnover_ratio']:[]];
continue;
}
}
if($v['end_time'] < $last_time_ratio['endtime']){
if($last_time_ratio['begintime'] < $v['begin_time']){
//中段
$tgr[count($tgr)-1]['endtime'] = $v['begin_time']-1;
$res = $this->where($map)->order("begin_time asc")->select();
$data = [];
if(empty($res)){
$this->getGameMouldRadio($data,$game_id,$company_belong,$begintime,$endtime);
return $data;
}
foreach ($res as $ke => $va) {
if($va['begin_time'] <= $begintime){
//
if($va['end_time'] == 0 || $va['end_time'] >= $endtime){
//全段
$tmp["begintime"] = $begintime;
$tmp["endtime"] = $endtime;
$tmp['ratio'] = $va['ratio'];
$tmp['turnover_ratio'] = $va['turnover_ratio'];
$data[] = $tmp;
break;
}
if($va['end_time'] > 0 && $va['end_time'] < $endtime){
//上分
$tmp["begintime"] = $begintime;
$tmp["endtime"] = $va['end_time'];
$tmp['ratio'] = $va['ratio'];
$tmp['turnover_ratio'] = $va['turnover_ratio'];
//插入空段
$begintime = $va['end_time']-0+1;
$data[] = $tmp;
continue;
}
}
if($va['begin_time'] > $begintime){
//空段 模板比例
$this->getGameMouldRadio($data,$game_id,$company_belong,$begintime,$va['begin_time']-1);
$tgr[] = ['begintime'=>$v['begin_time'],"endtime"=>$v['end_time'],"ratio"=>!$is_inside?$v['ratio']:0,"turnover_ratio"=>!$is_inside?$v['turnover_ratio']:[]];
//补充内容
if($va['end_time'] == 0 || $va['end_time'] >= $endtime){
$tmp["begintime"] = $va['begin_time'];
$tmp["endtime"] = $endtime;
$tmp['ratio'] = $va['ratio'];
$tmp['turnover_ratio'] = $va['turnover_ratio'];
$data[] = $tmp;
break;
}
if($va['end_time'] > 0 && $va['end_time'] < $endtime){
//上分
$tmp["begintime"] = $va['begin_time'];
$tmp["endtime"] = $va['end_time'];
$tmp['ratio'] = $va['ratio'];
$tmp['turnover_ratio'] = $va['turnover_ratio'];
//插入空段
$begintime = $va['end_time']-0+1;
$data[] = $tmp;
continue;
}
}
}
//获取最后一段
$end = end($data)['endtime'];
if($end !== $endtime){
//空段 模板比例
$this->getGameMouldRadio($data,$game_id,$company_belong,$end+1,$endtime);
}
$tgr[] = ['begintime'=>$v['end_time']-0+1,"endtime"=>$last_time_ratio['endtime']];
continue;
}
if($last_time_ratio['begintime'] > $v['begin_time']){
//下分段
$tgr[count($tgr)-1]['endtime'] = $v['end_time'];
$tgr[] = ['begintime'=>$v['end_time']-0+1,"endtime"=>$last_time_ratio['endtime'],"ratio"=>!$is_inside?$v['ratio']:0,"turnover_ratio"=>!$is_inside?$v['turnover_ratio']:[]];
continue;
}
if($last_time_ratio['begintime'] = $v['begin_time']){
$tgr[count($tgr)-1]['endtime'] = $v['end_time'];
$tgr[count($tgr)-1]['ratio'] = !$is_inside?$v['ratio']:0;
$tgr[count($tgr)-1]['turnover_ratio'] = !$is_inside?$v['turnover_ratio']:[];
// foreach ($data as $ke => &$va) {
// $va['begintime'] = \date("Y-m-d H:i:s", $va['begintime']);
// $va['endtime'] = \date("Y-m-d H:i:s", $va['endtime']);
// }
return $data;
$tgr[] = ['begintime'=>$v['end_time']-0+1,"endtime"=>$last_time_ratio['endtime']];
}
}
}
//模板填充
foreach($game_ratio as $k=>&$list){
foreach($list as $i => &$ratio){
if(!isset($ratio['ratio'])){
if(isset($modul_ratio[$k]['ratio'])){
$ratio['ratio'] = !$is_inside?$modul_ratio[$k]['ratio']:0;
$ratio['turnover_ratio'] = !$is_inside?$modul_ratio[$k]['turnover_ratio']:null;
}else{
$ratio['ratio'] = 0;
$ratio['turnover_ratio'] =null;
}
}
}
}
return $game_ratio;
}
}
//获取模板比例
protected function getGameMouldRadio(&$data,$game_id,$company_belong,$begintime,$endtime){
$where = [
"company_belong"=>$company_belong,
"relation_game_id"=>$game_id,
"_string"=>"begin_time <={$endtime} AND ( end_time = 0 OR end_time >= {$begintime})"
];
$res = M("GameRatioMould","tab_")->where($where)->order("begin_time asc")->select();
if(empty($res)){
$data[] = [
"begintime"=>$begintime,
"endtime"=>$endtime,
"ratio"=>0,
"turnover_ratio"=>''
];
return ;
}
foreach ($res as $ke => $va) {
if($va['begin_time'] <= $begintime){
//
if($va['end_time'] == 0 || $va['end_time'] >= $endtime){
//全段
$tmp["begintime"] = $begintime;
$tmp["endtime"] = $endtime;
$tmp['ratio'] = $va['ratio'];
$tmp['turnover_ratio'] = $va['turnover_ratio'];
$data[] = $tmp;
return;
}
if($va['end_time'] > 0 && $va['end_time'] < $endtime){
//上分
$tmp["begintime"] = $begintime;
$tmp["endtime"] = $va['end_time'];
$tmp['ratio'] = $va['ratio'];
$tmp['turnover_ratio'] = $va['turnover_ratio'];
//插入空段
$begintime = $va['end_time']-0+1;
$data[] = $tmp;
continue;
}
}
if($va['begin_time'] > $begintime){
//补充空段
$bank["begintime"] = $begintime;
$bank["endtime"] = $va['begin_time']-1;
$bank["ratio"] = 0;
$bank["turnover_ratio"] = '';
$data[] = $bank;
//补充内容
if($va['end_time'] == 0 || $va['end_time'] >= $endtime){
$tmp["begintime"] = $va['begin_time'];
$tmp["endtime"] = $endtime;
$tmp['ratio'] = $va['ratio'];
$tmp['turnover_ratio'] = $va['turnover_ratio'];
$data[] = $tmp;
break;
}
if($va['end_time'] > 0 && $va['end_time'] < $endtime){
//上分
$tmp["begintime"] = $va['begin_time'];
$tmp["endtime"] = $va['end_time'];
$tmp['ratio'] = $va['ratio'];
$tmp['turnover_ratio'] = $va['turnover_ratio'];
//插入空段
$begintime = $va['end_time']-0+1;
$data[] = $tmp;
continue;
}
}
}
$end = end($data)['endtime'];
if($end !== $endtime){
$data[] = [
"begintime"=>$end+1,
"endtime"=>$endtime,
"ratio"=>0,
"turnover_ratio"=>''
];
}
}
}

@ -463,6 +463,9 @@ class GameModel extends Model{
*/
public function changeRelationGameidToGameid($ids,$type=false)
{
if(empty($ids)){
return '';
}
$rid = $this->field('id')->where("relation_game_id in ({$ids})")->select();
if($type){
return array_column($rid,'id');

@ -831,6 +831,20 @@ class SpendModel extends Model
return $sum;
}
private function getGameMapByGameStatMap($map)
{
$gameMap = [];
if (isset($map['s.game_id'])) {
$gameMap['id'] = $map['s.game_id'];
}
if (isset($map['g.partner_id'])) {
$gameMap['partner_id'] = $map['g.partner_id'];
}
if (isset($map['g.game_type_id'])) {
$gameMap['game_type_id'] = $map['g.game_type_id'];
}
return $gameMap;
}
/**
*获取游戏统计列表数据
@ -840,6 +854,18 @@ class SpendModel extends Model
*/
public function gameStatistics($map, $row = 0, $page = 1)
{
$gameMap = $this->getGameMapByGameStatMap($map);
$gameQuery = M('game', 'tab_')->field(['id', 'relation_game_name', 'unique_code', 'partner_id', 'game_type_name', 'sdk_version'])->where($gameMap);
if ($row) {
$gameQuery->page($page,$row);
}
$games = $gameQuery->select();
$partners = [];
if (count($games)) {
$map['s.game_id'] = ['in', array_column($games, 'id')];
$partners = M('partner', 'tab_')->field(['id', 'partner'])->where(['id' => ['in', array_column($games, 'partner_id')]])->select();
$partners = index_by_column('id', $partners);
}
$noticeFailData = M("Spend s use index(game_time)","tab_")
->field("SUM(pay_amount) as notice_fail_count,game_id")
@ -862,26 +888,38 @@ SUM(CASE WHEN pay_way = -1 and s.pay_status = 1 and pay_game_status = 1 THEN pay
// ->where("(s.pay_status = 1 and pay_game_status = 1) or (s.pay_status = 1 and pay_game_status = 0)")
->where($map)
->group('s.game_id');
if ($row) {
/* if ($row) {
$query = $query->page($page,$row);
}
} */
$data = $query->select();
// var_dump($data);die();
return $data;
$data = index_by_column('game_id', $data);
$records = [];
foreach ($games as $game) {
if (isset($data[$game['id']])) {
$records[] = $data[$game['id']];
} else {
$partner = $partners[$game['partner_id']] ?? null;
$records[] = [
'game_id' => $game['id'],
'game_name' => $game['relation_game_name'],
'unique_code' => $game['unique_code'],
'partner_name' => $partner ? $partner['partner'] : '无',
'game_type_name' => $game['game_type_name'],
'cash_count' => 0,
'balance_coin_count' => 0,
'inside_cash_count' => 0,
'sdk_version' => $game['sdk_version'],
'notice_fail_count' => 0
];
}
}
return $records;
}
public function gameStatisticsCount($map)
{
$query = M("Spend s use index(game_time)","tab_")
->field("game_id")
->join('LEFT JOIN tab_game as g ON s.game_id=g.id')
->join('LEFT JOIN tab_partner as p ON g.partner_id=p.id')
->where(['s.pay_status' => 1])
->where($map)
->group('s.game_id');
$data = $query->select();
return count($data);
$gameMap = $this->getGameMapByGameStatMap($map);
return M('game', 'tab_')->where($gameMap)->count();
}
/**
@ -889,8 +927,6 @@ SUM(CASE WHEN pay_way = -1 and s.pay_status = 1 and pay_game_status = 1 THEN pay
*/
public function totalGameStatistics($map, $join = true)
{
$noticeFailData = M("Spend s use index(game_time)","tab_")
->field("SUM(pay_amount) as notice_fail_count,game_id")
->join('LEFT JOIN tab_game as g ON s.game_id=g.id')

@ -453,7 +453,7 @@
//重算金额
$("#updateStatement").on("click",function(){
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
if($(elem).data("status") == 0 || $(elem).data("status") == 1 || $(elem).data("status") == -1 || $(elem).data("status") == -3){
if($(elem).data("status") == 0 || $(elem).data("status") == -1 || $(elem).data("status") == -3){
return $(elem).val();
}else{
flag = true;
@ -461,10 +461,10 @@
// return $(elem).val();
}).get().join(",");
if(text == ''){
layer.msg("<font style='color:white'>" + '无需要进行重新结算的结算单,仅[未申请发票][申请开票][审批拒绝][汇总审批撤回]状态可以进行重新结算' + "</font>");
layer.msg("<font style='color:white'>" + '无需要进行重新结算的结算单,仅[未汇总][申请开票][审批拒绝][汇总审批撤回]状态可以进行重新结算' + "</font>");
return;
}
layer.confirm("重算结算金额会对结算单回退到未申请发票状态,请慎重处理,点击取消停止操作",{title:false}, function(index){
layer.confirm("重算结算金额会对结算单回退到未汇总状态,请慎重处理,点击取消停止操作",{title:false}, function(index){
_doReceived();
layer.close(index);
});

@ -49,7 +49,9 @@
<div class="tools">
<a class=" ajax-post " target-form="ids" url="{:U("Apply/android_set",array("status"=>1,"msg_type"=>5,"field"=>"status"))}"><span class="button_icon button_icon9"></span>审 核</a>
<a class=" pack" id="org" target-form="ids" url="{:U("Apply/allpackage",array('p'=>$_GET['p'],'type'=>$_GET['type']))}" ><span class="button_icon button_icon23"></span>打 包</a>
<!--
<a class=" ajax-post confirm " target-form="ids" url="{:U('android_del?model='.$model['id'])}"><span class="button_icon button_icon2"></span>删 除</a>
-->
<if condition="C(SET_AUTO_PACK) eq 0">
<a class="ajax-get" target-form="ids" url='{:U("set_config_auto_audit",array("val"=>1,"config_key"=>"SET_AUTO_PACK"))}'><span class="button_icon button_icon4"></span>开启自动审核</a>
<else/>

@ -136,6 +136,16 @@
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>结算流水类型:</td>
<td class="r">
<select id="turnover_type" name="turnover_type" class="select_gallery">
<option value="1">月流水</option>
<option value="2">历史流水</option>
</select>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>分成比例设定:</td>
<td class="r table_radio">
@ -305,10 +315,10 @@ $(function(){
var momday = getMonday();
//判断日期是否小于当周周一
if (momday > cres.begin_time) {
layer.msg("配置的开始日期不能大于当周周一", {icon: 2});
return false;
}
// if (momday > cres.begin_time) {
// layer.msg("配置的开始日期不能小于当周周一", {icon: 2});
// return false;
// }
if(!flag){

@ -125,7 +125,15 @@
<span class="notice-text"></span>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>结算流水类型:</td>
<td class="r">
<select id="turnover_type" name="turnover_type" class="select_gallery">
<option value="1" <if condition="$data['turnover_type'] eq 1">selected</if>>月流水</option>
<option value="2" <if condition="$data['turnover_type'] eq 2">selected</if>>历史流水</option>
</select>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>分成比例设定:</td>
<td class="r table_radio">

@ -121,6 +121,15 @@
<span class="notice-text"></span>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>结算流水类型:</td>
<td class="r">
<select id="turnover_type" name="turnover_type" class="select_gallery">
<option value="1" <if condition="$data['turnover_type'] eq 1">selected</if>>月流水</option>
<option value="2" <if condition="$data['turnover_type'] eq 2">selected</if>>历史流水</option>
</select>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>分成比例设定:</td>

@ -33,6 +33,7 @@
<th>游戏类型</th>
<th>原游戏名称</th>
<th>现游戏名称</th>
<th>结算流水类型</th>
<th>生效时间</th>
<th colspan="2">比例分成</th>
</tr>
@ -54,9 +55,11 @@
<td rowspan="{$data.row}">{$data.original_package_name}</td>
<td rowspan="{$data.row}">{$data.relation_game_name}</td>
<notempty name="data['valid'][0]">
<td rowspan="{$data['sec_row'][0]}">{$data['turnover_types'][0]}</td>
<td rowspan="{$data['sec_row'][0]}">{$data['valid'][0]}</td>
<else />
<td>--</td>
<td>--</td>
</notempty>
<notempty name="data['turnover_ratios'][0][0]">
<td >{$data['turnover_ratios'][0][0]['name']|default="--"}</td>
@ -71,14 +74,10 @@
<foreach name="data['valid']" item="valid" key="keys">
<if condition="$keys gt 0">
<tr>
<td rowspan="{$data['sec_row'][$keys]}">{$data['turnover_types'][$keys]}</td>
<td rowspan="{$data['sec_row'][$keys]}">{$valid|default="--"}</td>
<td>{$data['turnover_ratios'][$keys][0]['name']|default="--"}</td>
<td>{$data['turnover_ratios'][$keys][0]['ratio']|showPercent}</td>
<td rowspan="{$data['sec_row'][$keys]}">
<foreach name="data['oplist'][$keys]" item="vo" >
{$vo}
</foreach>
</td>
</tr>
<foreach name="data['turnover_ratios'][$keys]" item="game_ratio" key="gamekey">
<if condition="$gamekey gt 0">

@ -151,6 +151,7 @@
<th>游戏类型</th>
<th>原游戏名称</th>
<th>现游戏名称</th>
<th>结算流水类型</th>
<th>生效时间</th>
<th colspan="2">比例分成</th>
<th>操作</th>
@ -173,9 +174,11 @@
<td rowspan="{$data.row}">{$data.original_package_name}</td>
<td rowspan="{$data.row}">{$data.relation_game_name}</td>
<notempty name="data['valid'][0]">
<td rowspan="{$data['sec_row'][0]}">{$data['turnover_types'][0]}</td>
<td rowspan="{$data['sec_row'][0]}">{$data['valid'][0]}</td>
<else />
<td>--</td>
<td>--</td>
</notempty>
<notempty name="data['turnover_ratios'][0][0]">
<td >{$data['turnover_ratios'][0][0]['name']|default="--"}</td>
@ -195,6 +198,7 @@
<foreach name="data['valid']" item="valid" key="keys">
<if condition="$keys gt 0">
<tr>
<td rowspan="{$data['sec_row'][$keys]}">{$data['turnover_types'][$keys]}</td>
<td rowspan="{$data['sec_row'][$keys]}">{$valid|default="--"}</td>
<td>{$data['turnover_ratios'][$keys][0]['name']|default="--"}</td>
<td>{$data['turnover_ratios'][$keys][0]['ratio']|showPercent}</td>

@ -163,6 +163,7 @@
<th>游戏类型</th>
<th>原游戏名称</th>
<th>现游戏名称</th>
<th>结算流水类型</th>
<th>生效时间</th>
<th>原比例</th>
<th>申请比例</th>
@ -192,6 +193,7 @@
<td>{$data.game_type_name}</td>
<td>{$data.original_package_name}</td>
<td>{$data.relation_game_name}</td>
<td>{$data.turnover_types}</td>
<td>{$data.valid}</td>
<td style="line-height: 16px;text-indent: 0;">
<div style="text-align: left;width: 90%;margin-left: 5%;margin-top: 10px;margin-bottom: 10px;">

@ -103,6 +103,7 @@
<tr>
<th>序号</th>
<th>下游名称</th>
<!-- <th>结算时间</th>-->
<th>会长账号</th>
<th>内外团</th>
@ -120,6 +121,7 @@
<th>分成结算金额</th>
<th>奖励</th>
<th>罚款</th>
<th>周结算金额</th>
<th>结算金额</th>
<th>户名</th>
@ -145,6 +147,7 @@
<!-- <td rowspan="{$com.statement_count}">{$com.company_info.account}</td> -->
<notempty name="com['statement_info']">
<!-- <td rowspan="{$com['statement_info'][0]['time_row']}">{$com['statement_info'][0]['time']}</td>-->
<td rowspan="{$com['statement_info'][0]['row']}" >{$com['statement_info'][0]['account']}</td>
<else />
<td>-</td>
@ -159,7 +162,8 @@
<notempty name="com['statement_info'][0]['game_list']">
<td>{$com['statement_info'][0]['game_list'][0]['game_name']}</td>
<td>{$com['statement_info'][0]['game_list'][0]['game_type_name']}</td>
<td>{$com['statement_info'][0]['game_list'][0]['statement_begin_time']}-{$com['statement_info'][0]['game_list'][0]['statement_end_time']}</td>
<td rowspan="{$com['statement_info'][0]['time_row']}">{$com['statement_info'][0]['time']}</td>
<!-- <td>{$com['statement_info'][0]['game_list'][0]['statement_begin_time']}-{$com['statement_info'][0]['game_list'][0]['statement_end_time']}</td>-->
<td><span class="pay_amount">{$com['statement_info'][0]['game_list'][0]['pay_amount']}</span></td>
<td><input class="refund" onkeyup ="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" value="{$com['statement_info'][0]['game_list'][0]['refund']|default=0}" style="width: 40px;" name="refund[{$com['id']}][{$com['statement_info'][0]['account']}][]"></td>
<td><input class="ratio" onkeyup ="if(value>100){value=100}else{value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')}if(value.indexOf(0)==0){value=0}" name="ratio[{$com['id']}][{$com['statement_info'][0]['account']}][]" value="{$com['statement_info'][0]['game_list'][0]['ratio']}" style="width: 25px;">%</td>
@ -169,6 +173,7 @@
<input class="st" name="st[{$com['id']}]" value="{$com['st']}" style="width: 20px;display: none"></td>
<td rowspan="{$com.row}">{$com['reward']}</td>
<td rowspan="{$com.row}">{$com['fine']}</td>
<td rowspan="{$com['statement_info'][0]['time_row']}" class="week_amount">{$com['statement_info'][0]['week_amount']}</td>
<td rowspan="{$com.row}" data-st="{$com['st']}" class="statement_money">{$com['statement_money']}</td>
<else />
@ -179,6 +184,7 @@
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td rowspan="{$com.row}">-</td>
<td rowspan="{$com.row}">-</td>
<td rowspan="{$com.row}">-</td>
@ -216,7 +222,7 @@
<tr>
<td>{$game['game_name']}</td>
<td>{$game['game_type_name']}</td>
<td>{$game['statement_begin_time']}-{$game['statement_end_time']}</td>
<!-- <td>{$game['statement_begin_time']}-{$game['statement_end_time']}</td>-->
<td><span class="pay_amount">{$game['pay_amount']}</span></td>
<td><input class="refund" onkeyup ="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')" value="{$game['refund']|default=0}" style="width: 40px;" name="refund[{$com['id']}][{$com['statement_info'][0]['account']}][]"></td>
<td><input class="ratio" onkeyup ="if(value>100){value=100}else{value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')}if(value.indexOf(0)==0){value=0}" name="ratio[{$com['id']}][{$com['statement_info'][0]['account']}][]" value="{$game['ratio']}" style="width: 25px;">%</td>
@ -234,12 +240,16 @@
<foreach name="com['statement_info']" item="account" key="akey">
<if condition="$akey gt 0">
<tr>
<td rowspan="{$account['row']}" class="accounts">{$account['account']}</td>
<notempty name="account['game_list']">
<td>{$account['game_list'][0]['game_name']}</td>
<td>{$account['game_list'][0]['game_type_name']}</td>
<td>{$account['game_list'][0]['statement_begin_time']}-{$account['game_list'][0]['statement_end_time']}</td>
<notempty name="account['time']">
<td rowspan="{$account['time_row']}">{$account['time']}</td>
</notempty>
<!-- <td>{$account['game_list'][0]['statement_begin_time']}-{$account['game_list'][0]['statement_end_time']}</td>-->
<td><span class="pay_amount">{$account['game_list'][0]['pay_amount']}</span></td>
<!-- <td>{$account['game_list'][0]['ratio']|showNumPercent}</td>-->
<!-- <td>{$account['game_list'][0]['increment_ratio']|showNumPercent}</td>-->
@ -247,7 +257,9 @@
<td><input class="ratio" onkeyup ="if(value>100){value=100}else{value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')}if(value.indexOf(0)==0){value=0}" name="ratio[{$com['id']}][{$account['account']}][]" value="{$account['game_list'][0]['ratio']}" style="width: 25px;">%</td>
<td><input class="increment_ratio" onkeyup ="if(value>100){value=100}else{value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')}if(value.indexOf(0)==0){value=0}" name="increment_ratio[{$com['id']}][{$account['account']}][]" value="{$account['game_list'][0]['increment_ratio']}" style="width: 25px;">%</td>
<td><span class="sum_money_span">{$account['game_list'][0]['sum_money']}</span><input class="sum_money" name="sum_money[{$com['id']}][{$account['account']}][]" value="{$account['game_list'][0]['sum_money']}" style="width: 20px;display: none"></td>
<notempty name="account['time']">
<td rowspan="{$account['time_row']}" class="week_amount">{$account['week_amount']}</td>
</notempty>
<else />
<td>-</td>
<td>-</td>
@ -256,6 +268,8 @@
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
</notempty>
</tr>
@ -265,7 +279,7 @@
<tr>
<td>{$game['game_name']}</td>
<td>{$game['game_type_name']}</td>
<td>{$game['statement_begin_time']}-{$game['statement_end_time']}</td>
<!-- <td>{$game['statement_begin_time']}-{$game['statement_end_time']}</td>-->
<td><span class="pay_amount">{$game['pay_amount']}</span></td>
<!-- <td>{$game['ratio']|showNumPercent}</td>-->
<!-- <td>{$game['increment_ratio']|showNumPercent}</td>-->
@ -294,6 +308,7 @@
<td></td>
<td></td>
<td class="count_sum_money">{$count.sum_money}</td>
<td class="count_sum_money">{$count.sum_money}</td>
<td></td>
<td></td>
<td></td>
@ -433,19 +448,43 @@
$(_this).parent().parent().find(".increment_ratio").val(increment_ratio);
}
var week_amount_find = $(_this).parent().parent();
var old_amount = week_amount_find.find(".sum_money_span").text();
//扣款
pay_money = parseFloat(pay_money) - parseFloat(refund);
var value = parseFloat(pay_money)*(parseFloat(ratio)/100) + parseFloat(pay_money)*(parseFloat(increment_ratio)/100);
$(_this).parent().parent().find(".sum_money_span").text(value.toFixed(2));
$(_this).parent().parent().find(".sum_money").val(value.toFixed(2));
var this_amount = week_amount_find.find(".sum_money_span").text();
var week_amount = 0;
for (;;) {
week_amount = week_amount_find.find(".week_amount").text();
if (week_amount_find) {
break;
} else {
week_amount_find = week_amount_find.prev();
}
}
var D_value = parseFloat(old_amount)-parseFloat(this_amount);
week_amount_find.find(".week_amount").text((parseFloat(week_amount)-D_value).toFixed(2));
}
//结算金额重算
function changeStatementAmount(_this) {
var _parent = $(_this).parent().parent();
var statement_amount = '';
for (;;) {
statement_amount = _parent.find(".statement_money").text();
if (!statement_amount ) {
@ -466,7 +505,10 @@
get_item = get_item.next();
}
// week_amount_find.find(".week_amount").text();
_parent.find(".statement_money").text(sum_amount.toFixed(2));
}
//结算金额合计重算
function changeSumAmount() {
@ -474,7 +516,7 @@
var sum_amount = 0;
var st = 0;
$("#statementShow").find(".statement_money").each(function (key,val) {
$("#statementShow").find(".statement_money").each(function (key,val) {
st = $(val).data('st')
sum_amount = parseFloat(sum_amount) + parseFloat($(val).text());
@ -482,6 +524,9 @@
});
$(".count_sum_money").text(sum_amount.toFixed(2));
}
</script>

@ -111,6 +111,7 @@
<th rowspan="2" style="border-right: solid 1px #b6cad2;">合作方待结算分成</th>
<th rowspan="2" style="border-right: solid 1px #b6cad2;">违规罚款</th>
<th rowspan="2" style="border-right: solid 1px #b6cad2;">奖励</th>
<!-- <th rowspan="2" style="border-right: solid 1px #b6cad2;">周结算金额</th>-->
<th rowspan="2" style="border-right: solid 1px #b6cad2;">合作待结算金额</th>
<th rowspan=2 style="border-right: solid 1px #b6cad2;">是否结算</th>
@ -139,6 +140,7 @@
<td rowspan="{$com.statement_count}">{$com.company_name}</td>
<td rowspan="{$com.statement_count}">{$com.matche_platform}</td>
<!-- <td rowspan="{$com.statement_count}">{$com.statement_begin_time} ~ {$com.statement_end_time}</td> -->
<!-- <td rowspan="{$com['statement_info'][0]['row']}">{$com['statement_info'][0]['time']}</td>-->
<td>{$com['statement_info'][0]['statement_begin_time']}-{$com['statement_info'][0]['statement_end_time']}</td>
<td>{$com['statement_info'][0]['game_name']}</td>
@ -152,6 +154,7 @@
<td rowspan="{$com.statement_count}">{$com['fine']-0}</td>
<td rowspan="{$com.statement_count}">{$com['reward']-0}</td>
<!-- <td rowspan="{$com['statement_info'][0]['row']}">{$com['statement_info'][0]['week_amount']}</td>-->
<td rowspan="{$com.statement_count}">{$com['statement_money']}</td>
<td rowspan="{$com.statement_count}"><if condition="$com['st'] eq 0"><else /></if></td>
@ -185,6 +188,9 @@
<if condition="$k neq 0">
<tr>
<td>{$it['statement_begin_time']}-{$it['statement_end_time']}</td>
<!-- <notempty name="it['time']">-->
<!-- <td rowspan="{$it['row']}">{$it['time']}</td>-->
<!-- </notempty>-->
<td>{$it['game_name']}</td>
<td>{$it['pay_amount']}</td>
<td>{$it['pay_amount']}</td>

@ -98,6 +98,7 @@
<tr>
<th>序号</th>
<th>公司名称</th>
<!-- <th>结算日期</th>-->
<th>合作产品名称</th>
<th>平台总额(元)</th>
<th>下游内团分成比例</th>
@ -106,11 +107,10 @@
<th>分成金额/元</th>
<th>罚款</th>
<th>奖励</th>
<!-- <th>周结算金额</th>-->
<th>合计/元</th>
<th>对账人</th>
<th>结算日期</th>
<th>户名</th>
<th>帐号</th>
<th>开户行</th>
@ -128,6 +128,7 @@
<tr>
<td rowspan="{$com.statement_count}">{$key-0+1}</td>
<td rowspan="{$com.statement_count}">{$com.company_name}</td>
<!-- <td rowspan="{$com['statement_info'][0]['row']}">{$com['statement_info'][0]['time']}</td>-->
<td>{$com['statement_info'][0]['game_name']}</td>
<td>{$com['statement_info'][0]['pay_amount']}</td>
<td>{$com['statement_info'][0]['ratio']|showNumPercent}</td>
@ -136,10 +137,11 @@
<td>{$com['statement_info'][0]['d_statement_money']}</td>
<td rowspan="{$com.statement_count}">{$com['fine']-0}</td>
<td rowspan="{$com.statement_count}">{$com['reward']-0}</td>
<!-- <td rowspan="{$com['statement_info'][0]['row']}">{$com['statement_info'][0]['week_amount']}</td>-->
<td rowspan="{$com.statement_count}">{$com['statement_money']}</td>
<td rowspan="{$com.statement_count}">{$com.settlement_contact}</td>
<td>{$com['statement_info'][0]['statement_begin_time']}-{$com['statement_info'][0]['statement_end_time']}</td>
<!-- <td rowspan="{$com['statement_info'][0]['row']}">{$com['statement_info'][0]['time']}</td>-->
<if condition="$com['is_payment'] eq 2">
<td rowspan="{$com.statement_count}">{$com.company_info.payee_name}</td>
@ -169,6 +171,7 @@
<foreach name="com.statement_info" item="it" key="k">
<if condition="$k neq 0">
<tr>
<td>{$it['game_name']}</td>
<td>{$it['pay_amount']}</td>
<td>{$it['ratio']|showNumPercent}</td>
@ -176,6 +179,12 @@
<td>{$it['fax_ratio']|showNumPercent}</td>
<td>{$it['d_statement_money']}</td>
<td>{$it['statement_begin_time']}-{$it['statement_end_time']}</td>
<!-- <notempty name="it['time']">-->
<!-- <td rowspan="{$it['row']}">{$it['week_amount']}</td>-->
<!-- </notempty>-->
<!-- <notempty name="it['time']">-->
<!-- <td rowspan="{$it['row']}">{$it['time']}</td>-->
<!-- </notempty>-->
</tr>
</if>
</foreach>
@ -190,6 +199,8 @@
<td>{$count.fine}</td>
<td>{$count.reward}</td>
<td>{$count.statement_money}</td>
<!-- <td>{$count.statement_money}</td>-->
<td></td>
<td></td>
<td></td>
<td></td>

@ -101,6 +101,7 @@
<tr>
<th>序号</th>
<th>下游名称</th>
<!-- <th>结算时间</th>-->
<th>会长账号</th>
<th>内外团</th>
@ -118,6 +119,7 @@
<th>分成结算金额</th>
<th>奖励</th>
<th>罚款</th>
<th>周结算金额</th>
<th>结算金额</th>
<th>户名</th>
@ -143,8 +145,10 @@
<!-- <td rowspan="{$com.statement_count}">{$com.company_info.account}</td> -->
<notempty name="com['statement_info']">
<!-- <td rowspan="{$com['statement_info'][0]['time_row']}">{$com['statement_info'][0]['time']}</td>-->
<td rowspan="{$com['statement_info'][0]['row']}">{$com['statement_info'][0]['account']}</td>
<else />
<!-- <td>-</td>-->
<td>-</td>
</notempty>
@ -157,7 +161,8 @@
<notempty name="com['statement_info'][0]['game_list']">
<td>{$com['statement_info'][0]['game_list'][0]['game_name']}</td>
<td>{$com['statement_info'][0]['game_list'][0]['game_type_name']}</td>
<td>{$com['statement_info'][0]['game_list'][0]['statement_begin_time']}-{$com['statement_info'][0]['game_list'][0]['statement_end_time']}</td>
<td rowspan="{$com['statement_info'][0]['time_row']}">{$com['statement_info'][0]['time']}</td>
<!-- <td>{$com['statement_info'][0]['game_list'][0]['statement_begin_time']}-{$com['statement_info'][0]['game_list'][0]['statement_end_time']}</td>-->
<td><span class="pay_amount">{$com['statement_info'][0]['game_list'][0]['pay_amount']}</span></td>
<td>{$com['statement_info'][0]['game_list'][0]['refund']|default=0}</td>
<td>{$com['statement_info'][0]['game_list'][0]['ratio']}%</td>
@ -165,6 +170,7 @@
<td><span class="sum_money_span">{$com['statement_info'][0]['game_list'][0]['sum_money']}</span></td>
<td rowspan="{$com.row}">{$com['reward']}</td>
<td rowspan="{$com.row}">{$com['fine']}</td>
<td rowspan="{$com['statement_info'][0]['time_row']}">{$com['statement_info'][0]['week_amount']||default="0"}</td>
<td rowspan="{$com.row}">{$com['statement_money']}</td>
<else />
@ -175,6 +181,7 @@
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td rowspan="{$com.row}">-</td>
<td rowspan="{$com.row}">-</td>
<td rowspan="{$com.row}">-</td>
@ -212,7 +219,7 @@
<tr>
<td>{$game['game_name']}</td>
<td>{$game['game_type_name']}</td>
<td>{$game['statement_begin_time']}-{$game['statement_end_time']}</td>
<!-- <td>{$game['statement_begin_time']}-{$game['statement_end_time']}</td>-->
<td><span class="pay_amount">{$game['pay_amount']}</span></td>
<td>{$game['refund']|default=0}</td>
<td>{$game['ratio']}%</td>
@ -230,12 +237,17 @@
<foreach name="com['statement_info']" item="account" key="akey">
<if condition="$akey gt 0">
<tr>
<td rowspan="{$account['row']}">{$account['account']}</td>
<notempty name="account['game_list']">
<td>{$account['game_list'][0]['game_name']}</td>
<td>{$account['game_list'][0]['game_type_name']}</td>
<td>{$account['game_list'][0]['statement_begin_time']}-{$account['game_list'][0]['statement_end_time']}</td>
<notempty name="account['time']">
<td rowspan="{$account['time_row']}">{$account['time']|default="-----"}</td>
</notempty>
<!-- <td>{$account['game_list'][0]['statement_begin_time']}-{$account['game_list'][0]['statement_end_time']}</td>-->
<td><span class="pay_amount">{$account['game_list'][0]['pay_amount']}</span></td>
<!-- <td>{$account['game_list'][0]['ratio']|showNumPercent}</td>-->
<!-- <td>{$account['game_list'][0]['increment_ratio']|showNumPercent}</td>-->
@ -243,6 +255,9 @@
<td>{$account['game_list'][0]['ratio']}%</td>
<td>{$account['game_list'][0]['increment_ratio']}%</td>
<td><span class="sum_money_span">{$account['game_list'][0]['sum_money']}</span></td>
<notempty name="account['time']">
<td rowspan="{$account['time_row']}">{$account['week_amount']}</td>
</notempty>
<else />
<td>-</td>
@ -252,6 +267,7 @@
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
</notempty>
</tr>
@ -261,7 +277,7 @@
<tr>
<td>{$game['game_name']}</td>
<td>{$game['game_type_name']}</td>
<td>{$game['statement_begin_time']}-{$game['statement_end_time']}</td>
<!-- <td>{$game['statement_begin_time']}-{$game['statement_end_time']}</td>-->
<td><span class="pay_amount">{$game['pay_amount']}</span></td>
<!-- <td>{$game['ratio']|showNumPercent}</td>-->
<!-- <td>{$game['increment_ratio']|showNumPercent}</td>-->
@ -289,6 +305,7 @@
<td></td>
<td></td>
<td></td>
<td>{$count.week_money}</td>
<td>{$count.sum_money}</td>
<td></td>
<td></td>

@ -144,6 +144,16 @@
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>结算流水类型:</td>
<td class="r">
<select id="turnover_type" name="turnover_type" class="select_gallery">
<option value="1">月流水</option>
<option value="2">历史流水</option>
</select>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>分成比例设定:</td>
<td class="r table_radio">
@ -167,6 +177,18 @@
<span class="notice-text" style="width: auto;"></span>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>生效期限:</td>
<td class="r table_radio">
<div style="float: left;">
<input type="text" class="txt time" name="begin_time" id="begin_time" placeholder="开始时间" value="">
-
<input type="text" class="txt time" name="end_time" id="end_time" placeholder="结束时间" value="">
</div>
<span class="notice-text">结束时间不填则默认永久。</span>
</td>
</tr>
</tbody>
</table>
</div>
@ -208,15 +230,10 @@ $(".select_gallery").select2();
$(function(){
$('.time').datetimepicker({
format: 'yyyy-mm',
language: "zh-CN",
autoclose: true,
scrollMonth: false,
scrollTime: false,
scrollInput: false,
startView: 'year',
minView:'year',
maxView:'year',
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true
});
showTab();
@ -275,7 +292,9 @@ $(function(){
var obj = {
"relation_game_id":["required","游戏不能为空","select"],
"company_belong":["required","公司类型不能为空","select"],
"ratio":["number","默认比例必须是大于0的数字"]
"ratio":["number","默认比例必须是大于0的数字"],
"begin_time":["date","开始时间不能为空"],
"turnover_type":["required","结算流水类型必选","select"],
}
var cres = CIC.checkAddInput(obj);
if(!cres){

@ -128,6 +128,15 @@
<span class="notice-text"></span>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>结算流水类型:</td>
<td class="r">
<select id="turnover_type" name="turnover_type" class="select_gallery">
<option value="1" <if condition="$data['turnover_type'] eq 1">selected</if>>月流水</option>
<option value="2" <if condition="$data['turnover_type'] eq 2">selected</if>>历史流水</option>
</select>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>分成比例设定:</td>
<td class="r table_radio">
@ -170,6 +179,19 @@
<span class="notice-text" style="width: auto;"></span>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>生效期限:</td>
<td class="r table_radio">
<div style="float: left;margin-top: 5px;" class="li-ratio">
<span>{$data.begin_time}</span>
<input type="text" class="txt time" name="begin_time" id="begin_time" placeholder="开始时间" value="{$data.begin_time}" style="display: none">
-
<input type="text" class="txt time" name="end_time" id="end_time" placeholder="结束时间" value="{$data.end_time}" style="display: none">
<span>{$data.end_time}</span>
</div>
<span class="notice-text">结束时间不填则默认永久。</span>
</td>
</tr>
</tbody>
</table>
</div>

@ -31,8 +31,9 @@
<th>现包名</th>
<th>原包名</th>
<th>公司类型</th>
<th>结算流水类型</th>
<th colspan="2">比例分成</th>
<th>时间</th>
<th>生效时间</th>
<th>操作人</th>
</tr>
</thead>
@ -50,26 +51,47 @@
<td rowspan="{$data.row}">{$data.relation_game_name}</td>
<td rowspan="{$data.row}">{$data.original_package_name}</td>
<td rowspan="{$data.row}">{$data.company_belong}</td>
<notempty name="data['turnover_ratio'][0]">
<td>{$data['turnover_ratio'][0]['name']|default="--"}</td>
<td>{$data['turnover_ratio'][0]['ratio']|showPercent}</td>
<else />
<notempty name="data['turnover_ratios'][0][0]">
<td rowspan="{$data['sec_row'][0]}">{$data['turnover_types'][0]|default="--"}</td>
<td >{$data['turnover_ratios'][0][0]['name']|default="--"}</td>
<td >{$data['turnover_ratios'][0][0]['ratio']|showPercent}</td>
<td rowspan="{$data['sec_row'][0]}">{$data['valid'][0]|default="--"}</td>
<else />
<td>--</td>
<td>--</td>
</notempty>
<td rowspan="{$data.row}">{$data.create_time}</td>
<td>--</td>
<td>--</td>
</notempty>
<td rowspan="{$data.row}">{$data.admin_name}</td>
</tr>
<if condition="$data['row'] gt 1">
<foreach name="data['turnover_ratio']" item="game_ratio" key="gamekey">
<if condition="$gamekey gt 0">
<tr>
<td>{$game_ratio['name']|default="--"}</td>
<td>{$game_ratio['ratio']|showPercent}</td>
</tr>
</if>
</foreach>
</if>
<foreach name="data['valid']" item="valid" key="keys">
<if condition="$keys gt 0">
<tr>
<td rowspan="{$data['sec_row'][$keys]}">{$data['turnover_types'][$keys]|default="无"}</td>
<td>{$data['turnover_ratios'][$keys][0]['name']|default="--"}</td>
<td>{$data['turnover_ratios'][$keys][0]['ratio']|showPercent}</td>
<td rowspan="{$data['sec_row'][$keys]}">{$valid|default="--"}</td>
</tr>
<foreach name="data['turnover_ratios'][$keys]" item="game_ratio" key="gamekey">
<if condition="$gamekey gt 0">
<tr>
<td>{$game_ratio['name']|default="--"}</td>
<td>{$game_ratio['ratio']|showPercent}</td>
</tr>
</if>
</foreach>
<else/>
<foreach name="data['turnover_ratios'][$keys]" item="game_ratio" key="gamekey">
<if condition="$gamekey gt 0">
<tr>
<td>{$game_ratio['name']|default="--"}</td>
<td>{$game_ratio['ratio']|showPercent}</td>
</tr>
</if>
</foreach>
</if>
</foreach>
</volist>
</if>
</tbody>

@ -108,8 +108,10 @@
<th>现包名</th>
<th>原包名</th>
<th>公司类型</th>
<th>结算流水类型</th>
<!-- <th>生效时间</th>-->
<th colspan="2">比例分成</th>
<th>时间</th>
<th>生效时间</th>
<th>操作人</th>
<th>操作</th>
</tr>
@ -128,30 +130,55 @@
<td rowspan="{$data.row}">{$data.relation_game_name}</td>
<td rowspan="{$data.row}">{$data.original_package_name}</td>
<td rowspan="{$data.row}">{$data.company_belong}</td>
<notempty name="data['turnover_ratio'][0]">
<td>{$data['turnover_ratio'][0]['name']|default="--"}</td>
<td>{$data['turnover_ratio'][0]['ratio']|showPercent}</td>
<notempty name="data['turnover_ratios'][0][0]">
<td rowspan="{$data['sec_row'][0]}">{$data['turnover_types'][0]|default="--"}</td>
<td >{$data['turnover_ratios'][0][0]['name']|default="--"}</td>
<td >{$data['turnover_ratios'][0][0]['ratio']|showPercent}</td>
<td rowspan="{$data['sec_row'][0]}">{$data['valid'][0]|default="--"}</td>
<else />
<td>--</td>
<td>--</td>
</notempty>
<td rowspan="{$data.row}">{$data.create_time}</td>
<td>--</td>
<td>--</td>
</notempty>
<td rowspan="{$data.row}">{$data.admin_name}</td>
<td rowspan="{$data.row}">
<a href="{:U('edit', array('id'=>$data['id']))}" class="">修改</a>
<a data-url="{:U('del', array('id'=>$data['id']))}" class="ratio_del">删除</a>
<td rowspan="{$data['sec_row'][0]}">
<a href="{:U('edit', array('id'=>$data['ids'][0]))}" class="">修改</a>
<a data-url="{:U('del', array('id'=>$data['ids'][0]))}" class="ratio_del">删除</a>
</td>
</tr>
<if condition="$data['row'] gt 1">
<foreach name="data['turnover_ratio']" item="game_ratio" key="gamekey">
<if condition="$gamekey gt 0">
<tr>
<td>{$game_ratio['name']|default="--"}</td>
<td>{$game_ratio['ratio']|showPercent}</td>
</tr>
</if>
</foreach>
</if>
<foreach name="data['valid']" item="valid" key="keys">
<if condition="$keys gt 0">
<tr>
<td rowspan="{$data['sec_row'][$keys]}">{$data['turnover_types'][$keys]|default="无"}</td>
<td>{$data['turnover_ratios'][$keys][0]['name']|default="--"}</td>
<td>{$data['turnover_ratios'][$keys][0]['ratio']|showPercent}</td>
<td rowspan="{$data['sec_row'][$keys]}">{$valid|default="--"}</td>
<td rowspan="{$data['sec_row'][$keys]}">
<a href="{:U('edit', array('id'=>$data['ids'][$keys]))}" class="">修改</a>
<a data-url="{:U('del', array('id'=>$data['ids'][$keys]))}" class="ratio_del">删除</a>
</td>
</tr>
<foreach name="data['turnover_ratios'][$keys]" item="game_ratio" key="gamekey">
<if condition="$gamekey gt 0">
<tr>
<td>{$game_ratio['name']|default="--"}</td>
<td>{$game_ratio['ratio']|showPercent}</td>
</tr>
</if>
</foreach>
<else/>
<foreach name="data['turnover_ratios'][$keys]" item="game_ratio" key="gamekey">
<if condition="$gamekey gt 0">
<tr>
<td>{$game_ratio['name']|default="--"}</td>
<td>{$game_ratio['ratio']|showPercent}</td>
</tr>
</if>
</foreach>
</if>
</foreach>
</volist>
</if>
</tbody>

@ -0,0 +1,414 @@
<extend name="Public/base" />
<block name="body">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="__CSS__/admin_table.css" media="all">
<link href="__STATIC__/icons_alibaba/iconfont.css" rel="stylesheet">
<link rel="stylesheet" href="__CSS__/pro_promote.css" type="text/css" />
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
<script type="text/javascript" src="__STATIC__/provincecityarea/AreaData_min.js"></script>
<script src="__STATIC__/layer/layer.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<script src="__STATIC__/jquery.form.js"></script>
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
<style>
.tabcon1711 input.time {
width: 150px;
}
#form .txt_area {
width: 300px;
height: 150px;
}
.tabcon1711 .form_unit {
margin-left: 2px;
}
.tabcon1711 .mustmark {
margin-left:-7px;
}
.list-ratio {
display: table;
}
.list-ratio .li-ratio {
display: flex;
margin-bottom: 20px;
align-items: center;
}
.list-ratio .li-ratio .turnover, .list-ratio .li-ratio .turnover-ratio {
position: relative;
}
.list-ratio .li-ratio .turnover span, .list-ratio .li-ratio .turnover-ratio .error-message {
color: red;
position: absolute;
left: 0;
top: 30px;
white-space: nowrap;
display: none;
}
.iconfont-btn {
cursor: pointer;
}
.iconfont-style {
font-size: 18px;
color: #fff;
border-radius: 4px;
border: 0;
padding: 5px;
margin-left: 10px;
}
.iconfont-selected {
background-color: #0A9AF2;
}
.iconfont-selected:hover {
background-color: #03a9f4;
}
.iconfont-unselected {
background-color: #999;
}
.iconfont-unselected:hover {
background-color: #ababab;
}
input[type=number]{
padding: 4px 6px;
font-size: 12px;
line-height: 20px;
color: #555;
vertical-align: middle;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
background-color: #fff;
border: 1px solid #ccc;
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,0.075);
-moz-box-shadow: inset 0 1px 1px rgba(0,0,0,0.075);
box-shadow: inset 0 1px 1px rgba(0,0,0,0.075);
-webkit-transition: border linear .2s, box-shadow linear .2s;
-moz-transition: border linear .2s, box-shadow linear .2s;
-o-transition: border linear .2s, box-shadow linear .2s;
transition: border linear .2s, box-shadow linear .2s;
}
</style>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">新增</h3>
<p class="description_text">说明:选择仅内团推广的游戏,选中的游戏推广员将不进行业绩提成</p>
</div>
<!-- 标签页导航 -->
<div class="tab-wrap">
<div class="tab-content tabcon1711">
<!-- 表单 -->
<form id="form" action="{:U('addcompanybelonggame')}" method="post" class="form-horizontal">
<!-- 基础文档模型 -->
<div id="tab1" class="tab-pane in tab1">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="l"><i class="mustmark">*</i>生效期限:</td>
<td class="r table_radio">
<div style="float: left;">
<input type="text" class="txt time" name="begin_time" id="begin_time" placeholder="起始时间" value="">-
<input type="text" class="txt time" name="end_time" id="end_time" placeholder="结束时间" value="">
</div>
<span class="notice-text"></span>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>游戏:</td>
<td class="r">
<a class="ajax-view submit_btn mlspacing" data-id="{$data.id}" style="margin-left:0">选择游戏</a>
<span class="notice-text"></span>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>已申请游戏:</td>
<td class="r promote_id" id="game_name">
</td>
</tr>
</tbody>
</table>
</div>
<div class="form-item cf">
<input style="display: none" value="" name="game_ids" class="show_game_ids">
<button class="submit_btn mlspacing" id="submit" type="submit" target-form="form-horizontal">
保存
</button>
<a class="submit_btn " alt="返回上一页" title="返回上一页" href="javascript:window.history.back();" >
返回
</a>
</div>
</form>
<div class="pro_promot" style="display:none">
<form action="{:U('MarketPercentage/showGame')}" id="ajaxForm" method="post" />
<input type="hidden" name="promote_id" id="se_promote_id" value="" />
<div class="pro_promot_main">
<div class="pro_promot_title">
<div class="fl pro_promot_title_text">
<div class="fl pro_promot_title_bigtext"> 可申请游戏</div> </div>
<div class="pro_promot_close fr"><img src="__IMG__/icon_close.png"></div>
</div>
<div class="pro_promot_con">
<!-- <div class="pro_promot_account">推广员账号:<span class="pro_promot_number"></span></div>-->
<div class="pro_promot_select">
<div class="pro_promot_select_title fl">选择游戏:</div>
<div class="pro_promot_select_list fl">
<a class="pro_promot_select_list_con fl active pro_promot_all pro_promot_mr20">全部 </a>
<a class="pro_promot_select_list_con fl" data-index="A">A</a>
<a class="pro_promot_select_list_con fl" data-index="B">B</a>
<a class="pro_promot_select_list_con fl" data-index="C">C</a>
<a class="pro_promot_select_list_con fl pro_promot_mr20" data-index="D">D</a>
<a class="pro_promot_select_list_con fl" data-index="E">E</a>
<a class="pro_promot_select_list_con fl" data-index="F">F</a>
<a class="pro_promot_select_list_con fl" data-index="G">G</a>
<a class="pro_promot_select_list_con fl pro_promot_mr20" data-index="H">H</a>
<a class="pro_promot_select_list_con fl" data-index="I">I</a>
<a class="pro_promot_select_list_con fl" data-index="J">J</a>
<a class="pro_promot_select_list_con fl" data-index="K">K</a>
<a class="pro_promot_select_list_con fl pro_promot_mr20" data-index="L">L</a>
<a class="pro_promot_select_list_con fl" data-index="M">M</a>
<a class="pro_promot_select_list_con fl" data-index="N">N</a>
<a class="pro_promot_select_list_con fl" data-index="O">O</a>
<a class="pro_promot_select_list_con fl pro_promot_mr20" data-index="P">P</a>
<a class="pro_promot_select_list_con fl" data-index="Q">Q</a>
<a class="pro_promot_select_list_con fl" data-index="R">R</a>
<a class="pro_promot_select_list_con fl" data-index="S">S</a>
<a class="pro_promot_select_list_con fl pro_promot_mr20" data-index="T">T</a>
<a class="pro_promot_select_list_con fl" data-index="U">U</a>
<a class="pro_promot_select_list_con fl" data-index="V">V</a>
<a class="pro_promot_select_list_con fl" data-index="W">W</a>
<a class="pro_promot_select_list_con fl pro_promot_mr20" data-index="X">X</a>
<a class="pro_promot_select_list_con fl" data-index="Y">Y</a>
<a class="pro_promot_select_list_con fl" data-index="Z">Z</a>
</div>
</div>
<div class="clear"></div>
<div class="pro_promot_game">
<div class="jsgamecheckallbox z_clearfix" >
<label class="custom-label">
<input type="checkbox" class="form_control jsgamecheckall" >
<i class="label_icon"></i>
<span class="label_text">全选</span></label>
</div>
<ul id="game_list" class="z_clearfix game_list" style="clear: both;">
</ul>
</div>
<div class="clear"></div>
<div class="pro_promot_btn">
<div class="fl pro_promot_btn_confirm">确定</div>
<div class="fr pro_promot_btn_cancel">取消</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</block>
<block name="script">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script src="__STATIC__/czinputcheck.js?v=1.29" type="text/javascript"></script>
<script type="text/javascript">
//导航高亮
highlight_subnav("{:U('addcompanybelonggame')}");
$(".select_gallery").select2();
$(function(){
$('.time').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true
});
$('#submit').click(function (e) {
//查看是否报错
var target = $('#form').get(0).action;
var query = $('#form').serialize();
var starttime = $.trim($('#begin_time').val());
var endtime = $.trim($('#end_time').val());
if (starttime && endtime && starttime > endtime) {layer.msg('开始时间必须小于等于结束时间');return false;}
var that = this;
$(that).addClass('disabled').attr('autocomplete','off').prop('disabled',true);
$.post(target,query).success(function(data){
if(data.status == 1) {
layer.msg(data.msg);
setTimeout(function(){
window.location.href = "{:U('MarketPercentage/companybelonggame')}";
},2000);
} else {
layer.msg(data.msg);
$(that).addClass('disabled').attr('autocomplete','on').prop('disabled',false);
}
});
});
showTab();
var game_data = [];
var push_data = [];
$('#relation_game_id').change(function (e) {
var original_package_name = $('#relation_game_id option:selected').data("original");
if(original_package_name == ''){
original_package_name = '未配置原包名'
}
$("#original_package_name").html(original_package_name);
});
//点击字母按照条件按钮筛选
$(".pro_promot_select_list_con").click(function(){
//选中高亮样式
$(this).addClass('active');
$(this).siblings().removeClass('active');
var that = $(this);
var index = $(this).attr("data-index");
$("#game_list li").each(function(index,ele){
var short = $(this).attr('data-short');
$(this).show();
if(that.attr('data-index')){
if(that.attr('data-index')!=short.charAt(0)){
$(this).hide();
}
}
})
});
//打开弹窗
$(".ajax-view").click(function(){
//获取游戏列表
var url = "{:U('MarketPercentage/getPromoteGame')}";
var id = $(this).attr('data-id');
var checked = 'checked';
$.post(url,{id:id},function(res){
if(res.code==1){
$(".pro_promot_select_list a").eq(0).addClass('active');
$(".pro_promot_select_list a").eq(0).siblings().removeClass('active');
var game_list = res.data.game_list;
var lis = [];
$.each(game_list,function(index,ele){
if(ele.game_name.length>6){
ele.game_name = ele.game_name .substring(0,6)+"..."
}
lis.push('<li class="fl pro_promot_game_con" data-short="'+ele.short+'">');
if(game_data.indexOf(ele.id)>-1){
lis.push('<input type="checkbox" value="'+ele.id+'" name="game_ids[]" class="fl pro_promot_game_check jsgameid" checked="checked" id="gameCheck'+index+'" />');
}else{
$(".jsgamecheckall").attr('checked',false);
lis.push('<input type="checkbox" value="'+ele.id+'" name="game_ids[]" class="fl pro_promot_game_check jsgameid" id="gameCheck'+index+'" />');
checked = '';
}
lis.push('<label for="gameCheck'+index+'" class="fl"></label>');
lis.push('<span class="fl pro_promot_game_name">'+ele.game_name+'</span>');
lis.push('</li>');
});
$(".jsgamecheckall").attr('checked',checked);
$("#game_list").html(lis.join(''));
$(".pro_promot").css("display","block");
jsgameid();
}else{
var tip_msg = res.info ? res.info : '操作失败';
layer.msg(tip_msg);
}
});
});
//保存修改
$(".pro_promot_btn_confirm").click(function(){
$("#ajaxForm").ajaxSubmit(function(res){
if (res.status == 1) {
$("#game_name").empty();
layer.msg(res.msg);
var data = res.data;
var span = "";
for (var key in data) {
span += "<span style='margin-left: 15px'>"+data[key]['relation_game_name']+"</span>";
if ((parseInt(key)+1)%5 == 0) {
span += "<br>";
}
game_data.push(data[key]['relation_game_id']);
push_data.push(data[key]['relation_game_id']);
}
// push_data = JSON.stringify(push_data);
$(".show_game_ids").val(push_data);
$("#game_name").append(span);
$(".pro_promot").hide();
} else {
layer.msg(res.msg);
}
});
return false;
});
//关闭弹窗
$(".pro_promot_close").click(function(){
$(".pro_promot").css("display","none");
});
//取消修改
$(".pro_promot_btn_cancel").click(function(){
$(".pro_promot").css("display","none");
layer.msg('修改已取消');
});
$(".jsgamecheckall").click(function(){
$(this).closest('.jsgamecheckallbox').siblings("#game_list").find(".jsgameid").prop("checked", this.checked);
});
//可申请游戏 全选及全选反选 功能 @author zwm date 20180604
function jsgameid(){
$(".jsgameid").click(function(){
var option = $(this).closest('ul').find(".jsgameid"),
checkall = $(this).closest('ul').siblings('.jsgamecheckallbox').find('.jsgamecheckall');
option.each(function(i){
if(!this.checked){
checkall.prop("checked", false);
return false;
}else{
checkall.prop("checked", true);
}
});
});
}
});
</script>
</block>

@ -0,0 +1,272 @@
<extend name="Public/base"/>
<block name="body">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<link rel="stylesheet" href="__CSS__/pro_promote.css" type="text/css" />
<script src="__STATIC__/jquery.form.js"></script>
<script src="__STATIC__/layer/layer.js"></script>
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<script type="text/javascript" src="__STATIC__/layer/extend/layer.ext.js"></script>
<link rel="stylesheet" href="__CSS__/promote.css" type="text/css"/>
<style>
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;height:35px;
height:28px;border-radius:3px;font-size:12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height:35px;
line-height:28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height:26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height:26px;line-height:26px;font-size:12px;
}
.select2-results__option[aria-selected] {font-size:12px;}
.layui-layer-dialog .layui-layer-content{color:red}
.textarea-style {
width: 195px;
height: 150px;
padding-left: 5px;
}
.mustmark {
color: #FF0000;
font-style: normal;
margin: 0 3px;
margin-left:-7px
}
tr{
border-bottom: 1px solid #e6e6e6;
}
.data_list table td{
line-height: 2;
}
</style>
<div class="cf top_nav_list">
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">仅内团推广游戏</h3>
<p class="description_text">说明:仅内团推广游戏数据</p>
</div>
<div class="fl button_list">
<div class="tools">
<a class=" " href="{:U('addcompanybelonggame')}"><span class="button_icon button_icon1"></span>新增</a>
</div>
</div>
<!-- 高级搜索 -->
<div class="jssearch fl cf search_list">
<div class="input-list search-title-box">
<label>搜索:</label>
</div>
<div class="input-list input-list-game search_label_rehab">
<select id="relation_game_id" name="relation_game_id" class="select_gallery" >
<option value="">现包名</option>
<volist name="gameList" id="vo">
<option value="{$vo.relation_game_id}" <if condition="$vo.relation_game_id eq I('relation_game_id')">selected</if> >{$vo.relation_game_name}</option>
</volist>
</select>
</div>
<div class="input-list">
<input type="text" readonly id="time_start" name="time_start" class="" value="{:I('time_start')}" placeholder="生效时间开始" />
&nbsp;-&nbsp;
<div class="input-append date" style="display:inline-block">
<input type="text" readonly id="time_end" name="time_end" class="" value="{:I('time_end')}" placeholder="生效时间结束" />
<span class="add-on"><i class="icon-th"></i></span>
</div>
</div>
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('MarketPercentage/companybelonggame','model='.$model['name'] .'&row='.I('row') . '&group=' . $group,false)}">搜索</a>
</div>
</div>
</div>
<!-- 数据列表 -->
<div class="data_list">
<div class="">
<table>
<!-- 表头 -->
<thead>
<tr>
<th>生效时间</th>
<th>原包名</th>
<th>现包名</th>
<th>游戏类型</th>
<th>操作</th>
</tr>
</thead>
<!-- 列表 -->
<tbody>
<if condition = "empty($data)">
<tr>
<td colspan="16" class="text-center">aOh! 暂时还没有内容!</td>
</tr>
<else/>
<volist name="data" id="data">
<tr>
<td rowspan="{$data.row}">{$data.begin_time}-{$data.end_time}</td>
<td>{$data['game_data']['0']['original_package_name']|default="--"}</td>
<td>{$data['game_data']['0']['relation_game_name']|default="--"}</td>
<td>{$data['game_data']['0']['game_type_name']|default="--"}</td>
<td rowspan="{$data.row}">
<a href="{:U('editcompanybelonggame', array('id'=>$data['id']))}" class="">修改</a>
<a data-url="{:U('delcompanybelonggame', array('id'=>$data['id']))}" class="ratio_del">删除</a>
</td>
</tr>
<if condition="$data['row'] gt 1">
<foreach name="data['game_data']" item="game_data" key="gamekey">
<if condition="$gamekey neq 0">
<tr>
<td>{$game_data['original_package_name']|default="--"}</td>
<td>{$game_data['relation_game_name']|default="--"}</td>
<td>{$game_data['game_type_name']|default="--"}</td>
</tr>
</if>
</foreach>
</if>
</volist>
</if>
</tbody>
</table>
</div>
</div>
<div class="page">
<!-- <a class="sch-btn export-btn" id="downloadexcel" url="{:U(CONTROLLER_NAME.'/'.ACTION_NAME,array_merge(['export'=>1],I('get.')))}">导出</a>-->
{$_page|default=''}
</div>
<!--弹出层-->
<div class="promote-layer mb20">
<form id="ajaxForm" action="{:U('set_withdraw')}" method="post">
<ol class="promote-con">
<li class="promote-con-con " id="deny">
<div class="mb20">
<span class="promote-name">备注:</span>
<textarea class="textarea-style" name="remark" id="remark"></textarea>
</div>
<a class="ajax-post pack" style="cursor: pointer;" target-form="ids" url="{:U('setStatus',array('status'=>-1))}"><div class="promote-btn">拒绝</div></a>
</li>
</ol>
</form>
</div>
</block>
<block name="script">
<script>
<volist name=":I('get.')" id="vo">
Think.setValue('{$key}',"{$vo}");
</volist>
$(".select_gallery").select2();
</script>
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script type="text/javascript">
//导航高亮
highlight_subnav("{:U('MarketPercentage/companybelonggame')}");
$(function(){
$('#time_start').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true
});
$('#time_end').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true
});
$('#datetimepicker').datetimepicker({
format: 'yyyy-mm',
language:"zh-CN",
// minView:2,
weekStart: 1,
todayBtn: true,
todayHighlight: false,
startView: 3,
minView: 3,
forceParse: 0,
autoclose:true,
pickerPosition:'bottom-left'
})
//搜索功能
$("#search").click(function(){
var url = $(this).attr('url');
var query = $('.jssearch').find('input').serialize();
query += "&"+$('.jssearch').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
query = query.replace(/^&/g,'');
if( url.indexOf('?')>0 ){
url += '&' + query;
}else{
url += '?' + query;
}
window.location.href = url;
});
//回车自动提交
$('.jssearch').find('input').keyup(function(event){
if(event.keyCode===13){
$("#search").click();
}
});
$("#downloadexcel").on("click",function(){
var url = $(this).attr("url");
var title = '游戏分成比例模板,请耐心等待数据处理....';
var index = layer.load(2);
layer.open({
type: 2,
title: title,
shadeClose: false,
shade: 0.8,
area: ['40%', '30%'],
content: url,
success:function(){
layer.closeAll();
}
});
})
$(".ratio_del").on("click",function(){
var url = $(this).data("url");
layer.confirm('删除后将无法恢复,请慎重选择', {
closeBtn:0,
title:false,
btn: ['取消','删除'] //按钮
}, function(index){
layer.close(index);
}, function(){
$.get(url,function(data){
if(data.status == 1){
layer.msg('<span style="color:white">'+data.msg+'<span>',{time: 1000},function(){
window.location.reload();
});
}else{
layer.msg(data.msg,{icon: 2});
}
});
});
})
})
</script>
</block>

@ -0,0 +1,419 @@
<extend name="Public/base" />
<block name="body">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="__CSS__/admin_table.css" media="all">
<link href="__STATIC__/icons_alibaba/iconfont.css" rel="stylesheet">
<link rel="stylesheet" href="__CSS__/pro_promote.css" type="text/css" />
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
<script type="text/javascript" src="__STATIC__/provincecityarea/AreaData_min.js"></script>
<script src="__STATIC__/layer/layer.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<script src="__STATIC__/jquery.form.js"></script>
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
<style>
.tabcon1711 input.time {
width: 150px;
}
#form .txt_area {
width: 300px;
height: 150px;
}
.tabcon1711 .form_unit {
margin-left: 2px;
}
.tabcon1711 .mustmark {
margin-left:-7px;
}
.list-ratio {
display: table;
}
.list-ratio .li-ratio {
display: flex;
margin-bottom: 20px;
align-items: center;
}
.list-ratio .li-ratio .turnover, .list-ratio .li-ratio .turnover-ratio {
position: relative;
}
.list-ratio .li-ratio .turnover span, .list-ratio .li-ratio .turnover-ratio .error-message {
color: red;
position: absolute;
left: 0;
top: 30px;
white-space: nowrap;
display: none;
}
.iconfont-btn {
cursor: pointer;
}
.iconfont-style {
font-size: 18px;
color: #fff;
border-radius: 4px;
border: 0;
padding: 5px;
margin-left: 10px;
}
.iconfont-selected {
background-color: #0A9AF2;
}
.iconfont-selected:hover {
background-color: #03a9f4;
}
.iconfont-unselected {
background-color: #999;
}
.iconfont-unselected:hover {
background-color: #ababab;
}
input[type=number]{
padding: 4px 6px;
font-size: 12px;
line-height: 20px;
color: #555;
vertical-align: middle;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
background-color: #fff;
border: 1px solid #ccc;
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,0.075);
-moz-box-shadow: inset 0 1px 1px rgba(0,0,0,0.075);
box-shadow: inset 0 1px 1px rgba(0,0,0,0.075);
-webkit-transition: border linear .2s, box-shadow linear .2s;
-moz-transition: border linear .2s, box-shadow linear .2s;
-o-transition: border linear .2s, box-shadow linear .2s;
transition: border linear .2s, box-shadow linear .2s;
}
</style>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">编辑</h3>
<p class="description_text">说明:选择仅内团推广的游戏,选中的游戏推广员将不进行业绩提成</p>
</div>
<!-- 标签页导航 -->
<div class="tab-wrap">
<div class="tab-content tabcon1711">
<!-- 表单 -->
<form id="form" action="{:U('editcompanybelonggame')}" method="post" class="form-horizontal">
<!-- 基础文档模型 -->
<div id="tab1" class="tab-pane in tab1">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="l"><i class="mustmark">*</i>生效期限:</td>
<td class="r table_radio">
<div style="float: left;">
<input type="text" class="txt time" name="begin_time" id="begin_time" placeholder="起始时间" value="{$data['begin_time']}" <if condition="$data['is_start'] eq 1">disabled</if>>-
<input type="hidden" name="is_start" value="{$data['is_start']}">
<input type="text" class="txt time" name="end_time" id="end_time" placeholder="结束时间" value="{$data['end_time']}">
</div>
<span class="notice-text"></span>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>游戏:</td>
<td class="r">
<a class="ajax-view submit_btn mlspacing" data-id="{$data.id}" data-is="{$data['is_start']}" style="margin-left:0">选择游戏</a>
<span class="notice-text"></span>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>已申请游戏:</td>
<td class="r promote_id" id="game_name">
{$data['span_str']}
</td>
</tr>
</tbody>
</table>
</div>
<!-- {$data['game_ids']}-->
<div class="form-item cf">
<input style="display: none" value="{$_GET['id']}" name="id" >
<input style="display: none" value="{$data['ids']}" name="game_ids" class="show_game_ids">
<button class="submit_btn mlspacing" id="submit" type="submit" target-form="form-horizontal">
保存
</button>
<a class="submit_btn " alt="返回上一页" title="返回上一页" href="javascript:window.history.back();" >
返回
</a>
</div>
</form>
<div class="pro_promot" style="display:none">
<form action="{:U('MarketPercentage/showGame')}" id="ajaxForm" method="post" />
<input type="hidden" name="promote_id" id="se_promote_id" value="" />
<div class="pro_promot_main">
<div class="pro_promot_title">
<div class="fl pro_promot_title_text">
<div class="fl pro_promot_title_bigtext"> 可申请游戏</div> </div>
<div class="pro_promot_close fr"><img src="__IMG__/icon_close.png"></div>
</div>
<div class="pro_promot_con">
<!-- <div class="pro_promot_account">推广员账号:<span class="pro_promot_number"></span></div>-->
<div class="pro_promot_select">
<div class="pro_promot_select_title fl">选择游戏:</div>
<div class="pro_promot_select_list fl">
<a class="pro_promot_select_list_con fl active pro_promot_all pro_promot_mr20">全部 </a>
<a class="pro_promot_select_list_con fl" data-index="A">A</a>
<a class="pro_promot_select_list_con fl" data-index="B">B</a>
<a class="pro_promot_select_list_con fl" data-index="C">C</a>
<a class="pro_promot_select_list_con fl pro_promot_mr20" data-index="D">D</a>
<a class="pro_promot_select_list_con fl" data-index="E">E</a>
<a class="pro_promot_select_list_con fl" data-index="F">F</a>
<a class="pro_promot_select_list_con fl" data-index="G">G</a>
<a class="pro_promot_select_list_con fl pro_promot_mr20" data-index="H">H</a>
<a class="pro_promot_select_list_con fl" data-index="I">I</a>
<a class="pro_promot_select_list_con fl" data-index="J">J</a>
<a class="pro_promot_select_list_con fl" data-index="K">K</a>
<a class="pro_promot_select_list_con fl pro_promot_mr20" data-index="L">L</a>
<a class="pro_promot_select_list_con fl" data-index="M">M</a>
<a class="pro_promot_select_list_con fl" data-index="N">N</a>
<a class="pro_promot_select_list_con fl" data-index="O">O</a>
<a class="pro_promot_select_list_con fl pro_promot_mr20" data-index="P">P</a>
<a class="pro_promot_select_list_con fl" data-index="Q">Q</a>
<a class="pro_promot_select_list_con fl" data-index="R">R</a>
<a class="pro_promot_select_list_con fl" data-index="S">S</a>
<a class="pro_promot_select_list_con fl pro_promot_mr20" data-index="T">T</a>
<a class="pro_promot_select_list_con fl" data-index="U">U</a>
<a class="pro_promot_select_list_con fl" data-index="V">V</a>
<a class="pro_promot_select_list_con fl" data-index="W">W</a>
<a class="pro_promot_select_list_con fl pro_promot_mr20" data-index="X">X</a>
<a class="pro_promot_select_list_con fl" data-index="Y">Y</a>
<a class="pro_promot_select_list_con fl" data-index="Z">Z</a>
</div>
</div>
<div class="clear"></div>
<div class="pro_promot_game">
<div class="jsgamecheckallbox z_clearfix" >
<label class="custom-label">
<input type="checkbox" class="form_control jsgamecheckall" >
<i class="label_icon"></i>
<span class="label_text">全选</span></label>
</div>
<ul id="game_list" class="z_clearfix game_list" style="clear: both;">
</ul>
</div>
<div class="clear"></div>
<div class="pro_promot_btn">
<div class="fl pro_promot_btn_confirm">确定</div>
<div class="fr pro_promot_btn_cancel">取消</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</block>
<block name="script">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script src="__STATIC__/czinputcheck.js?v=1.29" type="text/javascript"></script>
<script type="text/javascript">
//导航高亮
highlight_subnav("{:U('editcompanybelonggame')}");
$(".select_gallery").select2();
$(function(){
$('.time').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true
});
$('#submit').click(function (e) {
//查看是否报错
var target = $('#form').get(0).action;
var query = $('#form').serialize();
var starttime = $.trim($('#begin_time').val());
var endtime = $.trim($('#end_time').val());
if (starttime && endtime && starttime > endtime) {layer.msg('开始时间必须小于等于结束时间');return false;}
var that = this;
$(that).addClass('disabled').attr('autocomplete','off').prop('disabled',true);
$.post(target,query).success(function(data){
if(data.status == 1) {
layer.msg(data.msg);
setTimeout(function(){
window.location.href = "{:U('MarketPercentage/companybelonggame')}";
},2000);
} else {
layer.msg(data.msg);
$(that).addClass('disabled').attr('autocomplete','on').prop('disabled',false);
}
});
});
showTab();
// var get_push_data = "{$data['game_ids']}";
var game_data = "{$data['game_ids']}";
var push_data = "{$data['ids']}";
$('#relation_game_id').change(function (e) {
var original_package_name = $('#relation_game_id option:selected').data("original");
if(original_package_name == ''){
original_package_name = '未配置原包名'
}
$("#original_package_name").html(original_package_name);
});
//点击字母按照条件按钮筛选
$(".pro_promot_select_list_con").click(function(){
//选中高亮样式
$(this).addClass('active');
$(this).siblings().removeClass('active');
var that = $(this);
var index = $(this).attr("data-index");
$("#game_list li").each(function(index,ele){
var short = $(this).attr('data-short');
$(this).show();
if(that.attr('data-index')){
if(that.attr('data-index')!=short.charAt(0)){
$(this).hide();
}
}
})
});
//打开弹窗
$(".ajax-view").click(function(){
//获取游戏列表
var url = "{:U('MarketPercentage/getPromoteGame')}";
var id = $(this).attr('data-id');
var is_show = $(this).attr('data-is');
var checked = 'checked';
if (is_show == 1) {
layer.msg("已经结算过的时间不能修改游戏");
return;
}
$.post(url,{id:id},function(res){
if(res.code==1){
$(".pro_promot_select_list a").eq(0).addClass('active');
$(".pro_promot_select_list a").eq(0).siblings().removeClass('active');
var game_list = res.data.game_list;
var lis = [];
$.each(game_list,function(index,ele){
if(ele.game_name.length>6){
ele.game_name = ele.game_name .substring(0,6)+"..."
}
lis.push('<li class="fl pro_promot_game_con" data-short="'+ele.short+'">');
if(game_data.indexOf(ele.id)>-1){
lis.push('<input type="checkbox" value="'+ele.id+'" name="game_ids[]" class="fl pro_promot_game_check jsgameid" checked="checked" id="gameCheck'+index+'" />');
}else{
$(".jsgamecheckall").attr('checked',false);
lis.push('<input type="checkbox" value="'+ele.id+'" name="game_ids[]" class="fl pro_promot_game_check jsgameid" id="gameCheck'+index+'" />');
checked = '';
}
lis.push('<label for="gameCheck'+index+'" class="fl"></label>');
lis.push('<span class="fl pro_promot_game_name">'+ele.game_name+'</span>');
lis.push('</li>');
});
$(".jsgamecheckall").attr('checked',checked);
$("#game_list").html(lis.join(''));
$(".pro_promot").css("display","block");
jsgameid();
}else{
var tip_msg = res.info ? res.info : '操作失败';
layer.msg(tip_msg);
}
});
});
//保存修改
$(".pro_promot_btn_confirm").click(function(){
$("#ajaxForm").ajaxSubmit(function(res){
if (res.status == 1) {
$("#game_name").empty();
layer.msg(res.msg);
var data = res.data;
var span = "";
push_data = [];
game_data = [];
for (var key in data) {
span += "<span style='margin-left: 15px'>"+data[key]['relation_game_name']+"</span>";
if ((parseInt(key)+1)%5 == 0) {
span += "<br>";
}
game_data.push(data[key]['relation_game_id']);
push_data.push(data[key]['relation_game_id']);
}
$(".show_game_ids").val(push_data);
$("#game_name").append(span);
$(".pro_promot").hide();
} else {
layer.msg(res.msg);
}
});
return false;
});
//关闭弹窗
$(".pro_promot_close").click(function(){
$(".pro_promot").css("display","none");
});
//取消修改
$(".pro_promot_btn_cancel").click(function(){
$(".pro_promot").css("display","none");
layer.msg('修改已取消');
});
$(".jsgamecheckall").click(function(){
$(this).closest('.jsgamecheckallbox').siblings("#game_list").find(".jsgameid").prop("checked", this.checked);
});
//可申请游戏 全选及全选反选 功能 @author zwm date 20180604
function jsgameid(){
$(".jsgameid").click(function(){
var option = $(this).closest('ul').find(".jsgameid"),
checkall = $(this).closest('ul').siblings('.jsgamecheckallbox').find('.jsgamecheckall');
option.each(function(i){
if(!this.checked){
checkall.prop("checked", false);
return false;
}else{
checkall.prop("checked", true);
}
});
});
}
});
</script>
</block>

@ -365,7 +365,7 @@
async: false,
success:function(data){
if(data.status == 1) {
layer.msg("重新计算需要时间,请等待5分钟后再查看");
layer.msg("重新计算需要时间,请等待10分钟后再查看");
setTimeout(function(){
window.location.reload();
},1500);

@ -0,0 +1,507 @@
<extend name="Public/base"/>
<block name="body">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<link rel="stylesheet" href="__CSS__/pro_promote.css" type="text/css" />
<script src="__STATIC__/jquery.form.js"></script>
<script src="__STATIC__/layer/layer.js"></script>
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<style>
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;height:35px;
height:28px;border-radius:3px;font-size:12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height:35px;
line-height:28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height:26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height:26px;line-height:26px;font-size:12px;
}
.select2-results__option[aria-selected] {font-size:12px;}
.layui-layer-dialog .layui-layer-content{color:red}
</style>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">非外团游戏结算数据统计</h3>
<p class="description_text">说明:不开放给外团游戏流水数据统计</p>
</div>
<div class="cf top_nav_list">
<div class="fl button_list">
<div class="tools">
<if condition="$caculate_check eq true">
<empty name="show_status">
<a class="recaculate" url="{:U('reCaculateBonus?pay_time='.$_GET['pay_time'])}" style="width: 60px;text-align: center;padding-right: 0;margin-right: 0;">重算</a>
</empty>
</if>
</div>
</div>
<!-- 高级搜索 -->
<div class="jssearch fl cf search_list">
<div class="input-list search-title-box">
<label>搜索:</label>
</div>
<div class="input-list input-list-resway search_label_rehab">
<select id="company_id" name="company_id" class="select_gallery" style="width:150px;">
<option value="">请选择推广公司</option>
<volist name=":getPromoteCompany()" id="vo">
<option value="{$vo.id}" <if condition="I('company_id') && $vo.id eq I('company_id')">selected
</if> >{$vo.company_name}</option>
</volist>
</select>
</div>
<!-- <div class="input-list input-list-promote search_label_rehab">-->
<!-- <select id="pay_time" name="pay_time" class="select_gallery" style="width:150px;">-->
<!-- <option value="">请选择月份</option>-->
<!-- <volist name=":getMonth()" id="vo">-->
<!-- <option value="{$vo}" <if condition="$vo eq $_GET['pay_time']">selected=selected</if>>{$vo}</option>-->
<!-- </volist>-->
<!-- </select>-->
<!-- </div>-->
<div class="input-list">
<input type="text" readonly id="time_start" name="time_start" class="" value="{:I('time_start')}" placeholder="开始时间" />
&nbsp;-&nbsp;
<div class="input-append date" id="datetimepicker" style="display:inline-block">
<input type="text" readonly id="time_end" name="time_end" class="" value="{:I('time_end')}" placeholder="结束时间" />
<span class="add-on"><i class="icon-th"></i></span>
</div>
</div>
<div class="input-list input-list-parent search_label_rehab">
<select id="promote_id" name="promote_id" class="select_gallery" style="width:120px;">
<option value="">请选择会长账号</option>
<volist name=":promote_listsMarket(1)" id="vo">
<option data-company_belong="{$vo['company_belong']}" data-belong="{:getCompanyBlong($vo['company_belong'])}" promote_id-id="{$vo.id}" value="{$vo.id}" <if condition="$vo.id eq $_GET['promote_id']">selected=selected</if>>{$vo.account}</option>
</volist>
</select>
</div>
<div class="input-list input-list-parent search_label_rehab">
<select id="admin_id" name="admin_id" class="select_gallery" style="width:120px;">
<option value="">请选择人员</option>
<volist name=":getMarketAdmin()" id="vo">
<option value="{$vo.uid}" <if condition="$vo.uid eq $_GET['admin_id']">selected=selected</if>>{$vo.real_name}</option>
</volist>
</select>
</div>
<div class="input-list input-list-game search_label_rehab">
<select id="relation_game_id" name="relation_game_id" class="select_gallery" style="width:120px;">
<option value="" selected="">请选择游戏</option>
<volist name=':get_game_list(null,2)' id='vo'>
<option value="{$vo.relation_game_id}" <if condition="$vo.relation_game_id eq $_GET['relation_game_id']"></if>>{$vo.relation_game_name}</option>
</volist>
</select>
</div>
<input type="hidden" name="" value="" class="sortBy">
<input type="hidden" name="type" value="{$_GET['type']}">
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('indexuncaculate','model='.$model['name'] .'&row='.I('row'),false)}">搜索</a>
</div>
</div>
</div>
<!-- 数据列表 -->
<div class="data_list">
<empty name="show_status">
<div class="">
<table>
<!-- 表头 -->
<thead>
<tr>
<th>时间</th>
<th>公司名称</th>
<th>会长账号</th>
<th>内外团</th>
<th>所属市场专员</th>
<th>类型</th>
<th >游戏名称</th>
<th >总流水</th>
<th>上游结算流水</th>
<th>下游结算流水</th>
<th>支付渠道费用</th>
<th><a href="{:U('editTaxRatio')}" style="text-decoration:none;">公司税费</a></th>
<th>税后毛利额</th>
</tr>
</thead>
<!-- 列表 -->
<tbody>
<if condition = "empty($list_data)">
<tr>
<td colspan="16" class="text-center">aOh! 暂时还没有内容!</td>
</tr>
</if>
<notemtpy name = "list_data">
<volist name="list_data" id="data">
<tr>
<td>{$data.pay_time}</td>
<td>{$data.company_name}</td>
<td>{$data.promote_account}</td>
<td>{$data.company_belong}</td>
<td>{$data.real_name}</td>
<td>{$data['develop_type']}</td>
<td>{$data['game_name']}</td>
<td>{$data['pay_amount']}</td>
<td>{$data['cp_amount']}</td>
<td>{$data['promote_amount']}</td>
<td>{$data['channel_amount']}</td>
<td>{$data['company_tax']}</td>
<td>{$data['company_profit']}</td>
</tr>
</volist>
<tr>
<td></td>
<td></td>
<td></td>
<td>合计</td>
<td></td>
<td></td>
<td></td>
<td>{$sum['pay_amount']}</td>
<td>{$sum['cp_amount']}</td>
<td>{$sum['promote_amount']}</td>
<td>{$sum['channel_amount']}</td>
<td>{$sum['company_tax']}</td>
<td>{$sum['company_profit']}</td>
</tr>
</notemtpy>
</tbody>
</table>
</div>
<else/>
</empty>
</div>
<div class="page">
<if condition="$role_export_check eq true ">
<a class="sch-btn" href="{:U(CONTROLLER_NAME.'/'.ACTION_NAME,array_merge(['export'=>1],I('get.')))}" target="_blank">导出</a>
</if>
{$_page|default=''}
</div>
</block>
<block name="script">
<script>
<volist name=":I('get.')" id="vo">
Think.setValue('{$key}',"{$vo}");
</volist>
$(".select_gallery").select2();
</script>
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script type="text/javascript">
//导航高亮
highlight_subnav('{:U('MarketPercentage/indexuncaculate')}');
$(function(){
//搜索功能
$("#search").click(function(){
var url = $(this).attr('url');
var query = $('.jssearch').find('input').serialize();
query += "&"+$('.jssearch').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
query = query.replace(/^&/g,'');
if( url.indexOf('?')>0 ){
url += '&' + query;
}else{
url += '?' + query;
}
var start = $("#time_start").val();
var end = $("#time_end").val();
if(start !='' && end != ''){
if (Date.parse(start) > Date.parse(end)){
layer.msg('开始时间必须小于等于结束时间');
return false;
}
}
window.location.href = url;
});
$(".paixu").click(function(){
var that=$(this);
$data_order=that.attr('data-order');
$order_type='{$userarpu_order}';
if($order_type==''||$order_type=='4'){
$(".sortBy").attr('name','data_order');
val='3,'+$data_order;
$(".sortBy").attr('value',val);
$("#search").click();
}else if($order_type=='3'){
$(".sortBy").attr('name','data_order');
val='4,'+$data_order;
$(".sortBy").attr('value',val);
$("#search").click();
}
});
//回车自动提交
$('.jssearch').find('input').keyup(function(event){
if(event.keyCode===13){
$("#search").click();
}
});
$("#admin").on('click',function(event) {
var navlist = $(this).find('.i_list_li');
if (navlist.hasClass('hidden')) {
navlist.removeClass('hidden');
$(this).find('#i_list_id').focus().val('');
} else {
navlist.addClass('hidden');
}
$(document).one("click", function(){
navlist.addClass('hidden');
});
event.stopPropagation();
});
$('#admin #i_list_id').on('keyup',function(event) {
var val = $.trim($(this).val()).toLowerCase();
$(this).closest('.drop-down').find('#i_list_idh').val(val);
});
$("#admin #i_list_li").find("a").each(function(){
$(this).click(function(){
var text = $.trim($(this).text()).toLowerCase();
$(this).closest('.drop-down').find("#i_list_id").val(text);
$(this).closest('.drop-down').find('#i_list_idh').val(text);
})
});
$('#time_start').datetimepicker({
format: 'yyyy-mm',
language:"zh-CN",
// minView:2,
weekStart: 1,
todayBtn: true,
todayHighlight: false,
startView: 3,
minView: 3,
forceParse: 0,
autoclose:true,
pickerPosition:'bottom-left'
});
$('#datetimepicker').datetimepicker({
format: 'yyyy-mm',
language:"zh-CN",
// minView:2,
weekStart: 1,
todayBtn: true,
todayHighlight: false,
startView: 3,
minView: 3,
forceParse: 0,
autoclose:true,
pickerPosition:'bottom-left'
})
//下拉内容框
$(".drop-down2").on('click',function(event) {
var navlist = $(this).find('.i_list_li');
if (navlist.hasClass('hidden')) {
navlist.removeClass('hidden');
$('#i_list_id').focus().val('');
} else {
navlist.addClass('hidden');
}
$(document).one("click", function(){
navlist.addClass('hidden');
});
event.stopPropagation();
});
/* 状态搜索子菜单 */
/*渠道删除*/
$('.delete').click(function(){
var id = $(this).attr('data-id');
layer.confirm('渠道删除后,下级渠道同时被删除,所属数据归属于自然渠道!', {
title:'确定要删除该渠道?',
icon:0,
btn: ['删除','取消'] //按钮
}, function(){
$.ajax({
type: "POST",
url: "{:U('del_promote')}",
dataType: 'json',
async: false,
data: {id:id},
success:function(data){
if(data.status==1){
layer.msg(data.msg);
setTimeout(function(){
window.location.reload();
},1500);
}
}
});
}, function(){
layer.close();
});
})
$('.recaculate').click(function(){
var url = $(this).attr('url');
layer.confirm('是否确认重算提成!', {
title:'重算提成?',
icon:0,
btn: ['重算','取消'] //按钮
}, function(){
$.ajax({
type: "POST",
url: url,
dataType: 'json',
async: false,
success:function(data){
if(data.status == 1) {
layer.msg("重新计算需要时间,请等待10分钟后再查看");
setTimeout(function(){
window.location.reload();
},1500);
} else {
layer.msg(data.info);
}
},
});
}, function(){
layer.close();
});
});
})
</script>
<script type="text/javascript">
//点击字母按照条件按钮筛选
$(".pro_promot_select_list_con").click(function(){
//选中高亮样式
$(this).addClass('active');
$(this).siblings().removeClass('active');
var that = $(this);
var index = $(this).attr("data-index");
$("#game_list li").each(function(index,ele){
var short = $(this).attr('data-short');
$(this).show();
if(that.attr('data-index')){
if(that.attr('data-index')!=short.charAt(0)){
$(this).hide();
}
}
})
});
//打开弹窗
$(".ajax-view").click(function(){
//获取游戏列表
var url = "{:U('Promote/getPromoteGame')}";
var id = $(this).attr('data-id');
var checked = 'checked';
$.post(url,{id:id},function(res){
if(res.code==1){
$(".pro_promot_select_list a").eq(0).addClass('active');
$(".pro_promot_select_list a").eq(0).siblings().removeClass('active');
var game_list = res.data.game_list;
var promote_info = res.data.promote_info;
var lis = [];
$.each(game_list,function(index,ele){
if(ele.game_name.length>6){
ele.game_name = ele.game_name .substring(0,6)+"..."
}
lis.push('<li class="fl pro_promot_game_con" data-short="'+ele.short+'">');
if(promote_info['game_ids']==''){
lis.push('<input type="checkbox" value="'+ele.id+'" name="game_ids[]" class="fl pro_promot_game_check jsgameid" checked="checked" id="gameCheck'+index+'" />');
}else{
if(promote_info['game_ids'].indexOf(ele.id)>-1){
lis.push('<input type="checkbox" value="'+ele.id+'" name="game_ids[]" class="fl pro_promot_game_check jsgameid" checked="checked" id="gameCheck'+index+'" />');
}else{
$(".jsgamecheckall").attr('checked',false);
lis.push('<input type="checkbox" value="'+ele.id+'" name="game_ids[]" class="fl pro_promot_game_check jsgameid" id="gameCheck'+index+'" />');
checked = '';
}
}
lis.push('<label for="gameCheck'+index+'" class="fl"></label>');
lis.push('<span class="fl pro_promot_game_name">'+ele.game_name+'</span>');
lis.push('</li>');
});
$(".jsgamecheckall").attr('checked',checked);
$("#game_list").html(lis.join(''));
$(".pro_promot_number").text(res.data.promote_info.account);
$("#se_promote_id").val(res.data.promote_info.id);
$(".pro_promot").css("display","block");
jsgameid();
}else{
var tip_msg = res.info ? res.info : '操作失败';
layer.msg(tip_msg);
}
});
});
//保存修改
$(".pro_promot_btn_confirm").click(function(){
$("#ajaxForm").ajaxSubmit(function(res){
layer.msg(res.msg);
$(".pro_promot").hide();
});
return false;
});
//关闭弹窗
$(".pro_promot_close").click(function(){
$(".pro_promot").css("display","none");
});
//取消修改
$(".pro_promot_btn_cancel").click(function(){
$(".pro_promot").css("display","none");
layer.msg('修改已取消');
});
$(".jsgamecheckall").click(function(){
$(this).closest('.jsgamecheckallbox').siblings("#game_list").find(".jsgameid").prop("checked", this.checked);
});
//可申请游戏 全选及全选反选 功能 @author zwm date 20180604
function jsgameid(){
$(".jsgameid").click(function(){
var option = $(this).closest('ul').find(".jsgameid"),
checkall = $(this).closest('ul').siblings('.jsgamecheckallbox').find('.jsgamecheckall');
option.each(function(i){
if(!this.checked){
checkall.prop("checked", false);
return false;
}else{
checkall.prop("checked", true);
}
});
});
}
</script>
</block>

@ -488,7 +488,7 @@
async: false,
success:function(data){
if(data.status == 1) {
layer.msg("重新计算需要时间,请等待5分钟后再查看");
layer.msg("重新计算需要时间,请等待10分钟后再查看");
setTimeout(function(){
window.location.reload();
},1500);

@ -396,7 +396,7 @@
async: false,
success:function(data){
if(data.status == 1) {
layer.msg("重新计算需要时间,请等待5分钟后再查看");
layer.msg("重新计算需要时间,请等待10分钟后再查看");
setTimeout(function(){
window.location.reload();
},1500);

@ -341,7 +341,7 @@
async: false,
success:function(data){
if(data.status == 1) {
layer.msg("重新计算需要时间,请等待5分钟后再查看");
layer.msg("重新计算需要时间,请等待10分钟后再查看");
setTimeout(function(){
window.location.reload();
},1500);

@ -140,7 +140,7 @@
<td class="l"><i class="mustmark">*</i>游戏:</td>
<td class="r">
<select name="game_id" id="game-select" class="select_gallery" multiple="multiple" style="width: 500px;">
<option value="0">所有游戏</option>
<option value="0">所有游戏</option>
<?php foreach($games as $game):?>
<option value="<?=$game['id']?>"><?=$game['name']?></option>
<?php endforeach;?>

@ -140,7 +140,7 @@
<td class="l"><i class="mustmark">*</i>游戏:</td>
<td class="r">
<select name="game_id" id="game-select" class="select_gallery" style="width: 500px;" disabled>
<option value="0">所有游戏</option>
<option value="0">所有游戏</option>
<?php foreach($games as $game):?>
<option value="<?=$game['id']?>" <?php if($record['game_id']==$game['id']):?>selected<?php endif;?>><?=$game['name']?></option>
<?php endforeach;?>
@ -183,13 +183,13 @@
<tr>
<td class="l">生效时间(开始):</td>
<td class="r">
<input type="text" id="start_time" name="start_time" class="time" value="<?=$record['start_time']?>" autocomplete="off" placeholder="请选择生效时间(开始)" style="width: 200px"/>
<input type="text" id="start_time" name="start_time" disabled class="time" value="<?=$record['start_time']?>" autocomplete="off" placeholder="请选择生效时间(开始)" style="width: 200px"/>
</td>
</tr>
<tr>
<td class="l">生效时间(结束):</td>
<td class="r">
<input type="text" id="end_time" name="end_time" class="time" value="<?=$record['end_time']?>" autocomplete="off" placeholder="请选择生效时间(开始)" style="width: 200px"/>
<input type="text" id="end_time" name="end_time" disabled class="time" value="<?=$record['end_time']?>" autocomplete="off" placeholder="请选择生效时间(开始)" style="width: 200px"/>
</td>
</tr>
</tbody>

@ -124,7 +124,6 @@
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('PaymentMerchant/rules')}">搜索</a>
<a class="sch-btn" style="width: 100px;" href="{:U('PaymentMerchant/addRule')}">新增配置</a>
<!-- <a class="sch-btn" href="javascript:;" id="batch-delete-btn">删除</a> -->
</div>
<!-- <div class="input-list">
<a class="sch-btn" href="{:U('Export/expUser',array_merge(array('id'=>12,),I('get.')))}">导出</a>
@ -253,27 +252,6 @@
minView:'month',
maxView:'month',
});
$('#batch-delete-btn').on({
click: function() {
var ids = getIds();
$.ajax({
url: '{:U("batchDelete")}',
type: 'post',
dataType: 'json',
data: {ids: ids},
success: function(result) {
if (result.status == 1) {
layer.msg(result.message)
setTimeout(function() {
window.location.href = window.location.href
}, 200)
} else {
layer.msg(result.message)
}
}
})
}
})
function getIds() {
var ids = [];
$('.ids:checked').each(function() {
@ -281,45 +259,30 @@
})
return ids;
}
$('.delete-btn').on({
click: function() {
var id = $(this).parents('tr').eq(0).attr('data-id');
$.ajax({
url: '{:U("deleteRule")}',
type: 'post',
dataType: 'json',
data: {id: id},
success: function(result) {
if (result.status == 1) {
layer.msg(result.message)
setTimeout(function() {
window.location.href = window.location.href
}, 200)
} else {
layer.msg(result.message)
}
function deleteRule(id) {
$.ajax({
url: '{:U("deleteRule")}',
type: 'post',
dataType: 'json',
data: {id: id},
success: function(result) {
if (result.status == 1) {
layer.msg(result.message)
setTimeout(function() {
window.location.href = window.location.href
}, 200)
} else {
layer.msg(result.message)
}
})
}
})
$('.cancel-btn').on({
}
})
}
$('.delete-btn').on({
click: function() {
var id = $(this).parents('tr').eq(0).attr('data-id');
$.ajax({
url: '{:U("cancel")}',
type: 'post',
dataType: 'json',
data: {id: id},
success: function(result) {
if (result.status == 1) {
layer.msg(result.message)
setTimeout(function() {
window.location.href = window.location.href
}, 200)
} else {
layer.msg(result.message)
}
}
var id = $(this).parents('tr').eq(0).attr('data-id')
layer.confirm('确定要删除该规则 ?请确保删除后时间范围内规则完整!', {icon: 3, title:'提示'}, function(index){
deleteRule(id)
})
}
})

@ -70,7 +70,7 @@ class PaymentRuleService
}
if ($length == 1) {
$first = $repeatRules[0];
if ($startTime <= $first['start_time'] && $endTime >= $last['end_time']) {
if ($startTime <= $first['start_time'] && $endTime >= $first['end_time']) {
M('payment_rule', 'tab_')->where(['id' => $first['id']])->delete();
} elseif ($endTime < $first['end_time'] && $startTime <= $first['start_time']) {
M('payment_rule', 'tab_')->where(['id' => $first['id']])->save(['start_time' => $endTime + 1, 'update_time' => time()]);
@ -109,4 +109,13 @@ class PaymentRuleService
}
}
}
public function filterRecords($records)
{
foreach ($records as $key => $record) {
$records[$key]['company_belong'] = $record['company_id'] > 0 ? -1 : $record['company_belong'];
$records[$key]['game_type_id'] = $record['game_id'] > 0 ? 0 :$record['game_type_id'];
}
return $records;
}
}

@ -6,6 +6,8 @@ use Base\Tool\GameCatClient;
class PromoteGradeService
{
const FOREVER_TIME = 300001;
public static $symbols = [
1 => '>=',
2 => '>',
@ -22,6 +24,14 @@ class PromoteGradeService
{
$id = $params['id'] ?? 0;
if (empty($params['base_game_id'])) {
throw new \Exception('请选择游戏');
}
$monthBegin = isset($params['month_begin']) && $params['month_begin'] ?
date('Ym', strtotime($params['month_begin'])) : 0;
$monthEnd = isset($params['month_end']) && $params['month_end'] ?
date('Ym', strtotime($params['month_end'])) : self::FOREVER_TIME;
$setting = null;
if ($id > 0) {
$setting = M('promote_grade_setting', 'tab_')->where(['id' => $id])->find();
@ -32,12 +42,16 @@ class PromoteGradeService
throw new \Exception('不允许修改其他公司的配置');
}
} else {
$setting = M('promote_grade_setting', 'tab_')->where(['company_id' => $promote['company_id']])->find();
if ($setting) {
throw new \Exception('您已经设置过了');
$count = $this->getRepeatRuleCount($promote['company_id'], $params['base_game_id'], $monthBegin, $monthEnd);
if ($count > 0) {
throw new \Exception('该游戏在相同时间段内已经设置规则');
}
}
if ($monthBegin > 0 && $monthEnd > 0 && $monthBegin > $monthEnd) {
throw new \Exception('规则截止时间不能大于规则开始时间');
}
$config = [];
$config['reach_level'] = $params['level'];
$config['grades'] = $this->sortGrades($params['grades']);
@ -45,6 +59,9 @@ class PromoteGradeService
$data = [];
$data['status'] = 1;
$data['base_game_id'] = $params['base_game_id'];
$data['month_begin'] = $monthBegin;
$data['month_end'] = $monthEnd;
$data['name'] = $params['name'];
$data['config'] = json_encode($config);
@ -75,9 +92,35 @@ class PromoteGradeService
return $grades;
}
public function getCurrentSetting($promote)
public function getTimeRepeatCondition($monthBegin, $monthEnd)
{
return ' ((month_begin >= ' . $monthBegin . ' AND month_begin <= ' . $monthEnd . ') OR (month_begin <= ' . $monthBegin . ' AND month_end >= ' . $monthEnd
. ') OR (month_end >= ' . $monthBegin . ' AND month_end <= ' . $monthEnd . '))';
}
public function getRepeatRuleCount($companyId, $baseGameId, $monthBegin, $monthEnd)
{
$conditions = [
'compnay_id' => $companyId,
'base_game_id' => $baseGameId,
];
$conditions['_string'] = $this->getTimeRepeatCondition($monthBegin, $monthEnd);
$count = M('promote_grade_setting', 'tab_')->where($conditions)->count();
return intval($count);
}
public function getCurrentSetting($promote, $baseGameId, $month)
{
return M('promote_grade_setting', 'tab_')->where(['status' => 1, 'company_id' => $promote['company_id']])->find();
$timeCondition = 'month_end >= ' . $month . ' and month_begin <= ' . $month;
return M('promote_grade_setting', 'tab_')
->where([
'status' => 1,
'company_id' => $promote['company_id'],
'base_game_id' => $baseGameId,
'_string' => $timeCondition
])
->find();
}
public function searchGradeByPromotes($promotes, $params, $setting)
@ -85,6 +128,7 @@ class PromoteGradeService
$config = json_decode($setting['config'], true);
$settingLevel = $config['reach_level'];
$month = $params['month'] ?? date('Y-m');
$baseGameId = $params['base_game_id'] ?? 0;
$promoteIds = array_column($promotes, 'id');
$beginTime = strtotime($month . '-01 00:00:00');
$endDate = date('Y-m-01 00:00:00', strtotime($month . '-01' . ' +1 month'));
@ -97,26 +141,44 @@ class PromoteGradeService
->where(['register_time' => ['between', $betweenTime], 'promote_id' => ['in', $promoteIds]])
->group('promote_id')
->select(false);
$baseGame = null;
if ($baseGameId > 0) {
$baseGame = M('base_game', 'tab_')->where(['id' => $baseGameId])->find();
}
$roleMap = [
'role_level' => ['egt', $settingLevel],
'create_time' => ['between', $betweenTime],
'promote_id' => ['in', $promoteIds],
'_string' => 'user_id in (' . $userSubSql . ')'
];
$spendMap = [
'pay_time' => ['between', $betweenTime],
'pay_status' => 1,
'promote_id' => ['in', $promoteIds],
'_string' => 'user_id in (' . $userSubSql . ')'
];
if ($baseGame) {
$roleMap['game_id'] = ['in', [$baseGame['android_game_id'], $baseGame['ios_game_id']]];
$spendMap['game_id'] = ['in', [$baseGame['android_game_id'], $baseGame['ios_game_id']]];
} else {
$roleMap['_string'] .= ' and 1=0';
$spendMap['_string'] .= ' and 1=0';
}
$accountItems = M('user_play_info', 'tab_')
->field(['promote_id', 'count(DISTINCT user_id) num'])
->where([
'role_level' => ['egt', $settingLevel],
'create_time' => ['between', $betweenTime],
'promote_id' => ['in', $promoteIds],
'_string' => 'user_id in (' . $userSubSql . ')'
])
->where($roleMap)
->group('promote_id')
->select();
$accountItems = index_by_column('promote_id', $accountItems);
$amountItems = M('spend', 'tab_')
->field(['promote_id', 'sum(pay_amount) amount'])
->where([
'pay_time' => ['between', $betweenTime],
'pay_status' => 1, 'promote_id' => ['in', $promoteIds],
'_string' => 'user_id in (' . $userSubSql . ')'
])
->where($spendMap)
->group('promote_id')
->select();
$amountItems = index_by_column('promote_id', $amountItems);

@ -1194,6 +1194,19 @@ class PromoteService {
return $groupName;
}
public function getVisibleBaseGames($promote)
{
$gameIds = $this->getVisibleGameIds($promote);
if (count($gameIds) == 0) {
return [];
}
return M('base_game', 'tab_')->where([
'_logic' => 'or',
'android_game_id' => ['in', $gameIds],
'ios_game_id' => ['in', $gameIds],
])->select();
}
public function getVisibleGameIds($promote)
{
/* $gameIds = M('game', 'tab_')->getField('id', true);

@ -404,9 +404,9 @@ class BaseController extends HomeController
}
}
$closePromoteLowest = [334];
$closePromoteLowest = [334, 370];
if (in_array($topPromote['company_id'], $closePromoteLowest)) {
if ($topPromote['can_view_recharge'] == 1 && $promote['level'] != 4) {
if ($topPromote['can_view_recharge'] == 1 && !in_array($promote['level'], [3, 4])) {
return true;
} else {
return false;

@ -13,6 +13,7 @@ use Base\Facade\Request;
use Base\Service\ApplyService;
use Base\Service\PromoteCoinRecordService;
use Base\Service\PromoteCoinTransferLogService;
use GuzzleHttp\Client;
/**
* @author elf<360197197@qq.com>
@ -22,13 +23,15 @@ class DownloadController extends BaseController {
-1 => '绑币',
0 => '平台币',
1 => '支付宝',
3 => '微信',
2 => '微信',
3 => '微信APP',
5 => '聚宝云',
6 => '竣付通',
7 => '苹果支付',
8 => '金猪支付',
9 => '双乾支付',
15 => '双乾支付-快捷'
15 => '双乾支付-快捷',
17 => '易宝支付'
];
//提现状态
@ -1395,11 +1398,28 @@ class DownloadController extends BaseController {
* 充值明细添加下载
* @author sunke
*/
public function recharge_data_export() {
public function recharge_data_export() {
// 支付到账时间
$payedBegTime = I("payed_begtime", '');
if ($payedBegTime) {
$payedBegTime = strtotime($payedBegTime);
$payedEndTime = I("payed_endtime", '');
if ($payedEndTime) {
$payedEndTime = strtotime($payedEndTime) + 86400;
}
}
if ($payedBegTime && !$payedEndTime) {
$this->error('到账时间有误,请检查。');
}
if (($payedEndTime - $payedBegTime) > 31 * 24 * 3600) {
$this->error('到账时间范围不能超过31天');
}
// 下单时间
$beginTime = strtotime(I('begtime') . ' 00:00:00');
$endtime = strtotime(I('endtime') . ' 23:59:59');
if (($endtime - $beginTime) > 31 * 24 * 3600) {
$this->error('时间范围不能超过31天');
$this->error('下单时间范围不能超过31天');
}
$map1['chain'] = ['like','%'.'/'.PID.'/'.'%'];
$rs = M('promote','tab_')->where($map1)->field('id,account,nickname')->select();
@ -1461,6 +1481,10 @@ class DownloadController extends BaseController {
$map['tab_spend.spend_time'] = ['between',[$initBegTime,$initEndTime]];
}
if ($payedBegTime) {
$map['tab_spend.payed_time'] = ['between', [$payedBegTime, $payedEndTime - 1]];
}
empty(I('relation_game_id')) || $map['tab_game.relation_game_id'] = I('relation_game_id');
empty(I('sdk_version')) || $map['tab_game.sdk_version'] = I('sdk_version');
empty(I('server_id')) || $map['tab_spend.server_id'] = I('server_id');
@ -1893,12 +1917,18 @@ class DownloadController extends BaseController {
public function promote_grade_export()
{
$month = I('month', date('Y-m'));
$month = $month ? $month : date('Y-m');
$baseGameId = I('base_game_id', 0);
$loginPromote = $this->getLoginPromote();
if ($baseGameId == 0) {
return $this->error('未选择游戏');
}
$promoteGradeService = new PromoteGradeService();
$setting = $promoteGradeService->getCurrentSetting($loginPromote);
$monthNumber = date('Ym', strtotime($month . '-01'));
$setting = $promoteGradeService->getCurrentSetting($loginPromote, $baseGameId, $monthNumber);
if (is_null($setting)) {
return $this->error('未设置评级规则');
return $this->error('该游戏在此月份未设置评级规则');
}
$parentId = I('parent_id', 0);
@ -1930,7 +1960,7 @@ class DownloadController extends BaseController {
$promotes = M('promote', 'tab_')->field(['id', 'account', 'real_name', 'level', 'chain'])->where($map)->select();
array_unshift($promotes, $parent);
$conditions = json_encode(['promotes' => $promotes, 'setting' => $setting, 'month' => $month], true);
$conditions = json_encode(['promotes' => $promotes, 'setting' => $setting, 'month' => $month, 'base_game_id' => $baseGameId], true);
$addtime = time();
$data1 = [
'logid' => 'pg_'.time(),
@ -1950,8 +1980,9 @@ class DownloadController extends BaseController {
$this->success('添加下载成功', U('listsIndex'));
}
//玩家角色
public function userRoles_data_export() {
$gameId = I('relation_game_id', 0);
public function userRoles_data_export()
{
$relationGameId = I('relation_game_id', 0);
$serverId = I('server_id', 0);
$isSelf = I('is_self', 0);
$roleName = I('role_name', '');
@ -1961,65 +1992,30 @@ class DownloadController extends BaseController {
$roleLevelBegin = intval(I('role_level_begin', 0));
$roleLevelEnd = intval(I('role_level_end', 0));
$headmanPromoteId = I('headman_promote_id', 0);
$playTime = I('create_time', '');
$promote = $this->getLoginPromote();
if (empty($playTime)) {
$createTime = I('create_time', date('Y-m-d') . ' 至 ' . date('Y-m-d', time()-7*24*3600));
$lastSortName = trim(I('last_sort_name', ''));
$sortName = trim(I('sort_name', ''));
$sort = intval(I('sort', 1));
if (empty($createTime)) {
$this->error('请选择创建时间');
}
$map1['chain'] = ['like','%'.'/'.PID.'/'.'%'];
$rs = M('promote','tab_')->where($map1)->field('id,account,nickname')->select();
$childPromoteIds = '';
if(empty($rs)) {
$map['tab_user.promote_id'] = PID;
}else {
foreach ($rs as $rsKey => $rsValue) {
$id = $rsValue['id'];
$childPromoteIds .= $id.',';
}
$childPromoteIds = rtrim($childPromoteIds, ',');
$childPromoteIds .= ',' . PID;
$map['promote_id'] = ['in', $childPromoteIds];
}
$promote = $this->getLoginPromote();
$levelPromote = $this->getLevelPromote();
$queryPromote = $this->getQueryPromote($levelPromote);
$map2[] = [
'_logic' => 'or',
'id' => $queryPromote['id'],
'chain' => ['like', $queryPromote['chain'] . $queryPromote['id'] . '/%']
];
$ids = M('promote', 'tab_')->where($map2)->getField('id', true);
if(empty($ids)) {
$ids = array();
}
if(empty($levelPromote)) {
array_push($ids,PID);
}
//array_push($ids,$queryPromote['id']);
if (!empty($ids)) {
$map['promote_id'] = ['in',$ids];
}else {
$map['_string'] = '1<>1';
}
if ($gameId != 0 || $sdkVersion != 0) {
if ($gameId != 0) {
$gameMap['relation_game_id'] = $gameId;
}
if ($sdkVersion != 0) {
$gameMap['sdk_version'] = $sdkVersion;
}
$gameId1 = M('game', 'tab_')->where($gameMap)->getField('id', true);
if(empty($gameId1)) {
$gameId1 = [-100];
}
$map['game_id'] = ['in', $gameId1];
$promoteService = new PromoteService();
$subInSql = $promoteService->subInSql($queryPromote);
$map = [];
$map['_string'] = '1=1';
$map['_string'] .= ' and role.promote_id in (' . $subInSql . ')';
if ($relationGameId != 0 || $sdkVersion != 0) {
$gameIds = gameSearch($relationGameId, $sdkVersion);
$map['game_id'] = ['in', $gameIds];
}
if ($serverId != 0) {
$map['serverId'] = $serverId;
$map['server_id'] = $serverId;
}
if ($roleName != '') {
$map['role_name'] = ['like', '%' . $roleName . '%'];
@ -2027,9 +2023,6 @@ class DownloadController extends BaseController {
if ($userAccount != '') {
$map['user_account'] = ['like', '%' . $userAccount . '%'];
}
if ($sdkVersion != 0) {
$map['sdk_version'] = $sdkVersion;
}
if ($roleLevelBegin != 0 && $roleLevelEnd == 0) {
$map['role_level'] = ['egt', $roleLevelBegin];
} elseif ($roleLevelEnd != 0 && $roleLevelBegin == 0) {
@ -2037,37 +2030,46 @@ class DownloadController extends BaseController {
} elseif ($roleLevelEnd != 0 && $roleLevelBegin != 0) {
$map['role_level'] = ['between', [$roleLevelBegin, $roleLevelEnd]];
}
if ($playTime != '') {
$playTimeRow = explode(' 至 ', $playTime);
$playTimeBegin = 0;
$playTimeEnd = 0;
if (count($playTimeRow) == 2) {
$playTimeBegin = strtotime($playTimeRow[0] . ' 00:00:00');
$playTimeEnd = strtotime($playTimeRow[1] . ' 23:59:59');
if ($createTime != '') {
$createTimeRow = explode(' 至 ', $createTime);
$createTimeBegin = 0;
$createTimeEnd = 0;
if (count($createTimeRow) == 2) {
$createTimeBegin = strtotime($createTimeRow[0] . ' 00:00:00');
$createTimeEnd = strtotime($createTimeRow[1] . ' 23:59:59');
} else {
$playTimeBegin = strtotime($playTimeRow[0] . ' 00:00:00');
$playTimeEnd = strtotime($playTimeRow[0] . ' 23:59:59');
$createTimeBegin = strtotime($createTimeRow[0] . ' 00:00:00');
$createTimeEnd = strtotime($createTimeRow[0] . ' 23:59:59');
}
if (($playTimeEnd - $playTimeBegin) > 31 * 24 * 3600) {
$this->error('时间范围不能超过31天');
if (($createTimeEnd - $createTimeBegin) > 7*24*3600) {
$this->error('时间范围不能超过7天');
}
$map['create_time'] = ['between', [$playTimeBegin, $playTimeEnd]];
$map['create_time'] = ['between', [$createTimeBegin, $createTimeEnd]];
}
if ($isSelf) {
$map['promote_id'] = $queryPromote['id'];
} else {
if ($headmanPromoteId != 0) {
$map['promote_id'] = $headmanPromoteId;
}
if ($promoteId != 0) {
$map['promote_id'] = $promoteId;
}
$orderBy = 'create_time desc';
$sortNameData = ['login_time', 'create_time', 'role_level', 'register_time', 'role.promote_account'];
if (!empty($sortName)) {
if (in_array($sortName, $sortNameData)) {
$desc = ' desc';
$asc = ' asc';
if ($lastSortName != $sortName) {
$sortString = $desc;
$sort = 1;
} else {
$sortString = ($sort == 1) ? $desc : $asc;
}
$orderBy = $sortName . $sortString;
}
}
$conditions = json_encode($map,TRUE);
$addtime = time();
$data = [
$conditions = json_encode(['map' => $map, 'order' => $orderBy], true);
$addtime = time();
$data = [
'logid' => 'js_'.time(),
'promote_id' => PID,
'type' => '/Home/Query/userRoles',
@ -2076,17 +2078,191 @@ class DownloadController extends BaseController {
'addtime' => $addtime,
'begintime' => 0,
'content' => '',
'conditions' =>$conditions
];
$res = M('downloadlog','tab_')->add($data);
if (!$res) {
// $this->ajaxReturn(array("status" => -1, "msg" => "添加导出日志失败", 'ret' => $res));
$this->error('添加下载失败');
}
$this->success('添加下载成功',U('listsIndex'));
'conditions' => $conditions
];
$res = M('downloadlog','tab_')->add($data);
if (!$res) {
$this->error('添加下载失败');
}
$this->success('添加下载成功',U('listsIndex'));
}
public function userretention_data_export()
{
$baseGameId = I('game_id', 0);
$deviceType = I('device_type', '');
$timeRange = I('time_range', date('Y-m-d',strtotime('-7 day')) . ' 至 ' . date('Y-m-d'));
$lastSortName = trim(I('last_sort_name', ''));
$sortName = trim(I('sort_name', ''));
$sort = intval(I('sort', 1));
$start = '';
$end = '';
$timeRangeRow = explode(' 至 ', $timeRange);
if (count($timeRangeRow) == 2) {
$start = $timeRangeRow[0];
$end = $timeRangeRow[1];
} else {
$start = $timeRangeRow[0];
$end = $timeRangeRow[0];
}
$promote = $this->getLoginPromote();
$levelPromote = $this->getLevelPromote();
$queryPromote = $this->getQueryPromote($levelPromote);
$orderColumn = $sortName;
$orderType = ($sort == 1) ? 'desc' : 'asc';
if (!empty($sortName)) {
$orderColumn = $sortName;
$orderType = ($sort == 1) ? 'desc' : 'asc';
}
$status = true;
$data = false;
$error = '';
if ($baseGameId == 0) {
$error = '请选择游戏!';
$status = false;
}
$startTime = strtotime($start . ' 00:00:00');
$endTime = strtotime($end . ' 23:59:59') + 1;
if ((($endTime - $startTime)/(24*3600)) > 31) {
$error = '时间间隔不能超过31天';
$status = false;
}
$searchGameId = 0;
if (!$status) {
$this->error($error);
}
}
$conditions = json_encode([
'base_game_id' => $baseGameId,
'start' => $start,
'end' => $end,
'promote_id' => $queryPromote['id'],
'device_type' => $deviceType,
'orderColumn' => $orderColumn,
'orderType' => $orderType,
], true);
$addtime = time();
$data = [
'logid' => 'ur_'.time(),
'promote_id' => PID,
'type' => '/Home/Query/userretention',
'dataname' => '用户留存率',
'status' => 0,
'addtime' => $addtime,
'begintime' => 0,
'content' => '',
'conditions' => $conditions
];
$res = M('downloadlog','tab_')->add($data);
if (!$res) {
$this->error('添加下载失败');
}
$this->success('添加下载成功',U('listsIndex'));
}
public function gameData_data_export()
{
$gameId = I('game_id', 0);
$serverId = I('server_id', '');
$timeRange = I('time_range', date('Y-m-d',strtotime('-7 day')) . ' 至 ' . date('Y-m-d'));
$lastSortName = trim(I('last_sort_name', ''));
$sortName = trim(I('sort_name', ''));
$sort = intval(I('sort', 1));
$promote = $this->getLoginPromote();
$levelPromote = $this->getLevelPromote();
$queryPromote = $this->getQueryPromote($levelPromote);
$start = '';
$end = '';
$timeRangeRow = explode(' 至 ', $timeRange);
if (count($timeRangeRow) == 2) {
$start = $timeRangeRow[0];
$end = $timeRangeRow[1];
} else {
$start = $timeRangeRow[0];
$end = $timeRangeRow[0];
}
$spendMap = ['pay_status' => 1, '_string' => '1=1'];
$roleMap = ['_string' => '1=1'];
$map = [];
$betweenTime = [strtotime($start . ' 00:00:00'), strtotime($end . ' 23:59:59')];
$spendMap['pay_time'] = ['between', $betweenTime];
$roleMap['create_time'] = ['between', $betweenTime];
$promoteService = new PromoteService();
$subInSql = $promoteService->subInSql($queryPromote);
$spendMap['_string'] .= ' and promote_id in (' . $subInSql . ')';
$roleMap['_string'] .= ' and promote_id in (' . $subInSql . ')';
if ($gameId > 0) {
$spendMap['game_id'] = $gameId;
$roleMap['game_id'] = $gameId;
$map['a.game_id'] = $gameId;
}
if ($serverId != '') {
$spendMap['server_id'] = $serverId;
$roleMap['server_id'] = $serverId;
$map['a.server_id'] = $serverId;
}
$orderBy = '';
$sortNameData = ['amount', 'count'];
if (!empty($sortName)) {
if (in_array($sortName, $sortNameData)) {
$desc = ' desc';
$asc = ' asc';
if ($lastSortName != $sortName) {
$sortString = $desc;
$sort = 1;
} else {
$sortString = ($sort == 1) ? $desc : $asc;
}
$orderBy = $sortName . $sortString;
}
}
$spendSubSql = M('spend', 'tab_')->field(['game_id', 'server_id', 'sum(pay_amount) amount'])->where($spendMap)->group('game_id, server_id')->select(false);
$roleSubSql = M('user_play_info', 'tab_')->field(['game_id', 'server_id', 'count(*) count'])->where($roleMap)->group('game_id, server_id')->select(false);
$conditions = json_encode([
'spendSubSql' => $spendSubSql,
'roleSubSql' => $roleSubSql,
'map' => $map,
'orderBy' => $orderBy,
], true);
$addtime = time();
$data = [
'logid' => 'gd_'.time(),
'promote_id' => PID,
'type' => '/Home/Query/gameData',
'dataname' => '游戏分区数据汇总',
'status' => 0,
'addtime' => $addtime,
'begintime' => 0,
'content' => '',
'conditions' => $conditions
];
$res = M('downloadlog','tab_')->add($data);
if (!$res) {
$this->error('添加下载失败');
}
$this->success('添加下载成功',U('listsIndex'));
}
/**
* 数据汇总添加下载
* @author sunke
@ -2104,15 +2280,15 @@ class DownloadController extends BaseController {
$rs = M('promote','tab_')->where($map1)->field('id,account,nickname')->select();
$childPromoteIds = '';
if(empty($rs)) {
$map['tab_user.promote_id'] = PID;
$map['tab_apply.promote_id'] = PID;
}else {
foreach ($rs as $rsKey => $rsValue) {
$id = $rsValue['id'];
$childPromoteIds .= $id.',';
}
$childPromoteIds = rtrim($childPromoteIds, ',');
$childPromoteIds .= ',' . PID;
$map['tab_apply.promote_id'] = ['in', $childPromoteIds];
$childPromoteIds = rtrim($childPromoteIds, ',');
$childPromoteIds .= ',' . PID;
$map['tab_apply.promote_id'] = ['in', $childPromoteIds];
}
$levelPromote = $this->getLevelPromote();
$queryPromote = $this->getQueryPromote($levelPromote);
@ -2195,7 +2371,7 @@ class DownloadController extends BaseController {
$dataname = $downloadStatus[0]['dataname'];
$conditions = $downloadStatus[0]['conditions'];
$map = array();
foreach (json_decode($conditions,FALSE) as $key => $value) {
foreach (json_decode($conditions, FALSE) as $key => $value) {
if($value !== 0 && $value !== "" ) {
$map[$key] = $value;
}
@ -2291,6 +2467,12 @@ class DownloadController extends BaseController {
case "结算单明细":
$this->WithdrawOrderExcelInfo($id,$map);
break;
case "用户留存率":
$this->userretentionExcelInfo($id,$map);
break;
case "游戏分区数据汇总":
$this->gameDataExcelInfo($id,$map);
break;
default:
break;
}
@ -2816,7 +2998,7 @@ public function iosDetailExcelInfo($id,$map) {
public function playactionExcelInfo($id,$map) {
$xlsName = "玩家行为日志";
$xlsCell = array(
'cp订单号',
// 'cp订单号',
'充值时间',
'玩家账号',
'游戏名称',
@ -2827,7 +3009,7 @@ public function iosDetailExcelInfo($id,$map) {
'订单金额'
);
$model = M('pay_info','tab_');
$data1 = $model->field('id')->where($map)->select();
$count = M('pay_info','tab_')->field('id')->where($map)->count();
$csvFileName = $xlsName.'.csv';
//设置好告诉浏览器要下载excel文件的headers
header('Content-Description: File Transfer');
@ -2840,7 +3022,7 @@ public function iosDetailExcelInfo($id,$map) {
mb_convert_variables('gb2312', 'UTF-8', $xlsCell);
fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中
$accessNum = '100000';//从数据库获取总量,假设是十万
$accessNum = count($data1)?:0 ;
$accessNum = $count ?? 0;
$perSize = 5000;//每次查询的条数
$pages = ceil($accessNum / $perSize);
for($i = 1; $i <= $pages; $i++) {
@ -2853,10 +3035,10 @@ public function iosDetailExcelInfo($id,$map) {
$gameId = $v['game_id'];
$serverInfo = M('server','tab_')->field('server_name')->where(['server_num'=>$serverId,'game_id'=>$gameId])->find();
$v['promote_id']= $promoteInfo['account'];
if(empty($v['extend'])) {
/* if(empty($v['extend'])) {
$v['extend'] = $v['order_id'];
}
$csvData['extend'] = $this->encryption($v['extend']);
} */
// $csvData['extend'] = $this->encryption($v['extend']);
$csvData['create_time'] = $v['create_time'];
$csvData['user_account'] = $this->encryption($v['user_account']);
$csvData['game_name'] = $v['game_name'];
@ -2938,7 +3120,7 @@ public function iosDetailExcelInfo($id,$map) {
}
//玩家角色excel信息
public function userRolesExcelInfo($id,$map) {
public function userRolesExcelInfo($id, $map) {
$xlsName = "角色查询";
$xlsCell = array(
array('user_account','玩家账号'),
@ -2957,16 +3139,35 @@ public function iosDetailExcelInfo($id,$map) {
array('create_time','创建时间'),
);
$records = recordPromoteLogs('数据管理','角色查询导出');
$model = M('user_play_info','tab_');
$data = $model->field('user_id,user_account,promote_account,game_name,server_name,role_name,role_level,create_time,play_time')->where($map)->order('create_time desc')->select();
$users = [];
if (count($data) > 0) {
$userIds = array_column($data, 'user_id');
$users = M('user', 'tab_')->field(['id', 'register_time', 'login_time', 'register_ip', 'login_ip', 'device_number'])->where(['id' => ['in', $userIds]])->select();
$users = index_by_column('id', $users);
}
$map = json_decode(json_encode($map), true);
$columns = [
'user_account',
'role.promote_account',
'role.game_name',
'user.device_number',
'user.register_time',
'user.register_ip',
'user.login_time',
'user.login_ip',
'role.server_name',
'role.sdk_version',
'role.role_name',
'role.role_level',
'role.create_time',
'role.play_time',
'role.play_ip'
];
$data = M('user_play_info', 'tab_')
->field($columns)
->alias('role')
->join('tab_user user on role.user_id = user.id')
->where($map['map'])
->order($map['order'])
->select();
$xlsData = [];
foreach ($data as $key1 => $value1) {
$value1['user_account'] = $this->encryption($value1['user_account']);
@ -2975,20 +3176,8 @@ public function iosDetailExcelInfo($id,$map) {
} else {
$value1['create_time'] = date('Y-m-d H:i:s', $value1['create_time']);
}
if (isset($users[$value1['user_id']])) {
$user = $users[$value1['user_id']];
$value1['register_time'] = date('Y-m-d H:i:s', $user['register_time']);
$value1['login_time'] = date('Y-m-d H:i:s', $user['login_time']);
$value1['register_ip'] = $user['register_ip'];
$value1['login_ip'] = $user['login_ip'];
$value1['device_number'] = $user['device_number'];
} else {
$value1['register_time'] = '--';
$value1['login_time'] = '--';
$value1['register_ip'] = '--';
$value1['login_ip'] = '--';
$value1['device_number'] = '--';
}
$value1['register_time'] = date('Y-m-d H:i:s', $value1['register_time']);
$value1['login_time'] = date('Y-m-d H:i:s', $value1['login_time']);
$xlsData[] = $value1;
}
$this->exportExcel($xlsName, $xlsCell, $xlsData,$id);
@ -4057,6 +4246,7 @@ public function iosDetailExcelInfo($id,$map) {
$promoteGradeService = new PromoteGradeService();
$records = $promoteGradeService->searchGradeByPromotes($map['promotes'], [
'month' => $map['month'],
'base_game_id' => $map['base_game_id']
], $map['setting']);
$xlsData = [];
@ -4420,7 +4610,8 @@ public function iosDetailExcelInfo($id,$map) {
'部门长',
'组长',
'推广员',
'付款时间',
'下单时间',
'到账时间',
);
$records = recordPromoteLogs('数据管理','充值明细导出');
$model = M('spend','tab_');
@ -4486,7 +4677,7 @@ public function iosDetailExcelInfo($id,$map) {
// $value1['user_account'] = substr_replace($value1['user_account'],'************',3,12);
$value1['user_account'] = $this->encryption($value1['user_account']);
$value1['pay_order_number'] = $this->encryption($value1['pay_order_number']);
$value1['pay_time'] = ($value1['pay_status'] == 1) ? date('Y-m-d H:i:s', $value1['pay_time']) : '--';
$value1['payed_time'] = ($value1['pay_status'] == 1) ? date('Y-m-d H:i:s', $value1['payed_time']) : '--';
$value1['pay_status'] = isset(self::$payStatus[$value1['pay_status']]) ? self::$payStatus[$value1['pay_status']] : "未知状态";
$value1['sdk_version'] = getSDKTypeName($value1['sdk_version']);
switch ($value1['level']) {
@ -4525,7 +4716,8 @@ public function iosDetailExcelInfo($id,$map) {
$csvData["p_p_proinfo"] = $value1["p_p_proinfo"];
$csvData["p_proinfo"] = $value1["p_proinfo"];
$csvData["proinfo"] = $value1["proinfo"];
$csvData["pay_time"] = $value1["pay_time"];
$csvData["spend_time"] = date('Y-m-d H:i:s', $value1["spend_time"]);
$csvData["payed_time"] = $value1["payed_time"];
mb_convert_variables('GBK', 'UTF-8', $csvData);
fputcsv($fp, $csvData);
$xlsData[] = $csvData;
@ -4554,7 +4746,8 @@ public function iosDetailExcelInfo($id,$map) {
$csvData1["p_p_proinfo"] = "--";
$csvData1["p_proinfo"] = "--";
$csvData1["proinfo"] = "--";
$csvData1["pay_time"] = "--";
$csvData1["spend_time"] = "--";
$csvData1["payed_time"] = "--";
mb_convert_variables('GBK', 'UTF-8', $csvData1);
fputcsv($fp, $csvData1);
$xlsData[] = $csvData1;
@ -5060,5 +5253,154 @@ public function iosDetailExcelInfo($id,$map) {
$this->backSuccessExport($id);
}
public function multisort($records, $column, $type = 'asc')
{
$length = count($records);
for ($i = 0; $i < $length; $i ++) {
for ($j = $i + 1; $j < $length; $j ++) {
if ($type == 'asc') {
if ($records[$i][$column] > $records[$j][$column]) {
$temp = $records[$i];
$records[$i] = $records[$j];
$records[$j] = $temp;
}
} else if ($type == 'desc') {
if ($records[$i][$column] < $records[$j][$column]) {
$temp = $records[$i];
$records[$i] = $records[$j];
$records[$j] = $temp;
}
}
}
}
return $records;
}
public function userretentionExcelInfo($id,$map)
{
$xlsName = "用户留存率";
$xlsCell = array(
array('date','日期'),
array('game_name','游戏名称'),
array('promote_name','渠道名称'),
array('register_count','新增玩家'),
array('retention_day1', '1日留存'),
array('retention_day2', '2日留存'),
array('retention_day3', '3日留存'),
array('retention_day4', '4日留存'),
array('retention_day5', '5日留存'),
array('retention_day6', '6日留存'),
array('retention_day7', '7日留存'),
array('retention_day15', '15日留存'),
array('retention_day30', '30日留存'),
);
$records = recordPromoteLogs('数据管理', '用户留存率导出');
$map = json_decode(json_encode($map), true);
$baseGameId = $map['base_game_id'];
$start = $map['start'];
$end = $map['end'];
$queryPromoteId = $map['promote_id'];
$deviceType = $map['device_type'];
$orderColumn = $map['orderColumn'];
$orderType = $map['orderType'];
$baseGame = M('base_game', 'tab_')->where(['id' => $baseGameId])->find();
$gameIds = [];
if ($deviceType) {
$searchGameId = $deviceType == 'android' ? $baseGame['android_game_id'] : $baseGame['ios_game_id'];
$gameIds[] = $searchGameId;
} else {
$gameIds = [$baseGame['android_game_id'], $baseGame['ios_game_id']];
}
$client = new Client([
'base_uri' => C('TASK_URL'),
'timeout' => 10.0,
]);
$response = $client->post('/statistics/player-retention', [
'verify' => false,
'form_params' => [
'start_time' => $start,
'end_time' => $end,
'promote_id' => $queryPromoteId,
'game_ids' => $gameIds,
]
]);
$result = (string)$response->getBody();
$result = json_decode($result, true);
if (!$result) {
$this->assign('error', '数据请求异常!');
}
$data = $result['data']['records'];
$dayList = [1, 2, 3, 4, 5, 6, 7, 15, 30];
$gameName = $deviceType ? get_game_name($searchGameId) : $baseGame['name'];
$promoteName = '全部';
if ($promoteId) {
$promoteName = get_promote_account($promoteId);
}
foreach ($data as $key => $item) {
$item['promote_name'] = $promoteName;
$item['game_name'] = $gameName;
foreach ($dayList as $day) {
if ($item['register_count'] > 0) {
$item['retention_day'. $day] = round($item['retention_day'. $day]/$item['register_count'], 4)*100;
} else {
$item['retention_day'. $day] = '--';
}
}
$data[$key] = $item;
}
if ($orderColumn) {
$data = $this->multisort($data, $orderColumn, $orderType);
}
foreach ($data as $key => $item) {
foreach ($dayList as $day) {
if ($item['retention_day' . $day] === '--') {
} else {
$item['retention_day' . $day] .= '%';
}
}
$data[$key] = $item;
}
$this->exportExcel($xlsName, $xlsCell, $data, $id);
}
public function gameDataExcelInfo($id,$map)
{
$xlsName = "游戏分区数据汇总";
$xlsCell = array(
array('game_name','游戏名称'),
array('server_name','区服名称'),
array('count','创角数'),
array('amount', '消费金额'),
);
$records = recordPromoteLogs('数据管理', '游戏分区数据汇总');
$map = json_decode(json_encode($map), true);
$spendSubSql = $map['spendSubSql'];
$roleSubSql = $map['roleSubSql'];
$queryMap = $map['map'];
$orderBy = $map['orderBy'];
$query = M('server', 'tab_')->alias('a')
->field(['a.game_id', 'a.game_name', 'a.server_id', 'a.server_name', 'b.amount', 'c.count'])
->join('left join (' . $spendSubSql . ') b on a.game_id = b.game_id and a.server_id = b.server_id')
->join('left join (' . $roleSubSql . ') c on a.game_id = c.game_id and a.server_id = c.server_id')
->where($queryMap);
if ($orderBy) {
$query->order($orderBy);
}
$data = $query->select();
foreach ($data as $key => $item) {
$item['amount'] = floatval($item['amount']);
$item['count'] = intval($item['count']);
$data[$key] = $item;
}
$this->exportExcel($xlsName, $xlsCell, $data, $id);
}
}

@ -98,8 +98,8 @@ class PlayersController extends BaseController {
$count = M('pay_info', 'tab_')
->field('tab_pay_info.id')
->where($map)
->select();
$count = count($count);
->count();
$count = intval($count);
//分页
$parameter['p'] = $page;

@ -14,7 +14,7 @@ class PromoteGradeController extends BaseController
parent::_initialize();
$loginPromote = $this->getLoginPromote();
if(C('APP_ENV') == 'dev' || $loginPromote['company_id'] == 334) {
if(C('APP_ENV') == 'dev' || in_array($loginPromote['company_id'], [334, 370])) {
} else {
return $this->error('您没有权限');
@ -24,14 +24,9 @@ class PromoteGradeController extends BaseController
public function index($p = 1)
{
$month = I('month', date('Y-m'));
$month = $month ? $month : date('Y-m');
$baseGameId = I('base_game_id', 0);
$loginPromote = $this->getLoginPromote();
$promoteGradeService = new PromoteGradeService();
$setting = $promoteGradeService->getCurrentSetting($loginPromote);
if (is_null($setting)) {
return $this->error('未设置评级规则');
}
$parentId = I('parent_id', 0);
$promoteId = I('promote_id', 0);
$searchLevel = 0;
@ -51,6 +46,9 @@ class PromoteGradeController extends BaseController
$currentDisplay = '自己';
}
$searchLevel = $parent['level'] + 1;
$searchLevelName = $promoteService->getLevelName($searchLevel);
$subPromotes = M('promote', 'tab_')->field(['id', 'account', 'real_name', 'group_remark'])->where(['parent_id' => $parent['id']])->select();
$map = ['parent_id' => $parent['id']];
@ -58,34 +56,72 @@ class PromoteGradeController extends BaseController
$map['id'] = $promoteId;
}
$query = M('promote', 'tab_')->field(['id', 'account', 'real_name', 'level', 'chain'])->where($map);
list($promotes, $pagination, $count) = $this->paginate($query);
$promoteGradeService = new PromoteGradeService();
if (I('p', 1) == 1) {
array_unshift($promotes, $parent);
$error = '';
$status = true;
$setting = null;
$pagination = null;
if ($baseGameId == 0) {
$status = false;
$error = '请选择游戏';
} else {
$monthNumber = date('Ym', strtotime($month . '-01'));
$setting = $promoteGradeService->getCurrentSetting($loginPromote, $baseGameId, $monthNumber);
if (is_null($setting)) {
$status = false;
$error = '该游戏在此月份未设置评级规则';
}
}
$records = $promoteGradeService->searchGradeByPromotes($promotes, [
'month' => $month,
], $setting);
$records = [];
if ($status) {
$query = M('promote', 'tab_')->field(['id', 'account', 'real_name', 'level', 'chain'])->where($map);
list($promotes, $pagination, $count) = $this->paginate($query);
if (I('p', 1) == 1) {
array_unshift($promotes, $parent);
}
$records = $promoteGradeService->searchGradeByPromotes($promotes, [
'month' => $month,
'base_game_id' => $baseGameId
], $setting);
if (I('p', 1) == 1) {
$records[0]['current_display'] = $currentDisplay;
if (I('p', 1) == 1) {
$records[0]['current_display'] = $currentDisplay;
}
}
$this->meta_title = '团队评级';
$this->assign('month', $month);
$baseGames = $promoteService->getVisibleBaseGames($loginPromote);
$this->assign('baseGames', $baseGames);
$this->assign('error', $error);
$this->assign('prevParentId', $prevParentId);
$this->assign('searchLevelName', $searchLevelName);
$this->assign('subPromotes', $subPromotes);
$this->assign('parentId', $parentId);
$this->assign('records', $records);
$this->assign('month', $month);
$this->assign('pagination', $pagination);
$this->display();
}
private function getMonthRangeDisplay($monthBegin, $monthEnd)
{
if ($monthBegin == 0 && $monthEnd == 0) {
return '永久';
} elseif ($monthBegin == 0 && $monthEnd > 0) {
return '从前 至 ' . date('Y-m', strtotime($monthEnd . '01'));
} elseif ($monthBegin > 0 && $monthEnd == 0) {
return date('Y-m', strtotime($monthBegin . '01')) . ' 至 永久';
} else {
return date('Y-m', strtotime($monthBegin . '01')) . ' 至 ' . date('Y-m', strtotime($monthEnd . '01'));
}
}
public function settings()
{
$this->checkSettingPermission();
@ -93,6 +129,13 @@ class PromoteGradeController extends BaseController
$loginPromote = $this->getLoginPromote();
$items = M('promote_grade_setting', 'tab_')->where(['company_id' => $loginPromote['company_id']])->select();
$baseGameIds = array_column($items, 'base_game_id');
$itemBaseGames = [];
if (count($baseGameIds) > 0) {
$itemBaseGames = M('base_game', 'tab_')->where(['id' => ['in', $baseGameIds]])->select();
$itemBaseGames = index_by_column('id', $itemBaseGames);
}
$symbols = PromoteGradeService::$symbols;
$records = [];
@ -100,11 +143,16 @@ class PromoteGradeController extends BaseController
$i = 0;
$config = json_decode($item['config'], true);
$gradeCount = count($config['grades']) + 1;
$baseGame = $itemBaseGames[$item['base_game_id']] ?? null;
$baseGameName = $baseGame ? $baseGame['name'] : '--';
$monthRangeDisplay = $this->getMonthRangeDisplay($item['month_begin'], $item['month_end']);
if ($gradeCount == 1) {
$records[] = [
'id' => $item['id'],
'name' => $item['name'],
'game_name' => $baseGameName,
'grade_count' => $gradeCount,
'month_range' => $monthRangeDisplay,
'reach_level' => $config['reach_level'],
'grade_name' => $config['default_grade_name'],
'grade_value' => '全部'
@ -114,7 +162,9 @@ class PromoteGradeController extends BaseController
$records[] = [
'id' => $item['id'],
'name' => $item['name'],
'game_name' => $baseGameName,
'grade_count' => $gradeCount,
'month_range' => $monthRangeDisplay,
'reach_level' => $config['reach_level'],
'grade_name' => $config['default_grade_name'],
'grade_value' => ($firstGrade['symbol'] == 1 ? '<' : '<=') . $firstGrade['value']
@ -123,7 +173,9 @@ class PromoteGradeController extends BaseController
$records[] = [
'id' => $item['id'],
'name' => $item['name'],
'game_name' => $baseGameName,
'grade_count' => 0,
'month_range' => $monthRangeDisplay,
'reach_level' => $config['reach_level'],
'grade_name' => $grade['name'],
'grade_value' => $symbols[$grade['symbol']] . $grade['value']
@ -131,6 +183,10 @@ class PromoteGradeController extends BaseController
}
}
}
$promoteService = new PromoteService();
$baseGames = $promoteService->getVisibleBaseGames($loginPromote);
$this->assign('baseGames', $baseGames);
$this->assign('records', $records);
$this->display();
}
@ -138,6 +194,8 @@ class PromoteGradeController extends BaseController
public function setting()
{
$this->checkSettingPermission();
$loginPromote = $this->getLoginPromote();
$id = I('id', 0);
$setting = null;
if ($id > 0) {
@ -148,6 +206,10 @@ class PromoteGradeController extends BaseController
$setting['config'] = json_decode($setting['config'], true);
}
}
$promoteService = new PromoteService();
$baseGames = $promoteService->getVisibleBaseGames($loginPromote);
$this->assign('baseGames', $baseGames);
$this->assign('setting', $setting);
$this->display();
}

@ -8,6 +8,8 @@ use Base\Repository\PromoteRepository;
use Base\Repository\SpendRepository;
use Base\Repository\UserRepository;
use Base\Service\PromoteService;
use GuzzleHttp\Client;
use Base\Repository\GameRepository;
/**
* 前台首页控制器
@ -20,8 +22,10 @@ class QueryController extends BaseController
0 => '平台币',
1 => '支付宝',
2 => '微信',
3 => '微信APP',
9 => '双乾支付',
15 => '双乾支付-快捷'
15 => '双乾支付-快捷',
17 => '易宝支付'
];
public static $payStatus = [
@ -41,13 +45,31 @@ class QueryController extends BaseController
$userAccount = trim(I('user_account', ''));
$payOrderNumber = trim(I('pay_order_number', ''));
$nowTime = date('Y-m-d');
$initBegTime = date('Y-m-d', strtotime('-6 day', strtotime($nowTime)));
$initBegTime = empty(I('begtime')) ? $initBegTime : I('begtime');
$initEndTime = $nowTime;
$initEndTime = empty(I('endtime')) ? $initEndTime : I('endtime');
$begTime = strtotime($initBegTime);
$endTime = strtotime($initEndTime);
$endTime += 3600 * 24;
$payedBegTime = I("payed_begtime", '');
if ($payedBegTime) $payedBegTime = strtotime($payedBegTime);
$payedEndTime = I("payed_endtime", '');
if ($payedEndTime) {
$payedEndTime = strtotime($payedEndTime) + 3600 * 24;
}
if ($payedBegTime && $payedEndTime) {
if (!I('begtime', '') && !I('endtime', '')) {
$initBegTime = '';
$initEndTime = '';
$begTime = 0;
$endTime = 0;
}
}
$levelPromote = $this->getLevelPromote();
$queryPromote = $this->getQueryPromote($levelPromote);
$loginPromote = $this->getLoginPromote();
@ -99,12 +121,18 @@ class QueryController extends BaseController
$map['tab_spend.pay_status'] = $payStatus;
}
}
$map['tab_spend.spend_time'] = ['between', [$begTime, $endTime - 1]];
if ($begTime && $endTime) {
$map['tab_spend.spend_time'] = ['between', [$begTime, $endTime - 1]];
}
if ($payedBegTime && $payedEndTime) {
$map['tab_spend.payed_time'] = ['between', [$payedBegTime, $payedEndTime - 1]];
}
$data = [];
$count = 0;
$income = '0.00';
if (intval($endTime - $begTime) / (24 * 3600) <= 31) {
if (intval($endTime - $begTime) / (24 * 3600) <= 31
|| intval($payedEndTime - $payedBegTime) / (24 * 3600) <= 31) {
$data = M('Spend', 'tab_')
->field('tab_spend.*,tab_promote.account as pro_account,tab_promote.real_name as pro_real_name,tab_promote.chain as chain,tab_promote.level,tab_promote.parent_id')
->join('tab_game on tab_spend.game_id = tab_game.id')
@ -175,6 +203,7 @@ class QueryController extends BaseController
break;
}
$list['user_account'] = substr($list['user_account'], 0, 2) . '******' . substr($list['user_account'], 8);
$list['spend_time'] = date('Y-m-d H:i:s', $list['spend_time']);
$list['pay_time'] = ($list['pay_status'] == 1) ? date('Y-m-d H:i:s', $list['pay_time']) : '--';
$list['pay_status'] = isset(QueryController::$payStatus[$list['pay_status']]) ? QueryController::$payStatus[$list['pay_status']] : '未知状态';
$list['sdk_version'] = getSDKTypeName($list['sdk_version']);
@ -224,6 +253,8 @@ class QueryController extends BaseController
$this->assign('income', $income);
$this->assign('initBegTime', $initBegTime);
$this->assign('initEndTime', $initEndTime);
$this->assign('payedBegTime', I("payed_begtime", ''));
$this->assign('payedEndTime', I("payed_endtime", ''));
$this->assign('setdate', date("Y-m-d"));
$this->assign('serverData', $serverData['data']);
$this->assign('ownId', $ownId);
@ -286,7 +317,6 @@ class QueryController extends BaseController
->where($map)
->count();
}
if (!empty($data)) {
foreach ($data as &$list) {
$loginMap['user_id'] = $list['id'];
@ -295,7 +325,7 @@ class QueryController extends BaseController
->where($loginMap)
->order('login_time desc')
->find();
$list['new_login_time'] = date('Y-m-d H:i:s', $newLoginData['login_time']);
$list['new_login_ip'] = $newLoginData['login_ip'];
$list['account'] = substr($list['account'], 0, 2) . '******' . substr($list['account'], 8);
@ -1681,7 +1711,10 @@ class QueryController extends BaseController
$roleLevelBegin = intval(I('role_level_begin', 0));
$roleLevelEnd = intval(I('role_level_end', 0));
$headmanPromoteId = I('headman_promote_id', 0);
$createTime = I('create_time', '');
$createTime = I('create_time', date('Y-m-d') . ' 至 ' . date('Y-m-d', time()-7*24*3600));
$lastSortName = trim(I('last_sort_name', ''));
$sortName = trim(I('sort_name', ''));
$sort = intval(I('sort', 1));
$promote = $this->getLoginPromote();
$levelPromote = $this->getLevelPromote();
@ -1692,20 +1725,7 @@ class QueryController extends BaseController
$map = [];
$map['_string'] = '1=1';
$map['_string'] .= ' and promote_id in (' . $subInSql . ')';
/* $map[] = [
'_logic' => 'or',
'id' => $queryPromote['id'],
'chain' => ['like', $queryPromote['chain'] . $queryPromote['id'] . '/%']
];
$ids = M('promote', 'tab_')->where($map)->getField('id', true);
$map = [];
if (count($ids) > 0) {
$map = ['promote_id' => ['in', $ids]];
} else {
$map['_string'] = '1<>1';
} */
$map['_string'] .= ' and role.promote_id in (' . $subInSql . ')';
if ($relationGameId != 0 || $sdkVersion != 0) {
$gameIds = gameSearch($relationGameId, $sdkVersion);
@ -1743,26 +1763,69 @@ class QueryController extends BaseController
if ($isSelf) {
$map['promote_id'] = $queryPromote['id'];
}
$query = M('user_play_info', 'tab_')->where($map)->order('create_time desc');
list($records, $pagination, $count) = $this->paginate($query);
$countRow = M('user_play_info', 'tab_')->field(['count(distinct user_id) user_count'])->where($map)->find();
$orderBy = 'create_time desc';
$sortNameData = ['login_time', 'create_time', 'role_level', 'register_time', 'role.promote_account'];
if (!empty($sortName)) {
if (in_array($sortName, $sortNameData)) {
$desc = ' desc';
$asc = ' asc';
if ($lastSortName != $sortName) {
$sortString = $desc;
$sort = 1;
} else {
$sortString = ($sort == 1) ? $desc : $asc;
}
$orderBy = $sortName . $sortString;
}
}
$columns = [
'user_account',
'role.promote_account',
'role.game_name',
'user.device_number',
'user.register_time',
'user.register_ip',
'user.login_time',
'user.login_ip',
'role.server_name',
'role.sdk_version',
'role.role_name',
'role.role_level',
'role.create_time',
'role.play_time',
'role.play_ip'
];
$query = M('user_play_info', 'tab_')
->field($columns)
->alias('role')
->join('tab_user user on role.user_id = user.id')
->where($map)
->order($orderBy);
$countQuery = clone $query;
list($records, $pagination, $count) = $this->paginate($query->order($orderBy));
$countRow = $countQuery->field(['count(distinct user_id) user_count'])->find();
$countMap = $map;
$subSql = M('user', 'tab_')->field('id')->where(['is_repeat' => 0])->select(false);
$countMap['_string'] .= ' and user_id in (' . $subSql . ')';
$uniqueCountRow = M('user_play_info', 'tab_')->field(['count(distinct user_id) user_count, count(*) count'])->where($countMap)->find();
$map['_string'] = str_replace('role.promote_id', 'promote_id', $map['_string']) . ' and user_id in (' . $subSql . ')';
$uniqueCountRow = M('user_play_info', 'tab_')->field(['count(distinct user_id) user_count, count(*) count'])->where($map)->find();
$users = [];
/* $users = [];
if (count($records) > 0) {
$userIds = array_column($records, 'user_id');
$users = M('user', 'tab_')->field(['id', 'register_time', 'login_time', 'register_ip', 'login_ip', 'device_number'])->where(['id' => ['in', $userIds]])->select();
$users = index_by_column('id', $users);
}
} */
// var_dump($records);die();
foreach ($records as $key => $value) {
//订单隐藏算法
//隐藏算法
$orderLen = strlen($value['user_account']);
$strLen = 3;
$hideChar = '';
@ -1780,7 +1843,10 @@ class QueryController extends BaseController
}
$records[$key]['user_account'] = substr($value['user_account'], 0, $strLen) . $hideChar . substr($value['user_account'], $orderLen - $strLen);
if (isset($users[$value['user_id']])) {
$records[$key]['register_time'] = date('Y-m-d', $value['register_time']) . '<br>' . date('H:i:s', $value['register_time']);
$records[$key]['login_time'] = date('Y-m-d', $value['login_time']) . '<br>' . date('H:i:s', $value['login_time']);
/* if (isset($users[$value['user_id']])) {
$user = $users[$value['user_id']];
$records[$key]['register_time'] = date('Y-m-d', $user['register_time']) . '<br>' . date('H:i:s', $user['register_time']);
$records[$key]['login_time'] = date('Y-m-d', $user['login_time']) . '<br>' . date('H:i:s', $user['login_time']);
@ -1793,7 +1859,7 @@ class QueryController extends BaseController
$records[$key]['register_ip'] = '--';
$records[$key]['login_ip'] = '--';
$records[$key]['device_number'] = '--';
}
} */
}
$games = get_promote_serach_game();
@ -1801,11 +1867,13 @@ class QueryController extends BaseController
$this->assign('user_count', $countRow['user_count']);
$this->assign('unique_user_count', $uniqueCountRow['user_count']);
$this->assign('unique_count', $uniqueCountRow['count']);
$this->assign('sort', $sort);
$this->assign('setdate', date('Y-m-d', $nowTime));
$this->assign('games', $games);
$this->assign('records', $records);
$this->assign('pagination', $pagination);
$this->assign('count', $count);
$this->assign('createTime', $createTime);
$this->display('userRoles');
}
@ -2772,4 +2840,241 @@ class QueryController extends BaseController
$this->assign('initEndTime', $initEndTime);
$this->display();
}
public function multisort($records, $column, $type = 'asc')
{
$length = count($records);
for ($i = 0; $i < $length; $i ++) {
for ($j = $i + 1; $j < $length; $j ++) {
if ($type == 'asc') {
if ($records[$i][$column] > $records[$j][$column]) {
$temp = $records[$i];
$records[$i] = $records[$j];
$records[$j] = $temp;
}
} else if ($type == 'desc') {
if ($records[$i][$column] < $records[$j][$column]) {
$temp = $records[$i];
$records[$i] = $records[$j];
$records[$j] = $temp;
}
}
}
}
return $records;
}
public function userretention()
{
$baseGameId = I('game_id', 0);
$deviceType = I('device_type', '');
$timeRange = I('time_range', date('Y-m-d',strtotime('-7 day')) . ' 至 ' . date('Y-m-d'));
$lastSortName = trim(I('last_sort_name', ''));
$sortName = trim(I('sort_name', ''));
$sort = intval(I('sort', 1));
$start = '';
$end = '';
$timeRangeRow = explode(' 至 ', $timeRange);
if (count($timeRangeRow) == 2) {
$start = $timeRangeRow[0];
$end = $timeRangeRow[1];
} else {
$start = $timeRangeRow[0];
$end = $timeRangeRow[0];
}
$promote = $this->getLoginPromote();
$levelPromote = $this->getLevelPromote();
$queryPromote = $this->getQueryPromote($levelPromote);
$orderColumn = $sortName;
$orderType = ($sort == 1) ? 'desc' : 'asc';
if (!empty($sortName)) {
$orderColumn = $sortName;
$orderType = ($sort == 1) ? 'desc' : 'asc';
}
$status = true;
$data = false;
$error = '';
if ($baseGameId == 0) {
$error = '请选择游戏!';
$status = false;
}
$startTime = strtotime($start . ' 00:00:00');
$endTime = strtotime($end . ' 23:59:59') + 1;
if ((($endTime - $startTime)/(24*3600)) > 31) {
$error = '时间间隔不能超过31天';
$status = false;
}
$searchGameId = 0;
if ($status) {
$baseGame = M('base_game', 'tab_')->where(['id' => $baseGameId])->find();
$gameIds = [];
if ($deviceType) {
$searchGameId = $deviceType == 'android' ? $baseGame['android_game_id'] : $baseGame['ios_game_id'];
$gameIds[] = $searchGameId;
} else {
$gameIds = [$baseGame['android_game_id'], $baseGame['ios_game_id']];
}
$client = new Client([
'base_uri' => C('TASK_URL'),
'timeout' => 10.0,
]);
$response = $client->post('/statistics/player-retention', [
'verify' => false,
'form_params' => [
'start_time' => $start,
'end_time' => $end,
'promote_id' => $queryPromote['id'],
'game_ids' => $gameIds,
]
]);
$result = (string)$response->getBody();
$result = json_decode($result, true);
if (!$result) {
$this->assign('error', '数据请求异常!');
}
$data = $result['data']['records'];
$dayList = [1, 2, 3, 4, 5, 6, 7, 15, 30];
$gameName = $deviceType ? get_game_name($searchGameId) : $baseGame['name'];
$promoteName = '全部';
if ($promoteId) {
$promoteName = get_promote_account($promoteId);
}
foreach ($data as $key => $item) {
$item['promote_name'] = $promoteName;
$item['game_name'] = $gameName;
foreach ($dayList as $day) {
if ($item['register_count'] > 0) {
$item['retention_day'. $day] = round($item['retention_day'. $day]/$item['register_count'], 4)*100;
} else {
$item['retention_day'. $day] = '--';
}
}
$data[$key] = $item;
}
if ($orderColumn) {
$data = $this->multisort($data, $orderColumn, $orderType);
}
} else {
$this->assign('error', $error);
}
$baseGames = M('base_game', 'tab_')->select();
$this->assign('baseGames', $baseGames);
$this->assign('sortName', $sortName);
$this->assign('sort', $sort);
$this->assign('data', $data);
$this->assign('start', $start);
$this->assign('end', $end);
$this->display();
}
public function gameData()
{
$gameId = I('game_id', 0);
$serverId = I('server_id', '');
$timeRange = I('time_range', date('Y-m-d',strtotime('-7 day')) . ' 至 ' . date('Y-m-d'));
$lastSortName = trim(I('last_sort_name', ''));
$sortName = trim(I('sort_name', ''));
$sort = intval(I('sort', 1));
$promote = $this->getLoginPromote();
$levelPromote = $this->getLevelPromote();
$queryPromote = $this->getQueryPromote($levelPromote);
$start = '';
$end = '';
$timeRangeRow = explode(' 至 ', $timeRange);
if (count($timeRangeRow) == 2) {
$start = $timeRangeRow[0];
$end = $timeRangeRow[1];
} else {
$start = $timeRangeRow[0];
$end = $timeRangeRow[0];
}
$spendMap = ['pay_status' => 1, '_string' => '1=1'];
$roleMap = ['_string' => '1=1'];
$map = [];
$betweenTime = [strtotime($start . ' 00:00:00'), strtotime($end . ' 23:59:59')];
$spendMap['pay_time'] = ['between', $betweenTime];
$roleMap['create_time'] = ['between', $betweenTime];
$promoteService = new PromoteService();
$subInSql = $promoteService->subInSql($queryPromote);
$spendMap['_string'] .= ' and promote_id in (' . $subInSql . ')';
$roleMap['_string'] .= ' and promote_id in (' . $subInSql . ')';
if ($gameId > 0) {
$spendMap['game_id'] = $gameId;
$roleMap['game_id'] = $gameId;
$map['a.game_id'] = $gameId;
}
if ($serverId != '') {
$spendMap['server_id'] = $serverId;
$roleMap['server_id'] = $serverId;
$map['a.server_id'] = $serverId;
}
$spendSubSql = M('spend', 'tab_')->field(['game_id', 'server_id', 'sum(pay_amount) amount'])->where($spendMap)->group('game_id, server_id')->select(false);
$roleSubSql = M('user_play_info', 'tab_')->field(['game_id', 'server_id', 'count(*) count'])->where($roleMap)->group('game_id, server_id')->select(false);
$orderBy = '';
$sortNameData = ['amount', 'count'];
if (!empty($sortName)) {
if (in_array($sortName, $sortNameData)) {
$desc = ' desc';
$asc = ' asc';
if ($lastSortName != $sortName) {
$sortString = $desc;
$sort = 1;
} else {
$sortString = ($sort == 1) ? $desc : $asc;
}
$orderBy = $sortName . $sortString;
}
}
$query = M('server', 'tab_')->alias('a')
->field(['a.game_id', 'a.game_name', 'a.server_id', 'a.server_name', 'b.amount', 'c.count'])
->join('left join (' . $spendSubSql . ') b on a.game_id = b.game_id and a.server_id = b.server_id')
->join('left join (' . $roleSubSql . ') c on a.game_id = c.game_id and a.server_id = c.server_id')
->where($map);
if ($orderBy) {
$query->order($orderBy);
}
list($records, $pagination, $count) = $this->paginate($query);
$gameRepository = new GameRepository();
$this->assign('games', $gameRepository->getChoiceGames());
$this->assign('servers', $gameRepository->getServersByGameId($gameId));
$this->assign('sort', $sort);
$this->assign('sortName', $sortName);
$this->assign('records', $records);
$this->assign('start', $start);
$this->assign('end', $end);
$this->assign('pagination', $pagination);
$this->display();
}
public function getServers()
{
$gameId = I('game_id', 0);
$gameRepository = new GameRepository();
$servers = $gameRepository->getServersByGameId($gameId);
return $this->ajaxReturn(['status' => 1, 'message' => '获取成功', 'data' => ['servers' => $servers]]);
}
}

@ -112,7 +112,7 @@
<div>
<div class="download" data-downloadable="<?= ($game['dow_status'] != 1 || $game['download_ways'] == 0) ? 0 : 1 ?>">免费安装</div>
<div style="display: flex;align-items: center;">
<img src="__IMG__/libao.png" style="width: 0.6rem;height: 0.6rem;margin-right:0.15rem;" class="giftBag" alt="">
<!-- <img src="__IMG__/libao.png" style="width: 0.6rem;height: 0.6rem;margin-right:0.15rem;" class="giftBag" alt=""> -->
<img src="__IMG__/wenhao.png" style="width: 0.6rem; height: 0.6rem;" class="doubt" alt="">
</div>
</div>
@ -352,12 +352,12 @@
</div>
<!-- 礼包 -->
<div class="giftBag_mode">
<!-- <div class="giftBag_mode">
<div class="">
<img src="__IMG__/libao2.png" class="img1" alt="">
<img src="__IMG__/lingqu.png" class="img2" alt="">
</div>
</div>
</div> -->
<div class="getGift giftStep" style="display: none;">
<div class="getGift-heard">
领取礼包

@ -130,12 +130,6 @@
</div>
</div>
<div class="form-group normal_space">
<input type="text" name="extend" class="txt normal_txt" placeholder="cp订单号"
value="{:I('extend')}">
</div>
<div class="form-group normal_space">
<input type="submit" class="submit" id='submit' url="{:U('Players/playAction','model='.$model['name'],false)}"
value="查询">
@ -151,7 +145,7 @@
<div class="tabcon trunk-list">
<table class="table normal_table">
<tr class="odd">
<th>cp订单号</th>
<!-- <th>cp订单号</th> -->
<th>充值时间</th>
<th>玩家账号</th>
<th>游戏名称</th>
@ -172,7 +166,6 @@
<else/>
<volist name="listData" id="vo">
<tr class="num2">
<td>{$vo.extend}</td>
<td>{$vo.create_time}</td>
<td>{$vo.user_account}</td>
<td>{$vo.game_name}</td>

@ -39,6 +39,16 @@
</volist>
</select>
</div>
<div class="form-group normal_space">
<select name="base_game_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择游戏</option>
<volist name="baseGames" id="baseGame">
<option ba-id="{$baseGame.id}" value="{$baseGame.id}" <if condition="I('base_game_id') == $baseGame['id']">selected</if>>
{$baseGame.name}
</option>
</volist>
</select>
</div>
<div class="form-group normal_space fr">
<input type="text" class="txt month-date" name="month" placeholder="月份" value="{$month}" >
</div>
@ -47,7 +57,7 @@
</div>
<?php if ($prevParentId > 0):?>
<div class="form-group">
<a class="submit normal_space" href="{:U('PromoteGrade/index', ['row'=>I('get.row'), 'parent_id' => $prevParentId, 'month'=>$month])}" style="line-height: 36px; display: inline-block; text-align: center; background: #E5E5E5; color: #2bd8ed; cursor: pointer;">返回上级</a>
<a class="submit normal_space" href="{:U('PromoteGrade/index', ['row'=>I('get.row'), 'parent_id' => $prevParentId, 'base_game_id' => I('base_game_id', 0), 'month'=>$month])}" style="line-height: 36px; display: inline-block; text-align: center; background: #E5E5E5; color: #2bd8ed; cursor: pointer;">返回上级</a>
</div>
<?php endif;?>
</form>
@ -63,7 +73,9 @@
<th>操作</th>
</tr>
<empty name="records">
<tr><td colspan="14" style="text-align: center;height: 45vh;"><img src="__IMG__/20180207/icon_wushujv2.png"/><p style="line-height: 40px;color: #A5A5A5;">暂无数据</p></td></tr>
<tr><td colspan="13" class="text-align: center;height: 45vh;"">
<?= $error ? '<span style="color: #ff0000;">' . $error . '</span>': '<img src="__IMG__/20180207/icon_wushujv2.png"/><p style="line-height: 40px;color: #A5A5A5;">暂无数据</p>' ?></td>
</tr>
<else />
<volist name="records" id="record" mod="2">
<tr data-id="{$record.id}" class="<eq name='mod' value='1'>odd</eq>">
@ -82,7 +94,7 @@
<td>{$record.amount}</td>
<td>
<?php if($record['current_display'] == '' && $record['level'] < 4):?>
<a href="{:U('PromoteGrade/index', ['parent_id' => $record['id'], 'month' => I('month', '')])}">查看下级</a>
<a href="{:U('PromoteGrade/index', ['parent_id' => $record['id'], 'base_game_id' => I('base_game_id', 0), 'month' => I('month', '')])}">查看下级</a>
<?php endif;?>
</td>
</tr>
@ -93,7 +105,7 @@
</div>
<div class="pagenation clearfix">
<?php if ($loginer['level'] !== 4) :?>
<a id="sch-btn" href="{:U('download/promote_grade_export',array_merge(['parent_id'=>$parentId,'month'=>$month],I('post.')))}" class="ajax-get">导出</a>
<a id="sch-btn" href="{:U('download/promote_grade_export',array_merge(['parent_id'=>$parentId,'month'=>$month, 'base_game_id' => I('base_game_id', 0)],I('post.')))}" class="ajax-get">导出</a>
<?php endif ;?>
{$pagination}
</div>

@ -61,6 +61,33 @@
<input type="text" class="name input-txt txt" name="name" value="<?= $setting['name'] ?? '' ?>" placeholder="请输入评级规则名称">
</td>
</tr>
<tr>
<td class="l">* 对应游戏:</td>
<td class="r">
<select id="baseGameId" name="base_game_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择游戏</option>
<?php foreach($baseGames as $baseGame):?>
<option value="<?= $baseGame['id'] ?>" <?php if($baseGame['id'] == $setting['base_game_id']):?>selected<?php endif;?>>
<?= $baseGame['name'] ?>
</option>
<?php endforeach;?>
</select>
</td>
</tr>
<tr>
<td class="l">规则开始月份:</td>
<td class="r">
<input type="text" class="txt month-date" name="month_begin" placeholder="规则开始月份" value="<?= $setting['month_begin'] == 0 ? '' : date('Y-m', strtotime($setting['month_begin'] . '01')) ?>" >
<span style="font-size: 12px; color: #F8AC59">仅可选月份</span>
</td>
</tr>
<tr>
<td class="l">规则截止月份:</td>
<td class="r">
<input type="text" class="txt month-date" name="month_end" placeholder="规则截止月份" value="<?= $setting['month_end'] == 0 ? '' : date('Y-m', strtotime($setting['month_end'] . '01')) ?>" >
<span style="font-size: 12px; color: #F8AC59">仅可选月份,不选则表示截止时间为永久</span>
</td>
</tr>
<?php $settingConfig = $setting ? $setting['config'] : null ?>
<tr>
<td class="l">* 玩家角色达标等级:</td>
@ -109,10 +136,18 @@
</div>
</block>
<block name="script">
<link rel="stylesheet" href="__STATIC__/flatpickr/flatpickr.min.css">
<script src="__STATIC__/flatpickr/flatpickr.min.js"></script>
<script src="__STATIC__/flatpickr/l10n/zh.js"></script>
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
<script type="text/javascript">
$(".select_gallery").select2();
var defaultDate = $('.month-date').val()
$('.month-date').flatpickr({
locale: 'zh',
dateFormat: "Y-m",
defaultDate: defaultDate,
})
$('#add-rule').on({
click: function () {
var html = '<div class="rule-item">'
@ -140,6 +175,9 @@
var id = form.find('input[name=id]').val()
var name = form.find('input[name=name]').val()
var level = form.find('input[name=level]').val()
var baseGameId = $('#baseGameId').val()
var monthBegin = form.find('input[name=month_begin]').val()
var monthEnd = form.find('input[name=month_end]').val()
var defaultGradeName = form.find('input[name=default_grade_name]').val()
$.ajax({
@ -150,7 +188,10 @@
name: name,
level: level,
default_grade_name: defaultGradeName,
grades: getGrades()
grades: getGrades(),
month_begin: monthBegin,
month_end: monthEnd,
base_game_id: baseGameId
},
success:function(res){
if(res.status == 1){

@ -35,6 +35,8 @@
<tr class="odd">
<th>ID</th>
<th style="width: 200px;">规则名称</th>
<th style="width: 200px;">规则所属游戏</th>
<th style="width: 200px;">规则有效期</th>
<th style="width: 200px;">当月注册玩家角色达标等级</th>
<th>系数值</th>
<th>等级名称</th>
@ -48,6 +50,8 @@
<?php if($record['grade_count'] > 0):?>
<td rowspan="<?=$record['grade_count']?>"><?=$record['id']?></td>
<td rowspan="<?=$record['grade_count']?>"><?=$record['name']?></td>
<td rowspan="<?=$record['grade_count']?>"><?=$record['game_name']?></td>
<td rowspan="<?=$record['grade_count']?>"><?=$record['month_range']?></td>
<td rowspan="<?=$record['grade_count']?>"><?=$record['reach_level']?></td>
<?php endif;?>
<td><?=$record['grade_value']?></td>

@ -75,6 +75,8 @@
<a href="{:U('Query/achievement')}" class="<if condition='CONTROLLER_NAME eq Query and ACTION_NAME eq achievement '>active</if> ">团队/推广员业绩</a>
<!-- <a href="{:U('Query/promoteQuota')}" class="<if condition='CONTROLLER_NAME eq Query and (ACTION_NAME eq promoteQuota or ACTION_NAME eq quotaDtl) '>active</if> ">推广员指标</a> -->
<a href="{:U('Query/iosDownLoadData')}" class="<if condition='CONTROLLER_NAME eq Query and (ACTION_NAME eq iosDownLoadData or ACTION_NAME eq iosDownLoadData) '>active</if> ">IOS下载数统计</a>
<a href="{:U('Query/userretention')}" class="<if condition='CONTROLLER_NAME eq Query and (ACTION_NAME eq userretention) '>active</if> ">用户留存率</a>
<a href="{:U('Query/gameData')}" class="<if condition='CONTROLLER_NAME eq Query and (ACTION_NAME eq gameData) '>active</if> ">游戏分区数据汇总</a>
</div>
<?php endif;?>
<?php if ($canViewUserRecharge && $loginer['level'] == 1) :?>
@ -119,7 +121,7 @@
<a href="{:U('TestingResource/batches')}" class="<if condition='CONTROLLER_NAME eq TestingResource and ACTION_NAME eq batches '>active</if> ">测试资源申请记录</a>
</div>
<?php endif;?>
<?php if(C('APP_ENV') == 'dev' || $loginer['company_id'] == 334):?>
<?php if(C('APP_ENV') == 'dev' || in_array($loginer['company_id'], [334, 370])):?>
<div class="subNav jssubNav"><i class="prev_icon icon_fenbao"></i><span>评级管理</span><i class="arrow_icon"></i></div>
<div class="navContent jsnavContent">
<?php if($loginer['level'] <= 2):?>

@ -0,0 +1,218 @@
<extend name="Public/promote_base"/>
<block name="css">
<link href="__CSS__/20180207/account.css" rel="stylesheet" >
<link href="__STATIC__/icons_alibaba/iconfont.css?v=1.3" rel="stylesheet">
<style>
.form-group {
float: left;
margin-bottom: 10px;
}
.form-group label {
line-height: 34px;
height: 34px;
}
.iconsort {
font-size: 1rem;
}
.normal_table tr .sort {
color: #145ccd;
cursor: pointer;
}
.trunk-search .select-time .txt {
width: 100px;
}
.title-cursor-pointer {
cursor: pointer;
}
</style>
</block>
<block name="body">
<div class="page-list normal_list promote-mychlid-list">
<div class="trunk-title">
<div class="location">
<div class="location-container">当前位置:<span>数据管理></span><span>游戏分区数据汇总</span></div>
</div>
<img src="__IMG__/20180207/icon_normal_game.png">
<span class="title_main">游戏分区数据汇总</span>
</div>
<div class="trunk-content article">
<div class="trunk-search clearfix jssearch">
<div class="form-group normal_space">
<select id="game_id" name="game_id" class="reselect select_gallery">
<option game-id="0" value="">请选择游戏</option>
<?php foreach($games as $game):?>
<option game-id="<?=$game['id']?>" value="<?=$game['id']?>" <?php if($game['id'] == I('game_id')):?>selected="selected"<?php endif;?>>
<?=$game['game_name']?>
</option>
<?php endforeach;?>
</select>
</div>
<div class="form-group normal_space">
<span id="server_js">
<select id="server_id" name="server_id" class="reselect select_gallery" data-default="<?=I('server_id', '')?>">
<option server-id="0" value="">请选择区服</option>
<?php foreach($servers as $server):?>
<option server-id="<?=$server['server_id']?>" value="<?=$server['server_id']?>" <?php if($server['server_id'] == I('server_id')):?>selected="selected"<?php endif;?>>
<?=$server['server_name']?>
</option>
<?php endforeach;?>
</select>
</span>
</div>
<include file="Public/promote_select" />
<div class="form-group normal_space fr">
<label>起止时间:</label>
<input type="text" class="txt range-date" name="time_range" placeholder="创建时间" value="{$start} 至 {$end}" >
</div>
<div class="form-group normal_space">
<input type="hidden" name="last_sort_name" id="last_sort_name" value="{:I('sort_name', '')}">
<input type="hidden" name="sort_name" id="sort_name" value="{:I('sort_name', '')}">
<input type="hidden" name="sort" id="sort" value="{$sort}">
<input type="submit" class="submit" id='submit' url="{:U('Query/gameData','model='.$model['name'],false)}"
value="查询">
</div>
</div>
<div class="trunk-list list_normal">
<table class="table normal_table">
<tr class="odd">
<th>游戏名称</th>
<th>区服名称</th>
<th class="sort" sort-name="count" class="title-cursor-pointer">创角数
<if condition="'count' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="sort" sort-name="amount" class="title-cursor-pointer">消费金额
<if condition="'amount' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
</tr>
<empty name="records">
<tr><td colspan="13" class="text-align: center;height: 45vh;">
<img src="__IMG__/20180207/icon_wushujv2.png"/><p style="line-height: 40px;color: #A5A5A5;">暂无数据</p>
</td>
</tr>
<else />
<volist name="records" id="vo">
<tr>
<td>{$vo.game_name}</td>
<td>{$vo.server_name}</td>
<td><?=intval($vo['count'])?></td>
<td><?=floatval($vo['amount'])?></td>
</tr>
</volist>
</empty>
</table>
</div>
<div class="pagenation clearfix">
<?php if ($loginer['level'] !== 4) :?>
<a id="sch-btn" data-href="{:U('download/gameData_data_export',array_merge(['xlsname'=>'ceshi'],I('get.')))}" class="ajax-get">导出</a>
<?php endif ;?>
{$pagination}
</div>
</div>
<div class="page-explain promote-mychlid-explain">
<div class="trunk-content article border_normal">
<!-- <table class="desccontent">
<tr><td class="title" style="width: 100px;display: inline-block;">二级渠道说明:</td><td class="det">推广员默认为一级渠道,一级渠道可通过推广员后台新增二级渠道;二级渠道由一级渠道管理开启权限,并由一级渠道给二级渠道结算,结算可到财务管理操作。</td></tr>
</table>-->
</div>
</div>
</div>
</block>
<block name="script">
<link rel="stylesheet" href="__STATIC__/flatpickr/flatpickr.min.css">
<script src="__STATIC__/flatpickr/flatpickr.min.js"></script>
<script src="__STATIC__/flatpickr/l10n/zh.js"></script>
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
<script type="text/javascript" src="__JS__/common.js"></script>
<script type="text/javascript">
$(function() {
setValue('row', '{:I("get.row",10)}');
var defaultDate = $('.range-date').val()
defaultDate = defaultDate == '' ? [] : defaultDate.split(' 至 ')
$('.range-date').flatpickr({
mode: 'range',
locale: 'zh',
dateFormat: "Y-m-d",
defaultDate: defaultDate,
})
$('.select_gallery').select2()
$("#game_id").change(function () {
$.ajax({
url: "{:U('getServers')}",
type: "post",
data: { game_id: $("#game_id option:selected").attr('game-id') },
dataType: 'json',
success: function (result ) {
if (result.status == 1) {
var servers = result.data.servers
var str = "<option value=''>请选择区服</option>"
for (var i in servers){
str += "<option value='"+servers[i].server_id+"'>"+servers[i].server_name+"</option>"
}
$("#server_id").empty()
$("#server_id").append(str)
$("#server_id").select2()
}
}
})
})
$("#server_js").click(function (event) {
var game_id = $("#game_id").val();
if (game_id == 0) {
layer.msg('请先选择游戏');
}
});
var promoteUrl = "{:U('Query/getSubPromotes')}"
initPromoteSelect(promoteUrl)
$('.sort').click(function () {
var element = $(this);
var sortName = element.attr('sort-name');
var sort = parseInt($('#sort').val());
sort = (sort === 1) ? 2 : 1;
$('#sort').val(sort);
$('#sort_name').val(sortName);
$('#submit').trigger('click');
});
$('#submit').click(function () {
console.log('ssb')
var url = $(this).attr('url');
console.log(url);
var query = $('.jssearch').find('input').serialize();
query += "&" + $('.jssearch').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
query = query.replace(/^&/g, '');
if (url.indexOf('?') > 0) {
url += '&' + query;
} else {
url += '?' + query;
}
window.location.href = url;
});
})
</script>
</block>

@ -116,7 +116,7 @@
</div>
<div class="form-group normal_space">
<label class="form-title select-title" style="position: relative;">起止时间:</label>
<label class="form-title select-title" style="position: relative;">下单时间:</label>
<div class="select-time">
<input type="text" readonly id="sdate" class="txt" name="begtime" placeholder="开始时间" value="{$initBegTime}">
</div>
@ -125,6 +125,17 @@
<input type="text" readonly id="edate" class="txt" name="endtime" placeholder="结束时间" value="{$initEndTime}">
</div>
</div>
<div class="form-group normal_space">
<label class="form-title select-title" style="position: relative;">到账时间:</label>
<div class="select-time">
<input type="text" readonly id="payed_sdate" class="txt" name="payed_begtime" placeholder="开始时间" value="{$payedBegTime}">
</div>
<label class="form-title select-title zhi_color">&nbsp;&nbsp;</label>
<div class="select-time">
<input type="text" readonly id="payed_edate" class="txt" name="payed_endtime" placeholder="结束时间" value="{$payedEndTime}">
</div>
</div>
<div class="form-group normal_space">
<input type="text" name="pay_order_number" class="txt normal_txt" placeholder="请输入订单号"
@ -191,7 +202,8 @@
<th>部门长</th>
<th>组长</th>
<th>推广员</th>
<th>付款时间</th>
<th>下单时间</th>
<th>到账时间</th>
<!-- <th>操作</th>-->
</tr>
<empty name="listData">
@ -216,6 +228,7 @@
<td>{$vo.p_p_pro_account}({$vo.p_p_pro_real_name}/{$vo.p_p_pro_group_remark})</td>
<td>{$vo.p_pro_account}({$vo.p_pro_real_name}/{$vo.p_pro_group_remark})</td>
<td>{$vo.pro_account}({$vo.pro_real_name})</td>
<td>{$vo.spend_time}</td>
<td>{$vo.pay_time}</td>
<!-- <td>-->
<!-- <a href="{:U('Query/viewSpendDetailed',array('id'=>$vo['id']))}" style="cursor: pointer"-->
@ -251,10 +264,10 @@
</div>
</block>
<block name="script">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<link href="__STATIC__/my-time-picker/css/bootstrap-datetimepicker.css" rel="stylesheet" type="text/css">
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"
<script type="text/javascript" src="__STATIC__/my-time-picker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/my-time-picker/js/bootstrap-datetimepicker.zh-CN.js"
charset="UTF-8"></script>
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
<script src="__STATIC__/layer/layer.js"></script>
@ -277,8 +290,9 @@
autoclose: true,
scrollMonth: false,
scrollTime: false,
scrollInput: false,
endDate: date
scrollInput: true,
endDate: date,
clearBtn: true,
});
$('#edate').datetimepicker({
@ -290,9 +304,36 @@
scrollMonth: false,
scrollTime: false,
scrollInput: false,
endDate: date
endDate: date,
clearBtn: true
});
$('#payed_sdate').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true,
scrollMonth: false,
scrollTime: false,
scrollInput: false,
endDate: date,
clearBtn: true
});
$('#payed_edate').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true,
pickerPosition: 'bottom-left',
scrollMonth: false,
scrollTime: false,
scrollInput: false,
endDate: date,
clearBtn: true
});
function showPromoteSelect(html)
{
$("#promote_id").empty();
@ -373,14 +414,35 @@
var sdate = Date.parse($('#sdate').val()) / 1000;
var edate = Date.parse($('#edate').val()) / 1000;
if (sdate > edate) {
layer.msg('开始时间必须小于等于结束时间');
layer.msg('下单开始时间必须小于等于结束时间');
return false;
}
if ((edate - sdate) > 2592000) {
layer.msg('时间间隔不能超过31天请重新选择日期');
layer.msg('下单时间间隔不能超过31天请重新选择日期');
return false;
}
var payed_sdate = Date.parse($('#payed_sdate').val()) / 1000;
var payed_edate = Date.parse($('#payed_edate').val()) / 1000;
if (payed_sdate > payed_edate) {
layer.msg('到账开始时间必须小于等于结束时间');
return false;
}
if ((payed_edate - payed_sdate) > 2592000) {
layer.msg('到账时间间隔不能超过31天请重新选择日期');
return false;
}
if (payed_sdate && !payed_edate) {
layer.msg('到账结束时间不能为空');
}
if (!payed_sdate && payed_edate) {
layer.msg('到账开始时间不能为空');
}
if (!edate && !sdate && !payed_sdate && !payed_edate) {
layer.msg('时间不能为空');
}
var url = $(this).attr('url');
console.log(url);
var query = $('.jssearch').find('input').serialize();

@ -1,6 +1,7 @@
<extend name="Public/promote_base"/>
<block name="css">
<link href="__CSS__/20180207/account.css" rel="stylesheet" >
<link href="__STATIC__/icons_alibaba/iconfont.css?v=1.3" rel="stylesheet">
<style>
.form-group {
float: left;
@ -10,6 +11,19 @@
line-height: 34px;
height: 34px;
}
.iconsort {
font-size: 1rem;
}
.normal_table tr .sort {
color: #145ccd;
cursor: pointer;
}
.trunk-search .select-time .txt {
width: 100px;
}
.title-cursor-pointer {
cursor: pointer;
}
</style>
</block>
<block name="body">
@ -52,7 +66,7 @@
</div>
<div class="form-group normal_space fr">
<label>创建时间:</label>
<input type="text" class="txt range-date" name="create_time" placeholder="创建时间" value="{:I('create_time')}" >
<input type="text" class="txt range-date" name="create_time" placeholder="创建时间" value="{$createTime}" >
</div>
<div class="form-group normal_space fr">
<label>玩家等级:</label>
@ -61,6 +75,9 @@
<input type="text" class="txt integer-input" name="role_level_end" style="width: 50px" value="{:I('role_level_end')}" >
</div>
<div class="form-group normal_space">
<input type="hidden" name="last_sort_name" id="last_sort_name" value="{:I('sort_name', '')}">
<input type="hidden" name="sort_name" id="sort_name" value="{:I('sort_name', '')}">
<input type="hidden" name="sort" id="sort" value="{$sort}">
<input type="submit" class="submit" id='submit' url="{:U('Query/userRoles','model='.$model['name'],false)}"
value="查询">
</div>
@ -72,20 +89,70 @@
<table class="table normal_table">
<tr class="odd">
<th>玩家帐号</th>
<th>推广账号</th>
<th class="sort" sort-name="role.promote_account" class="title-cursor-pointer">推广账号
<if condition="'role.promote_account' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
<th>游戏名称</th>
<th>设备码</th>
<th>注册时间</th>
<th class="sort" sort-name="register_time" class="title-cursor-pointer">注册时间
<if condition="'register_time' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
<th>注册IP</th>
<th>最近登录时间</th>
<th class="sort" sort-name="login_time" class="title-cursor-pointer">最近登录时间
<if condition="'login_time' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
<th>最近登录IP</th>
<th>平台</th>
<th>游戏区服</th>
<th>角色名</th>
<th>等级</th>
<th>创建时间</th>
<th class="sort" sort-name="role_level" class="title-cursor-pointer">等级
<if condition="'role_level' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="sort" sort-name="create_time" class="title-cursor-pointer">创建时间
<if condition="'create_time' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
</tr>
<empty name="records">
<tr><td colspan="8" style="text-align: center;height: 45vh;"><img src="__IMG__/20180207/icon_wushujv2.png"/><p style="line-height: 40px;color: #A5A5A5;">暂无数据</p></td></tr>
@ -189,21 +256,32 @@ $(function() {
var promoteUrl = "{:U('Query/getSubPromotes')}"
initPromoteSelect(promoteUrl)
$('#submit').click(function () {
var url = $(this).attr('url');
console.log(url);
var query = $('.jssearch').find('input').serialize();
query += "&" + $('.jssearch').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
query = query.replace(/^&/g, '');
if (url.indexOf('?') > 0) {
url += '&' + query;
} else {
url += '?' + query;
}
window.location.href = url;
$('.sort').click(function () {
var element = $(this);
var sortName = element.attr('sort-name');
var sort = parseInt($('#sort').val());
});
sort = (sort === 1) ? 2 : 1;
$('#sort').val(sort);
$('#sort_name').val(sortName);
$('#submit').trigger('click');
});
$('#submit').click(function () {
var url = $(this).attr('url');
console.log(url);
var query = $('.jssearch').find('input').serialize();
query += "&" + $('.jssearch').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
query = query.replace(/^&/g, '');
if (url.indexOf('?') > 0) {
url += '&' + query;
} else {
url += '?' + query;
}
window.location.href = url;
});
})
</script>
</block>

@ -0,0 +1,295 @@
<extend name="Public/promote_base"/>
<block name="css">
<link href="__CSS__/20180207/account.css" rel="stylesheet" >
<link href="__STATIC__/icons_alibaba/iconfont.css?v=1.3" rel="stylesheet">
<style>
.form-group {
float: left;
margin-bottom: 10px;
}
.form-group label {
line-height: 34px;
height: 34px;
}
.iconsort {
font-size: 1rem;
}
.normal_table tr .sort {
color: #145ccd;
cursor: pointer;
}
.trunk-search .select-time .txt {
width: 100px;
}
.title-cursor-pointer {
cursor: pointer;
}
</style>
</block>
<block name="body">
<div class="page-list normal_list promote-mychlid-list">
<div class="trunk-title">
<div class="location">
<div class="location-container">当前位置:<span>数据管理></span><span>用户留存率</span></div>
</div>
<img src="__IMG__/20180207/icon_normal_game.png">
<span class="title_main">用户留存率</span>
</div>
<div class="trunk-content article">
<div class="trunk-search clearfix jssearch">
<div class="form-group normal_space">
<select id="game-select" name="game_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择游戏</option>
<volist name="baseGames" id="game">
<option value="{$game.id}" <if condition="I('game_id') eq $game['id']">selected</if>>{$game.name}</option>
</volist>
</select>
</div>
<div class="form-group normal_space">
<select id="sdk_version" name="device_type" class="reselect select_gallery" style="width: 220px;" >
<option value="">请选择设备类型</option>
<option value="android" <if condition="I('device_type') === 'android'">selected</if>>Andriod</option>
<option value="ios" <if condition="I('device_type') === 'ios'">selected</if>>IOS</option>
</select>
</div>
<include file="Public/promote_select" />
<div class="form-group normal_space fr">
<label>起止时间:</label>
<input type="text" class="txt range-date" name="time_range" placeholder="创建时间" value="{$start} 至 {$end}" >
</div>
<div class="form-group normal_space">
<input type="hidden" name="last_sort_name" id="last_sort_name" value="{:I('sort_name', '')}">
<input type="hidden" name="sort_name" id="sort_name" value="{:I('sort_name', '')}">
<input type="hidden" name="sort" id="sort" value="{$sort}">
<input type="submit" class="submit" id='submit' url="{:U('Query/userretention','model='.$model['name'],false)}"
value="查询">
</div>
</div>
<div class="trunk-list list_normal">
<table class="table normal_table">
<tr class="odd">
<th class="sort" sort-name="date" class="title-cursor-pointer">日期
<if condition="'date' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
<th>游戏名称</th>
<th>渠道名称</th>
<th class="sort" sort-name="register_count" class="title-cursor-pointer">新增玩家
<if condition="'register_count' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="sort" sort-name="retention_day1" class="title-cursor-pointer">1日留存
<if condition="'retention_day1' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="sort" sort-name="retention_day2" class="title-cursor-pointer">2日留存
<if condition="'retention_day2' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="sort" sort-name="retention_day3" class="title-cursor-pointer">3日留存
<if condition="'retention_day3' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="sort" sort-name="retention_day4" class="title-cursor-pointer">4日留存
<if condition="'retention_day4' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="sort" sort-name="retention_day5" class="title-cursor-pointer">5日留存
<if condition="'retention_day5' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="sort" sort-name="retention_day6" class="title-cursor-pointer">6日留存
<if condition="'retention_day6' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="sort" sort-name="retention_day7" class="title-cursor-pointer">7日留存
<if condition="'retention_day7' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="sort" sort-name="retention_day15" class="title-cursor-pointer">15日留存
<if condition="'retention_day15' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
<th class="sort" sort-name="retention_day30" class="title-cursor-pointer">30日留存
<if condition="'retention_day30' == I('sort_name', '')">
<if condition="1 == $sort">
<i class="iconfont iconsort-down"></i>
<else/>
<i class="iconfont iconsort-up"></i>
</if>
<else/>
<i class="iconfont iconsort"></i>
</if>
</th>
</tr>
<empty name="data">
<tr><td colspan="13" class="text-align: center;height: 45vh;"">
<?= $error ? '<span style="color: #ff0000;">' . $error . '</span>': '<img src="__IMG__/20180207/icon_wushujv2.png"/><p style="line-height: 40px;color: #A5A5A5;">暂无数据</p>' ?></td>
</tr>
<else />
<volist name="data" id="vo">
<tr>
<td>{$vo.date}</td>
<td>{$vo.game_name}</td>
<td>{$vo.promote_name}</td>
<td>{$vo.register_count}</td>
<?php if ($vo['register_count']>0):?>
<td>{$vo['retention_day1']}%</td>
<td>{$vo['retention_day2']}%</td>
<td>{$vo['retention_day3']}%</td>
<td>{$vo['retention_day4']}%</td>
<td>{$vo['retention_day5']}%</td>
<td>{$vo['retention_day6']}%</td>
<td>{$vo['retention_day7']}%</td>
<td>{$vo['retention_day15']}%</td>
<td>{$vo['retention_day30']}%</td>
<?php else:?>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<?php endif;?>
</tr>
</volist>
</empty>
</table>
</div>
<div class="pagenation clearfix">
<?php if ($loginer['level'] !== 4) :?>
<a id="sch-btn" data-href="{:U('download/userretention_data_export',array_merge(['xlsname'=>'ceshi'],I('get.')))}" class="ajax-get">导出</a>
<?php endif ;?>
</div>
</div>
<div class="page-explain promote-mychlid-explain">
<div class="trunk-content article border_normal">
</div>
</div>
</div>
</block>
<block name="script">
<link rel="stylesheet" href="__STATIC__/flatpickr/flatpickr.min.css">
<script src="__STATIC__/flatpickr/flatpickr.min.js"></script>
<script src="__STATIC__/flatpickr/l10n/zh.js"></script>
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
<script type="text/javascript" src="__JS__/common.js"></script>
<script type="text/javascript">
$(function() {
setValue('row', '{:I("get.row",10)}');
var defaultDate = $('.range-date').val()
defaultDate = defaultDate == '' ? [] : defaultDate.split(' 至 ')
$('.range-date').flatpickr({
mode: 'range',
locale: 'zh',
dateFormat: "Y-m-d",
defaultDate: defaultDate,
})
$('.select_gallery').select2()
var promoteUrl = "{:U('Query/getSubPromotes')}"
initPromoteSelect(promoteUrl)
$('.sort').click(function () {
var element = $(this);
var sortName = element.attr('sort-name');
var sort = parseInt($('#sort').val());
sort = (sort === 1) ? 2 : 1;
$('#sort').val(sort);
$('#sort_name').val(sortName);
$('#submit').trigger('click');
});
$('#submit').click(function () {
var url = $(this).attr('url');
console.log(url);
var query = $('.jssearch').find('input').serialize();
query += "&" + $('.jssearch').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
query = query.replace(/^&/g, '');
if (url.indexOf('?') > 0) {
url += '&' + query;
} else {
url += '?' + query;
}
window.location.href = url;
});
})
</script>
</block>

@ -2665,6 +2665,32 @@ CREATE TABLE `tab_promote_grade_setting` (
ALTER TABLE `tab_aggregate_statement`
ADD COLUMN `detail` longtext NULL COMMENT '审批详情' AFTER `remark`;
ALTER TABLE `tab_game_ratio_mould`
ADD COLUMN `begin_time` int(11) NOT NULL DEFAULT 0 COMMENT '开始时间' AFTER `admin_name`,
ADD COLUMN `end_time` int(11) NOT NULL DEFAULT 0 COMMENT '过期时间' AFTER `begin_time`;
ALTER TABLE `tab_game_ratio_mould`
ADD COLUMN `turnover_type` tinyint(2) NULL DEFAULT 1 COMMENT '结算流水类型' AFTER `end_time`;
ALTER TABLE `tab_company_game_ratio_log`
ADD COLUMN `turnover_type` tinyint(2) NULL DEFAULT 1 COMMENT '结算流水类型 1 月流水 2 历史流水' AFTER `end_time`;
ALTER TABLE `tab_company_game_ratio`
ADD COLUMN `turnover_type` tinyint(2) NULL DEFAULT 1 COMMENT '结算流水类型 1 月流水 2 历史流水' AFTER `end_time`;
ALTER TABLE `tab_settleup_marketorder`
ADD COLUMN `is_settlement` tinyint(2) NULL DEFAULT 0 COMMENT '是否结算' AFTER `company_profit`;
CREATE TABLE `tab_company_belong_game` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`game_ids` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '外团推广关联游戏的数据',
`begin_time` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '起始时间',
`end_time` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0' COMMENT '结束时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
UPDATE `tab_game_ratio_mould` SET `begin_time` = 1567267200 WHERE `begin_time` = 0
CREATE TABLE `tab_testing_game_setting` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`base_game_id` int(11) NOT NULL COMMENT '游戏ID',
@ -2674,4 +2700,10 @@ CREATE TABLE `tab_testing_game_setting` (
`create_time` int(11) NOT NULL DEFAULT '0',
`update_time` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='测试资源游戏设置';
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='测试资源游戏设置';
ALTER TABLE `tab_promote_grade_setting`
ADD COLUMN `base_game_id` int(11) not NULL DEFAULT 0 COMMENT '游戏ID' AFTER `name`,
ADD COLUMN `month_begin` int(11) not NULL DEFAULT 0 COMMENT '规则截止月份' AFTER `base_game_id`,
ADD COLUMN `month_end` int(11) not NULL DEFAULT 0 COMMENT '规则开始月份' AFTER `month_begin`;

Binary file not shown.

@ -0,0 +1,424 @@
/*!
* Datetimepicker for Bootstrap
*
* Copyright 2012 Stefan Petre
* Improvements by Andrew Rowls
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
*/
.datetimepicker {
padding: 4px;
margin-top: 1px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
direction: ltr;
}
.datetimepicker-inline {
width: 220px;
}
.datetimepicker.datetimepicker-rtl {
direction: rtl;
}
.datetimepicker.datetimepicker-rtl table tr td span {
float: right;
}
.datetimepicker-dropdown, .datetimepicker-dropdown-left {
top: 0;
left: 0;
}
[class*=" datetimepicker-dropdown"]:before {
content: '';
display: inline-block;
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-bottom: 7px solid #cccccc;
border-bottom-color: rgba(0, 0, 0, 0.2);
position: absolute;
}
[class*=" datetimepicker-dropdown"]:after {
content: '';
display: inline-block;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid #ffffff;
position: absolute;
}
[class*=" datetimepicker-dropdown-top"]:before {
content: '';
display: inline-block;
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-top: 7px solid #cccccc;
border-top-color: rgba(0, 0, 0, 0.2);
border-bottom: 0;
}
[class*=" datetimepicker-dropdown-top"]:after {
content: '';
display: inline-block;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-top: 6px solid #ffffff;
border-bottom: 0;
}
.datetimepicker-dropdown-bottom-left:before {
top: -7px;
right: 6px;
}
.datetimepicker-dropdown-bottom-left:after {
top: -6px;
right: 7px;
}
.datetimepicker-dropdown-bottom-right:before {
top: -7px;
left: 6px;
}
.datetimepicker-dropdown-bottom-right:after {
top: -6px;
left: 7px;
}
.datetimepicker-dropdown-top-left:before {
bottom: -7px;
right: 6px;
}
.datetimepicker-dropdown-top-left:after {
bottom: -6px;
right: 7px;
}
.datetimepicker-dropdown-top-right:before {
bottom: -7px;
left: 6px;
}
.datetimepicker-dropdown-top-right:after {
bottom: -6px;
left: 7px;
}
.datetimepicker > div {
display: none;
}
.datetimepicker.minutes div.datetimepicker-minutes {
display: block;
}
.datetimepicker.hours div.datetimepicker-hours {
display: block;
}
.datetimepicker.days div.datetimepicker-days {
display: block;
}
.datetimepicker.months div.datetimepicker-months {
display: block;
}
.datetimepicker.years div.datetimepicker-years {
display: block;
}
.datetimepicker table {
margin: 0;
}
.datetimepicker td,
.datetimepicker th {
text-align: center;
width: 20px;
height: 20px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
border: none;
}
.table-striped .datetimepicker table tr td,
.table-striped .datetimepicker table tr th {
background-color: transparent;
}
.datetimepicker table tr td.minute:hover {
background: #eeeeee;
cursor: pointer;
}
.datetimepicker table tr td.hour:hover {
background: #eeeeee;
cursor: pointer;
}
.datetimepicker table tr td.day:hover {
background: #eeeeee;
cursor: pointer;
}
.datetimepicker table tr td.old,
.datetimepicker table tr td.new {
color: #999999;
}
.datetimepicker table tr td.disabled,
.datetimepicker table tr td.disabled:hover {
background: none;
color: #999999;
cursor: default;
}
.datetimepicker table tr td.today,
.datetimepicker table tr td.today:hover,
.datetimepicker table tr td.today.disabled,
.datetimepicker table tr td.today.disabled:hover {
background-color: #fde19a;
background-image: -moz-linear-gradient(top, #fdd49a, #fdf59a);
background-image: -ms-linear-gradient(top, #fdd49a, #fdf59a);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fdd49a), to(#fdf59a));
background-image: -webkit-linear-gradient(top, #fdd49a, #fdf59a);
background-image: -o-linear-gradient(top, #fdd49a, #fdf59a);
background-image: linear-gradient(top, #fdd49a, #fdf59a);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdd49a', endColorstr='#fdf59a', GradientType=0);
border-color: #fdf59a #fdf59a #fbed50;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
}
.datetimepicker table tr td.today:hover,
.datetimepicker table tr td.today:hover:hover,
.datetimepicker table tr td.today.disabled:hover,
.datetimepicker table tr td.today.disabled:hover:hover,
.datetimepicker table tr td.today:active,
.datetimepicker table tr td.today:hover:active,
.datetimepicker table tr td.today.disabled:active,
.datetimepicker table tr td.today.disabled:hover:active,
.datetimepicker table tr td.today.active,
.datetimepicker table tr td.today:hover.active,
.datetimepicker table tr td.today.disabled.active,
.datetimepicker table tr td.today.disabled:hover.active,
.datetimepicker table tr td.today.disabled,
.datetimepicker table tr td.today:hover.disabled,
.datetimepicker table tr td.today.disabled.disabled,
.datetimepicker table tr td.today.disabled:hover.disabled,
.datetimepicker table tr td.today[disabled],
.datetimepicker table tr td.today:hover[disabled],
.datetimepicker table tr td.today.disabled[disabled],
.datetimepicker table tr td.today.disabled:hover[disabled] {
background-color: #fdf59a;
}
.datetimepicker table tr td.today:active,
.datetimepicker table tr td.today:hover:active,
.datetimepicker table tr td.today.disabled:active,
.datetimepicker table tr td.today.disabled:hover:active,
.datetimepicker table tr td.today.active,
.datetimepicker table tr td.today:hover.active,
.datetimepicker table tr td.today.disabled.active,
.datetimepicker table tr td.today.disabled:hover.active {
background-color: #fbf069;
}
.datetimepicker table tr td.active,
.datetimepicker table tr td.active:hover,
.datetimepicker table tr td.active.disabled,
.datetimepicker table tr td.active.disabled:hover {
background-color: #006dcc;
background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
background-image: -ms-linear-gradient(top, #0088cc, #0044cc);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
background-image: -o-linear-gradient(top, #0088cc, #0044cc);
background-image: linear-gradient(top, #0088cc, #0044cc);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0);
border-color: #0044cc #0044cc #002a80;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
color: #ffffff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.datetimepicker table tr td.active:hover,
.datetimepicker table tr td.active:hover:hover,
.datetimepicker table tr td.active.disabled:hover,
.datetimepicker table tr td.active.disabled:hover:hover,
.datetimepicker table tr td.active:active,
.datetimepicker table tr td.active:hover:active,
.datetimepicker table tr td.active.disabled:active,
.datetimepicker table tr td.active.disabled:hover:active,
.datetimepicker table tr td.active.active,
.datetimepicker table tr td.active:hover.active,
.datetimepicker table tr td.active.disabled.active,
.datetimepicker table tr td.active.disabled:hover.active,
.datetimepicker table tr td.active.disabled,
.datetimepicker table tr td.active:hover.disabled,
.datetimepicker table tr td.active.disabled.disabled,
.datetimepicker table tr td.active.disabled:hover.disabled,
.datetimepicker table tr td.active[disabled],
.datetimepicker table tr td.active:hover[disabled],
.datetimepicker table tr td.active.disabled[disabled],
.datetimepicker table tr td.active.disabled:hover[disabled] {
background-color: #0044cc;
}
.datetimepicker table tr td.active:active,
.datetimepicker table tr td.active:hover:active,
.datetimepicker table tr td.active.disabled:active,
.datetimepicker table tr td.active.disabled:hover:active,
.datetimepicker table tr td.active.active,
.datetimepicker table tr td.active:hover.active,
.datetimepicker table tr td.active.disabled.active,
.datetimepicker table tr td.active.disabled:hover.active {
background-color: #003399;
}
.datetimepicker table tr td span {
display: block;
width: 23%;
height: 54px;
line-height: 54px;
float: left;
margin: 1%;
cursor: pointer;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.datetimepicker .datetimepicker-hours span {
height: 26px;
line-height: 26px;
}
.datetimepicker .datetimepicker-hours table tr td span.hour_am,
.datetimepicker .datetimepicker-hours table tr td span.hour_pm {
width: 14.6%;
}
.datetimepicker .datetimepicker-hours fieldset legend,
.datetimepicker .datetimepicker-minutes fieldset legend {
margin-bottom: inherit;
line-height: 30px;
}
.datetimepicker .datetimepicker-minutes span {
height: 26px;
line-height: 26px;
}
.datetimepicker table tr td span:hover {
background: #eeeeee;
}
.datetimepicker table tr td span.disabled,
.datetimepicker table tr td span.disabled:hover {
background: none;
color: #999999;
cursor: default;
}
.datetimepicker table tr td span.active,
.datetimepicker table tr td span.active:hover,
.datetimepicker table tr td span.active.disabled,
.datetimepicker table tr td span.active.disabled:hover {
background-color: #006dcc;
background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
background-image: -ms-linear-gradient(top, #0088cc, #0044cc);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
background-image: -o-linear-gradient(top, #0088cc, #0044cc);
background-image: linear-gradient(top, #0088cc, #0044cc);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0);
border-color: #0044cc #0044cc #002a80;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
color: #ffffff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.datetimepicker table tr td span.active:hover,
.datetimepicker table tr td span.active:hover:hover,
.datetimepicker table tr td span.active.disabled:hover,
.datetimepicker table tr td span.active.disabled:hover:hover,
.datetimepicker table tr td span.active:active,
.datetimepicker table tr td span.active:hover:active,
.datetimepicker table tr td span.active.disabled:active,
.datetimepicker table tr td span.active.disabled:hover:active,
.datetimepicker table tr td span.active.active,
.datetimepicker table tr td span.active:hover.active,
.datetimepicker table tr td span.active.disabled.active,
.datetimepicker table tr td span.active.disabled:hover.active,
.datetimepicker table tr td span.active.disabled,
.datetimepicker table tr td span.active:hover.disabled,
.datetimepicker table tr td span.active.disabled.disabled,
.datetimepicker table tr td span.active.disabled:hover.disabled,
.datetimepicker table tr td span.active[disabled],
.datetimepicker table tr td span.active:hover[disabled],
.datetimepicker table tr td span.active.disabled[disabled],
.datetimepicker table tr td span.active.disabled:hover[disabled] {
background-color: #0044cc;
}
.datetimepicker table tr td span.active:active,
.datetimepicker table tr td span.active:hover:active,
.datetimepicker table tr td span.active.disabled:active,
.datetimepicker table tr td span.active.disabled:hover:active,
.datetimepicker table tr td span.active.active,
.datetimepicker table tr td span.active:hover.active,
.datetimepicker table tr td span.active.disabled.active,
.datetimepicker table tr td span.active.disabled:hover.active {
background-color: #003399;
}
.datetimepicker table tr td span.old {
color: #999999;
}
.datetimepicker th.switch {
width: 145px;
}
.datetimepicker th span.glyphicon {
pointer-events: none;
}
.datetimepicker thead tr:first-child th,
.datetimepicker tfoot tr:first-child th {
cursor: pointer;
}
.datetimepicker thead tr:first-child th:hover,
.datetimepicker tfoot tr:first-child th:hover {
background: #eeeeee;
}
/* add by xiaomin */
.datetimepicker tfoot tr th.clear:hover {
background: #eeeeee;
cursor:pointer;
}
.input-append.date .add-on i,
.input-prepend.date .add-on i,
.input-group.date .input-group-addon span {
cursor: pointer;
width: 14px;
height: 14px;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

@ -0,0 +1,17 @@
/**
* Simplified Chinese translation for bootstrap-datetimepicker
* Yuan Cheung <advanimal@gmail.com>
*/
;(function($){
$.fn.datetimepicker.dates['zh-CN'] = {
days: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六", "星期日"],
daysShort: ["周日", "周一", "周二", "周三", "周四", "周五", "周六", "周日"],
daysMin: ["日", "一", "二", "三", "四", "五", "六", "日"],
months: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
monthsShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
today: "今天",
clear: "清空", // add by xiaomin
suffix: [],
meridiem: ["上午", "下午"]
};
}(jQuery));

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save