管理后台>推广员管理>公会分成管理--更新

master
chenxiaojun 5 years ago
parent cf8f6d007f
commit 3e439715c1

@ -66,9 +66,11 @@ class PromoteGameRatioController extends ThinkController
$thisPromoteVerStatus = '未知';
$thisGameName = '未知';
$thisGameRatio = '0.00';
$thisStatusText = self::$statusList[$promoteGameRatio['status']];
$thisStatusText = ($promoteGameRatio['status'] == -1) ? '<span style="color: red;">' . $thisStatusText . '</span>' : $thisStatusText;
$thisApplicant = getPromoteAccount($promoteGameRatio['applicant_id']);
$thisReviewer = $promoteGameRatio['reviewer_id'] ? getPromoteAccount($promoteGameRatio['reviewer_id']) : '待确认';
if ($promoteGameRatio['ratio'] > 0) {
if ($promoteGameRatio['ratio'] > 0 && $promoteGameRatio['begin_time']) {
$thisBeninTime = date('Y/m/d', $promoteGameRatio['begin_time']);
} else {
$thisBeninTime = date('Y/m/d', $this->getPromoteApplyCreateTime($thisPromoteId, $thisGameId));
@ -102,13 +104,15 @@ class PromoteGameRatioController extends ThinkController
'ratio' => $promoteGameRatio['ratio'] . '%',
'valid_date' => $validDate,
'remark' => $promoteGameRatio['remark'],
'status_text' => self::$statusList[$promoteGameRatio['status']],
'status' => $promoteGameRatio['status'],
'status_text' => $thisStatusText,
'applicant' => $thisApplicant ?? '未知',
'reviewer' => $thisReviewer ?? '未知',
];
}
}
// var_dump(get_defined_constants());die;
$this->assign('records', $records);
$this->assign('count', $count);
$this->assign('gameList', getAllGameList());
@ -121,7 +125,48 @@ class PromoteGameRatioController extends ThinkController
public function applyRatio()
{
if ($_POST) {
$params = I('post.');
$time = time();
$save['ratio'] = $params['ratio'] ?? 0;
$save['begin_time'] = $params['begin_time'] ? strtotime($params['begin_time']) : 0;
$save['end_time'] = $params['end_time'] ? strtotime($params['end_time']) : 0;
$save['remark'] = $params['remark'] ?? '';
$save['status'] = 0;
$save['update_time'] = $time;
if (!empty($params['id'])) {//修改
$promoteGameRatio = D(self::MODEL_NAME)->find($params['id']);
if (empty($promoteGameRatio)) {
$this->error('参数异常');
}
$save['id'] = intval($params['id']);
$result = D(self::MODEL_NAME)->save($save);
} else {//新增
if (empty($params['promote_id'])) {
$this->error('请选择会长账号');
}
if (empty($params['game_id'])) {
$this->error('请选择要申请的游戏');
}
$promoteId = intval($params['promote_id']);
$gameId = intval($params['game_id']);
$map['promote_id'] = $promoteId;
$map['game_id'] = $gameId;
$promoteGameRatio = D(self::MODEL_NAME)->where($map)->find();
if ($promoteGameRatio) {
$this->error('网络异常');
}
$save['promote_id'] = $promoteId;
$save['game_id'] = $gameId;
$save['applicant_id'] = is_login();
$save['create_time'] = $time;
$result = D(self::MODEL_NAME)->add($save);
}
if ($result === false) {
$this->error('保存失败');
} else {
$this->success('保存成功', U('lists'));
}
} else {
$params = I('get.');
$id = $params['id'] ?? 0;
@ -129,13 +174,19 @@ class PromoteGameRatioController extends ThinkController
$metaTitle = '游戏分成比例申请';
if ($id) {
$metaTitle .= '--修改';
$field = 'promote_id, game_id, ratio, begin_time, end_time, remark';
$field = 'id, promote_id, game_id, ratio, begin_time, end_time, remark';
$map['id'] = $id;
$promoteGameRatio = D(self::MODEL_NAME)->field($field)->where($map)->find();
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']) : '';
$gameRatio = M('game', 'tab_')->where(array(['id' => $promoteGameRatio['game_id']]))->getField('ratio');
$gameRatio = ($gameRatio ?? '0.00') . '%';
$this->assign('record', $promoteGameRatio);
$this->assign('gameRatio', $gameRatio);
}
$this->assign('gameList', getAllGameList());
@ -145,6 +196,31 @@ class PromoteGameRatioController extends ThinkController
}
}
public function setStatus($status)
{
$params = I('post.');
$ids = $params['ids'] ?? [];
if (empty($ids)) {
$this->error('操作失败');
}
if (empty($status) || !in_array($status, [-1, 1])) {
$this->error('操作失败');
}
$time = time();
$map['id'] = ['in', $ids];
$map['status'] = 0;
$save['status'] = $status;
$save['reviewer_id'] = is_login();
$save['review_time'] = $time;
$save['update_time'] = $time;
$result = D(self::MODEL_NAME)->where($map)->save($save);
if ($result) {
$this->success('操作成功');
} else {
$this->error('操作失败');
}
}
private function getPromoteApplyCreateTime($promoteId, $gameId)
{
$map['promote_id'] = $promoteId;
@ -152,4 +228,21 @@ class PromoteGameRatioController extends ThinkController
$createTime = $apply = M('apply', 'tab_')->where($map)->getField('apply_time');
return $createTime;
}
public function getGameRatio()
{
$gameId = I('post.game_id', 0);
$gameId = intval($gameId);
$gameRatio = '';
if ($gameId) {
$map['id'] = $gameId;
$gameRatio = M('game', 'tab_')->where($map)->getField('ratio');
$gameRatio = ($gameRatio ?? '0.00') . '%';
}
$data = [
'status' => 1,
'ratio' => $gameRatio,
];
$this->ajaxReturn($data);
}
}

@ -1,9 +1,12 @@
<extend name="Public/base" />
<block name="body">
<link rel="stylesheet" type="text/css" href="__CSS__/admin_table.css" media="all">
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
<script type="text/javascript" src="__STATIC__/provincecityarea/AreaData_min.js"></script>
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="__CSS__/admin_table.css" media="all">
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
<script type="text/javascript" src="__STATIC__/provincecityarea/AreaData_min.js"></script>
<script src="__STATIC__/layer/layer.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<style>
.tabcon1711 input.time {
@ -13,6 +16,9 @@
width: 300px;
height: 150px;
}
.tabcon1711 .form_unit {
margin-left: 2px;
}
</style>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">{$meta_title}</h3>
@ -31,7 +37,7 @@
<tr>
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>会长账号:</td>
<td class="r">
<select name="promote_id" id="promote_id">
<select name="promote_id" id="promote_id" class="select_gallery" <notempty name="record">disabled</notempty>>
<option value="">会长账号</option>
<empty name="record">
<volist name="promoteList" id="vo">
@ -49,7 +55,7 @@
<tr>
<td class="l"><i class="mustmark" style="margin-left:-7px">*</i>已申请游戏:</td>
<td class="r">
<select id="game_id" name="game_id" class="select_gallery" >
<select id="game_id" name="game_id" class="select_gallery" <notempty name="record">disabled</notempty>>
<option value="">游戏名称</option>
<empty name="record">
<volist name="gameList" id="vo">
@ -67,7 +73,7 @@
<tr>
<td class="l">原分成比例:</td>
<td class="r table_radio">
<span class="form_radio table_btn"></span>
<span class="form_radio table_btn" id="game_ratio" style="color: red;">{$gameRatio|default=''}</span>
<span class="notice-text"></span>
</td>
</tr>
@ -75,6 +81,7 @@
<td class="l">现分成比例:</td>
<td class="r table_radio">
<input type="text" class="txt" name="ratio" value="{$record.ratio|default='0.00'}" placeholder="" onKeyUp="value=value.replace(/[^\w\.\/]/ig,'')">
<span class="form_unit">%</span>
<span class="notice-text">当前需要修改成的分成比例</span>
</td>
</tr>
@ -82,9 +89,9 @@
<td class="l">开始时间:</td>
<td class="r table_radio">
<div style="float: left;">
<input type="text" class="txt time" name="start_time" placeholder="开始时间" value="">
<input type="text" class="txt time" name="begin_time" placeholder="开始时间" value="{$record['begin_time']|default=''}">
-
<input type="text" class="txt time" name="start_time" placeholder="结束时间" value="">
<input type="text" class="txt time" name="end_time" placeholder="结束时间" value="{$record['end_time']|default=''}">
</div>
<span class="notice-text">结束时间不填则默认永久。</span>
</td>
@ -92,14 +99,14 @@
<tr>
<td class="l">备注:</td>
<td class="r table_radio">
<textarea type="text" name="introduction" class="txt_area"></textarea>
<textarea type="text" name="remark" class="txt_area">{$record['remark']|default=''}</textarea>
<span class="notice-text"></span>
</td>
</tr>
</tbody>
</table>
</div>
<input type="hidden" name="id" value="{$data['id']}" />
<input type="hidden" name="id" value="{$record['id']|default=''}" />
<div class="form-item cf">
<button class="submit_btn ajax-post mlspacing" id="submit" type="submit" target-form="form-horizontal">
@ -133,49 +140,46 @@
<script type="text/javascript">
//导航高亮
highlight_subnav('{:U('PromoteGameRatio/lists')}');
Think.setValue("game_type_id", {$data.game_type_id|default = 0});
Think.setValue("category", {$data.category|default = 0});
$(".select_gallery").select2();
$(function(){
$('.time').datetimepicker({
language:"zh-CN",
hour: 13,
minute: 15
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true,
scrollMonth: false,
scrollTime: false,
scrollInput: false,
});
showTab();
prov="{:substr($data['bank_area'],0,2)}";
city="{:substr($data['bank_area'],2,2)}";
ciarea="{:substr($data['bank_area'],4,2)}";
});
//得到地区码
function getAreaID(){
var area = 0;
if($("#seachdistrict").val() != "0"){
area = $("#seachdistrict").val();
}else if ($("#seachcity").val() != "0"){
area = $("#seachcity").val();
}else{
area = $("#seachprov").val();
}
return area;
}
$('#game_id').change(function () {
var gameId = parseInt($(this).val());
getGameRatio(gameId);
});
//根据地区码查询地区名
function getAreaNamebyID(areaID){
var areaName = "";
if(areaID.length == 2){
areaName = area_array[areaID];
}else if(areaID.length == 4){
var index1 = areaID.substring(0, 2);
areaName = area_array[index1] + " " + sub_array[index1][areaID];
}else if(areaID.length == 6){
var index1 = areaID.substring(0, 2);
var index2 = areaID.substring(0, 4);
areaName = area_array[index1] + " " + sub_array[index1][index2] + " " + sub_arr[index2][areaID];
function getGameRatio(gameId) {
$.ajax({
type: "post",
url: "{:U('getGameRatio')}",
dataType: "json",
data: {'game_id': gameId},
success: function (data) {
if (data.status == 1) {
$('#game_ratio').text(data.ratio);
} else {
console.log(data);
}
},
error: function (result) {
layer.msg('网络异常', {icon: 5});
}
});
}
return areaName;
}
$('submit')
});
</script>
</block>

@ -41,8 +41,8 @@
<div class="tools">
<empty name="show_status">
<a class=" " href="{:U('applyRatio?model='.$model['id'])}"><span class="button_icon button_icon1"></span>游戏分成比例申请</a>
<a class="ajax-post " target-form="ids" url="{:U('Promote/set_status',array('status'=>1,'msg_type'=>5,'field'=>'status'))}"><span class="button_icon button_icon9"></span>审核通过</a>
<a class="ajax-post " style="color: red;" target-form="ids" url="{:U('Promote/set_status',array('status'=>1,'msg_type'=>5,'field'=>'status'))}"><span class="button_icon button_icon9"></span>审核拒绝</a>
<a class="ajax-post " target-form="ids" url="{:U('setStatus',array('status'=>1))}"><span class="button_icon button_icon9"></span>审核通过</a>
<a class="ajax-post " style="color: red;" target-form="ids" url="{:U('setStatus',array('status'=>-1))}"><span class="button_icon button_icon9"></span>审核拒绝</a>
</empty>
</div>
</div>
@ -117,7 +117,13 @@
<else/>
<volist name="records" id="record">
<tr>
<td><input class="ids" type="checkbox" value="{$record['id']}" name="ids[]"></td>
<td>
<eq name="record.status" value="0">
<input class="ids" type="checkbox" value="{$record['id']}" name="ids[]">
<else />
<input class="ids disabled" disabled="disabled" type="checkbox" value="{$record['id']}" name="ids[]">
</eq>
</td>
<td>{$record.promote_id}</td>
<td>{$record.promote_account}</td>
<td>{$record.promote_mobile_phone}</td>

@ -728,19 +728,20 @@ ADD COLUMN `flooring_page_video_cover` int(11) NOT NULL DEFAULT 0 COMMENT '落
--2019-12-16
--
CREATE TABLE `tab_promote_game_ratio` (
CREATE TABLE `tab_promote_game_ratio` (
`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 COMMENT '分成比例',
`begin_time` int(10) NOT NULL DEFAULT 0 COMMENT '开始时间',
`end_time` int(10) NOT NULL DEFAULT 0 COMMENT '过期时间',
`remark` varchar(255) NOT NULL COMMENT '备注',
`status` tinyint(3) NOT NULL DEFAULT 0 COMMENT '审核状态:-1-未通过 0-待审核 1-通过',
`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 '创建时间',
`update_time` int(10) NOT NULL DEFAULT 0 COMMENT '更新时间',
`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 '分成比例',
`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 '创建时间',
`update_time` int(10) NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`id`),
INDEX `promote_id`(`promote_id`, `game_id`, `status`) USING BTREE
);
KEY `promote_id` (`promote_id`,`game_id`,`status`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
Loading…
Cancel
Save