diff --git a/Application/Admin/Controller/PromoteGameRatioController.class.php b/Application/Admin/Controller/PromoteGameRatioController.class.php index d752c51e0..36dfa12c5 100644 --- a/Application/Admin/Controller/PromoteGameRatioController.class.php +++ b/Application/Admin/Controller/PromoteGameRatioController.class.php @@ -116,8 +116,8 @@ class PromoteGameRatioController extends ThinkController $thisTurnoverRatios = $promoteGameRatio['turnover_ratio'] ? json_decode($promoteGameRatio['turnover_ratio'], true) : []; $thisRatioDtl = "默认:{$promoteGameRatio['ratio']}%"; if ($thisTurnoverRatios) { - $thisIntervalClosedStatusText = ($promoteGameRatio['interval_closed_status'] == 1 ? '≥' : '>'); foreach ($thisTurnoverRatios as $thisTurnoverRatio) { + $thisIntervalClosedStatusText = isset($thisTurnoverRatio['interval_closed_status']) ? ($thisTurnoverRatio['interval_closed_status'] == 1 ? '≥' : '>') : '≥'; $thisRatioDtl .= "<br>月流水{$thisIntervalClosedStatusText}{$thisTurnoverRatio['turnover']},比例:{$thisTurnoverRatio['ratio']}%"; } } @@ -232,8 +232,8 @@ class PromoteGameRatioController extends ThinkController $this->error('默认分成比例不能为空'); } $save['turnover_ratio'] = []; - if (!empty(array_filter($params['turnover'])) || !empty(array_filter($params['turnover_ratio']))) { - if (is_array($params['turnover']) && is_array($params['turnover_ratio'])) { + if (!empty(array_filter($params['turnover'])) || !empty(array_filter($params['turnover_ratio'])) || !empty(array_filter($params['interval_closed_status']))) { + if (is_array($params['turnover']) && is_array($params['turnover_ratio']) && is_array($params['interval_closed_status'])) { foreach ($params['turnover'] as $turnover) { if (empty($turnover)) { $this->error('月流水不能为空'); @@ -244,6 +244,11 @@ class PromoteGameRatioController extends ThinkController $this->error('月流水分成比例不能为空'); } } + foreach ($params['interval_closed_status'] as $intervalClosedStatus) { + if (!in_array($intervalClosedStatus, [1, 2])) { + $this->error('月流水分符号不能为空'); + } + } $turnoverCount = count($params['turnover']); $sortTurnover = $params['turnover']; sort($sortTurnover); @@ -265,6 +270,7 @@ class PromoteGameRatioController extends ThinkController $save['turnover_ratio'][] = [ 'turnover' => bcdiv($turnover, 1, 2), 'ratio' => bcdiv($params['turnover_ratio'][$key], 1, 2), + 'interval_closed_status' => (isset($params['interval_closed_status'][$key]) ? $params['interval_closed_status'][$key] : 1), ]; } $save['turnover_ratio'] = json_encode($save['turnover_ratio']); diff --git a/Application/Admin/Model/WithdrawModel.class.php b/Application/Admin/Model/WithdrawModel.class.php index f4fe43914..e937a96a6 100644 --- a/Application/Admin/Model/WithdrawModel.class.php +++ b/Application/Admin/Model/WithdrawModel.class.php @@ -252,7 +252,7 @@ class WithdrawModel extends Model{ $promoteGameRatioMap['status'] = 1; $promoteGameRatioMap['promote_id'] = $promote['id']; - $promoteGameRatios = D('promote_game_ratio')->field('game_id, ratio, turnover_ratio, begin_time, end_time, interval_closed_status') + $promoteGameRatios = D('promote_game_ratio')->field('game_id, ratio, turnover_ratio, begin_time, end_time') ->where($promoteGameRatioMap) ->order('update_time desc') ->select(); @@ -278,15 +278,13 @@ class WithdrawModel extends Model{ ->where($spendWhere) ->find()['sum_amount']; $sumAmount = $sumAmount ?? 0; - if ($promoteGameRatio['interval_closed_status'] == 1) { - foreach ($turnoverRatios as $turnoverRatio) { + foreach ($turnoverRatios as $turnoverRatio) { + if (empty($turnoverRatio['interval_closed_status']) || $turnoverRatio['interval_closed_status'] == 1) { if ($sumAmount >= $turnoverRatio['turnover']) { $ratio = $turnoverRatio['ratio']; break; } - } - } else { - foreach ($turnoverRatios as $turnoverRatio) { + } else { if ($sumAmount > $turnoverRatio['turnover']) { $ratio = $turnoverRatio['ratio']; break; @@ -369,7 +367,7 @@ class WithdrawModel extends Model{ { $promoteGameRatioMap['status'] = 1; $promoteGameRatioMap['promote_id'] = $promote['id']; - $promoteGameRatios = D('promote_game_ratio')->field('game_id, ratio, turnover_ratio, begin_time, end_time, interval_closed_status') + $promoteGameRatios = D('promote_game_ratio')->field('game_id, ratio, turnover_ratio, begin_time, end_time') ->where($promoteGameRatioMap) ->order('update_time desc') ->select(); @@ -408,15 +406,13 @@ class WithdrawModel extends Model{ ->find()['sum_amount']; $sumAmount = $sumAmount ?? 0; $ratio = 0; - if ($promoteGameRatio['interval_closed_status'] == 1) { - foreach ($turnoverRatios as $turnoverRatio) { + foreach ($turnoverRatios as $turnoverRatio) { + if (empty($turnoverRatio['interval_closed_status']) || $turnoverRatio['interval_closed_status'] == 1) { if ($sumAmount >= $turnoverRatio['turnover']) { $ratio = $turnoverRatio['ratio']; break; } - } - } else { - foreach ($turnoverRatios as $turnoverRatio) { + } else { if ($sumAmount > $turnoverRatio['turnover']) { $ratio = $turnoverRatio['ratio']; break; @@ -475,7 +471,7 @@ class WithdrawModel extends Model{ { $promoteGameRatioMap['status'] = 1; $promoteGameRatioMap['promote_id'] = $promote['id']; - $promoteGameRatios = D('promote_game_ratio')->field('game_id, ratio, turnover_ratio, begin_time, end_time, interval_closed_status') + $promoteGameRatios = D('promote_game_ratio')->field('game_id, ratio, turnover_ratio, begin_time, end_time') ->where($promoteGameRatioMap) ->order('update_time desc') ->select(); @@ -503,15 +499,13 @@ class WithdrawModel extends Model{ ->find()['sum_amount']; $sumAmount = $sumAmount ?? 0; $ratio = 0; - if ($promoteGameRatio['interval_closed_status'] == 1) { - foreach ($turnoverRatios as $turnoverRatio) { + foreach ($turnoverRatios as $turnoverRatio) { + if (empty($turnoverRatio['interval_closed_status']) || $turnoverRatio['interval_closed_status'] == 1) { if ($sumAmount >= $turnoverRatio['turnover']) { $ratio = $turnoverRatio['ratio']; break; } - } - } else { - foreach ($turnoverRatios as $turnoverRatio) { + } else { if ($sumAmount > $turnoverRatio['turnover']) { $ratio = $turnoverRatio['ratio']; break; @@ -545,7 +539,7 @@ class WithdrawModel extends Model{ $promoteGameRatioMap['status'] = 1; $promoteGameRatioMap['promote_id'] = $promote['id']; - $promoteGameRatios = D('promote_game_ratio')->field('game_id, ratio, turnover_ratio, begin_time, end_time, interval_closed_status') + $promoteGameRatios = D('promote_game_ratio')->field('game_id, ratio, turnover_ratio, begin_time, end_time') ->where($promoteGameRatioMap) ->order('update_time desc') ->select(); @@ -569,15 +563,13 @@ class WithdrawModel extends Model{ ->where($spendWhere) ->find()['sum_amount']; $sumAmount = $sumAmount ?? 0; - if ($promoteGameRatio['interval_closed_status'] == 1) { - foreach ($turnoverRatios as $turnoverRatio) { + foreach ($turnoverRatios as $turnoverRatio) { + if (empty($turnoverRatio['interval_closed_status']) || $turnoverRatio['interval_closed_status'] == 1) { if ($sumAmount >= $turnoverRatio['turnover']) { $ratio = $turnoverRatio['ratio']; break; } - } - } else { - foreach ($turnoverRatios as $turnoverRatio) { + } else { if ($sumAmount > $turnoverRatio['turnover']) { $ratio = $turnoverRatio['ratio']; break; diff --git a/Application/Admin/View/PromoteGameRatio/applyRatio.html b/Application/Admin/View/PromoteGameRatio/applyRatio.html index 8f70d7356..ddb97a3c4 100644 --- a/Application/Admin/View/PromoteGameRatio/applyRatio.html +++ b/Application/Admin/View/PromoteGameRatio/applyRatio.html @@ -141,25 +141,6 @@ <span class="notice-text"></span> </td> </tr> - <tr> - <td class="l">月流水类型:</td> - <td class="r table_radio"> - <span class="form_radio table_btn"> - <label> - <input class="interval_closed_status" type="radio" value="1" name="interval_closed_status" - <if condition="empty($record) or $record['interval_closed_status'] eq 1"> - checked="checked" - </if>>大于等于 - </label> - <label> - <input class="interval_closed_status" type="radio" value="2" name="interval_closed_status" - <if condition="!empty($record) and $record['interval_closed_status'] eq 2"> - checked="checked" - </if>>大于 - </label> - </span> - </td> - </tr> <tr> <td class="l">现分成比例:</td> <td class="r table_radio"> @@ -176,20 +157,18 @@ <div class="list-ratio"> <empty name="record['turnover_ratio']"> <div class="li-ratio"> - <label class="interval_closed_status_text"> - <if condition="empty($record) or $record['interval_closed_status'] eq 1"> - 月流水大于等于: - <else/> - 月流水大于: - </if> - </label> + <label class="interval_closed_status_text" style="margin-right: 10px;">月流水</label> + <select name="interval_closed_status[]" style="width: 50px;margin-right: 10px;"> + <option value="1">≥</option> + <option value="2">></option> + </select> <div class="turnover"> - <input type="text" class="txt" name="turnover[]" value="" placeholder="" onKeyUp="value=value.replace(/[^\w\.\/]/ig,'')" style="width: 100px;margin-right: 10px;"> + <input type="text" class="txt" name="turnover[]" value="" placeholder="请输入金额" onKeyUp="value=value.replace(/[^\w\.\/]/ig,'')" style="width: 100px;margin-right: 10px;"> <span></span> </div> <label>分成比例:</label> <div class="turnover-ratio"> - <input type="text" class="txt" name="turnover_ratio[]" value="" placeholder="" onKeyUp="value=value.replace(/[^\w\.\/]/ig,'')" style="width: 60px;"> + <input type="text" class="txt" name="turnover_ratio[]" value="" placeholder="请输入比例" onKeyUp="value=value.replace(/[^\w\.\/]/ig,'')" style="width: 60px;"> <span class="form_unit" style="margin-right: 10px;">%</span> <span class="error-message">sadasdas</span> </div> @@ -199,13 +178,11 @@ <else/> <volist name="record['turnover_ratio']" key="key" id="vo"> <div class="li-ratio"> - <label class="interval_closed_status_text"> - <if condition="empty($record) or $record['interval_closed_status'] eq 1"> - 月流水大于等于: - <else/> - 月流水大于: - </if> - </label> + <label class="interval_closed_status_text" style="margin-right: 10px;">月流水</label> + <select name="interval_closed_status[]" style="width: 50px;margin-right: 10px;"> + <option value="1" <if condition="empty($vo['interval_closed_status']) or $vo['interval_closed_status'] eq 1">selected</if>>≥</option> + <option value="2" <if condition="!empty($vo['interval_closed_status']) and $vo['interval_closed_status'] eq 2">selected</if>>></option> + </select> <div class="turnover"> <input type="text" class="txt" name="turnover[]" value="{$vo['turnover']|default=''}" placeholder="" onKeyUp="value=value.replace(/[^\w\.\/]/ig,'')" style="width: 100px;margin-right: 10px;"> <span></span> @@ -289,8 +266,6 @@ highlight_subnav('{:U('PromoteGameRatio/lists')}'); $(".select_gallery").select2(); $(function(){ - var intervalClosedStatusText = '月流水大于等于:'; - $('.time').datetimepicker({ format: 'yyyy-mm', language: "zh-CN", @@ -375,25 +350,6 @@ $(function(){ }); } - $('.interval_closed_status').change(function (e) { - var intervalClosedStatus = parseInt($("input[name=interval_closed_status]:checked").val()); - var html = ''; - switch (intervalClosedStatus) { - case 1: - html = '月流水大于等于:'; - break; - case 2: - html = '月流水大于:'; - break; - } - - intervalClosedStatusText = html; - $('.interval_closed_status_text').text(html); - }); - $('input[name=interval_closed_status]').change(function (e) { - - }); - $('#submit').click(function (e) { var target = $('form').get(0).action; var query = $('form').serialize(); @@ -435,14 +391,18 @@ $(function(){ var delBtn = $('.iconfont-btn-del'); var html = ''; html += '<div class="li-ratio">'; - html += '<label class="interval_closed_status_text">' + intervalClosedStatusText + '</label>'; + html += '<label class="interval_closed_status_text">月流水:</label>'; + html += '<select name="interval_closed_status[]" style="width: 50px;margin-right: 10px;">'; + html += '<option value="1">≥</option>'; + html += '<option value="2">></option>'; + html += '</select>'; html += '<div class="turnover">'; - html += '<input type="text" class="txt" name="turnover[]" value="" placeholder="" onKeyUp="value=value.replace(/[^\\w\\.\\/]/ig, \'\')" style="width: 100px;margin-right: 10px;">'; + html += '<input type="text" class="txt" name="turnover[]" value="" placeholder="请输入金额" onKeyUp="value=value.replace(/[^\\w\\.\\/]/ig, \'\')" style="width: 100px;margin-right: 10px;">'; html += '<span></span>'; html += '</div>'; html += '<label>分成比例:</label>'; html += '<div class="turnover-ratio">'; - html += '<input type="text" class="txt" name="turnover_ratio[]" value="" placeholder="" onKeyUp="value=value.replace(/[^\\w\\.\\/]/ig, \'\')" style="width: 60px;">'; + html += '<input type="text" class="txt" name="turnover_ratio[]" value="" placeholder="请输入比例" onKeyUp="value=value.replace(/[^\\w\\.\\/]/ig, \'\')" style="width: 60px;">'; html += '<span class="form_unit" style="margin-right: 10px;">%</span>'; html += '<span class="error-message"></span>'; html += '</div>'; diff --git a/Data/update.sql b/Data/update.sql index 297b625d3..e9f221550 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -1102,10 +1102,6 @@ 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是'; --- 2020-02-03 -ALTER TABLE `tab_promote_game_ratio` -ADD COLUMN `interval_closed_status` tinyint(3) NOT NULL DEFAULT 1 COMMENT '区间闭合状态:1-闭合 2-不闭合' AFTER `last_turnover_ratio`; - -- 2020-02-04 ALTER TABLE `tab_promote` ADD COLUMN `auto_review_withdraw_status` tinyint(3) NOT NULL DEFAULT 0 COMMENT '提现自动审核状态:0-关闭 1-开启';