公会分成管理--更新

master
chenxiaojun 5 years ago
commit 02ccf125dc

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

@ -6,6 +6,23 @@ use Think\Model;
class PromoteGameRatioModel extends Model class PromoteGameRatioModel extends Model
{ {
protected $db = 'promote_game_ratio';
// 数据表前缀 // 数据表前缀
protected $tablePrefix = 'tab_'; 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);
}
}
} }

@ -44,12 +44,17 @@
} }
</style> </style>
<div class="cf top_nav_list">
<div class="cf main-place top_nav_list navtab_list"> <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> <h3 class="page_title">{$meta_title}</h3>
<p class="description_text">说明:此功能可设置所有公会对应的游戏分成比例。</p> <p class="description_text">说明:此功能可设置所有公会对应的游戏分成比例。</p>
</div> </div>
<div class="cf top_nav_list"> <if condition="$group eq 1">
<div class="fl button_list"> <div class="fl button_list">
<div class="tools"> <div class="tools">
<empty name="show_status"> <empty name="show_status">
@ -61,6 +66,7 @@
</empty> </empty>
</div> </div>
</div> </div>
</if>
<!-- 高级搜索 --> <!-- 高级搜索 -->
<div class="jssearch fl cf search_list"> <div class="jssearch fl cf search_list">
<div class="input-list search-title-box"> <div class="input-list search-title-box">
@ -91,7 +97,7 @@
</select> </select>
</div> </div>
<div class="input-list"> <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> </div>
</div> </div>
@ -119,7 +125,9 @@
<th>分成比例审核</th> <th>分成比例审核</th>
<th>申请人</th> <th>申请人</th>
<th>确认人</th> <th>确认人</th>
<if condition="$group eq 1">
<th>操作</th> <th>操作</th>
</if>
</tr> </tr>
</thead> </thead>
@ -153,9 +161,11 @@
<td>{$record.status_text}</td> <td>{$record.status_text}</td>
<td>{$record.applicant}</td> <td>{$record.applicant}</td>
<td>{$record.reviewer}</td> <td>{$record.reviewer}</td>
<if condition="$group eq 1">
<td> <td>
<a href="{:U('applyRatio', array('id'=>$record['id']))}" class="">修改</a> <a href="{:U('applyRatio', array('id'=>$record['id']))}" class="">修改</a>
</td> </td>
</if>
</tr> </tr>
</volist> </volist>
</if> </if>

@ -1047,3 +1047,26 @@ CREATE TABLE `sys_document_pop_rules` (
`operater_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '操作者ID', `operater_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '操作者ID',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- 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