CP分成比例修改

master
zhengchanglong 5 years ago
parent 29868a6331
commit 72d222a64a

@ -424,7 +424,7 @@ class GameController extends ThinkController
$this->assign('data', $data);
$this->assign('game_id', $id);
$game_ratio = M('cp_game_ratio', 'tab_')->where(array('is_del'=>"0","game_id"=>$id))->order('begin_total_amount asc')->select();
$game_ratio = M('cp_game_ratio', 'tab_')->where(array('is_del'=>"0","game_id"=>$id))->order('id asc')->select();
$this->meta_title = '编辑游戏';
$this->m_title = '游戏列表';
@ -861,7 +861,7 @@ class GameController extends ThinkController
$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();
M('cp_game_ratio', 'tab_')->where("id=%d",$updainfo['id'])->data(array("instanceof"=>$data['instanceof'],"ratio"=>$data['game_ratio'],"begin_total_amount"=>$data['total_amount'],"update_time"=>time()))->save();
}
}
}else{
@ -872,10 +872,10 @@ class GameController extends ThinkController
if($exis_info){
die(json_encode(array("result"=>"0","desc"=>"分成档位已存在")));
}else{
$max_info = M('cp_game_ratio', 'tab_')->field("max(ratio) as max_ratio,max(begin_total_amount) as max_amount")->where("game_id=%d and is_del=0",$data['game_id'])->find();
/*$max_info = M('cp_game_ratio', 'tab_')->field("max(ratio) as max_ratio,max(begin_total_amount) as max_amount")->where("game_id=%d and is_del=0",$data['game_id'])->find();
if($max_info['max_ratio'] >= $data['game_ratio'] || $max_info['max_amount']>=$data['total_amount']){
die(json_encode(array("result"=>"0","desc"=>"新增分成档位金额或分成比例需大于现有分成档位")));
}
}*/
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();
}

@ -616,8 +616,12 @@
</tr>
<empty name="game_ratio[1]">
<tr class="bns">
<td class="l noticeinfo">CP流水大于等于</td>
<td class="l noticeinfo">CP流水</td>
<td class="r">
<select name="instanceof" style="width: 50px;margin-right: 5px" >
<option value="1"></option>
<option value="2">></option>
</select>
<input type="text" class="txt table_text_input" name="game_amount" value="" placeholder="" style="width: 55px">
<span class="form_unit" style="margin: 0 10px">分成比例</span>
<input type="text" class="txt table_text_input" name="game_ratio" value="" placeholder="" style="width: 50px">
@ -629,8 +633,12 @@
<foreach name="game_ratio" item="vo" key="k">
<if condition="$k gt 0">
<tr class="bns">
<td class="l noticeinfo">CP流水大于等于</td>
<td class="l noticeinfo">CP流水</td>
<td class="r">
<select name="instanceof" style="width: 50px;margin-right: 5px" >
<option value="1" <if condition="$vo['instanceof'] eq 1"> selected </if>>≥</option>
<option value="2" <if condition="$vo['instanceof'] eq 2"> selected </if>>></option>
</select>
<input type="text" class="txt table_text_input" name="game_amount" value="{$vo['begin_total_amount']}" placeholder="" style="width: 55px"><span class="form_unit" style="margin: 0 10px">分成比例</span>
<input type="text" class="txt table_text_input" name="game_ratio" value="{$vo['ratio']}" placeholder="" style="width: 50px"><span class="form_unit">%</span>
<if condition="$k eq 1">
@ -2238,8 +2246,12 @@
<script>
$(".bnt_add").bind("click",function(){
var a= '<tr class="bns" data-id="0">'+
'<td class="l noticeinfo">CP流水大于等于</td>' +
'<td class="l noticeinfo">CP流水</td>' +
'<td class="r">'+
'<select name="instanceof" style="width: 50px;margin-right: 5px" >'+
'<option value="1"></option>'+
'<option value="2">></option>'+
'</select>'+
'<input type="text" class="txt table_text_input" name="game_amount" value="" placeholder="" style="width: 55px">' +
'<span class="form_unit" style="margin: 0 10px">分成比例</span>'+
'<input type="text" class="txt table_text_input" name="game_ratio" value="" placeholder="" style="width: 50px">' +
@ -2254,38 +2266,47 @@
$(document).on('click', '.bnt_remove', function(){
var that = $(this).parents("tr.bns");
var data_id = $(this).attr("data-id");
layer.confirm('你确定要删除本档分成比例吗?', {icon: 3, title:'提示'}, function(index){
layer.close(index);
$.ajax({
//请求方式
type : "POST",
dataType: "json",
url : "{:U('delete_ratio')}",
data : {
data_id :data_id,
game_id:'{$game_id}'
},
//请求成功
success : function(result) {
if(result.result==1){
$(that).remove();
layer.msg(result.desc);
/*setTimeout(function(){
location.reload();
},1500);*/
}else{
layer.msg(result.desc);
if(data_id>0){
layer.confirm('你确定要删除本档分成比例吗?', {icon: 3, title:'提示'}, function(index){
layer.close(index);
$.ajax({
//请求方式
type : "POST",
dataType: "json",
url : "{:U('delete_ratio')}",
data : {
data_id :data_id,
game_id:'{$game_id}'
},
//请求成功
success : function(result) {
if(result.result==1){
$(that).remove();
layer.msg(result.desc);
/*setTimeout(function(){
location.reload();
},1500);*/
}else{
layer.msg(result.desc);
}
},
//请求失败,包含具体的错误信息
error : function(e){
console.log(e.status);
console.log(e.responseText);
}
},
//请求失败,包含具体的错误信息
error : function(e){
console.log(e.status);
console.log(e.responseText);
}
});
});
});
}else{
$(that).remove();
}
});
$(document).on('input propertychange', 'select[name=instanceof]', function(){
var that = $(this).parents("tr.bns");
$(that).find("button[class=bnt_save]").css("display","")
})
$(document).on('input propertychange', 'input[name=game_ratio]', function(){
var that = $(this).parents("tr.bns");
$(that).find("button[class=bnt_save]").css("display","")
@ -2297,11 +2318,11 @@
})
/* $('input[name=game_ratio]').live('input propertychange', function()
{
//获取input 元素,并实时监听用户输入
//逻辑
})*/
/* $('input[name=game_ratio]').live('input propertychange', function()
{
//获取input 元素,并实时监听用户输入
//逻辑
})*/
$(document).on('click', '.bnt_save', function(){
@ -2310,6 +2331,7 @@
var that = $(this).parents("tr.bns");
var total_amount = $(that).find("input[name=game_amount]").val();
var game_ratio = $(that).find("input[name=game_ratio]").val();
var instanceofs = $(that).find("select[name=instanceof]").val();
$.ajax({
//请求方式
type : "POST",
@ -2320,7 +2342,8 @@
data_id :data_id,
total_amount:total_amount,
game_ratio:game_ratio,
game_id:'{$game_id}'
game_id:'{$game_id}',
instanceof:instanceofs
},
//请求成功
success : function(result) {

@ -1101,3 +1101,7 @@ ADD COLUMN `can_view_recharge` tinyint(1) NOT NULL default 0 COMMENT '是否显
ALTER TABLE `tab_promote_belong`
ADD COLUMN `can_view_recharge` tinyint(1) NOT NULL default 0 COMMENT '是否显示充值数据 0否 1是';
--CP 2020-02-04
ALTER TABLE `tab_cp_game_ratio`
ADD COLUMN `instanceof` tinyint(2) NOT NULL DEFAULT 1 COMMENT '运算符1:>= ; 2:>' AFTER `game_id`;

13
composer.lock generated

@ -8,16 +8,16 @@
"packages": [
{
"name": "guzzlehttp/guzzle",
"version": "6.4.1",
"version": "6.5.2",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "0895c932405407fd3a7368b6910c09a24d26db11"
"reference": "43ece0e75098b7ecd8d13918293029e555a50f82"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/0895c932405407fd3a7368b6910c09a24d26db11",
"reference": "0895c932405407fd3a7368b6910c09a24d26db11",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/43ece0e75098b7ecd8d13918293029e555a50f82",
"reference": "43ece0e75098b7ecd8d13918293029e555a50f82",
"shasum": ""
},
"require": {
@ -32,12 +32,13 @@
"psr/log": "^1.1"
},
"suggest": {
"ext-intl": "Required for Internationalized Domain Name (IDN) support",
"psr/log": "Required for using the Log middleware"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "6.3-dev"
"dev-master": "6.5-dev"
}
},
"autoload": {
@ -70,7 +71,7 @@
"rest",
"web service"
],
"time": "2019-10-23T15:58:00+00:00"
"time": "2019-12-23T11:57:10+00:00"
},
{
"name": "guzzlehttp/promises",

Loading…
Cancel
Save