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

master
chenxiaojun 5 years ago
commit f2fc739db2

@ -610,4 +610,62 @@ function encryptIdCard($str) {
$stars_str = "****";
}
return substr_replace($str, $stars_str, $length-4, 4);
}
//获取推广员资质审核状态 $type 1-获取数组 2-获取文本
function getPromoteVerStatus($status, $type = 1)
{
$statusList = [
0 => '未认证',
1 => '审核成功',
2 => '审核失败',
3 => '审核中',
4 => '修改审核中',
];
$records = null;
switch ($type) {
case 1:
$records = $status;
break;
case 2:
$records = $statusList[$status] ?? '未知';
break;
default:
$records = false;
break;
}
return $records;
}
//获取推广员账号
function getPromoteAccount($promoteId)
{
$map['id'] = intval($promoteId);
return M('promote', 'tab_')->where($map)->getField('account');
}
//获取推广员列表 $level 0-全部
function getPromoteByLevel($level = 0)
{
$field = 'id, account, real_name';
if ($level) {
$map['level'] = $level;
$promotes = M('promote', 'tab_')->field($field)->where($map)->select();
} else {
$promotes = M('promote', 'tab_')->field($field)->select();
}
return $promotes;
}
//获取游戏列表
function getAllGameList($groupByRelation = false)
{
$field = 'id, game_name, relation_game_id, relation_game_name';
if ($groupByRelation) {
$games = M('game', 'tab_')->field($field)->group('relation_game_id')->select();
} else {
$games = M('game', 'tab_')->field($field)->select();
}
return $games;
}

@ -7,6 +7,15 @@ use Think\Controller;
class PromoteGameRatioController extends ThinkController
{
const MODEL_NAME = 'promote_game_ratio';
const STATUS_REFUSE = -1;
const STATUS_WAIT = 0;
const STATUS_PASS = 1;
public static $statusList = [
self::STATUS_REFUSE => '审核未通过',
self::STATUS_WAIT => '待审核',
self::STATUS_PASS => '已审核',
];
public function lists()
{
@ -14,22 +23,109 @@ class PromoteGameRatioController extends ThinkController
$promoteAccount = $params['promote_account'] ?? '';
$gameId = $params['game_id'] ?? 0;
$status = $params['status'] ?? '';
$page = $params['p'] ? intval($params['p']) : 1;
$row = $params['row'] ? intval($params['row']) : 10;
$map['_string'] = '1 = 1';
if ($promoteAccount) {
$promoteMap['account'] = $promoteAccount;
$promoteMap['account'] = trim($promoteAccount);
$promoteId = M('promote', 'tab_')->where($promoteMap)->getField('id');
$promoteId = $promoteId ?? 0;
$map['promote_id'] = $promoteId;
}
if ($gameId) {
$map['game_id'] = $gameId;
$map['game_id'] = intval($gameId);
}
if ($status !== '') {
$map['status'] = $status;
$map['status'] = intval($status);
}
$field = 'create_time, update_time';
$query = D(self::MODEL_NAME)->getLists();
$promoteGameRatios = D(self::MODEL_NAME)->field($field, true)
->where($map)
->page($page, $row)
->order('update_time desc, id desc')
->select();
$count = D(self::MODEL_NAME)->where($map)->count();
$records = [];
if ($promoteGameRatios) {
$promoteIds = array_column($promoteGameRatios, 'promote_id');
$gameIds = array_column($promoteGameRatios, 'game_id');
$promoteFiled = 'id, account, mobile_phone, create_time, status, ver_status';
$gameFiled = 'id, game_name, ratio';
$promotes = M('promote', 'tab_')->where(array('id' => ['in', $promoteIds]))->getField($promoteFiled, true);
$games = M('game', 'tab_')->where(array('id' => ['in', $gameIds]))->getField($gameFiled, true);
foreach ($promoteGameRatios as $promoteGameRatio) {
$thisPromoteId = $promoteGameRatio['promote_id'];
$thisGameId = $promoteGameRatio['game_id'];
$issetPromote = isset($promotes[$thisPromoteId]);
$issetGame = isset($games[$thisGameId]);
$thisPromoteAccount = '未知';
$thisPromoteMobilePhone = '未知';
$thisPromoteCreateTime = '未知';
$thisPromoteStatus = '未知';
$thisPromoteVerStatus = '未知';
$thisGameName = '未知';
$thisGameRatio = '0.00';
$thisApplicant = getPromoteAccount($promoteGameRatio['applicant_id']);
$thisReviewer = $promoteGameRatio['reviewer_id'] ? getPromoteAccount($promoteGameRatio['reviewer_id']) : '待确认';
if ($promoteGameRatio['ratio'] > 0) {
$thisBeninTime = date('Y/m/d', $promoteGameRatio['begin_time']);
$thisEndTime = date('Y/m/d', $promoteGameRatio['end_time']);
} else {
$thisBeninTime = date('Y/m/d', $this->getPromoteApplyCreateTime($thisPromoteId, $thisGameId));
$thisEndTime = '永久';
}
$validDate = $thisBeninTime . ' - ' . $thisEndTime;
if ($issetPromote) {
$thisPromoteAccount = $promotes[$thisPromoteId]['account'];
$thisPromoteMobilePhone = $promotes[$thisPromoteId]['mobile_phone'];
$thisPromoteCreateTime = date('Y-m-d H:i:s', $promotes[$thisPromoteId]['create_time']);
$thisPromoteStatus = get_status_title($promotes[$thisPromoteId]['status']);
$thisPromoteStatus = $thisPromoteStatus ?? '未知';
$thisPromoteVerStatus = getPromoteVerStatus($promotes[$thisPromoteId]['status'], 2);
}
if ($issetGame) {
$thisGameName = $games[$thisGameId]['game_name'];
$thisGameRatio = $games[$thisGameId]['ratio'];
$thisGameRatio = $thisGameRatio ?? '0.00';
}
$records[] = [
'id' => $promoteGameRatio['id'],
'promote_id' => $promoteGameRatio['promote_id'],
'promote_account' => $thisPromoteAccount,
'promote_mobile_phone' => $thisPromoteMobilePhone,
'promote_create_time' => $thisPromoteCreateTime,
'promote_status_text' => $thisPromoteStatus,
'promote_ver_status_text' => $thisPromoteVerStatus,
'game_name' => $thisGameName,
'game_ratio' => $thisGameRatio . '%',
'ratio' => $promoteGameRatio['ratio'] . '%',
'valid_date' => $validDate,
'remark' => $promoteGameRatio['remark'],
'status_text' => self::$statusList[$promoteGameRatio['status']],
'applicant' => $thisApplicant ?? '未知',
'reviewer' => $thisReviewer ?? '未知',
];
}
}
$this->assign('records', $records);
$this->assign('count', $count);
$this->assign('gameList', getAllGameList());
$this->assign('promoteList', getPromoteByLevel(1));
$this->meta_title = '公会分成管理';
$this->display();
}
private function getPromoteApplyCreateTime($promoteId, $gameId)
{
$map['promote_id'] = $promoteId;
$map['game_id'] = $gameId;
$createTime = $apply = M('apply', 'tab_')->where($map)->getField('apply_time');
return $createTime;
}
}

@ -2,7 +2,10 @@
namespace Admin\Model;
class PromoteGameRatioModel extends CommentModel
{
use Think\Model;
class PromoteGameRatioModel extends Model
{
// 数据表前缀
protected $tablePrefix = 'tab_';
}

@ -0,0 +1,415 @@
<extend name="Public/base"/>
<block name="body">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<link rel="stylesheet" href="__CSS__/pro_promote.css" type="text/css" />
<script src="__STATIC__/jquery.form.js"></script>
<script src="__STATIC__/layer/layer.js"></script>
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<style>
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;height:35px;
height:28px;border-radius:3px;font-size:12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height:35px;
line-height:28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height:26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height:26px;line-height:26px;font-size:12px;
}
.select2-results__option[aria-selected] {font-size:12px;}
.layui-layer-dialog .layui-layer-content{color:red}
</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('add?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>
</empty>
</div>
</div>
<!-- 高级搜索 -->
<div class="jssearch fl cf search_list">
<div class="input-list search-title-box">
<label>搜索:</label>
</div>
<div class="input-list input-list-promote search_label_rehab">
<select id="promote_id" name="promote_id" class="select_gallery" >
<option value="">推广员账号</option>
<volist name="promoteList" id="vo">
<option promote-id="{$vo.id}" value="{$vo.id}">{$vo.account}({$vo.real_name})</option>
</volist>
</select>
</div>
<div class="input-list input-list-game search_label_rehab">
<select id="game_id" name="game_id" class="select_gallery" >
<option value="">游戏名称</option>
<volist name="gameList" id="vo">
<option value="{$vo.id}" <if condition="$vo.id eq I('game_id')">selected</if> >{$vo.game_name}</option>
</volist>
</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>
</div>
</div>
</div>
<!-- 数据列表 -->
<div class="data_list">
<div class="">
<table>
<!-- 表头 -->
<thead>
<tr>
<th>
<input class="check-all" type="checkbox">
</th>
<th>会长ID</th>
<th>会长账号</th>
<th>手机号码</th>
<th>注册时间</th>
<th>状态</th>
<th>身份状态</th>
<th>已申请游戏</th>
<th>原分成比例</th>
<th>当前分成比例</th>
<th>开始时间</th>
<th>备注</th>
<th>分成比例审核</th>
<th>申请人</th>
<th>确认人</th>
<th>操作</th>
</tr>
</thead>
<!-- 列表 -->
<tbody>
<if condition = "empty($records)">
<tr>
<td colspan="16" class="text-center">aOh! 暂时还没有内容!</td>
</tr>
<else/>
<volist name="records" id="record">
<tr>
<td><input class="ids" type="checkbox" value="{$record['id']}" name="ids[]"></td>
<td>{$record.promote_id}</td>
<td>{$record.promote_account}</td>
<td>{$record.promote_mobile_phone}</td>
<td>{$record.promote_create_time}</td>
<td>{$record.promote_status_text}</td>
<td>{$record.promote_ver_status_text}</td>
<td>{$record.game_name}</td>
<td>{$record.game_ratio}</td>
<td>{$record.ratio}</td>
<td>{$record.valid_date}</td>
<td>{$record.remark}</td>
<td>{$record.status_text}</td>
<td>{$record.applicant}</td>
<td>{$record.reviewer}</td>
<td>
<a href="{:U('edit', array('id'=>$record['id']))}" class="">修改</a>
</td>
</tr>
</volist>
</if>
</tbody>
</table>
</div>
</div>
<div class="page">
<a class="sch-btn" href="{:U('Export/promote_list',array_merge(['xlsname'=>'推广员管理_推广员列表'.((I('type',1)==2)?'_混服申请':'_推广员列表')],I('get.')))}">导出</a>
{$_page|default=''}
</div>
<div class="pro_promot" style="display:none">
<form action="{:U('Promote/savePromoteGame')}" id="ajaxForm" method="post" />
<input type="hidden" name="promote_id" id="se_promote_id" value="" />
<div class="pro_promot_main">
<div class="pro_promot_title">
<div class="fl pro_promot_title_text">
<div class="fl pro_promot_title_bigtext"> 可申请游戏</div> 选中的游戏将在对应的推广员后台进行展示,推广员可进行游戏申请</div>
<div class="pro_promot_close fr"><img src="__IMG__/icon_close.png"></div>
</div>
<div class="pro_promot_con">
<div class="pro_promot_account">推广员账号:<span class="pro_promot_number"></span></div>
<div class="pro_promot_select">
<div class="pro_promot_select_title fl">选择游戏:</div>
<div class="pro_promot_select_list fl">
<a class="pro_promot_select_list_con fl active pro_promot_all pro_promot_mr20">全部 </a>
<a class="pro_promot_select_list_con fl" data-index="A">A</a>
<a class="pro_promot_select_list_con fl" data-index="B">B</a>
<a class="pro_promot_select_list_con fl" data-index="C">C</a>
<a class="pro_promot_select_list_con fl pro_promot_mr20" data-index="D">D</a>
<a class="pro_promot_select_list_con fl" data-index="E">E</a>
<a class="pro_promot_select_list_con fl" data-index="F">F</a>
<a class="pro_promot_select_list_con fl" data-index="G">G</a>
<a class="pro_promot_select_list_con fl pro_promot_mr20" data-index="H">H</a>
<a class="pro_promot_select_list_con fl" data-index="I">I</a>
<a class="pro_promot_select_list_con fl" data-index="J">J</a>
<a class="pro_promot_select_list_con fl" data-index="K">K</a>
<a class="pro_promot_select_list_con fl pro_promot_mr20" data-index="L">L</a>
<a class="pro_promot_select_list_con fl" data-index="M">M</a>
<a class="pro_promot_select_list_con fl" data-index="N">N</a>
<a class="pro_promot_select_list_con fl" data-index="O">O</a>
<a class="pro_promot_select_list_con fl pro_promot_mr20" data-index="P">P</a>
<a class="pro_promot_select_list_con fl" data-index="Q">Q</a>
<a class="pro_promot_select_list_con fl" data-index="R">R</a>
<a class="pro_promot_select_list_con fl" data-index="S">S</a>
<a class="pro_promot_select_list_con fl pro_promot_mr20" data-index="T">T</a>
<a class="pro_promot_select_list_con fl" data-index="U">U</a>
<a class="pro_promot_select_list_con fl" data-index="V">V</a>
<a class="pro_promot_select_list_con fl" data-index="W">W</a>
<a class="pro_promot_select_list_con fl pro_promot_mr20" data-index="X">X</a>
<a class="pro_promot_select_list_con fl" data-index="Y">Y</a>
<a class="pro_promot_select_list_con fl" data-index="Z">Z</a>
</div>
</div>
<div class="clear"></div>
<div class="pro_promot_game">
<div class="jsgamecheckallbox z_clearfix" >
<label class="custom-label">
<input type="checkbox" checked="checked" class="form_control jsgamecheckall" >
<i class="label_icon"></i>
<span class="label_text">全选</span></label>
</div>
<ul id="game_list" class="z_clearfix game_list">
</ul>
</div>
<div class="clear"></div>
<div class="pro_promot_btn">
<div class="fl pro_promot_btn_confirm">确定</div>
<div class="fr pro_promot_btn_cancel">取消</div>
</div>
</div>
</div>
</form>
</div>
<div class="common_settings">
<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
<form class="addShortcutIcon">
<input type="hidden" name="title" value="{$m_title}">
<input type="hidden" name="url" value="Promote/lists/type/{:I('type',1)}">
</form>
<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
</div>
</block>
<block name="script">
<script>
<volist name=":I('get.')" id="vo">
Think.setValue('{$key}',"{$vo}");
</volist>
$(".select_gallery").select2();
</script>
<script type="text/javascript">
//导航高亮
highlight_subnav('{:U('Promote/lists')}');
$(function(){
//搜索功能
$("#search").click(function(){
var url = $(this).attr('url');
var query = $('.jssearch').find('input').serialize();
query += "&"+$('.jssearch').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
query = query.replace(/^&/g,'');
if( url.indexOf('?')>0 ){
url += '&' + query;
}else{
url += '?' + query;
}
window.location.href = url;
});
//回车自动提交
$('.jssearch').find('input').keyup(function(event){
if(event.keyCode===13){
$("#search").click();
}
});
$("#admin").on('click',function(event) {
var navlist = $(this).find('.i_list_li');
if (navlist.hasClass('hidden')) {
navlist.removeClass('hidden');
$(this).find('#i_list_id').focus().val('');
} else {
navlist.addClass('hidden');
}
$(document).one("click", function(){
navlist.addClass('hidden');
});
event.stopPropagation();
});
$('#admin #i_list_id').on('keyup',function(event) {
var val = $.trim($(this).val()).toLowerCase();
$(this).closest('.drop-down').find('#i_list_idh').val(val);
});
$("#admin #i_list_li").find("a").each(function(){
$(this).click(function(){
var text = $.trim($(this).text()).toLowerCase();
$(this).closest('.drop-down').find("#i_list_id").val(text);
$(this).closest('.drop-down').find('#i_list_idh').val(text);
})
});
/* 状态搜索子菜单 */
/*渠道删除*/
$('.delete').click(function(){
var id = $(this).attr('data-id');
layer.confirm('渠道删除后,下级渠道同时被删除,所属数据归属于自然渠道!', {
title:'确定要删除该渠道?',
icon:0,
btn: ['删除','取消'] //按钮
}, function(){
$.ajax({
type: "POST",
url: "{:U('del_promote')}",
dataType: 'json',
async: false,
data: {id:id},
success:function(data){
if(data.status==1){
layer.msg(data.msg);
setTimeout(function(){
window.location.reload();
},1500);
}
}
});
}, function(){
layer.close();
});
})
})
</script>
<script type="text/javascript">
//点击字母按照条件按钮筛选
$(".pro_promot_select_list_con").click(function(){
//选中高亮样式
$(this).addClass('active');
$(this).siblings().removeClass('active');
var that = $(this);
var index = $(this).attr("data-index");
$("#game_list li").each(function(index,ele){
var short = $(this).attr('data-short');
$(this).show();
if(that.attr('data-index')){
if(that.attr('data-index')!=short.charAt(0)){
$(this).hide();
}
}
})
});
//打开弹窗
$(".ajax-view").click(function(){
//获取游戏列表
var url = "{:U('Promote/getPromoteGame')}";
var id = $(this).attr('data-id');
$.post(url,{id:id},function(res){
if(res.code==1){
$(".pro_promot_select_list a").eq(0).addClass('active');
$(".pro_promot_select_list a").eq(0).siblings().removeClass('active');
var game_list = res.data.game_list;
var promote_info = res.data.promote_info;
var lis = [];
$.each(game_list,function(index,ele){
if(ele.game_name.length>6){
ele.game_name = ele.game_name .substring(0,6)+"..."
}
lis.push('<li class="fl pro_promot_game_con" data-short="'+ele.short+'">');
if(promote_info['game_ids']==''){
lis.push('<input type="checkbox" value="'+ele.id+'" name="game_ids[]" class="fl pro_promot_game_check jsgameid" checked="checked" id="gameCheck'+index+'" />');
}else{
if(promote_info['game_ids'].indexOf(ele.id)>-1){
lis.push('<input type="checkbox" value="'+ele.id+'" name="game_ids[]" class="fl pro_promot_game_check jsgameid" checked="checked" id="gameCheck'+index+'" />');
}else{
lis.push('<input type="checkbox" value="'+ele.id+'" name="game_ids[]" class="fl pro_promot_game_check jsgameid" id="gameCheck'+index+'" />');
}
}
lis.push('<label for="gameCheck'+index+'" class="fl"></label>');
lis.push('<span class="fl pro_promot_game_name">'+ele.game_name+'</span>');
lis.push('</li>');
});
$("#game_list").html(lis.join(''));
$(".pro_promot_number").text(res.data.promote_info.account);
$("#se_promote_id").val(res.data.promote_info.id);
$(".pro_promot").css("display","block");
jsgameid();
}else{
alert('请求失败');
}
});
});
//保存修改
$(".pro_promot_btn_confirm").click(function(){
$("#ajaxForm").ajaxSubmit(function(res){
layer.msg(res.msg);
$(".pro_promot").hide();
});
return false;
});
//关闭弹窗
$(".pro_promot_close").click(function(){
$(".pro_promot").css("display","none");
});
//取消修改
$(".pro_promot_btn_cancel").click(function(){
$(".pro_promot").css("display","none");
layer.msg('修改已取消');
});
$(".jsgamecheckall").click(function(){
$(this).closest('.jsgamecheckallbox').siblings("#game_list").find(".jsgameid").prop("checked", this.checked);
});
//可申请游戏 全选及全选反选 功能 @author zwm date 20180604
function jsgameid(){
$(".jsgameid").click(function(){
var option = $(this).closest('ul').find(".jsgameid"),
checkall = $(this).closest('ul').siblings('.jsgamecheckallbox').find('.jsgamecheckall');
option.each(function(i){
if(!this.checked){
checkall.prop("checked", false);
return false;
}else{
checkall.prop("checked", true);
}
});
});
}
</script>
</block>
Loading…
Cancel
Save