Files
Administrator 0e902893ca 1.0-version
2019-04-11 15:54:34 +08:00

111 lines
2.6 KiB
PHP

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class User extends MY_Controller {
public function __construct()
{
parent::__construct();
$this->Func_model->check_session(true);
$this->load->model('admin/User_model');
}
/*
获取用户列表
*/
public function lst()
{
$pagecurrent = isset($_POST['pagecurrent'])?stripslashes($_POST['pagecurrent']):"";
$username = isset($_POST['username'])?stripslashes($_POST['username']):"";
if ($pagecurrent == "")
{
return false;
}else
{
$data = array();
$num = $this->Config_model->getPageNum();
if(strlen($username) == 11){
$like = array('telephone' => $username);
}else {
$like = array('name' => $username);
}
$where = array('type' => (int)1);
$data = $this->Db_model->getPage("user",$where,$like,$pagecurrent);
$msg = $this->Db_model->getSearchData("user",$where,$like,"id","DESC",((int)$pagecurrent-1)*$num,$num);
$len = count($data);
foreach ($msg as $row)
{
$data[$len][] = $this->User_model->setUserMsg($row);
}
$this->Func_model->toJsFunc("userList",$this->Func_model->decodeUnicode($data));
return;
}
}
/*
编辑登录者信息
*/
public function editInfor()
{
$id = isset($_POST['id'])?$_POST['id']:"";
if ($id == "" || $id == 1)
$id = $_SESSION['id'];
$data = $this->User_model->receiveUserMsg();
$where = array('password' => $data['password']);
$infor = $this->Db_model->getSpecificData("user",$where);
if (count($infor) > 0)
{
if ($id != $infor[0]->id)
{
$this->Func_model->setTip("password2_tip",$this->Config_model->msg[7]);
return;
}
}
$where = array('id' => $id);
$this->Db_model->updateData("user",$data,$where);
$this->Func_model->toJsFunc("disInfor","");
$this->Func_model->setAlert($this->Config_model->msg[0]);
}
/*
获取用户信息
*/
public function userInfor()
{
$uid = isset($_POST['id'])?$_POST['id']:"";
if ($uid == "" || $uid == 1)
$uid = $_SESSION['id'];
$where = array('id' => $uid);
$infor = $this->Db_model->getSpecificData("user",$where);
$data = $this->User_model->setUserMsg($infor[0]);
//$this->Func_model->sendServiceMsg($this->Func_model->decodeUnicode($data));
$this->Func_model->toJsFunc("infor",$this->Func_model->decodeUnicode($data));
return ;
}
/*
删除用户
*/
public function delUser()
{
$id = isset($_POST['id'])?$_POST['id']:"";
if ($id != "")
{
$where = array('id' => $id);
$this->Db_model->delData("user",$where);
}
$this->Func_model->toJsFunc("disUser","");
$this->Func_model->setAlert($this->Config_model->msg[0]);
}
}