diff --git a/Application/Admin/Controller/AmericaIpForbitController.class.php b/Application/Admin/Controller/AmericaIpForbitController.class.php index 6f71f4f24..b43d6f323 100644 --- a/Application/Admin/Controller/AmericaIpForbitController.class.php +++ b/Application/Admin/Controller/AmericaIpForbitController.class.php @@ -18,6 +18,7 @@ class AmericaIpForbitController extends ThinkController } $map = []; + $map['type'] = 0; if ($_REQUEST['user_account']) { $map['user_account'] = ['like',"%{$_REQUEST['user_account']}%"]; @@ -67,6 +68,7 @@ class AmericaIpForbitController extends ThinkController ); $map = []; + $map['type'] = 0; if ($_REQUEST['user_account']) { $map['user_account'] = ['like',"%{$_REQUEST['user_account']}%"]; @@ -186,7 +188,7 @@ class AmericaIpForbitController extends ThinkController $id = I('id'); } - $is_del = $is_change = M('forbit_ip','tab_')->where(['id'=>['in',$id]])->delete(); + $is_del = $is_change = M('forbit_ip','tab_')->where(['id'=>['in',$id],'type'=>0])->delete(); if ($is_del) { $hav_firbit = M('forbit_ip','tab_')->where(['id'=>I('id')])->find(); @@ -222,7 +224,7 @@ class AmericaIpForbitController extends ThinkController $this->error('用户不存在'); } - $hav_firbit = M('forbit_ip','tab_')->where(['user_account'=>I('account')])->find(); + $hav_firbit = M('forbit_ip','tab_')->where(['user_account'=>I('account'),'type'=>0])->find(); if ($hav_firbit) { $this->error('该用户已添加封禁'); diff --git a/Application/Admin/Controller/ThirdPartyIpController.class.php b/Application/Admin/Controller/ThirdPartyIpController.class.php new file mode 100644 index 000000000..154f323e7 --- /dev/null +++ b/Application/Admin/Controller/ThirdPartyIpController.class.php @@ -0,0 +1,216 @@ +where($map) + ->page($page,$row) + ->order('create_time DESC') + ->select(); + + foreach ( $data as $key => $value ) { + + $data[$key]['create_time'] = date('Y-m-d H:i:s',$value['create_time']); + + } + + $count = M('forbit_ip','tab_') + ->where($map) + ->count(); + + $appleInteriorBuyStatus = M('tool','tab_')->where(['name'=>'apple_interior_buy'])->getField('status'); + + $setAppleInteriorBuyStatus = $appleInteriorBuyStatus?1:0; + + $this->checkListOrCountAuthRestMap($map,[]); + + $page = set_pagination($count, $row); + + $this->assign('_page', $page); + + $this->assign('apple_interior_buy',$appleInteriorBuyStatus); + $this->assign('set_apple_interior_buy',$setAppleInteriorBuyStatus); + + $this->assign('data',$data); + + $this->display(); + + } + + public function export() { + + $xlsName = '苹果第三方支付开放名单'; + + $xlsCell = array( + "玩家账号", '添加人', '添加时间' + ); + + $map = []; + $map['type'] = 1; + + if ($_REQUEST['user_account']) { + $map['user_account'] = ['like',"%{$_REQUEST['user_account']}%"]; + } + + $csvFileName = $xlsName.'.csv'; + //设置好告诉浏览器要下载excel文件的headers + header('Content-Description: File Transfer'); + header('Content-Type: application/vnd.ms-excel'); + header('Content-Disposition: attachment; filename="'. $csvFileName .'"'); + header('Expires: 0'); + header('Cache-Control: must-revalidate'); + header('Pragma: public'); + $fp = fopen('php://output', 'a');//打开output流 + mb_convert_variables('GBK', 'UTF-8', $xlsCell); + fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中 + + $accessNum = M('forbit_ip','tab_') + ->where($map) + ->count(); + + $accessNum =$accessNum['count']; + + $perSize = 2000;//每次查询的条数 + $pages = ceil($accessNum / $perSize); + + for($i = 1; $i <= $pages; $i++) { + $xlsData = M('forbit_ip','tab_') + ->field('user_account,admin_account,create_time') + ->where($map) + ->limit(($i-1)*$perSize ,$perSize) + ->order('create_time DESC') + ->select(); + + foreach($xlsData as $value) { + $value['create_time'] = date("Y-m-d H:i:s",$value['create_time']); + +// if ($value['status'] == 0) { +// $value['status'] = '限制'; +// } else { +// $value['status'] = '不限制'; +// } + + mb_convert_variables('GBK', 'UTF-8', $value); + fputcsv($fp, $value); + } + unset($xlsData);//释放变量的内存 + //刷新输出缓冲到浏览器 + ob_flush(); + flush();//必须同时使用 ob_flush() 和flush() 函数来刷新输出缓冲。 + } + fclose($fp); + + addOperationLog(array( + "op_type"=>3, + "key"=> getNowDate(), + "menu"=>"游戏-游戏管理-ip限制白名单-导出", + "url"=>U("ThirdPartyIp/index") + )); + + $getData = $_GET; + unset($getData['id']); + unset($getData['xlsname']); + + } + + public function del() { + + if (!I('id')) { + $this->ajaxReturn(['code'=>1,'msg'=>'ID未选择']); + } else { + $id = I('id'); + } + + $is_del = $is_change = M('forbit_ip','tab_')->where(['id'=>['in',$id],'type'=>1])->delete(); + + if ($is_del) { + $hav_firbit = M('forbit_ip','tab_')->where(['id'=>I('id')])->find(); + addOperationLog(array( + "op_type"=>2, + "key"=> I('id'), + "menu"=>"游戏-游戏管理-ip限制白名单-删除", + "url"=>U("ThirdPartyIp/index") + )); + + $this->ajaxReturn(['code'=>1]); + } else { + $this->ajaxReturn(['code'=>0]); + } + + } + + public function add() { + + $this->display(); + + } + + public function addUser() { + + $insert = []; + + $hav_user = M('user','tab_')->where(['account'=>I('account')])->find(); + + $auth = $_SESSION['onethink_admin']['user_auth']; + + if (!$hav_user) { + $this->error('用户不存在'); + } + + $hav_firbit = M('forbit_ip','tab_')->where(['user_account'=>I('account'),'type'=>1])->find(); + + if ($hav_firbit) { + $this->error('该用户已添加封禁'); + } + + $insert['user_id'] = $hav_user['id']; + $insert['type'] = 1; + $insert['user_account'] = I('account'); + $insert['status'] = I('status'); + $insert['admin_id'] = $auth['uid']; + $insert['admin_account'] = $auth['username']; + $insert['create_time'] = time(); + $insert['remarks'] = ''; + + $is_insert = M('forbit_ip','tab_')->add($insert); + + if ($is_insert) { + + addOperationLog(array( + "op_type"=>0, + "key"=> I('account'), + "menu"=>"游戏-游戏管理-ip限制白名单-新增", + "url"=>U("ThirdPartyIp/index") + )); + + $this->success('添加成功',U('index')); + } else { + $this->error('添加失败'); + } + + } + + +} \ No newline at end of file diff --git a/Application/Admin/View/ThirdPartyIp/add.html b/Application/Admin/View/ThirdPartyIp/add.html new file mode 100644 index 000000000..eda05e0a6 --- /dev/null +++ b/Application/Admin/View/ThirdPartyIp/add.html @@ -0,0 +1,139 @@ + + + + + + + + + + + + + +
+ +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
玩家账号: + +
+
+ + +
+ + + 返回 + +
+
+
+
+ + + +
+ + + + + + diff --git a/Application/Admin/View/ThirdPartyIp/index.html b/Application/Admin/View/ThirdPartyIp/index.html new file mode 100644 index 000000000..9162c17b8 --- /dev/null +++ b/Application/Admin/View/ThirdPartyIp/index.html @@ -0,0 +1,558 @@ + + + + + + + + + + +
+ + +
+ + +
+ +
+ + +
+ 搜索 +
+ + + + + + + + + + + + + +
+
+ + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + 玩家账号添加人添加时间操作
aOh! 暂时还没有内容!
{$data.user_account}{$data.admin_account}{$data.create_time} + 删除 + + + + + +
+
+
+
+
+ + 导出 + + + {$_page|default=''} +
+ +
+ + + + + + if(C('COLOR_STYLE')=='blue_color') echo ''; + + + + + + diff --git a/Data/update.sql b/Data/update.sql index 57205c85b..f88a19722 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -1753,3 +1753,10 @@ ADD COLUMN `old_change_promote_account` varchar(30) NULL COMMENT '修改配置 --聚合渠道结算单 zyx 20200515 INSERT INTO `tab_tool`( `name`, `title`, `config`, `template`, `type`, `status`, `create_time`) VALUES ('juhedata', '聚合数据', '{\"tpl_id\":\"215303\",\"key\":\"1aa07a33b6d6408e835e416fafcd6f22\",\"limit\":\"\",\"status\":\"1\"}', NULL, 1, 1, 1589361782); INSERT INTO `tab_tool`( `name`, `title`, `config`, `template`, `type`, `status`, `create_time`) VALUES ('juhe_age', '聚合身份认证', '{\"appkey\":\"80427f4769c6938f12a870f51014ddbe\",\"status\":\"1\"}', NULL, 1, 1, 1464164373); + + +ALTER TABLE `tab_forbit_ip` +ADD COLUMN `type` tinyint(2) NULL DEFAULT 0 COMMENT '类型 0:美国ip白名单 1:苹果第三方支付白名单' AFTER `remarks`; + +ALTER TABLE `tab_forbit_ip` +ADD UNIQUE INDEX `userid_type`(`user_id`, `type`) COMMENT '用户id与类型唯一索引'; \ No newline at end of file