公会分成管理--更新

master
chenxiaojun 5 years ago
parent d615a1402f
commit 365a276b95

@ -3,6 +3,7 @@
namespace Admin\Controller;
use Think\Controller;
use Admin\Model\PromoteGameRatioModel;
class PromoteGameRatioController extends ThinkController
{
@ -20,6 +21,7 @@ class PromoteGameRatioController extends ThinkController
public function lists()
{
$params = I('get.');
$group = $params['group'] ?? 1;
$promoteId = $params['promote_id'] ?? 0;
$gameId = $params['game_id'] ?? 0;
$status = $params['status'] ?? '';
@ -38,9 +40,17 @@ class PromoteGameRatioController extends ThinkController
}
$field = 'create_time, update_time';
$query = D(self::MODEL_NAME)->field($field, true)
->where($map)
->order('update_time desc, id desc');
if ($group == 1) {
$query = D(self::MODEL_NAME)->field($field, true)
->where($map)
->order('update_time desc, id desc');
$metaTitle = $csvTitle = '公会分成管理';
} else {
$query = M(self::MODEL_NAME . '_log', 'tab_')->field($field, true)
->where($map)
->order('create_time desc, id desc');
$metaTitle = $csvTitle = '公会分成申请记录';
}
if (I('export', 0) != 1) {
$query->page($page, $row);
}
@ -107,7 +117,7 @@ class PromoteGameRatioController extends ThinkController
'promote_status_text' => $thisPromoteStatus,
'promote_ver_status_text' => $thisPromoteVerStatus,
'game_name' => $thisGameName,
'last_ratio' => (($thisLastRatioStatus == 1) ? $thisLastRatio : $thisGameRatio),
'last_ratio' => (($thisLastRatioStatus == 1 || $group != 1) ? $thisLastRatio : $thisGameRatio),
'ratio' => $thisRatio,
'valid_date' => $validDate,
'remark' => $promoteGameRatio['remark'],
@ -139,7 +149,7 @@ class PromoteGameRatioController extends ThinkController
'applicant' => '申请人',
'reviewer' => '确认人',
];
data2csv($records,"公会分成管理", $field);
data2csv($records,$csvTitle, $field);
exit;
}
@ -148,6 +158,7 @@ class PromoteGameRatioController extends ThinkController
if($page) {
$this->assign('_page', $page);
}
$this->assign('group', $group);
$this->assign('records', $records);
$this->assign('count', $count);
$this->assign('gameList', getAllGameList());
@ -155,7 +166,7 @@ class PromoteGameRatioController extends ThinkController
$this->assign('statusList', self::$statusList);
$this->assign('reviewRule', $reviewRule);
$this->assign('is_admin', is_administrator());
$this->meta_title = '公会分成管理';
$this->meta_title = $metaTitle;
$this->display();
}
@ -236,8 +247,10 @@ class PromoteGameRatioController extends ThinkController
}
$save['id'] = intval($params['id']);
$result = D(self::MODEL_NAME)->save($save);
$logResult = $result;
} else {
$result = true;
$logResult = false;
}
} else {//新增
if (empty($params['promote_id'])) {
@ -264,14 +277,27 @@ class PromoteGameRatioController extends ThinkController
}
$save['promote_id'] = $promoteId;
$save['game_id'] = $gameId;
$save['last_turnover_ratio'] = '';
$save['applicant_id'] = is_login();
$save['create_time'] = $time;
$result = D(self::MODEL_NAME)->add($save);
$logResult = $result;
}
if ($result === false) {
$this->error('保存失败');
} else {
if ($logResult) {
if (empty($params['id'])) {
$promoteGameRatioId = $result;
} else {
$promoteGameRatioId = $params['id'];
}
$model = new PromoteGameRatioModel();
$model->addLog($promoteGameRatioId);
}
$this->success('保存成功', U('lists'));
}
} else {
@ -351,10 +377,12 @@ class PromoteGameRatioController extends ThinkController
}
$result = D(self::MODEL_NAME)->where($map)->save($save);
if ($result) {
if ($status == 1) {
foreach ($ids as $id) {
$promoteGameRatio = D(self::MODEL_NAME)->find($id);
if (!empty($promoteGameRatio)) {
$model = new PromoteGameRatioModel();
foreach ($ids as $id) {
$model->addLog($id);
$promoteGameRatio = D(self::MODEL_NAME)->find($id);
if (!empty($promoteGameRatio)) {
if ($status == 1) {
if ($promoteGameRatio['begin_time'] <= strtotime(date('Y-m-d', time()))) {
$promoteId = $promoteGameRatio['promote_id'];
$promoteMap['chain'] = ['like', "/{$promoteId}/%"];

@ -6,6 +6,23 @@ use Think\Model;
class PromoteGameRatioModel extends Model
{
protected $db = 'promote_game_ratio';
// 数据表前缀
protected $tablePrefix = 'tab_';
public function addLog($id)
{
$logSave = $this->find($id);
if (!empty($logSave)) {
if (empty($logSave['last_ratio_status'])) {
$logSave['last_ratio'] = D('game')->where(array('id' => $logSave['game_id']))->getField('ratio');
$logSave['last_ratio'] = $logSave['last_ratio'] ?? 0;
}
$logSave['create_time'] = $logSave['update_time'];
unset($logSave['id']);
unset($logSave['update_time']);
M('promote_game_ratio_log', 'tab_')->add($logSave);
}
}
}

@ -43,24 +43,30 @@
margin-left:-7px
}
</style>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">{$meta_title}</h3>
<p class="description_text">说明:此功能可设置所有公会对应的游戏分成比例。</p>
</div>
<div class="cf top_nav_list">
<div class="fl button_list">
<div class="tools">
<empty name="show_status">
<a class=" " href="{:U('applyRatio?model='.$model['id'])}"><span class="button_icon button_icon1"></span>游戏分成比例申请</a>
<if condition = "$reviewRule">
<a class="ajax-post " target-form="ids" url="{:U('setStatus',array('status'=>1))}"><span class="button_icon button_icon9"></span>审核通过</a>
<a href="javascript:;" onclick="refuse()" style="color: red;"><span class="button_icon button_icon9"></span>审核拒绝</a>
</if>
</empty>
<div class="cf main-place top_nav_list navtab_list">
<div class="fr">
<a <if condition="$group eq 1"> class="tabchose" </if> href="{:U('lists?group=1')}">分成比例申请</a>
<a <if condition="$group eq 2"> class="tabchose" </if> href="{:U('lists?group=2')}">申请记录</a>
</div>
<h3 class="page_title">{$meta_title}</h3>
<p class="description_text">说明:此功能可设置所有公会对应的游戏分成比例。</p>
</div>
<if condition="$group eq 1">
<div class="fl button_list">
<div class="tools">
<empty name="show_status">
<a class=" " href="{:U('applyRatio?model='.$model['id'])}"><span class="button_icon button_icon1"></span>游戏分成比例申请</a>
<if condition = "$reviewRule">
<a class="ajax-post " target-form="ids" url="{:U('setStatus',array('status'=>1))}"><span class="button_icon button_icon9"></span>审核通过</a>
<a href="javascript:;" onclick="refuse()" style="color: red;"><span class="button_icon button_icon9"></span>审核拒绝</a>
</if>
</empty>
</div>
</div>
</if>
<!-- 高级搜索 -->
<div class="jssearch fl cf search_list">
<div class="input-list search-title-box">
@ -91,7 +97,7 @@
</select>
</div>
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('PromoteGameRatio/lists','model='.$model['name'] .'&row='.I('row'),false)}">搜索</a>
<a class="sch-btn" href="javascript:;" id="search" url="{:U('PromoteGameRatio/lists','model='.$model['name'] .'&row='.I('row') . '&group=' . $group,false)}">搜索</a>
</div>
</div>
</div>
@ -119,7 +125,9 @@
<th>分成比例审核</th>
<th>申请人</th>
<th>确认人</th>
<th>操作</th>
<if condition="$group eq 1">
<th>操作</th>
</if>
</tr>
</thead>
@ -153,9 +161,11 @@
<td>{$record.status_text}</td>
<td>{$record.applicant}</td>
<td>{$record.reviewer}</td>
<td>
<a href="{:U('applyRatio', array('id'=>$record['id']))}" class="">修改</a>
</td>
<if condition="$group eq 1">
<td>
<a href="{:U('applyRatio', array('id'=>$record['id']))}" class="">修改</a>
</td>
</if>
</tr>
</volist>
</if>

@ -962,3 +962,26 @@ ADD COLUMN `game_ratio` varchar(5000) NOT NULL COMMENT '游戏提现实际分成
ALTER TABLE `tab_withdraw`
MODIFY COLUMN `settlement_type` tinyint(3) NOT NULL DEFAULT 1 COMMENT '结算类型1-周结 2-月结 9-其他';
-- 2020 01-13
-- 公会分成比例申请记录
CREATE TABLE `tab_promote_game_ratio_log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`promote_id` int(11) NOT NULL DEFAULT '0' COMMENT '推广员id',
`game_id` int(11) NOT NULL DEFAULT '0' COMMENT '游戏id',
`ratio` decimal(5,2) NOT NULL DEFAULT '0.00' COMMENT '分成比例',
`last_ratio` decimal(5,2) NOT NULL DEFAULT '0.00' COMMENT '上次的分成比例',
`last_ratio_status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '上次的分成比例状态0-未设置 1-已设置',
`turnover_ratio` varchar(2000) COLLATE utf8mb4_bin NOT NULL COMMENT '流水分成比例',
`last_turnover_ratio` varchar(2000) COLLATE utf8mb4_bin NOT NULL COMMENT '上次流水分成比例',
`begin_time` int(10) NOT NULL DEFAULT '0' COMMENT '开始时间',
`end_time` int(10) NOT NULL DEFAULT '0' COMMENT '过期时间',
`remark` varchar(255) COLLATE utf8mb4_bin NOT NULL COMMENT '备注',
`status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '审核状态:-1-未通过 0-待审核 1-通过',
`review_time` int(10) NOT NULL DEFAULT '0' COMMENT '审核时间',
`applicant_id` int(11) NOT NULL DEFAULT '0' COMMENT '申请人',
`reviewer_id` int(11) NOT NULL DEFAULT '0' COMMENT '审核人',
`create_time` int(10) NOT NULL DEFAULT '0' COMMENT '创建时间',
PRIMARY KEY (`id`),
KEY `promote_id` (`promote_id`,`game_id`,`status`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
Loading…
Cancel
Save