formate code

master
LMR 1 year ago
parent c1dcd41570
commit 114becf0e2

@ -14,77 +14,66 @@ class Operator_model extends CI_Model
function check_login($user_code, $password) function check_login($user_code, $password)
{ {
$sql = "SELECT TOP 1 1 \n" $sql = "SELECT TOP 1 1 \n"
. "FROM tourmanager.dbo.OperatorInfo oi \n" . "FROM tourmanager.dbo.OperatorInfo oi \n"
. "WHERE oi.OPI_Code = N? \n" . "WHERE oi.OPI_Code = N? \n"
. " AND CONVERT(VARCHAR(100), oi.OPI_Password) = N? "; . " AND CONVERT(VARCHAR(100), oi.OPI_Password) = N? ";
$query = $this->HT->query($sql, array($user_code, $password)); $query = $this->HT->query($sql, array($user_code, $password));
//print_r($this->HT->queries); //print_r($this->HT->queries);
if ($query->num_rows() > 0) if ($query->num_rows() > 0) {
{
return 1; return 1;
} } else {
else
{
$author_sql = "SELECT TOP 1 1 FROM tourmanager.dbo.infoAuthors WHERE a_email=? AND a_password=?"; $author_sql = "SELECT TOP 1 1 FROM tourmanager.dbo.infoAuthors WHERE a_email=? AND a_password=?";
$author_query = $this->HT->query($author_sql, array($user_code, $password)); $author_query = $this->HT->query($author_sql, array($user_code, $password));
if ($author_query->num_rows() > 0) if ($author_query->num_rows() > 0) {
{
return 2; return 2;
} } else {
else{
return FALSE; return FALSE;
} }
} }
} }
function get_password($user_code) function get_password($user_code)
{ {
$sql = "SELECT TOP 1 oi.OPI_Password \n" $sql = "SELECT TOP 1 oi.OPI_Password \n"
. "FROM tourmanager.dbo.OperatorInfo oi \n" . "FROM tourmanager.dbo.OperatorInfo oi \n"
. "WHERE oi.OPI_Code = N?"; . "WHERE oi.OPI_Code = N?";
$query = $this->HT->query($sql, array($user_code)); $query = $this->HT->query($sql, array($user_code));
//print_r($this->HT->queries); //print_r($this->HT->queries);
if ($query->num_rows() > 0) if ($query->num_rows() > 0) {
{
$row = $query->row_array(); $row = $query->row_array();
return $row; return $row;
} } else {
else
{
return FALSE; return FALSE;
} }
} }
//获取登录用户详细信息 //获取登录用户详细信息
function get_user($user_code) function get_user($user_code)
{ {
if(empty($user_code)) if (empty($user_code)) {
{ return false;
return false; }
}
$sql = "SELECT TOP 1 oi.OPI_SN, \n" $sql = "SELECT TOP 1 oi.OPI_SN, \n"
. " oi.OPI_Name, \n" . " oi.OPI_Name, \n"
. " oi.OPI_Email, \n" . " oi.OPI_Email, \n"
. " oi.OPI_FirstName, \n" . " oi.OPI_FirstName, \n"
. " oi.OPI_Code \n" . " oi.OPI_Code \n"
. "FROM tourmanager.dbo.OperatorInfo oi \n" . "FROM tourmanager.dbo.OperatorInfo oi \n"
. "WHERE oi.OPI_Code = N?"; . "WHERE oi.OPI_Code = N?";
$query = $this->HT->query($sql, array($user_code)); $query = $this->HT->query($sql, array($user_code));
//print_r($this->HT->queries); //print_r($this->HT->queries);
if ($query->num_rows() > 0) if ($query->num_rows() > 0) {
{
$row = $query->row_array(); $row = $query->row_array();
return $row; return $row;
} } else {
else
{
return FALSE; return FALSE;
} }
} }
//获取作者平台的作者信息 //获取作者平台的作者信息
public function get_author_user($a_email){ public function get_author_user($a_email)
{
$sql = "SELECT TOP 1 $sql = "SELECT TOP 1
a_id as OPI_SN, a_id as OPI_SN,
a_email as OPI_Email, a_email as OPI_Email,
@ -94,42 +83,39 @@ class Operator_model extends CI_Model
FROM tourmanager.dbo.infoAuthors FROM tourmanager.dbo.infoAuthors
WHERE a_email=? AND a_active=1"; WHERE a_email=? AND a_active=1";
$query = $this->HT->query($sql, array($a_email)); $query = $this->HT->query($sql, array($a_email));
if ($query->num_rows() > 0) if ($query->num_rows() > 0) {
{
$row = $query->row_array(); $row = $query->row_array();
return $row; return $row;
} } else {
else
{
return FALSE; return FALSE;
} }
} }
//获取作者信息 //获取作者信息
function get_author($user_code=array()) function get_author($user_code = array())
{ {
$user_code_str=''; $user_code_str = '';
foreach($user_code as $user_item) foreach ($user_code as $user_item) {
{ $user_code_str .= "'" . $user_item . "',";
$user_code_str.="'".$user_item."',"; }
} $user_code_str .= "'0'";
$user_code_str.="'0'";
$sql = "SELECT oi.OPI_SN, \n" $sql = "SELECT oi.OPI_SN, \n"
. " oi.OPI_Name, \n" . " oi.OPI_Name, \n"
. " oi.OPI_Email, \n" . " oi.OPI_Email, \n"
. " oi.OPI_FirstName, \n" . " oi.OPI_FirstName, \n"
. " oi.OPI_Code \n" . " oi.OPI_Code \n"
. "FROM tourmanager.dbo.OperatorInfo oi \n" . "FROM tourmanager.dbo.OperatorInfo oi \n"
. "WHERE oi.OPI_Code IN ( $user_code_str )"; . "WHERE oi.OPI_Code IN ( $user_code_str )";
$query = $this->HT->query($sql); $query = $this->HT->query($sql);
//print_r($this->HT->queries); //print_r($this->HT->queries);
return $query->result(); return $query->result();
} }
//获取作者的昵称 //获取作者的昵称
function get_author_nikename($user_code){ function get_author_nikename($user_code)
$sql=" {
$sql = "
SELECT top 1 isnull(uio.NickName,'') as NickName,uio.customPic, uio.userid, uio.sex, uio.Email,uio.intro SELECT top 1 isnull(uio.NickName,'') as NickName,uio.customPic, uio.userid, uio.sex, uio.Email,uio.intro
,OPI_SN,OPI_Name,OPI_Email,OPI_FirstName,OPI_Code ,OPI_SN,OPI_Name,OPI_Email,OPI_FirstName,OPI_Code
FROM tourmanager.dbo.OperatorInfo left JOIN FROM tourmanager.dbo.OperatorInfo left JOIN
@ -146,24 +132,25 @@ class Operator_model extends CI_Model
} }
} }
//HT中所有账号 //HT中所有账号
function all() function all()
{ {
$sql = "SELECT oi.OPI_SN, \n" $sql = "SELECT oi.OPI_SN, \n"
. " oi.OPI_Name, \n" . " oi.OPI_Name, \n"
. " oi.OPI_Email, \n" . " oi.OPI_Email, \n"
. " oi.OPI_FirstName, \n" . " oi.OPI_FirstName, \n"
. " oi.OPI_Code \n" . " oi.OPI_Code \n"
. "FROM tourmanager.dbo.OperatorInfo oi \n" . "FROM tourmanager.dbo.OperatorInfo oi \n"
. "WHERE oi.deleteFlag=0 \n" . "WHERE oi.deleteFlag=0 \n"
. "ORDER BY OPI_Code ASC "; . "ORDER BY OPI_Code ASC ";
$query = $this->HT->query($sql); $query = $this->HT->query($sql);
//print_r($this->HT->queries); //print_r($this->HT->queries);
return $query->result(); return $query->result();
} }
//获取当前站点的作者 //获取当前站点的作者
public function get_site_user($site_code){ public function get_site_user($site_code)
{
$sql = "SELECT oi.OPI_SN, $sql = "SELECT oi.OPI_SN,
oi.OPI_Name, oi.OPI_Name,
oi.OPI_Email, oi.OPI_Email,
@ -171,7 +158,7 @@ class Operator_model extends CI_Model
oi.OPI_Code oi.OPI_Code
FROM tourmanager.dbo.OperatorInfo oi INNER JOIN infoaccessownsite i ON oi.OPI_Code=i.iao_author AND i.iao_other='editor' FROM tourmanager.dbo.OperatorInfo oi INNER JOIN infoaccessownsite i ON oi.OPI_Code=i.iao_author AND i.iao_other='editor'
WHERE i.iao_site=?"; WHERE i.iao_site=?";
$query = $this->HT->query($sql,$site_code); $query = $this->HT->query($sql, $site_code);
return $query->result(); return $query->result();
} }
} }
Loading…
Cancel
Save