Merge remote-tracking branch 'origin/feature/group_type' into feature/group_type

master
liuweiwen 5 years ago
commit e2095af7a8

@ -245,7 +245,7 @@ class AjaxController extends ThinkController{
$withdraw_number = $_REQUEST['withdraw_number'];
$data = M("withdraw","tab_")
->field("widthdraw_number,promote_account,tab_promote_company.id as company_id,company_name,settlement_type,mobile_phone,real_name,bank_card,account_openin,address,game_ratio,bank_account")
->field("widthdraw_number,promote_account,tab_promote_company.id as company_id,company_name,tab_withdraw.settlement_type,mobile_phone,real_name,bank_card,account_openin,address,game_ratio,bank_account")
->join("left join tab_promote on tab_withdraw.promote_id=tab_promote.id")
->join("left join tab_promote_company on tab_promote.company_id=tab_promote_company.id")
->where(['widthdraw_number'=>$withdraw_number])
@ -312,9 +312,22 @@ class AjaxController extends ThinkController{
// dump($statementData);die();
} else {
$data['address'] = json_decode($data['address'],1);
// dd($data['address']);
$address = '';
if (is_array($data['address'])) {
foreach($data['address'] as $key => $value) {
$address = $address.' '.$value;
}
}
$data['address'] = $address;
if (is_array($data['game_ratio'])) {
foreach ($data['game_ratio'] as $key => &$value) {
foreach ($value as $k => &$v) {
$v['game_name'] = get_gamename($key);
}

@ -774,9 +774,10 @@ class GameController extends ThinkController
if(!is_numeric($data['game_ratio']) || $data['game_ratio']<0 || $data['game_ratio']>100){
die(json_encode(array("result"=>"0","desc"=>"分成比例为0~100之间")));
}
$game_info = M("game","tab_")->where("id=".$data['game_id'])->field("relation_game_id")->find();//根据游戏找到关联的游戏ID
$relation_game_list = M("game","tab_")->where("relation_game_id=".$game_info['relation_game_id'])->select();//根据关联ID找到游戏列表
if($data['data_type']=='initial'){ //CP初始分成比例
if($data['data_id']>0){ //修改初始CP分成比例
$where = array();
$where['is_del'] = "0";
@ -790,12 +791,27 @@ class GameController extends ThinkController
if($info){
die(json_encode(array("result"=>"0","desc"=>"CP分成比例应小于".$info['ratio']."%")));
}
M('cp_game_ratio', 'tab_')->where("id=%d",$data['data_id'])->data(array("ratio"=>$data['game_ratio'],"update_time"=>time()))->save();
foreach ($relation_game_list as $game){
$map['game_id'] = $game['id'];
$map['is_del'] = 0;
$map['begin_total_amount'] = 0;
M('cp_game_ratio', 'tab_')->where($map)->data(array("ratio"=>$data['game_ratio'],"update_time"=>time()))->save();
}
//M('cp_game_ratio', 'tab_')->where("id=%d",$data['data_id'])->data(array("ratio"=>$data['game_ratio'],"update_time"=>time()))->save();
}else{
if($initial_info){
M('cp_game_ratio', 'tab_')->where("id=%d",$initial_info['id'])->data(array("ratio"=>$data['game_ratio'],"update_time"=>time()))->save();
foreach ($relation_game_list as $game){
$map['game_id'] = $game['id'];
$map['is_del'] = 0;
$map['begin_total_amount'] = 0;
M('cp_game_ratio', 'tab_')->where($map)->data(array("ratio"=>$data['game_ratio'],"update_time"=>time()))->save();
}
//M('cp_game_ratio', 'tab_')->where("id=%d",$initial_info['id'])->data(array("ratio"=>$data['game_ratio'],"update_time"=>time()))->save();
}else{
M('cp_game_ratio', 'tab_')->data(array("game_id"=>$data['game_id'],"ratio"=>$data['game_ratio'],"begin_total_amount"=>0,"add_time"=>time(),"update_time"=>time()))->add();
foreach ($relation_game_list as $game) {
M('cp_game_ratio', 'tab_')->data(array("game_id" => $game['id'], "ratio" => $data['game_ratio'], "begin_total_amount" => 0, "add_time" => time(), "update_time" => time()))->add();
}
}
}
}else{ //CP阶梯分成档位
@ -820,7 +836,17 @@ class GameController extends ThinkController
die(json_encode(array("result"=>"0","desc"=>"分成比例不得小于初始比例")));
}
M('cp_game_ratio', 'tab_')->where("id=%d",$data['data_id'])->data(array("ratio"=>$data['game_ratio'],"begin_total_amount"=>$data['total_amount'],"update_time"=>time()))->save();
$info = M('cp_game_ratio', 'tab_')->where("id=%d",$data['data_id'])->find();
foreach ($relation_game_list as $game) {
$map['ratio'] = $info['ratio'];
$map['begin_total_amount'] = $info['begin_total_amount'];
$map['is_del'] = 0;
$map['game_id']= $game['id'];
$updainfo = M('cp_game_ratio', 'tab_')->where($map)->find();
if($updainfo){
M('cp_game_ratio', 'tab_')->where("id=%d",$updainfo['id'])->data(array("ratio"=>$data['game_ratio'],"begin_total_amount"=>$data['total_amount'],"update_time"=>time()))->save();
}
}
}else{
if(!$initial_info){
die(json_encode(array("result"=>"0","desc"=>"请先设置初始CP分成比例")));
@ -833,7 +859,9 @@ class GameController extends ThinkController
if($max_info['max_ratio'] >= $data['game_ratio'] || $max_info['max_amount']>=$data['total_amount']){
die(json_encode(array("result"=>"0","desc"=>"新增分成档位金额或分成比例需大于现有分成档位")));
}
M('cp_game_ratio', 'tab_')->data(array("game_id"=>$data['game_id'],"ratio"=>$data['game_ratio'],"begin_total_amount"=>$data['total_amount'],"add_time"=>time(),"update_time"=>time()))->add();
foreach ($relation_game_list as $game) {
M('cp_game_ratio', 'tab_')->data(array("game_id"=>$game['id'],"ratio"=>$data['game_ratio'],"begin_total_amount"=>$data['total_amount'],"add_time"=>time(),"update_time"=>time()))->add();
}
}
}
}
@ -844,7 +872,21 @@ class GameController extends ThinkController
* 删除CP分成比例
*/
public function delete_ratio(){
M('cp_game_ratio', 'tab_')->where("id=".$_POST['data_id'])->data(array("is_del"=>"1","update_time"=>time()))->save();
$info = M('cp_game_ratio', 'tab_')->where("id=%d",$_POST['data_id'])->find();
$game_info = M("game","tab_")->where("id=".$info['game_id'])->field("relation_game_id")->find();//根据游戏找到关联的游戏ID
$relation_game_list = M("game","tab_")->where("relation_game_id=".$game_info['relation_game_id'])->select();//根据关联ID找到游戏列表
foreach ($relation_game_list as $game) {
$map['ratio'] = $info['ratio'];
$map['begin_total_amount'] = $info['begin_total_amount'];
$map['is_del'] = 0;
$map['game_id']= $game['id'];
$updainfo = M('cp_game_ratio', 'tab_')->where($map)->find();
if($updainfo){
M('cp_game_ratio', 'tab_')->where("id=".$updainfo['id'])->data(array("is_del"=>"1","update_time"=>time()))->save();
}
}
//M('cp_game_ratio', 'tab_')->where("id=".$_POST['data_id'])->data(array("is_del"=>"1","update_time"=>time()))->save();
echo(json_encode(array("result"=>"1","desc"=>"删除成功")));
}
}

@ -697,7 +697,7 @@ class PlatformController extends ThinkController
// dd($data);
unset($map['tp1.id']);
unset($map['tp1.chain']);
unset($tmap['tp1.chain']);
unset($tmap['tp1.id']);
unset($tmap['tp1.chain']);
$map['s.promote_id'] = 0;
$tmap['s.promote_id'] = 0;

@ -1015,8 +1015,9 @@ class QueryController extends ThinkController
}
$map = [];
setPowerPromoteIds($map,'root_id');
if ($_REQUEST['promote_id']) {
if ($_REQUEST['promote_id']||$_REQUEST['promote_id']=='0') {
$map['root_id'] = $_REQUEST['promote_id'];
}
@ -1041,7 +1042,6 @@ class QueryController extends ThinkController
->order("my_time Desc")
->select(false);
setPowerPromoteIds($map,'root_id');
$count = M()->table('('.$data.') as a')
->field("my_time,pay_amount,game_id,game_names,promote_id,promote_account,a.company_relation,a.company_belong,CASE WHEN root_id is null THEN 0 ELSE root_id END as root_id,CASE WHEN account is null THEN '官方渠道' ELSE account END as account")
@ -1062,6 +1062,8 @@ class QueryController extends ThinkController
->group("my_time,game_names,root_id")
->order("my_time Desc")
->select();
// var_dump($data);die();
// dump($data);die();
$pagecount = M()->table('('.$count.') as a')->count();

@ -322,11 +322,11 @@
var str = '<option value="">对账类型</option>';
console.log($("#company_id option:selected").attr('company-type'))
if ($("#company_id option:selected").attr('company-type') == '1') {
str += ' <option value="1" selected=selected>公会对账单</option>\n' +
' <option value="0">CP对账单</option>';
str += ' <option value="1" selected=selected>下游游对账单</option>\n' +
' <option value="0">上游对账单</option>';
} else if ($("#company_id option:selected").attr('company-type') == '0') {
str += ' <option value="1">公会对账单</option>\n' +
' <option value="0" selected=selected>CP对账单</option>';
str += ' <option value="1">下游对账单</option>\n' +
' <option value="0" selected=selected>上游对账单</option>';
}

Loading…
Cancel
Save