hotfix/paypal-note
LMR 4 years ago
parent 2d17cbe614
commit b0b13775a7

@ -1,6 +1,7 @@
<?php <?php
class Information_model extends CI_Model { class Information_model extends CI_Model
{
var $topNum = false; var $topNum = false;
var $orderBy = false; var $orderBy = false;
@ -17,13 +18,15 @@ class Information_model extends CI_Model {
var $ic_type = false; var $ic_type = false;
var $ic_id = false; var $ic_id = false;
function __construct() { function __construct()
{
parent::__construct(); parent::__construct();
$this->HT = $this->load->database('INFORMATION', TRUE); $this->HT = $this->load->database('INFORMATION', TRUE);
$this->HT229 = $this->load->database('HT', TRUE); $this->HT229 = $this->load->database('HT', TRUE);
} }
function init() { function init()
{
$this->topNum = false; $this->topNum = false;
$this->orderBy = " ORDER BY ic_datetime DESC "; $this->orderBy = " ORDER BY ic_datetime DESC ";
$this->search_title = false; $this->search_title = false;
@ -39,13 +42,15 @@ class Information_model extends CI_Model {
$this->ic_id = false; $this->ic_id = false;
} }
function get_last_edit_list($topNum = 24) { function get_last_edit_list($topNum = 24)
{
$this->init(); $this->init();
$this->topNum = $topNum; $this->topNum = $topNum;
return $this->GetList(); return $this->GetList();
} }
function search($keyword) { function search($keyword)
{
$this->init(); $this->init();
$this->topNum = 24; $this->topNum = 24;
if (is_numeric($keyword)) { if (is_numeric($keyword)) {
@ -57,7 +62,8 @@ class Information_model extends CI_Model {
return $this->GetList(); return $this->GetList();
} }
function search_all_text($keyword,$topnum=24) { function search_all_text($keyword, $topnum = 24)
{
$this->init(); $this->init();
$this->topNum = $topnum; $this->topNum = $topnum;
$sql_keyword = '%' . $this->HT->escape_like_str($keyword) . '%'; $sql_keyword = '%' . $this->HT->escape_like_str($keyword) . '%';
@ -66,7 +72,8 @@ class Information_model extends CI_Model {
} }
//根据关键词来搜索内容 //根据关键词来搜索内容
function search_by_words($url,array $words,$exclude_ids){ function search_by_words($url, array $words, $exclude_ids)
{
$this->init(); $this->init();
$this->topNum = 1; $this->topNum = 1;
$sql_keyword = ' AND ( 1=1 '; $sql_keyword = ' AND ( 1=1 ';
@ -80,7 +87,8 @@ class Information_model extends CI_Model {
} }
//在当前节点下搜索关键词 //在当前节点下搜索关键词
function search_by_words_2($path,array $words,$exclude_ids){ function search_by_words_2($path, array $words, $exclude_ids)
{
$this->init(); $this->init();
$this->topNum = 1; $this->topNum = 1;
$sql_keyword = ' AND ( 1=1 '; $sql_keyword = ' AND ( 1=1 ';
@ -95,7 +103,8 @@ class Information_model extends CI_Model {
} }
//在同级别下随机获取N条数据并且排除某些id //在同级别下随机获取N条数据并且排除某些id
function random($topnum,$is_path,array $exclude_ids){ function random($topnum, $is_path, array $exclude_ids)
{
$this->init(); $this->init();
$this->topNum = $topnum; $this->topNum = $topnum;
$this->search = " AND is1.is_path LIKE '$is_path%' "; $this->search = " AND is1.is_path LIKE '$is_path%' ";
@ -107,7 +116,8 @@ class Information_model extends CI_Model {
} }
//在urls列表里面随机获取N条数据并且排除某些id //在urls列表里面随机获取N条数据并且排除某些id
function random_range($topnum,array $url_array,array $exclude_ids){ function random_range($topnum, array $url_array, array $exclude_ids)
{
$this->init(); $this->init();
$this->topNum = $topnum; $this->topNum = $topnum;
$this->search = ' AND ( 1=2 '; $this->search = ' AND ( 1=2 ';
@ -122,7 +132,8 @@ class Information_model extends CI_Model {
} }
//根据url搜索信息 //根据url搜索信息
function search_url($url) { function search_url($url)
{
$this->init(); $this->init();
$this->topNum = 24; $this->topNum = 24;
$this->search_url = ' AND ic_url= ' . $this->HT->escape($url); $this->search_url = ' AND ic_url= ' . $this->HT->escape($url);
@ -130,7 +141,8 @@ class Information_model extends CI_Model {
} }
//根据根节点路径获取子节点列表 //根据根节点路径获取子节点列表
function get_list_by_path($path, $level = false, $site_code = false,$filed=false) { function get_list_by_path($path, $level = false, $site_code = false, $filed = false)
{
$this->init(); $this->init();
if ($level !== false) { if ($level !== false) {
$this->level = " AND is1.is_level= '$level' "; $this->level = " AND is1.is_level= '$level' ";
@ -143,7 +155,8 @@ class Information_model extends CI_Model {
/** /**
* 获取当前页面的面包屑,不包括当前节点 * 获取当前页面的面包屑,不包括当前节点
*/ */
function get_path_exclude_self($is_id, $path) { function get_path_exclude_self($is_id, $path)
{
$site_code = $this->config->item('site_code'); $site_code = $this->config->item('site_code');
$path_query = $this->HT->query("select $path_query = $this->HT->query("select
ic_id, is_id, ic_url,ic_url_title,ic_title,is_path,is_level,ic_status ic_id, is_id, ic_url,ic_url_title,ic_title,is_path,is_level,ic_status
@ -202,7 +215,6 @@ class Information_model extends CI_Model {
'ic_url_title' => $path_row->ic_url_title 'ic_url_title' => $path_row->ic_url_title
]; ];
$path_list[] = $path_array; $path_list[] = $path_array;
} }
} }
@ -210,7 +222,8 @@ class Information_model extends CI_Model {
} }
//根据路径获取某一级别节点详细页 //根据路径获取某一级别节点详细页
function get_detail_by_path($path, $level) { function get_detail_by_path($path, $level)
{
$this->init(); $this->init();
$this->topNum = 1; $this->topNum = 1;
$this->level = " AND is1.is_level= '$level' "; $this->level = " AND is1.is_level= '$level' ";
@ -219,7 +232,8 @@ class Information_model extends CI_Model {
return $this->GetList(); return $this->GetList();
} }
//根据节点ID列表获取信息 //根据节点ID列表获取信息
function get_detail_by_ids($is_ids) { function get_detail_by_ids($is_ids)
{
$this->init(); $this->init();
$this->is_id_array = " AND is1.is_id IN ($is_ids) "; $this->is_id_array = " AND is1.is_id IN ($is_ids) ";
$this->orderBy = ' ORDER BY is1.is_level ASC, is1.is_sort ASC,is1.is_path ASC '; $this->orderBy = ' ORDER BY is1.is_level ASC, is1.is_sort ASC,is1.is_path ASC ';
@ -227,7 +241,8 @@ class Information_model extends CI_Model {
} }
//根据根节点ID获取子节点列表 //根据根节点ID获取子节点列表
function get_list_by_id($is_parent_id, $level = false) { function get_list_by_id($is_parent_id, $level = false)
{
$this->init(); $this->init();
if ($level !== false) { if ($level !== false) {
$this->level = " AND is1.is_level= '$level' "; $this->level = " AND is1.is_level= '$level' ";
@ -238,7 +253,8 @@ class Information_model extends CI_Model {
} }
function Detail($ic_url_is_id,$filed='') { function Detail($ic_url_is_id, $filed = '')
{
if (empty($ic_url_is_id)) { if (empty($ic_url_is_id)) {
return false; return false;
} }
@ -252,7 +268,8 @@ class Information_model extends CI_Model {
return $this->GetList(); return $this->GetList();
} }
function detail_by_ic_id($ic_id) { function detail_by_ic_id($ic_id)
{
if (empty($ic_id)) { if (empty($ic_id)) {
return false; return false;
} }
@ -262,7 +279,8 @@ class Information_model extends CI_Model {
return $this->GetList(); return $this->GetList();
} }
function GetList($filed = "", $site_code = "") { function GetList($filed = "", $site_code = "")
{
$this->topNum ? $sql = "SELECT TOP " . $this->topNum : $sql = "SELECT "; $this->topNum ? $sql = "SELECT TOP " . $this->topNum : $sql = "SELECT ";
if (empty($filed)) { if (empty($filed)) {
$sql .= " is1.is_id, \n" $sql .= " is1.is_id, \n"
@ -340,7 +358,8 @@ class Information_model extends CI_Model {
} }
//根据区域信息获取根节点 //根据区域信息获取根节点
function GetRoot($ic_ht_area_type, $ic_ht_area_id) { function GetRoot($ic_ht_area_type, $ic_ht_area_id)
{
$sql = "SELECT TOP 1 is1.is_id, \n" $sql = "SELECT TOP 1 is1.is_id, \n"
. " is1.is_parent_id, \n" . " is1.is_parent_id, \n"
. " is1.is_path, \n" . " is1.is_path, \n"
@ -366,7 +385,8 @@ class Information_model extends CI_Model {
} }
//根据信息树id获取省份代号 //根据信息树id获取省份代号
public function get_province_by_isid($is_id) { public function get_province_by_isid($is_id)
{
$sql = " SELECT top 1 CII_PRI_SN $sql = " SELECT top 1 CII_PRI_SN
FROM infoStructures is1 FROM infoStructures is1
INNER JOIN infoContents ic ON ic.ic_id = is1.is_ic_id INNER JOIN infoContents ic ON ic.ic_id = is1.is_ic_id
@ -382,7 +402,8 @@ class Information_model extends CI_Model {
} }
//获取结构列表 //获取结构列表
function StructureList($is_id) { function StructureList($is_id)
{
$sql = "SELECT is1.is_id AS id, \n" $sql = "SELECT is1.is_id AS id, \n"
. " is1.is_parent_id AS pId, \n" . " is1.is_parent_id AS pId, \n"
. " ISNULL(ic.ic_url_title,'New Information') AS name , \n" . " ISNULL(ic.ic_url_title,'New Information') AS name , \n"
@ -403,7 +424,8 @@ class Information_model extends CI_Model {
} }
//检测链接是否重复 //检测链接是否重复
function URLcheck($is_id, $ic_url) { function URLcheck($is_id, $ic_url)
{
$sql = "SELECT TOP 1 is1.is_id \n" $sql = "SELECT TOP 1 is1.is_id \n"
. "FROM infoStructures is1 \n" . "FROM infoStructures is1 \n"
. " INNER JOIN infoContents ic ON ic.ic_id = is1.is_ic_id \n" . " INNER JOIN infoContents ic ON ic.ic_id = is1.is_ic_id \n"
@ -420,15 +442,16 @@ class Information_model extends CI_Model {
} }
//获取没有绑定的景点列表 //获取没有绑定的景点列表
function get_unlink_landscape_list($city_id) { function get_unlink_landscape_list($city_id)
{
$sql = "SELECT TOP 8 lsi.LSI_SN, \n" $sql = "SELECT TOP 8 lsi.LSI_SN, \n"
. " lsi.LSI_City, \n" . " lsi.LSI_City, \n"
. " lsi2.LSI2_Name, \n" . " lsi2.LSI2_Name, \n"
. " ci2.CII2_Name \n" . " ci2.CII2_Name \n"
. "FROM LandScapeInfo lsi \n" . "FROM tourmanager.dbo.LandScapeInfo lsi \n"
. " INNER JOIN LandScapeInfo2 lsi2 ON lsi2.LSI2_LSI_SN = lsi.LSI_SN \n" . " INNER JOIN tourmanager.dbo.LandScapeInfo2 lsi2 ON lsi2.LSI2_LSI_SN = lsi.LSI_SN \n"
. " AND lsi2.LSI2_LGC = ? \n" . " AND lsi2.LSI2_LGC = ? \n"
. " INNER JOIN CItyInfo2 ci2 ON ci2.CII2_CII_SN = lsi.LSI_City \n" . " INNER JOIN tourmanager.dbo.CItyInfo2 ci2 ON ci2.CII2_CII_SN = lsi.LSI_City \n"
. " AND ci2.CII2_LGC = ? \n" . " AND ci2.CII2_LGC = ? \n"
. "WHERE lsi.LSI_Publish = 1 \n" . "WHERE lsi.LSI_Publish = 1 \n"
. " AND (lsi.LSI_ParentSN IS NULL OR lsi.LSI_ParentSN = 0) \n" . " AND (lsi.LSI_ParentSN IS NULL OR lsi.LSI_ParentSN = 0) \n"
@ -446,7 +469,8 @@ class Information_model extends CI_Model {
} }
//获取根节点列表 //获取根节点列表
function root_type_list() { function root_type_list()
{
$this->init(); $this->init();
$this->orderBy = " ORDER BY ic.ic_url_title ASC "; $this->orderBy = " ORDER BY ic.ic_url_title ASC ";
$this->level = " AND is1.is_level=1 "; $this->level = " AND is1.is_level=1 ";
@ -456,7 +480,8 @@ class Information_model extends CI_Model {
} }
//获取某个信息类型详情 //获取某个信息类型详情
function get_type_detail($type_name, $area_type, $area_id) { function get_type_detail($type_name, $area_type, $area_id)
{
$this->init(); $this->init();
$this->topNum = 1; $this->topNum = 1;
$this->orderBy = " ORDER BY is1.is_level ASC "; $this->orderBy = " ORDER BY is1.is_level ASC ";
@ -467,7 +492,8 @@ class Information_model extends CI_Model {
} }
//获取3年未更新的信息 //获取3年未更新的信息
function get_oldest_info($yeardiff = 3, $has_no_pub = true, $empty_info = true) { function get_oldest_info($yeardiff = 3, $has_no_pub = true, $empty_info = true)
{
$has_no_pub ? $sql_no_pub = '' : $sql_no_pub = "AND ic_status = 1"; $has_no_pub ? $sql_no_pub = '' : $sql_no_pub = "AND ic_status = 1";
$empty_info ? $sql_empty_info = '' : $sql_empty_info = "AND datalength(ic_content) > 0"; $empty_info ? $sql_empty_info = '' : $sql_empty_info = "AND datalength(ic_content) > 0";
//sql //sql
@ -545,7 +571,8 @@ class Information_model extends CI_Model {
} }
//获取分组列表 //获取分组列表
function group_list(){ function group_list()
{
$this->init(); $this->init();
$this->search = ' AND is_level<=1 '; $this->search = ' AND is_level<=1 ';
$this->orderBy = ' ORDER BY is1.is_level ASC, is1.is_sort ASC,ic.ic_title ASC,is1.is_path ASC '; $this->orderBy = ' ORDER BY is1.is_level ASC, is1.is_sort ASC,ic.ic_title ASC,is1.is_path ASC ';
@ -555,7 +582,8 @@ class Information_model extends CI_Model {
/** /**
* CT 获取当前页面的面包屑,不包括当前节点,去除链接为空及不发布的节点 * CT 获取当前页面的面包屑,不包括当前节点,去除链接为空及不发布的节点
*/ */
function get_path_exclude_ct($is_id, $path) { function get_path_exclude_ct($is_id, $path)
{
$site_code = $this->config->item('site_code'); $site_code = $this->config->item('site_code');
$path_query = $this->HT->query("select $path_query = $this->HT->query("select
ic_id, is_id, ic_url,ic_url_title,ic_title,is_path,is_level,ic_status ic_id, is_id, ic_url,ic_url_title,ic_title,is_path,is_level,ic_status
@ -599,8 +627,7 @@ class Information_model extends CI_Model {
'ic_url_title' => $top_group['ic_url_title'] 'ic_url_title' => $top_group['ic_url_title']
]; ];
$path_list[] = $path_array; $path_list[] = $path_array;
} } else if ($path_row->ic_status === 1) {
else if ($path_row->ic_status === 1) {
$path_array = [ $path_array = [
'ic_id' => $path_row->ic_id, 'ic_id' => $path_row->ic_id,
'is_id' => $path_row->is_id, 'is_id' => $path_row->is_id,
@ -609,11 +636,9 @@ class Information_model extends CI_Model {
'ic_url_title' => $path_row->ic_url_title 'ic_url_title' => $path_row->ic_url_title
]; ];
$path_list[] = $path_array; $path_list[] = $path_array;
} }
} }
return $path_list; return $path_list;
} }
} }

@ -16,10 +16,10 @@ class Landscape_model extends CI_Model
. " lsi.LSI_City, \n" . " lsi.LSI_City, \n"
. " lsi2.LSI2_Name, \n" . " lsi2.LSI2_Name, \n"
. " ci2.CII2_Name \n" . " ci2.CII2_Name \n"
. "FROM LandScapeInfo lsi \n" . "FROM tourmanager.dbo.LandScapeInfo lsi \n"
. " INNER JOIN LandScapeInfo2 lsi2 ON lsi2.LSI2_LSI_SN = lsi.LSI_SN \n" . " INNER JOIN tourmanager.dbo.LandScapeInfo2 lsi2 ON lsi2.LSI2_LSI_SN = lsi.LSI_SN \n"
. " AND lsi2.LSI2_LGC = ? \n" . " AND lsi2.LSI2_LGC = ? \n"
. " INNER JOIN CItyInfo2 ci2 ON ci2.CII2_CII_SN = lsi.LSI_City \n" . " INNER JOIN tourmanager.dbo.CItyInfo2 ci2 ON ci2.CII2_CII_SN = lsi.LSI_City \n"
. " AND ci2.CII2_LGC = ? \n" . " AND ci2.CII2_LGC = ? \n"
. "WHERE lsi.LSI_Publish = 1 \n" . "WHERE lsi.LSI_Publish = 1 \n"
. " AND (lsi.LSI_ParentSN IS NULL OR lsi.LSI_ParentSN = 0) \n" . " AND (lsi.LSI_ParentSN IS NULL OR lsi.LSI_ParentSN = 0) \n"
@ -42,13 +42,10 @@ class Landscape_model extends CI_Model
. " AND lsi.LSI_SN = ?"; . " AND lsi.LSI_SN = ?";
$query = $this->HT->query($sql, array($this->config->item('site_lgc'), $this->config->item('site_lgc'), $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); //print_r($this->HT->queries);
if ($query->result()) if ($query->result()) {
{
$row = $query->row(); $row = $query->row();
return $row->LSI2_Name; return $row->LSI2_Name;
} } else {
else
{
return FALSE; return FALSE;
} }
} }
@ -73,16 +70,11 @@ class Landscape_model extends CI_Model
. " AND (lsi.LSI_ParentSN IS NULL OR lsi.LSI_ParentSN = 0) \n" . " AND (lsi.LSI_ParentSN IS NULL OR lsi.LSI_ParentSN = 0) \n"
. " AND lsi.LSI_SN = ?"; . " AND lsi.LSI_SN = ?";
$query = $this->HT->query($sql, array($this->config->item('site_lgc'), $this->config->item('site_lgc'), $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) if ($query->num_rows() > 0) {
{
$row = $query->row(); $row = $query->row();
return $row; return $row;
} } else {
else
{
return FALSE; return FALSE;
} }
} }
} }
Loading…
Cancel
Save