diff --git a/Application/Admin/Controller/PromoteGameRatioController.class.php b/Application/Admin/Controller/PromoteGameRatioController.class.php index aa3852bc7..fae9c3e32 100644 --- a/Application/Admin/Controller/PromoteGameRatioController.class.php +++ b/Application/Admin/Controller/PromoteGameRatioController.class.php @@ -69,15 +69,20 @@ class PromoteGameRatioController extends ThinkController $thisPromoteStatus = '待审核'; $thisPromoteVerStatus = '未知'; $thisGameName = '未知'; - $thisGameRatio = '0.00'; - $thisLastRatio = $promoteGameRatio['last_ratio']; + $thisGameRatio = '0.00%'; + $thisLastRatio = $promoteGameRatio['last_ratio'] . '%'; + $thisLastTurnoverRatio = $promoteGameRatio['last_turnover_ratio'] ? json_decode($promoteGameRatio['last_turnover_ratio'], true) : []; + $thisLastRatio = $thisLastTurnoverRatio ? "{$thisLastRatio} - " . $thisLastTurnoverRatio[count($thisLastTurnoverRatio) - 1]['ratio'] . '%' : $thisLastRatio; + $thisRatio = $promoteGameRatio['ratio'] . '%'; + $thisTurnoverRatio = $promoteGameRatio['turnover_ratio'] ? json_decode($promoteGameRatio['turnover_ratio'], true) : []; + $thisRatio = $thisTurnoverRatio ? "{$thisRatio} - " . $thisTurnoverRatio[count($thisTurnoverRatio) - 1]['ratio'] . '%' : $thisRatio; $thisLastRatioStatus = $promoteGameRatio['last_ratio_status']; $thisStatusText = self::$statusList[$promoteGameRatio['status']]; $thisStatusText = ($promoteGameRatio['status'] == -1) ? '' . $thisStatusText . '' : $thisStatusText; $thisApplicant = get_admin_account($promoteGameRatio['applicant_id']); $thisReviewer = $promoteGameRatio['reviewer_id'] ? get_admin_account($promoteGameRatio['reviewer_id']) : '待确认'; - $thisBeninTime = date('Y/m/d', $promoteGameRatio['begin_time']); - $thisEndTime = $promoteGameRatio['end_time'] ? date('Y/m/d', $promoteGameRatio['end_time']) : '永久'; + $thisBeninTime = date('Y/m', $promoteGameRatio['begin_time']); + $thisEndTime = $promoteGameRatio['end_time'] ? date('Y/m', $promoteGameRatio['end_time']) : '永久'; $validDate = $thisBeninTime . ' - ' . $thisEndTime; if ($issetPromote) { $thisPromoteAccount = $promotes[$thisPromoteId]['account']; @@ -90,7 +95,7 @@ class PromoteGameRatioController extends ThinkController if ($issetGame) { $thisGameName = $games[$thisGameId]['game_name']; $thisGameRatio = $games[$thisGameId]['ratio']; - $thisGameRatio = $thisGameRatio ?? '0.00'; + $thisGameRatio = ($thisGameRatio ?? '0.00') . '%'; } $record = [ @@ -102,8 +107,8 @@ class PromoteGameRatioController extends ThinkController 'promote_status_text' => $thisPromoteStatus, 'promote_ver_status_text' => $thisPromoteVerStatus, 'game_name' => $thisGameName, - 'last_ratio' => (($thisLastRatioStatus == 1) ? $thisLastRatio : $thisGameRatio) . '%', - 'ratio' => $promoteGameRatio['ratio'] . '%', + 'last_ratio' => (($thisLastRatioStatus == 1) ? $thisLastRatio : $thisGameRatio), + 'ratio' => $thisRatio, 'valid_date' => $validDate, 'remark' => $promoteGameRatio['remark'], 'status_text' => $thisStatusText, @@ -167,6 +172,50 @@ class PromoteGameRatioController extends ThinkController $this->error('结束时间不得小于开始时间'); } } + if (!isset($params['ratio']) || $params['ratio'] === '') { + $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'])) { + foreach ($params['turnover'] as $turnover) { + if (empty($turnover)) { + $this->error('月流水不能为空'); + } + } + foreach ($params['turnover_ratio'] as $turnoverRatio) { + if (empty($turnoverRatio)) { + $this->error('月流水分成比例不能为空'); + } + } + $turnoverCount = count($params['turnover']); + $sortTurnover = $params['turnover']; + sort($sortTurnover); + if ($params['turnover'] != $sortTurnover || $turnoverCount != count(array_unique($params['turnover']))) { + $this->error('月流水必须以正序的方式填写,且必须大于上一个月流水'); + } + $ratio = $params['ratio'] ?? 0; + if ($params['turnover_ratio'][0] <= $ratio) { + $this->error('月流水分成比例必须大于默认分成比例'); + } + $turnoverRatioCount = count($params['turnover_ratio']); + $sortTurnoverRatio = $params['turnover_ratio']; + sort($sortTurnoverRatio); + if ($params['turnover_ratio'] != $sortTurnoverRatio || $turnoverRatioCount != count(array_unique($params['turnover_ratio']))) { + $this->error('月流水分成比例必须以正序的方式填写,且必须大于上一个月流水分成比例'); + } + + $save['turnover_ratio'] = []; + foreach ($params['turnover'] as $key => $turnover) { + $save['turnover_ratio'][] = [ + 'turnover' => bcdiv($turnover, 1, 2), + 'ratio' => bcdiv($params['turnover_ratio'][$key], 1, 2), + ]; + } + $save['turnover_ratio'] = json_encode($save['turnover_ratio']); + } + } + $save['ratio'] = $params['ratio'] ?? 0; $save['begin_time'] = strtotime($params['begin_time']); $save['end_time'] = $params['end_time'] ? strtotime($params['end_time']) : 0; @@ -183,6 +232,7 @@ class PromoteGameRatioController extends ThinkController $this->isWithdraw($promoteId, $save['begin_time']);//是否存在开始时间后已提现数据 if ($promoteGameRatio['status'] == 1) { + $save['last_turnover_ratio'] = $promoteGameRatio['turnover_ratio']; $save['last_ratio'] = $promoteGameRatio['ratio']; $save['last_ratio_status'] = 1; } @@ -237,8 +287,9 @@ class PromoteGameRatioController extends ThinkController if (empty($promoteGameRatio)) { $this->error('数据异常'); } - $promoteGameRatio['begin_time'] = $promoteGameRatio['begin_time'] ? date('Y-m-d', $promoteGameRatio['begin_time']) : ''; - $promoteGameRatio['end_time'] = $promoteGameRatio['end_time'] ? date('Y-m-d', $promoteGameRatio['end_time']) : ''; + $promoteGameRatio['begin_time'] = $promoteGameRatio['begin_time'] ? date('Y-m', $promoteGameRatio['begin_time']) : ''; + $promoteGameRatio['end_time'] = $promoteGameRatio['end_time'] ? date('Y-m', $promoteGameRatio['end_time']) : ''; + $promoteGameRatio['turnover_ratio'] = $promoteGameRatio['turnover_ratio'] ? json_decode($promoteGameRatio['turnover_ratio'], true) : $promoteGameRatio['turnover_ratio']; if ($promoteGameRatio['last_ratio_status'] == 1) { $lastRatio = $promoteGameRatio['last_ratio']; } else { diff --git a/Application/Admin/View/PromoteGameRatio/applyRatio.html b/Application/Admin/View/PromoteGameRatio/applyRatio.html index 3ce73e049..7d14a96be 100644 --- a/Application/Admin/View/PromoteGameRatio/applyRatio.html +++ b/Application/Admin/View/PromoteGameRatio/applyRatio.html @@ -3,6 +3,7 @@ + @@ -22,6 +23,48 @@ .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; + }