Commit 93535843 authored by liyadong's avatar liyadong

Merge branch 'test' of http://gitlab.cccwangluo.com/zhoujun/uc_card into test

parents f4fb9d73 b140596c
......@@ -5,6 +5,8 @@
/public/*.htaccess
/storage/*.key
/storage/logs/*
/public/card
/public/cardImg
/vendor
.env
.env.backup
......
......@@ -34,8 +34,21 @@ class AdminController extends Controller
* @date 2021/06/02
* @author live
*/
public function getLogin()
public function getLogin(Request $request)
{
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}else {
$ip = $_SERVER['REMOTE_ADDR'];
}
$ips = explode(',',$ip);
if(!in_array($ips[0],['116.227.124.169','116.227.126.145'])){
abort(404);
exit();
}
if(Auth::check()) return redirect(route('checkImg'));
$data['ERROR'] = Session::get('error','');
return $this->view('admin.login',$data);
......@@ -48,6 +61,19 @@ class AdminController extends Controller
*/
public function getPostLogin(Request $request)
{
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}else {
$ip = $_SERVER['REMOTE_ADDR'];
}
$ips = explode(',',$ip);
if(!in_array($ips[0],['116.227.124.169','116.227.126.145'])){
exit('页面走丢了');
return false;
}
$postData = $request->all();
if( Auth::check()) return redirect(route('checkImg'));
if($request->isMethod('post'))
......@@ -159,4 +185,30 @@ class AdminController extends Controller
return $this->getErrorMsg('10063', '审核失败');
}
/**
* 删除角色信息
* @date 2021/06/10
* @author live
*/
public function getDeleteRole(Request $request)
{
$postData = $request->all();
$serverId = $postData['serverId'] ?? '';
$roleId = $postData['roleId'] ?? '';
$tableName = 'wx_card_role_'.$serverId;
if($serverId == '' || $roleId == '') return $this->getErrorMsg('10060', '参数错误');
$verity = DB::connection('wx_mysql')->table($tableName)->where('role_id',$roleId)->first();
if(!$verity) return $this->getErrorMsg('10061', '区服角色不匹配');
$uid = $verity->uid;
$result = DB::connection('wx_mysql')->table($tableName)->where('role_id',$roleId)->delete();
if($result){
$row = WxUserImg::where('uid',$uid)->where('server_id',$serverId)->where('role',$roleId)->first();
$row->delete();
return $this->getSuccessMsg([]);
}
return $this->getErrorMsg('10062', '清除角色失败');
}
}
\ No newline at end of file
......@@ -8,6 +8,7 @@
<div class="panel col-lg-12">
<div class="panel-content">
<div class="text-md mt-md bg-scale-0 mb-sm" style="height: 30px;"><a href="">图片审核</a>
<button class="add-item btn btn-o btn-primary btn-xs pull-right" onclick="return deleteRole();" style="height: 30px;">清除角色信息<i class="fa fa-plus coloff"></i></button>
</div>
<div class="table-responsive">
<form action="" method="GET" onsubmit="return check();">
......@@ -108,6 +109,39 @@
@include('admin.common.foot')
<script>
function deleteRole(){
$('#DELETE_ROLE').modal('show')
}
function delRoleSave(){
var serverId = $('#del_server_id').val();
var token = $("input[name='_token']").val();
var roleId = $('#del_role_id').val();
$('#del_cir_role').attr("disabled",true);
$('#del_cir_role_shut').attr("disabled",true);
$.ajax({
type: 'POST',
url: '/admin/delete/role',
data: {_token:token,serverId:serverId,roleId:roleId},
success:function(data){
$('#show_error_info').html(data.info);
$('#show_success_info').html(data.info);
$('#del_cir_role').attr("disabled",false);
$('#del_cir_role_shut').attr("disabled",false);
$('#DELETE_ROLE').modal('hide')
if(data.code == 200){
$('#message-success-modal').modal('show')
}else{
verity_field(data.info,'show_error_info');
$("#message-error-modal").modal('show');
}
}
});
}
function setAllStatus(){
$('#ALL_VERITY').modal('show')
}
......
......@@ -106,4 +106,31 @@
</div>
</div>
<div class="modal fade" id="DELETE_ROLE" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">删除角色信息</h4>
</div>
<div class="modal-body">
<div class="panel-content">
<div class="row">
<div class="form-group col-lg-6">
<h6>区服ID</h6>
<input type="text" class="form-control" id="del_server_id" placeholder="区服ID">
</div>
<div class="form-group col-lg-6">
<h6>角色ID</h6>
<input type="text" class="form-control" id="del_role_id" placeholder="角色ID">
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary active" id="del_cir_role" onclick="return delRoleSave();">提交</button>
<button type="button" class="btn btn-default active" id="del_cir_role_shut" onclick="return cir_cancel('DELETE_ROLE');">取消</button>
</div>
</div>
</div>
</div>
......@@ -35,6 +35,7 @@ Route::prefix('admin')->namespace('Admin')->middleware('check.adminLogin')->grou
Route::get('/image/list', 'AdminController@getImgList')->name('checkImg');
Route::post('/save/status', 'AdminController@getSaveStatus');
Route::post('/save/status/all', 'AdminController@getSaveStatusAll');
Route::post('/delete/role', 'AdminController@getDeleteRole');
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment