diff --git a/Application/Home/Controller/TestResourceController.class.php b/Application/Home/Controller/TestResourceController.class.php index fd71fce1a..acbdb29c7 100644 --- a/Application/Home/Controller/TestResourceController.class.php +++ b/Application/Home/Controller/TestResourceController.class.php @@ -3,10 +3,125 @@ namespace Home\Controller; +use Home\Model\SupportModel; + class TestResourceController extends BaseController { public function test(){ echo 'test1'; } + + public function supportNumberList($p = 1) { + $page = intval($p); + $page = $page ? $page : 1; //默认显示第一页数据 + $row=10; + if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;} + + $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('role_name'))){ + $map['tab_support.role_name']=['like','%'.I('role_name').'%']; + } + if(!empty(I('user_account'))){ + $map['user_account']=I('user_account'); + } + if(!empty(I('promote_name'))){ + $map['tab_support.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') + ->where($map) + ->page($page,$row) + ->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') + ->where($map) + ->select(); + $count = count($count); + + $page = set_pagination($count,$row); + if($page) {$this->assign('_page', $page);} + + $this->assign('data',$data); +// var_dump($data); + + $this->display(); + + } + + public function freezeSupport() { + $supportId = I('support_id', 0); + if ($supportId == 0) { + $this->ajaxReturn(['status'=>0,'msg'=>"参数错误"]); + } + + $isFreeze = D('support')->froze($supportId); + if ($isFreeze) { + $this->ajaxReturn(['status'=>1, 'msg'=> '冻结成功']); + } else { + $this->ajaxReturn(['status'=>0, 'msg'=> '冻结失败']); + } + } + + public function unfreezeSupport() { + $supportId = I('support_id', 0); + if ($supportId == 0) { + $this->ajaxReturn(['status'=>0,'msg'=>"参数错误"]); + } + + $isFreeze = D('support')->unfreeze($supportId); + if ($isFreeze) { + $this->ajaxReturn(['status'=>1, 'msg'=> '启用成功']); + } else { + $this->ajaxReturn(['status'=>0, 'msg'=> '启用失败']); + } + } + + public function rechangePassward() { + $supportId = I('support_id', 0); + if ($supportId == 0) { + $this->ajaxReturn(['status'=>0,'msg'=>"参数错误"]); + } + + $passward = D('support')->rechangePassward($supportId); + if ($passward) { + $this->ajaxReturn(['status'=>1, 'msg'=> '新密码:'.$passward]); + } else { + $this->ajaxReturn(['status'=>0, 'msg'=> '重置密码失败']); + } + } + + /** + * 获取区服列表 + * @param $game_id + */ + public function getServer($game_id=""){ + $map['game_id']=$game_id; + $map['start_time']=['lt',time()]; + if(I('status')==2){ + $map['show_status']=1; + } + $data = M('server','tab_') + ->field('tab_server.server_name,support_quota') + ->where($map) + ->join('join tab_game tg ON tg.id=tab_server.game_id') + ->select(); + + $this->AjaxReturn($data); + } + } \ No newline at end of file diff --git a/Application/Home/Model/SupportModel.class.php b/Application/Home/Model/SupportModel.class.php new file mode 100644 index 000000000..b2afb7b8c --- /dev/null +++ b/Application/Home/Model/SupportModel.class.php @@ -0,0 +1,107 @@ + +// +---------------------------------------------------------------------- + +namespace Home\Model; +use Think\Model; + +/** + * 分类模型 + */ +class SupportModel 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 integer $id 数据库表行id + */ + public function froze($id) { + $data = [ + 'freeze' => 0 + ]; + + return $this->where("id=".$id)->save($data); + } + + /** + * 按照时间分组统计注册总数 + * @param integer $id 数据库表行id + */ + public function unfreeze($id) + { + $data = [ + 'freeze' => 1 + ]; + return $this->where("id=".$id)->save($data); + } + + public function rechangePassward($id) { + + $passward = $this->getRandomPassword(6); + + $data = [ + 'user_password' => base64_encode($passward) + ]; + + if ($this->where("id=".$id)->save($data)) { + return $passward; + } else { + return false; + } + + } + + 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; + } + +} diff --git a/Application/Home/View/default/TestResource/supportNumberList.html b/Application/Home/View/default/TestResource/supportNumberList.html new file mode 100644 index 000000000..311e65ace --- /dev/null +++ b/Application/Home/View/default/TestResource/supportNumberList.html @@ -0,0 +1,442 @@ + + + + + + + + + + + + + +
+ +
+
+
当前位置:测试资源管理>扶持号管理
+
+ + 扶持号管理 + 说明:扶持号管理 +
+ + +
+ +
+ + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
产品名称区服测试账号所属推广员角色名称设备信息状态创建时间操作

暂无数据

{$s.game_name}{$s.server_name}{$s.user_account}{$s.promote_account}{$s.role_name} + 尚未登录,无设备号 + {$s.device_number} + + + 冻结 + 启用 + + {$s.create_time} + + 冻结 + + 启用 + + + 重置密码 +
+ +
{$_page}
+
+
+
+
+
+ + + + + + + + + diff --git a/Data/update.sql b/Data/update.sql index cddc9af1b..72c9195d0 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -74,5 +74,7 @@ ALTER TABLE `tab_game` ADD COLUMN `detail_content` MEDIUMTEXT NULL DEFAULT NULL -- ---------------------------- ALTER TABLE `tab_promote` ADD COLUMN `child_game_permission` tinyint(2) NOT NULL DEFAULT 0 COMMENT '下级游戏添加权限 0-本账号已添加游戏 1-所有游戏' AFTER `idcard`; --- 2019-10-11 cxj -ALTER TABLE `tab_apply` ADD COLUMN `bale_sort` int(5) NOT NULL DEFAULT 0 COMMENT '打包顺序' AFTER `offline_status`; +-- ---------------------------- +-- 2019-10-11 zyx +-- ---------------------------- +ALTER TABLE `tab_support` ADD COLUMN `freeze` tinyint(2) NOT NULL DEFAULT 1 COMMENT '0-冻结 1-启用' AFTER `notice_status`; \ No newline at end of file