新增注销申请管理

master
chenzhi 3 years ago
parent 26eb4ccf32
commit 5107fb9b32

@ -0,0 +1,132 @@
<?php
namespace Admin\Controller;
use User\Api\UserApi as UserApi;
class CloseAccountController extends ThinkController {
public $STATUS = [
0=>"未审核",
1=>"审核通过",
2=>"撤销申请",
];
public $admininfo;
public $DBModel;
public function _initialize()
{
$this->admininfo = $_SESSION['onethink_admin']['user_auth'];
$this->DBModel = M("close_account_log","tab_");
parent::_initialize();
}
public function list()
{
$page = I('p', 1);
$row = I('row', 10);
if(isset($_REQUEST['account'])){
$map['account']=array('like','%'.trim($_REQUEST['account']).'%');
}
if(isset($_REQUEST['user_id'])){
$map['user_id']=trim($_REQUEST['user_id']);
}
if(isset($_REQUEST['phone'])){
$map['phone']=$_REQUEST['phone'];
}
if(isset($_REQUEST['status'])){
$map['status']= $_REQUEST['status'];
}
if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) {
$time_start = strtotime($_REQUEST['time_start']);
$time_end = strtotime($_REQUEST['time_end'])+ 86399;
$map["_string"] = "(create_time BETWEEN {$time_start} AND {$time_end})";
} elseif (isset($_REQUEST['time_start'])) {
$time_start = strtotime($_REQUEST['time_start']);
$map["_string"] = "(create_time >= {$time_start} )";
} elseif (isset($_REQUEST['time_end'])) {
$time_end = strtotime($_REQUEST['time_end'])+ 86399;
$map["_string"] = "(create_time <= {$time_end} )";
}
$data = $this->DBModel->where($map)->order("create_time desc")->page($page, $row)->select();
if($data){
$game = M("game","tab_")->where(['id'=>["in",array_column($data,'game_id')]])->getField("id,game_name",true);
$admin = M("member")->where(['uid'=>["in",array_column($data,'admin_id')]])->getField("uid,nickname",true);
foreach ($data as $k => &$v) {
$v['game_name'] = $game[$v['game_id']] ?? "--";
$v['admin_name'] = $admin[$v['admin_id']] ?? "--";
$v['create_time'] = date("Y-m-d H:i:s",$v['create_time']);
$v['update_time'] = $v['update_time'] ? date("Y-m-d H:i:s",$v['update_time']) : '--';
$v['status_str'] = $this->STATUS[$v['status']] ?? "--";
}
}
$count = $this->DBModel->where($map)->count();
$page = set_pagination($count, $row);
if ($page) {
$this->assign('_page', $page);
}
$Rule = strtolower(MODULE_NAME . '/' . CONTROLLER_NAME . '/check');
if ($this->checkRule($Rule, array('in', '1,2')) || IS_ROOT) {
$this->assign("check",true);
}
$this->assign("data",$data);
$this->display();
}
public function check(){
$status = $_REQUEST['status'];
$ids = $_REQUEST['ids'];
if (!$ids) {
$this->ajaxReturn(['status'=>0,'msg'=>'数据错误']);
}
$userIds = $this->DBModel->where(['id'=>['in',$ids],'status'=>0])->getField('user_id',true);
if($status == 1){
$this->closeAccount($userIds);
}
if($status == 2){
$this->cancel($userIds);
}
$this->resetCloseAccount($ids,$status);
$this->ajaxReturn(['status'=>1,'msg'=>'操作成功']);
}
private function closeAccount($userIds)
{
$userBase = [
'lock_status'=>0,
'lock_remark'=>"用户注销锁定",
'phone'=>''
];
$userDB = M('user',"tab_");
foreach ($userIds as $k => $v) {
$userBase['account'] = "zxzh".substr(md5($v.time()),8,16);
$userBase['id'] = $v;
$userDB->save($userBase);
}
}
private function cancel($userIds)
{
$userBase = [
'lock_status'=>1,
'lock_remark'=>"",
'id'=>['in',$userIds]
];
M('user',"tab_")->save($userBase);
}
private function resetCloseAccount($ids,$status)
{
$base = [
'status'=>$status,
'id'=>['in',$ids],
'admin_id'=>$this->admininfo['uid'],
'update_time'=>time(),
];
$this->DBModel->save($base);
}
}

@ -0,0 +1,303 @@
<extend name="Public/base"/>
<block name="body">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<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;}
.tooltip {
position: relative;
display: inline-block;
color: #056dae;
}
.tooltip .tooltiptext {
visibility: hidden;
width: 250%;
background-color: #fff;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 0;
position: absolute;
z-index: 1;
bottom: 80%;
left: 0;
margin-left: -70%;
border: #000 solid 1px;
}
.tooltip .tooltiptext::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: black transparent transparent transparent;
}
.tooltip:hover .tooltiptext {
color: #000;
visibility: visible;
line-height: 20px;
}
.butnbox {padding:10px 0 10px;}
.butnbox .butnlist {overflow:hidden;clear:both;}
.butnbox .butnlist .butn,.butnbox .butnlist .butn:hover {text-decoration:none;border:none;}
.butnbox .butnlist .butn {display:inline-block;width:120px;height:28px;line-height:28px;text-align:center;color:#FFF;background:#3C95C8;border-radius:3px;}
.butnbox .butnlist .butn.last {background:#009900;}
.butnbox .butnlist .butn~.butn {margin-left:20px;}
</style>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">注销申请</h3>
<p class="description_text"></p>
</div>
<div class="cf top_nav_list">
<!-- 高级搜索 -->
<div class="jssearch fl cf search_list" style="margin-bottom:0;">
<div class="input-list">
<input style="width: 200px;" type="text" name="user_id" class="search-input" value="{:I('user_id')}" placeholder="请输入账号id">&nbsp;
</div>
<div class="input-list">
<input style="width: 200px;" type="text" name="account" class="search-input" value="{:I('account')}" placeholder="请输入玩家账号">&nbsp;
</div>
<div class="input-list">
<select name="status" style="color:#444" class="select_gallery" id="status">
<option value="">请选择审核状态</option>
<option value="0" >未审核</option>
<option value="1" >审核通过</option>
<option value="2" >撤销申请</option>
</select>
</div>
<div class="input-list">
<input type="text" readonly id="time_start" name="time_start" class="" value="{:I('time_start')}"
placeholder="申请开始时间" />
&nbsp;-&nbsp;
<div class="input-append date" id="datetimepicker" style="display:inline-block">
<input type="text" readonly id="time_end" name="time_end" class="" value="{:I('time_end')}"
placeholder="申请结束时间" />
<span class="add-on"><i class="icon-th"></i></span>
</div>
</div>
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('list')}"
style="width: 100px;border: #3C95C8 solid 1px;">搜索</a>
</div>
</div>
</div>
<div class="butnbox" >
<div class="butnlist jscheckbutn" style="margin-left: 2px">
<if condition="$check eq true">
<a href="javascript:" class='butn check' style='background-color: red;' data-status="1">审核注销</a>
<a href="javascript:" class='butn check' style='background-color: #3C95C8;' data-status="2">撤销申请</a>
</if>
</div>
</div>
<!-- 数据列表 -->
<div class="data_list">
<empty name="show_status">
<div class="">
<table>
<!-- 表头 -->
<thead>
<tr>
<th><input class="check-all" type="checkbox"></th>
<th >玩家账号</th>
<th >账号ID</th>
<th >手机号码</th>
<th >游戏</th>
<th >申请注销时间</th>
<th >审核日期</th>
<th >审核人</th>
<th >审核状态</th>
</tr>
</thead>
<!-- 列表 -->
<tbody>
<style>
.data-table thead th, .data-table tbody td{text-align:center}
.data-table tbody td{border-right:1px solid #DDDDDD;}
.d_list .drop-down ul {z-index:999;}
</style>
<if condition = "empty($data)">
<tr>
<td colspan="16" class="text-center">aOh! 暂时还没有内容!</td>
</tr>
</if>
<notemtpy name = "data">
<volist name="data" id="data">
<tr>
<td><input class="ids" type="checkbox" value="{$data['id']}" data-status="{$data['status']}" name="ids[]"></td>
<td >{$data.account}</td>
<td data-id="{$data['user_id']}" class="goInfo"><a href="javascript:">{$data.user_id}</a></td>
<td >{$data.phone}</td>
<td >{$data.game_name}</td>
<td >{$data.create_time}</td>
<td >{$data.update_time}</td>
<td >{$data.admin_name}</td>
<td >{$data.status_str}</td>
</tr>
</volist>
</notemtpy>
</tbody>
</table>
</div>
</empty>
</div>
<div class="page">
{$_page|default=''}
</div>
</block>
<block name="script">
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script type="text/javascript" src="__STATIC__/layer/extend/layer.ext.js" ></script>
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script>
<volist name=":I('get.')" id="vo">
Think.setValue('{$key}',"{$vo}");
</volist>
</script>
<script type="text/javascript">
//导航高亮
highlight_subnav("{:U('list')}");
$(function(){
$(".select_gallery").select2();
$('#time_start').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true
});
$('#time_end').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true
});
$(".goInfo").on("click",function(){
var id = $(this).data("id");
var url = "{:U('Member/edit')}"+'&id='+id;
window.location.href = url;
})
$(".check").on("click",function(){
var tip = '';
var status = $(this).attr("data-status");
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
if($(elem).data("status") == 0 && status == 1){
tip = "是否确认注销申请,此操作不可回退,请慎重选择";
return $(elem).val();
}
if ($(elem).data("status") == 0 && status == 2) {
tip = "是否撤销注销申请,撤销后需要用户再次发起才能注销";
return $(elem).val();
}
}).get();
if(text.length < 1){
layer.msg("<font style='color:white'>" + '无需要进行操作</font>');
return;
}
text = text.join(",");
layer.confirm(tip, {
btn: ['确认','取消'],
title:false
}, function(index){
layer.close(index);
_doAgreeApply();
});
function _doAgreeApply(){
//执行
layer.load(2);
$.ajax({
type: "POST",
url: "{:U('check')}",
dataType: 'json',
async: true,
data: {ids:text,status:status},
success:function(data){
layer.closeAll('loading');
if(data.status==1){
layer.msg("<font style='color:white'>" + data.msg + "</font>");
setTimeout(function(){
window.location.reload();
},1500);
}else{
layer.msg("<font style='color:white'>" + data.msg + "</font>");
return false;
}
}
});
}
});
//搜索功能
$("#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();
}
});
})
</script>
</block>
Loading…
Cancel
Save