特殊比例与模板比例添加流水类型

master
zhengyongxing 4 years ago
parent 68ba764d72
commit 9bf3c89659

@ -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); $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_") $dbres = M("company_game_ratio","tab_")
->alias('m') ->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 SEPARATOR '|') turnover_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")
->join("JOIN ({$gameres}) g ON m.relation_game_id = g.relation_game_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("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)"); ->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']); $begin_time = explode('|',$v['begin_time']);
$end_time = explode('|',$v['end_time']); $end_time = explode('|',$v['end_time']);
$turnover_type = explode('|',$v['turnover_type']);
foreach ($begin_time as $tk => $tv) { 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]) : '永久'; $endtime = $end_time[$tk] ? date('Y-m-d', $end_time[$tk]) : '永久';
$v["valid"][$tk] = "{$begintime} ~ {$endtime}"; $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']); // $v['begin_time'] = date("Y-m-d",$v['begin_time']);
@ -245,6 +254,7 @@ class CompanyGameRatioController extends AdminController
}else{ }else{
$dbres = $dbres->page($page, $row)->select(); $dbres = $dbres->page($page, $row)->select();
} }
// dump($dbres);die();
foreach($dbres as $k=>&$v){ foreach($dbres as $k=>&$v){
$v['settlement_type'] = $this->SettlementType[$v['settlement_type']]; $v['settlement_type'] = $this->SettlementType[$v['settlement_type']];
$v['begin_time'] = date("Y-m-d",$v['begin_time']); $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']}"; $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['company_belong'] ="下游".getCompanyBlong($v['company_belong']);
$v['verify_log'] = json_decode($v['verify_log'], true); $v['verify_log'] = json_decode($v['verify_log'], true);
if (isset($params['export'])) { if (isset($params['export'])) {
@ -434,6 +453,7 @@ class CompanyGameRatioController extends AdminController
"turnover_ratio"=>$v['turnover_ratio'], "turnover_ratio"=>$v['turnover_ratio'],
"begin_time"=>$v['begin_time'], "begin_time"=>$v['begin_time'],
"end_time"=>$v['end_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); $this->companyRatioTimeChange($v['company_id'],$v['relation_game_id'],$v['begin_time'],$v['end_time'],$ratiov);
@ -578,6 +598,7 @@ class CompanyGameRatioController extends AdminController
$save['end_time'] = $params['end_time'] ? strtotime($params['end_time'])+86399 : 0; $save['end_time'] = $params['end_time'] ? strtotime($params['end_time'])+86399 : 0;
$save['remark'] = $params['remark'] ?? ''; $save['remark'] = $params['remark'] ?? '';
$save['status'] = 0; $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")]); $save['verify_log']=json_encode(["create_user"=>$this->admininfo["username"],"create_time"=>date("Y-m-d H:i:s")]);
//获取旧比例 //获取旧比例
$this->getOldRatio($save); $this->getOldRatio($save);
@ -635,6 +656,7 @@ class CompanyGameRatioController extends AdminController
$save['begin_time'] = strtotime($params['begin_time']); $save['begin_time'] = strtotime($params['begin_time']);
$save['end_time'] = $params['end_time'] ? strtotime($params['end_time'])+86399 : 0; $save['end_time'] = $params['end_time'] ? strtotime($params['end_time'])+86399 : 0;
$save['remark'] = $params['remark'] ?? ''; $save['remark'] = $params['remark'] ?? '';
$save['turnover_type'] = $params['turnover_type'] ?? 1;
$save['status'] = 0; $save['status'] = 0;
$save['verify_log']=json_encode(["create_user"=>$this->admininfo["username"],"create_time"=>date("Y-m-d H:i:s")]); $save['verify_log']=json_encode(["create_user"=>$this->admininfo["username"],"create_time"=>date("Y-m-d H:i:s")]);
@ -693,6 +715,7 @@ class CompanyGameRatioController extends AdminController
$save['begin_time'] = strtotime($params['begin_time']); $save['begin_time'] = strtotime($params['begin_time']);
$save['end_time'] = $params['end_time'] ? strtotime($params['end_time'])+86399 : 0; $save['end_time'] = $params['end_time'] ? strtotime($params['end_time'])+86399 : 0;
$save['remark'] = $params['remark'] ?? ''; $save['remark'] = $params['remark'] ?? '';
$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']){ if($y['ratio'] != $save['ratio'] || $y['turnover_ratio'] != $save['turnover_ratio'] || $y['begin_time'] != $save['begin_time'] || $y['end_time'] != $save['end_time']){
$save['status'] = 0; $save['status'] = 0;
$save['verify_log'] = json_encode(["create_user"=>$this->admininfo["username"],"create_time"=>date("Y-m-d H:i:s")]); $save['verify_log'] = json_encode(["create_user"=>$this->admininfo["username"],"create_time"=>date("Y-m-d H:i:s")]);

@ -647,8 +647,8 @@ class CompanyStatementSetController extends Controller {
} }
unset($tmpp); unset($tmpp);
unset($js_id); 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")]); $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'])){ if(isset($v['game_list'][$t_game_id]['all_pay_amount'])){
$game_all_payment = $v['game_list'][$t_game_id]['all_pay_amount']-0; $game_all_payment = $v['game_list'][$t_game_id]['all_pay_amount']-0;
}else{ }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); // dump($tratio);
@ -885,6 +886,7 @@ class CompanyStatementSetController extends Controller {
//获取推广公司推广金额 //获取推广公司推广金额
public function getPromoteCompanySpend(&$pcList,$idarr,$begintime,$endtime){ public function getPromoteCompanySpend(&$pcList,$idarr,$begintime,$endtime){
$res = []; $res = [];
$all_res = [];
//获取推广员 //获取推广员
if(count($idarr) == 0){return $res;} if(count($idarr) == 0){return $res;}
$Promote = M("Promote","tab_"); $Promote = M("Promote","tab_");
@ -903,6 +905,29 @@ 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') $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") ->join("left join tab_game g on s.game_id = g.id")
->select(); ->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;} if(empty($list)){continue;}
foreach($list as $k=>$v){ foreach($list as $k=>$v){
try { try {
@ -913,31 +938,66 @@ class CompanyStatementSetController extends Controller {
if(isset($res[$company_id][$v['relation_game_id']])){ 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']]['pay_amount'] += $v['pay_amount'];
$res[$company_id][$v['relation_game_id']]['ratio_pay_amount'] += $v['pay_amount'];
}else{ }else{
unset($v['game_id']); unset($v['game_id']);
$res[$company_id][$v['relation_game_id']]= $v; $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){ foreach($res as $k=>$v){
$pcList[$k]["pay_amount"] = $v['pay_amount']; $pcList[$k]["pay_amount"] = $v['pay_amount'];
unset($v['pay_amount']); unset($v['pay_amount']);
@ -946,6 +1006,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){ protected function getPuPromoteSpend(&$pcList,$idarr,$begintime,$endtime){
$res = []; $res = [];
@ -977,6 +1077,19 @@ class CompanyStatementSetController extends Controller {
->join("tab_promote promote ON s.promote_id = promote.id","left") ->join("tab_promote promote ON s.promote_id = promote.id","left")
->join("left join tab_game g on s.game_id = g.id") ->join("left join tab_game g on s.game_id = g.id")
->select(); ->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($spenMap)
->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(empty($list)){continue;} if(empty($list)){continue;}
$game = []; $game = [];
foreach($list as $k=>$v){ foreach($list as $k=>$v){
@ -986,6 +1099,16 @@ class CompanyStatementSetController extends Controller {
$game[$v['relation_game_id']]['pay_amount'] = $v['pay_amount']; $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同一个原包名的共享总流水分成 //同cp同一个原包名的共享总流水分成
$game_ids = implode(",",array_keys($game)); $game_ids = implode(",",array_keys($game));
$game_ids = $this->getModuleRatioGame($company_id,$game_ids,$begintime,$endtime); $game_ids = $this->getModuleRatioGame($company_id,$game_ids,$begintime,$endtime);
@ -993,8 +1116,15 @@ class CompanyStatementSetController extends Controller {
if(!empty($sameGame)){ if(!empty($sameGame)){
foreach ($sameGame as $k => $v) { foreach ($sameGame as $k => $v) {
$temp = 0; $temp = 0;
for ($j=0; $j < count($v); $j++) { for ($j=0; $j < count($v); $j++) {
$temp += $game[$v[$j]]['pay_amount']; $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; $sameGame[$k] = $temp;
} }

@ -35,19 +35,47 @@ class GameRatioMouldController extends AdminController
} }
$this->checkListOrCountAuthRestMap($where); $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); $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 SEPARATOR '|') id,group_concat(turnover_type SEPARATOR '|') turnover_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")
->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'])){ if(isset($params['export'])){
$dbres = $dbres->select(); $dbres = $dbres->group("m.relation_game_id,company_belong")->select();
}else{ }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){ 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['create_time'] = date("Y-m-d H:i:s",$v['create_time']);
$v['company_belong'] ="下游".getCompanyBlong($v['company_belong']); $v['company_belong'] ="下游".getCompanyBlong($v['company_belong']);
$this->readTurnoverRatio($v); $this->readTurnoverRatio($v);
} }
$this->assign('data', $dbres); $this->assign('data', $dbres);
//判断导出 //判断导出
if(isset($_REQUEST['export'])){ if(isset($_REQUEST['export'])){
@ -57,7 +85,15 @@ class GameRatioMouldController extends AdminController
$this->display("export"); $this->display("export");
exit(); 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); $page = set_pagination($count, $row,$params);
if($page) { if($page) {
$this->assign('_page', $page); $this->assign('_page', $page);
@ -68,6 +104,109 @@ class GameRatioMouldController extends AdminController
$this->display(); $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() public function add()
{ {
@ -84,18 +223,25 @@ class GameRatioMouldController extends AdminController
$save["admin_name"]=$this->admininfo["username"]; $save["admin_name"]=$this->admininfo["username"];
$save["admin_id"]=$this->admininfo["uid"]; $save["admin_id"]=$this->admininfo["uid"];
$save["create_time"]=time(); $save["create_time"]=time();
$save["begin_time"] = strtotime($params["begin_time"]) ?? 0;
$save["end_time"] = $params["end_time"] ?strtotime($params["end_time"]): 0;
$save["turnover_type"] = $params["turnover_type"] ?? 0;
//判断是否存在 //判断是否存在
$where = [ // $where = [
"relation_game_id"=>$save['relation_game_id'], // "relation_game_id"=>$save['relation_game_id'],
"company_belong"=>$save['company_belong'] // "company_belong"=>$save['company_belong']
]; // ];
$hasdb = $this->DBModel->field("count(id) count")->where($where)->find()['count']; // $hasdb = $this->DBModel->field("count(id) count")->where($where)->find()['count'];
if($hasdb > 0){
$this->error('该游戏与该公司类型的模板已经存在,请搜索后编辑'); // 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); // $id = $this->DBModel->add($save);
addOperationLog(['op_type'=>0,'key'=>$id,'op_name'=>'新增游戏分成比例模板','url'=>U('GameRatioMould/index')]); addOperationLog(['op_type'=>0,'key'=>$save['relation_game_id'],'op_name'=>'新增游戏分成比例模板','url'=>U('GameRatioMould/index')]);
$this->ajaxReturn(["msg"=>"添加成功","code"=>1,"url"=>U("index")]); $this->ajaxReturn(["msg"=>"添加成功","code"=>1,"url"=>U("index")]);
} else { } else {
$game_type = M("game_type","tab_")->field("id,type_name")->where("status=1")->select(); $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['id'] = $params['id'];
$save["create_time"]=time(); $save["create_time"]=time();
$save['turnover_ratio'] = $this->setTurnoverRatio($params); $save['turnover_ratio'] = $this->setTurnoverRatio($params);
$save["turnover_type"] = $params["turnover_type"] ?? 0;
$this->DBModel->save($save); $this->DBModel->save($save);
addOperationLog(['op_type'=>1,'key'=>$save['id'],'op_name'=>'修改游戏分成比例模板','url'=>U('PromoteGameRatio/index')]); 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 = $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['turnover_ratio'] = $dbres['turnover_ratio'] ? json_decode($dbres['turnover_ratio'], true) : $dbres['turnover_ratio'];
$dbres['company_belong'] = getCompanyBlong($dbres['company_belong']); $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->assign('data', $dbres);
$this->display(); $this->display();
} }
@ -210,28 +361,66 @@ class GameRatioMouldController extends AdminController
} }
return $save['turnover_ratio']; 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'];
// }else{
// $t['name']="月流水>".$va['turnover'];
// }
// }else{
// $t['name']="月流水≥".$va['turnover'];
// }
// $v['turnover_ratio'][]=$t;
// }
// $v['row'] = count($v['turnover_ratio']);
// }
//设置比例阶梯 //设置比例阶梯
protected function readTurnoverRatio(&$v){ protected function readTurnoverRatio(&$v){
$turnover_ratio = json_decode($v['turnover_ratio'],true);
$v['turnover_ratio'] = array( $radio = explode('|',$v['ratio']);
array("ratio"=>floatval($v['ratio'])."%","name"=>"默认比例") $turnover_ratio = explode('|',$v['turnover_ratio']);
);
$sec_row = 1;
foreach($turnover_ratio as $ke=>$va){
$t=array("ratio"=>floatval($va["ratio"])."%"); foreach ($radio as $key => $value) {
if(array_key_exists("instanceof",$va)){
//存在 $turnoverratio = json_decode($turnover_ratio[$key],true);
if($va['instanceof']=='1'){ $v['turnover_ratios'][$key] = array(
$t['name']="月流水≥".$va['turnover']; 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']="月流水≥".$va['turnover'];
}else{
$t['name']="月流水>".$va['turnover'];
}
}else{ }else{
$t['name']="月流水>".$va['turnover']; $t['name']="月流水".$va['turnover'];
} }
}else{ $sec_row++;
$t['name']="月流水≥".$va['turnover']; $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']);
} }

@ -28,7 +28,8 @@ class CompanyGameRatioModel extends Model
$mwhere = [ $mwhere = [
"company_belong"=>$company_belong, "company_belong"=>$company_belong,
"relation_game_id"=>["in",$game_ids] "relation_game_id"=>["in",$game_ids],
"_string"=>"begin_time <={$endtime} AND ( end_time = 0 OR end_time >= {$begintime})"
]; ];
$m_res = M("GameRatioMould","tab_")->where($mwhere)->select(); $m_res = M("GameRatioMould","tab_")->where($mwhere)->select();
$modul_ratio = []; $modul_ratio = [];

@ -136,6 +136,16 @@
</td> </td>
</tr> </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> <tr>
<td class="l"><i class="mustmark">*</i>分成比例设定:</td> <td class="l"><i class="mustmark">*</i>分成比例设定:</td>
<td class="r table_radio"> <td class="r table_radio">

@ -125,7 +125,15 @@
<span class="notice-text"></span> <span class="notice-text"></span>
</td> </td>
</tr> </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> <tr>
<td class="l"><i class="mustmark">*</i>分成比例设定:</td> <td class="l"><i class="mustmark">*</i>分成比例设定:</td>
<td class="r table_radio"> <td class="r table_radio">

@ -121,6 +121,15 @@
<span class="notice-text"></span> <span class="notice-text"></span>
</td> </td>
</tr> </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> <tr>
<td class="l"><i class="mustmark">*</i>分成比例设定:</td> <td class="l"><i class="mustmark">*</i>分成比例设定:</td>

@ -151,6 +151,7 @@
<th>游戏类型</th> <th>游戏类型</th>
<th>原游戏名称</th> <th>原游戏名称</th>
<th>现游戏名称</th> <th>现游戏名称</th>
<th>结算流水类型</th>
<th>生效时间</th> <th>生效时间</th>
<th colspan="2">比例分成</th> <th colspan="2">比例分成</th>
<th>操作</th> <th>操作</th>
@ -173,9 +174,11 @@
<td rowspan="{$data.row}">{$data.original_package_name}</td> <td rowspan="{$data.row}">{$data.original_package_name}</td>
<td rowspan="{$data.row}">{$data.relation_game_name}</td> <td rowspan="{$data.row}">{$data.relation_game_name}</td>
<notempty name="data['valid'][0]"> <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> <td rowspan="{$data['sec_row'][0]}">{$data['valid'][0]}</td>
<else /> <else />
<td>--</td> <td>--</td>
<td>--</td>
</notempty> </notempty>
<notempty name="data['turnover_ratios'][0][0]"> <notempty name="data['turnover_ratios'][0][0]">
<td >{$data['turnover_ratios'][0][0]['name']|default="--"}</td> <td >{$data['turnover_ratios'][0][0]['name']|default="--"}</td>
@ -195,6 +198,7 @@
<foreach name="data['valid']" item="valid" key="keys"> <foreach name="data['valid']" item="valid" key="keys">
<if condition="$keys gt 0"> <if condition="$keys gt 0">
<tr> <tr>
<td rowspan="{$data['sec_row'][$keys]}">{$data['turnover_types'][$keys]}</td>
<td rowspan="{$data['sec_row'][$keys]}">{$valid|default="--"}</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]['name']|default="--"}</td>
<td>{$data['turnover_ratios'][$keys][0]['ratio']|showPercent}</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>
<th>生效时间</th> <th>生效时间</th>
<th>原比例</th> <th>原比例</th>
<th>申请比例</th> <th>申请比例</th>
@ -192,6 +193,7 @@
<td>{$data.game_type_name}</td> <td>{$data.game_type_name}</td>
<td>{$data.original_package_name}</td> <td>{$data.original_package_name}</td>
<td>{$data.relation_game_name}</td> <td>{$data.relation_game_name}</td>
<td>{$data.turnover_types}</td>
<td>{$data.valid}</td> <td>{$data.valid}</td>
<td style="line-height: 16px;text-indent: 0;"> <td style="line-height: 16px;text-indent: 0;">
<div style="text-align: left;width: 90%;margin-left: 5%;margin-top: 10px;margin-bottom: 10px;"> <div style="text-align: left;width: 90%;margin-left: 5%;margin-top: 10px;margin-bottom: 10px;">

@ -144,6 +144,16 @@
</td> </td>
</tr> </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> <tr>
<td class="l"><i class="mustmark">*</i>分成比例设定:</td> <td class="l"><i class="mustmark">*</i>分成比例设定:</td>
<td class="r table_radio"> <td class="r table_radio">
@ -167,6 +177,18 @@
<span class="notice-text" style="width: auto;"></span> <span class="notice-text" style="width: auto;"></span>
</td> </td>
</tr> </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> </tbody>
</table> </table>
</div> </div>
@ -275,7 +297,9 @@ $(function(){
var obj = { var obj = {
"relation_game_id":["required","游戏不能为空","select"], "relation_game_id":["required","游戏不能为空","select"],
"company_belong":["required","公司类型不能为空","select"], "company_belong":["required","公司类型不能为空","select"],
"ratio":["number","默认比例必须是大于0的数字"] "ratio":["number","默认比例必须是大于0的数字"],
"begin_time":["date","开始时间不能为空"],
"turnover_type":["required","结算流水类型必选","select"],
} }
var cres = CIC.checkAddInput(obj); var cres = CIC.checkAddInput(obj);
if(!cres){ if(!cres){

@ -128,6 +128,15 @@
<span class="notice-text"></span> <span class="notice-text"></span>
</td> </td>
</tr> </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> <tr>
<td class="l"><i class="mustmark">*</i>分成比例设定:</td> <td class="l"><i class="mustmark">*</i>分成比例设定:</td>
<td class="r table_radio"> <td class="r table_radio">
@ -170,6 +179,19 @@
<span class="notice-text" style="width: auto;"></span> <span class="notice-text" style="width: auto;"></span>
</td> </td>
</tr> </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> </tbody>
</table> </table>
</div> </div>

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

@ -2663,4 +2663,14 @@ CREATE TABLE `tab_promote_grade_setting` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='推广评级设定'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='推广评级设定';
ALTER TABLE `tab_aggregate_statement` ALTER TABLE `tab_aggregate_statement`
ADD COLUMN `detail` longtext NULL COMMENT '审批详情' AFTER `remark`; 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 0 COMMENT '结算流水类型' AFTER `end_time`;
ALTER TABLE `tab_company_game_ratio_log`
ADD COLUMN `turnover_type` tinyint(2) NULL DEFAULT 0 COMMENT '结算流水类型 1 月流水 2 历史流水' AFTER `end_time`;
Loading…
Cancel
Save