diff --git a/Application/Admin/Controller/AmericaIpForbitController.class.php b/Application/Admin/Controller/AmericaIpForbitController.class.php new file mode 100644 index 000000000..bd0e526c6 --- /dev/null +++ b/Application/Admin/Controller/AmericaIpForbitController.class.php @@ -0,0 +1,237 @@ +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?0:1; + + + $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 = 'ip限制白名单'; + + $xlsCell = array( + "玩家账号", "区域", '状态', '添加人', '添加时间' + ); + + $map = []; + + 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,area,status,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); + + $getData = $_GET; + unset($getData['id']); + unset($getData['xlsname']); + + } + + public function operateIp() { + + if (!I('id')) { + $this->ajaxReturn(['code'=>1,'msg'=>'ID未选择']); + } else { + $id = I('id'); + } + + if (I('status')) { + $status = I('status'); + } else { + $status = 0; + } + + + $map['id'] = ['in',$id]; + + + $is_change = M('forbit_ip','tab_')->where(['id'=>['in',$id]])->save(['status'=>$status]); + + if ($is_change) { + $this->ajaxReturn(['code'=>1]); + } else { + $this->ajaxReturn(['code'=>0]); + } + + } + + 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]])->delete(); + + if ($is_del) { + $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')])->find(); + + if ($hav_firbit) { + $this->error('该用户已添加封禁'); + } + + $insert['user_id'] = $hav_user['id']; + $insert['user_account'] = I('account'); + $insert['area'] = I('area'); + $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) { + $this->success('添加成功',U('AmericaIpForbit/index')); + } else { + $this->error('添加失败'); + } + + + } + + public function setAppleInteriorBuyStatus() { + + $status = I('status'); + + if (!$status && $status!='0') { + $this->ajaxReturn(['code'=>0]); + } + + $is_success = M('tool','tab_')->where(['name'=>'apple_interior_buy'])->save(['status'=>$status]); + + if ($is_success) { + $this->ajaxReturn(['code'=>1]); + } else { + $this->ajaxReturn(['code'=>0]); + } + + } + + +} \ No newline at end of file diff --git a/Application/Admin/View/AmericaIpForbit/add.html b/Application/Admin/View/AmericaIpForbit/add.html new file mode 100644 index 000000000..0503d6b09 --- /dev/null +++ b/Application/Admin/View/AmericaIpForbit/add.html @@ -0,0 +1,139 @@ + + + + + + + + + + 新增IP限制账号 + 说明:此功能是新增IP限制白名单 + + + + + + + + + + + + + + + + 玩家账号: + + + + + + 状态: + + + + 限制 + + + 不限制 + + + + + + 区域 + + + 请选择区域 + 美国 + + + + + + + + + + + + + 保存 + + + 返回 + + + + + + + + + + + + + 已添加添加至常用设置 + + + + + + + + + diff --git a/Application/Admin/View/AmericaIpForbit/index.html b/Application/Admin/View/AmericaIpForbit/index.html new file mode 100644 index 000000000..0d14f0141 --- /dev/null +++ b/Application/Admin/View/AmericaIpForbit/index.html @@ -0,0 +1,546 @@ + + + + + + + + + + + ip限制白名单 + 说明:苹果内购白名单,名单中的用户支付成功可通知游戏 + + 关 + checked /> + 开 + 全游戏苹果内购支付成功通知默认限制 + + + + + + + + + + + + + + + + + + + + + 搜索 + + + + 批量限制 + + + 批量不限制 + + + 批量删除 + + + 添加玩家账号 + + + + + + + + + + + + + + + + + + + + + 玩家账号 + + 区域 + + 状态 + + 添加人 + + 添加时间 + + 操作 + + + + + + + + aOh! 暂时还没有内容! + + + + + + + {$data.user_account} + {$data.area} + 不限制限制 + {$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 9ffda74a9..c1ac307b8 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -1469,6 +1469,21 @@ ALTER TABLE `tab_spend` ADD INDEX `pay_channel`(`pay_way`, `pay_status`, `game_id`) USING BTREE, ADD INDEX `pay_channel_type`(`pay_status`, `pay_way`) USING BTREE; +-- 2020-03-16 zyx 添加ip限制白名单表,内购tool表状态配置列 +INSERT INTO `tab_tool`(`name`, `title`, `config`, `template`, `type`, `status`, `create_time`) VALUES ('apple_interior_buy', '苹果内购通知开启', NULL, NULL, 1, 0, 1584345308); +CREATE TABLE `tab_forbit_ip` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `user_id` int(11) NULL DEFAULT 0 COMMENT '用户id', + `user_account` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT '用户账号', + `area` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT '区域', + `status` tinyint(2) NULL DEFAULT 1 COMMENT '状态 1:不限制 0:限制', + `admin_id` int(11) NULL DEFAULT 1 COMMENT '管理员账号id', + `admin_account` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT '管理员账号', + `create_time` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL COMMENT '创建时间', + `remarks` longtext CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL COMMENT '备注', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB AUTO_INCREMENT = 30 CHARACTER SET = utf8 COLLATE = utf8_unicode_ci ROW_FORMAT = Dynamic; + -- 为游戏统计新增spend索引 chenzhi 2020/03/11 ALTER TABLE `tab_spend` ADD INDEX `game_time`(`game_id`,`pay_time`) USING BTREE; @@ -1479,5 +1494,5 @@ ADD INDEX `promote_time`(`promote_id`,`pay_time`) USING BTREE; -- liaojinling 用户重复标识 ALTER TABLE `tab_user` ADD INDEX `index_device_ip` (`device_number`, `last_login_ip`) USING BTREE ; -ALTER TABLE `tab_user` +ALTER TABLE `tab_user` ADD COLUMN `is_repeat` tinyint(1) not null default 0 comment '是否重复用户[设备/IP]';
说明:此功能是新增IP限制白名单
说明:苹果内购白名单,名单中的用户支付成功可通知游戏