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.
information-system/application/models/landscape_model.php

88 lines
3.3 KiB
PHP

<?php
class Landscape_model extends CI_Model
{
function __construct()
{
parent::__construct();
$this->HT = $this->load->database('HT', TRUE);
}
function search_list($keyword)
{
$sql = "SELECT TOP 8 lsi.LSI_SN, \n"
. " lsi.LSI_ID, \n"
. " lsi.LSI_City, \n"
. " lsi2.LSI2_Name, \n"
. " ci2.CII2_Name \n"
. "FROM LandScapeInfo lsi \n"
. " INNER JOIN LandScapeInfo2 lsi2 ON lsi2.LSI2_LSI_SN = lsi.LSI_SN \n"
. " AND lsi2.LSI2_LGC = ? \n"
. " INNER JOIN CItyInfo2 ci2 ON ci2.CII2_CII_SN = lsi.LSI_City \n"
. " AND ci2.CII2_LGC = ? \n"
. "WHERE lsi.LSI_Publish = 1 \n"
. " AND (lsi.LSI_ParentSN IS NULL OR lsi.LSI_ParentSN = 0) \n"
. " AND lsi2.LSI2_Name LIKE N? ";
$query = $this->HT->query($sql, array($this->config->item('site_lgc'), $this->config->item('site_lgc'), '%' . urldecode($keyword) . '%'));
//print_r($this->HT->queries);
return $query->result();
}
function get_landscape_title($lsi_sn)
{
$sql = "SELECT TOP 1 lsi2.LSI2_Name \n"
. "FROM LandScapeInfo lsi \n"
. " INNER JOIN LandScapeInfo2 lsi2 ON lsi2.LSI2_LSI_SN = lsi.LSI_SN \n"
. " AND lsi2.LSI2_LGC = ? \n"
. " INNER JOIN CItyInfo2 ci2 ON ci2.CII2_CII_SN = lsi.LSI_City \n"
. " AND ci2.CII2_LGC = ? \n"
. "WHERE lsi.LSI_Publish = 1 \n"
. " AND (lsi.LSI_ParentSN IS NULL OR lsi.LSI_ParentSN = 0) \n"
. " AND lsi.LSI_SN = ?";
$query = $this->HT->query($sql, array($this->config->item('site_lgc'), $this->config->item('site_lgc'),$lsi_sn));
//print_r($this->HT->queries);
if ($query->result())
{
$row = $query->row();
return $row->LSI2_Name;
}
else
{
return FALSE;
}
}
//获取景点详细内容
function get_detail($lsi_sn)
{
$sql = "SELECT TOP 1 lsi.LSI_SN, \n"
. " lsi.LSI_ID, \n"
. " lsi.LSI_City, \n"
. " lsi2.LSI2_Name, \n"
. " lsi2.LSI2_Intro, \n"
. " lsi2.LSI2_ShortIntro, \n"
. " ci2.CII2_Name \n"
. "FROM LandScapeInfo lsi \n"
. " INNER JOIN LandScapeInfo2 lsi2 ON lsi2.LSI2_LSI_SN = lsi.LSI_SN \n"
. " AND lsi2.LSI2_LGC = ? \n"
. " INNER JOIN CItyInfo2 ci2 ON ci2.CII2_CII_SN = lsi.LSI_City \n"
. " AND ci2.CII2_LGC = ? \n"
. "WHERE lsi.LSI_Publish = 1 \n"
. " AND (lsi.LSI_ParentSN IS NULL OR lsi.LSI_ParentSN = 0) \n"
. " AND lsi.LSI_SN = ?";
$query = $this->HT->query($sql, array($this->config->item('site_lgc'), $this->config->item('site_lgc'), $lsi_sn));
if ($query->num_rows() > 0)
{
$row = $query->row();
return $row;
}
else
{
return FALSE;
}
}
}