From 1aec352b502d1f4942927ab04cc132ebe4edd684 Mon Sep 17 00:00:00 2001 From: zyx Date: Sat, 12 Oct 2019 11:05:15 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=B2=E6=8A=A4=E6=97=A5=E5=BF=97=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E6=B7=BB=E5=8A=A0=EF=BC=8C=E6=89=B6=E6=8C=81=E5=8F=B7?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TestResourceController.class.php | 131 +++++- .../Home/Model/ProtectLogModel.class.php | 71 +++ .../default/TestResource/protectLogList.html | 422 ++++++++++++++++++ .../TestResource/supportNumberList.html | 61 +-- 4 files changed, 625 insertions(+), 60 deletions(-) create mode 100644 Application/Home/Model/ProtectLogModel.class.php create mode 100644 Application/Home/View/default/TestResource/protectLogList.html diff --git a/Application/Home/Controller/TestResourceController.class.php b/Application/Home/Controller/TestResourceController.class.php index c7254bb88..d65d95fba 100644 --- a/Application/Home/Controller/TestResourceController.class.php +++ b/Application/Home/Controller/TestResourceController.class.php @@ -3,7 +3,8 @@ namespace Home\Controller; -use Home\Model\SupportModel; +use Base\Model\PromoteModel; +use Base\Service\PromoteService; class TestResourceController extends BaseController @@ -20,36 +21,36 @@ class TestResourceController extends BaseController $map = []; if(!empty(I('server_name'))){ - $map['server_name']=I('server_name'); + $map['tab_test_resource.server_name']=I('server_name'); } if(!empty(I('game_name'))){ - $map['game_name']=I('game_name'); + $map['tab_test_resource.game_name']=I('game_name'); } if(!empty(I('role_name'))){ - $map['tab_support.role_name']=['like','%'.I('role_name').'%']; + $map['tab_test_resource.role_name']=['like','%'.I('role_name').'%']; } if(!empty(I('user_account'))){ - $map['user_account']=I('user_account'); + $map['tab_test_resource.user_account']=I('user_account'); } if(!empty(I('promote_name'))){ - $map['tab_support.promote_account']=I('promote_name'); + $map['tab_test_resource.promote_account']=I('promote_name'); } - $data = M('support','tab_') - ->field('tab_support.id,tab_support.role_name,tab_support.game_name,tab_support.promote_account,tab_support.create_time,user_account,role_name,server_name,freeze,user.device_number') - ->join('left join tab_user as user on tab_support.user_id = user.id') + $data = M('test_resource','tab_') + ->field('tab_test_resource.id,tab_test_resource.user_id,tab_test_resource.game_name,tab_test_resource.server_name,tab_test_resource.user_account,tab_test_resource.promote_account,tab_test_resource.role_name,tab_test_resource.create_time,device_number,check_status') + ->join('left join tab_user as user on tab_test_resource.user_id = user.id') ->where($map) ->page($page,$row) - ->order('tab_support.create_time DESC') + ->order('tab_test_resource.create_time DESC') ->select(); foreach ($data as $key => $value) { $data[$key]['create_time'] = date('Y-m-d H:m:i',$value['create_time']); } - $count = M('support','tab_') - ->field('tab_support.role_name,tab_support.game_id,tab_support.promote_id,tab_support.create_time,user_account,role_name,server_name,freeze,user.device_number') - ->join('left join tab_user as user on tab_support.user_id = user.id') + $count = M('test_resource','tab_') + ->field('tab_test_resource.game_name,tab_test_resource.server_name,tab_test_resource.user_account,tab_test_resource.promote_account,tab_test_resource.role_name,tab_test_resource.create_time,device_number,check_status') + ->join('left join tab_user as user on tab_test_resource.user_id = user.id') ->where($map) ->select(); $count = count($count); @@ -58,7 +59,6 @@ class TestResourceController extends BaseController if($page) {$this->assign('_page', $page);} $this->assign('data',$data); -// var_dump($data); $this->display(); @@ -70,7 +70,12 @@ class TestResourceController extends BaseController $this->ajaxReturn(['status'=>0,'msg'=>"参数错误"]); } - $isFreeze = D('support')->froze($supportId); + $data = [ + 'check_status' => 0 + ]; + + $isFreeze = M('user','tab_')->where("id=".$supportId)->save($data); + if ($isFreeze) { $this->ajaxReturn(['status'=>1, 'msg'=> '冻结成功']); } else { @@ -84,7 +89,12 @@ class TestResourceController extends BaseController $this->ajaxReturn(['status'=>0,'msg'=>"参数错误"]); } - $isFreeze = D('support')->unfreeze($supportId); + $data = [ + 'check_status' => 1 + ]; + + $isFreeze = M('user','tab_')->where("id=".$supportId)->save($data); + if ($isFreeze) { $this->ajaxReturn(['status'=>1, 'msg'=> '启用成功']); } else { @@ -98,13 +108,98 @@ class TestResourceController extends BaseController $this->ajaxReturn(['status'=>0,'msg'=>"参数错误"]); } - $passward = D('support')->rechangePassward($supportId); + $password = $this->getRandomPassword(6); + $data = [ + 'password' => md5(sha1($password) . UC_AUTH_KEY) + ]; + + $passward = M('user','tab_')->where("id=".$supportId)->save($data); if ($passward) { - $this->ajaxReturn(['status'=>1, 'msg'=> '新密码:'.$passward]); + $this->ajaxReturn(['status'=>1, 'msg'=> '新密码:'.$password]); } else { $this->ajaxReturn(['status'=>0, 'msg'=> '重置密码失败']); } } + + private function getRandomPassword($length, $special = true){ + $chars = array( + 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', + 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', + 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', + 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', + 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', + '3', '4', '5', '6', '7', '8', '9' + ); + +// if($special){ +// $chars = array_merge($chars, array( +// '!', '@', '#', '$', '?', '|', '{', '/', ':', ';', +// '%', '^', '&', '*', '(', ')', '-', '_', '[', ']', +// '}', '<', '>', '~', '+', '=', ',', '.' +// )); +// } + + $charsLen = count($chars) - 1; + shuffle($chars); + + $password = ''; + for($i=0; $i<$length; $i++){ + $password .= $chars[mt_rand(0, $charsLen)]; + } + return $password; + } + + public function protectLogList($p = 1) { + $page = intval($p); + $page = $page ? $page : 1; //默认显示第一页数据 + $row=10; + if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 1;} + + $map = []; + if(!empty(I('server_name'))){ + $map['server_name']=I('server_name'); + } + if(!empty(I('game_name'))){ + $map['game_name']=I('game_name'); + } + if(!empty(I('nickname'))){ + $map['nickname']=['like','%'.I('nickname').'%']; + } + if(!empty(I('user_account'))){ + $map['user_account']=I('user_account'); + } + if(!empty($_REQUEST['start'])&&empty($_REQUEST['end'])){ + $map['create_time'] = array('GT',strtotime($_REQUEST['start'])); + unset($_REQUEST['start']); + } + if(empty($_REQUEST['start'])&&!empty($_REQUEST['end'])){ + $map['create_time'] = array('LT',strtotime($_REQUEST['end'])+24*60*60-1); + unset($_REQUEST['end']); + } + if(!empty($_REQUEST['start'])&&!empty($_REQUEST['end'])){ + $map['create_time'] = array('BETWEEN',array(strtotime($_REQUEST['start']),strtotime($_REQUEST['end'])+24*60*60-1)); + unset($_REQUEST['start']);unset($_REQUEST['end']); + } + if(!empty(I('types'))){ + $map['type']=I('types'); + } + + $field = 'game_name,server_name,user_account,nickname,promote_account,detail'; + $order = 'id DESC'; + + $data = D('protect_log')->getProtectLog($field,$map,'',$order,$page,$row); + + $count = D('protect_log')->getProtectLog($field,$map,'',$order); + $count = count($count); + + $page = set_pagination($count,$row); + if($page) {$this->assign('_page', $page);} + + $this->assign('data',$data); + + $this->display(); + } + protected function _initialize() { parent::_initialize(); diff --git a/Application/Home/Model/ProtectLogModel.class.php b/Application/Home/Model/ProtectLogModel.class.php new file mode 100644 index 000000000..921a44145 --- /dev/null +++ b/Application/Home/Model/ProtectLogModel.class.php @@ -0,0 +1,71 @@ + +// +---------------------------------------------------------------------- + +namespace Home\Model; +use Think\Model; + +/** + * 分类模型 + */ +class ProtectLogModel extends Model{ + + protected $_validate = array( + + ); + + protected $_auto = array( + ); + + /** + * 构造函数 + * @param string $name 模型名称 + * @param string $tablePrefix 表前缀 + * @param mixed $connection 数据库连接信息 + */ + public function __construct($name = '', $tablePrefix = '', $connection = '') { + /* 设置默认的表前缀 */ + $this->tablePrefix ='tab_'; + /* 执行构造方法 */ + parent::__construct($name, $tablePrefix, $connection); + } + + + /** + * 按照时间分组统计注册总数 + * @param string $field 需要的字段 + * @param string $where sql条件 + * @param string $group sqlGroup条件 + * @param string $order sql排序 + * @param string $page 页数 + * @param string $row 每页几条 + * @return array 详细数据 + * @author 鹿文学 + */ + public function getProtectLog($field = '*', $where = [], $group = '', $order='',$page = 0, $row = 0) { + + if ($page) { + $data = $this->field($field) + ->where($where) + ->page($page,$row) + ->group($group) + ->order($order) + ->select(); + } else { + $data = $this->field($field) + ->where($where) + ->group($group) + ->order($order) + ->select(); + } + + return $data; + } + + +} diff --git a/Application/Home/View/default/TestResource/protectLogList.html b/Application/Home/View/default/TestResource/protectLogList.html new file mode 100644 index 000000000..93c8c63f1 --- /dev/null +++ b/Application/Home/View/default/TestResource/protectLogList.html @@ -0,0 +1,422 @@ + + + + + + + + + + + + + +
+ +
+
+
当前位置:测试资源管理>防护日志
+
+ + 防护日志 + 说明:防护日志 +
+ + +
+ +
+ + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
产品名称区服测试账号所属推广员角色名称异常内容

暂无数据

{$s.game_name}{$s.server_name}{$s.user_account}{$s.promote_account}{$s.nickname}{$s.detail}
+ +
{$_page}
+
+
+
+
+
+ + + + + + + + + diff --git a/Application/Home/View/default/TestResource/supportNumberList.html b/Application/Home/View/default/TestResource/supportNumberList.html index 72e96cbad..137979270 100644 --- a/Application/Home/View/default/TestResource/supportNumberList.html +++ b/Application/Home/View/default/TestResource/supportNumberList.html @@ -33,12 +33,12 @@
-
+
@@ -48,8 +48,8 @@ @@ -57,19 +57,19 @@
- +
- +
- +
- +
@@ -140,8 +140,7 @@ 启用 - - 重置密码 + 重置密码 @@ -272,38 +271,15 @@