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.
99 lines
2.5 KiB
PHP
99 lines
2.5 KiB
PHP
<?php
|
|
|
|
class Operator_model extends CI_Model
|
|
{
|
|
|
|
function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->HT = $this->load->database('HT', TRUE);
|
|
}
|
|
|
|
//输入用户名和密码,检查是否可以正确
|
|
function check_login($user_code, $password)
|
|
{
|
|
$sql = "SELECT TOP 1 1 \n"
|
|
. "FROM OperatorInfo oi \n"
|
|
. "WHERE oi.OPI_Code = N? \n"
|
|
. " AND CONVERT(VARCHAR(100), oi.OPI_Password) = N? ";
|
|
$query = $this->HT->query($sql, array($user_code, $password));
|
|
//print_r($this->HT->queries);
|
|
if ($query->num_rows() > 0)
|
|
{
|
|
return TRUE;
|
|
}
|
|
else
|
|
{
|
|
return FALSE;
|
|
}
|
|
}
|
|
|
|
function get_password($user_code)
|
|
{
|
|
$sql = "SELECT TOP 1 oi.OPI_Password \n"
|
|
. "FROM OperatorInfo oi \n"
|
|
. "WHERE oi.OPI_Code = N?";
|
|
$query = $this->HT->query($sql, array($user_code));
|
|
//print_r($this->HT->queries);
|
|
if ($query->num_rows() > 0)
|
|
{
|
|
$row = $query->row_array();
|
|
return $row;
|
|
}
|
|
else
|
|
{
|
|
return FALSE;
|
|
}
|
|
}
|
|
|
|
//获取登录用户详细信息
|
|
function get_user($user_code)
|
|
{
|
|
if(empty($user_code))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
$sql = "SELECT TOP 1 oi.OPI_SN, \n"
|
|
. " oi.OPI_Name, \n"
|
|
. " oi.OPI_Email, \n"
|
|
. " oi.OPI_FirstName, \n"
|
|
. " oi.OPI_Code \n"
|
|
. "FROM OperatorInfo oi \n"
|
|
. "WHERE oi.OPI_Code = N?";
|
|
$query = $this->HT->query($sql, array($user_code));
|
|
//print_r($this->HT->queries);
|
|
if ($query->num_rows() > 0)
|
|
{
|
|
$row = $query->row_array();
|
|
return $row;
|
|
}
|
|
else
|
|
{
|
|
return FALSE;
|
|
}
|
|
}
|
|
|
|
//获取作者信息
|
|
function get_author($user_code=array())
|
|
{
|
|
$user_code_str='';
|
|
foreach($user_code as $user_item)
|
|
{
|
|
$user_code_str.="'".$user_item."',";
|
|
}
|
|
$user_code_str.="'0'";
|
|
|
|
$sql = "SELECT oi.OPI_SN, \n"
|
|
. " oi.OPI_Name, \n"
|
|
. " oi.OPI_Email, \n"
|
|
. " oi.OPI_FirstName, \n"
|
|
. " oi.OPI_Code \n"
|
|
. "FROM OperatorInfo oi \n"
|
|
. "WHERE oi.OPI_Code IN ( $user_code_str )";
|
|
$query = $this->HT->query($sql);
|
|
//print_r($this->HT->queries);
|
|
return $query->result();
|
|
}
|
|
|
|
} |