You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

128 lines
3.8 KiB
PHTML

<?php
namespace Home\Controller;
use Home\Model\SupportModel;
class TestResourceController extends BaseController
{
5 years ago
public function test(){
echo 'test1';
5 years ago
}
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)
->order('tab_support.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')
->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);
}
}