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.
89 lines
2.8 KiB
PHP
89 lines
2.8 KiB
PHP
<?php
|
|
|
|
class wwwlogs_model extends CI_Model
|
|
{
|
|
|
|
public $topnum = false; //返回记录数
|
|
public $orderby = false;
|
|
public $where = false; //查询条件
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->HT = $this->load->database('HT', true);
|
|
$this->INFO = $this->load->database('INFO', true);
|
|
}
|
|
|
|
public function init()
|
|
{
|
|
$this->topnum = false;
|
|
$this->where = false;
|
|
$this->orderby = ' order by COLI_ApplyDate desc ';
|
|
}
|
|
|
|
public function detail($psd_URL, $psd_SiteCode)
|
|
{
|
|
$this->init();
|
|
$this->topnum = 1;
|
|
$this->where = ' AND psd.psd_URL=N' . $this->INFO->escape($psd_URL);
|
|
$this->where .= ' AND psd.psd_SiteCode=' . $this->INFO->escape($psd_SiteCode);
|
|
return $this->get_list();
|
|
}
|
|
|
|
public function add($table, $data)
|
|
{
|
|
if ($this->INFO->insert($table, $data)) {
|
|
return $this->INFO->last_id($table);
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public function get_update_list($topnum = 10)
|
|
{
|
|
$this->init();
|
|
$this->topnum = $topnum;
|
|
$this->orderby = ' order by COLI_SN desc ';
|
|
return $this->get_list();
|
|
}
|
|
|
|
public function update($table, $data, $where)
|
|
{
|
|
$this->INFO->update($table, $data, $where);
|
|
}
|
|
|
|
//删除数据
|
|
// public function delete($psd_id) {
|
|
// $sql = " DELETE FROM PageSpeedData WHERE psd_id=? ";
|
|
// return $this->INFO->query($sql, array($psd_id));
|
|
// }
|
|
|
|
public function get_list()
|
|
{
|
|
$this->topnum ? $sql = "SELECT TOP " . $this->topnum : $sql = "SELECT ";
|
|
$sql .= "
|
|
COLI_SN,COLI_ID, COLI_WebCode,COLI_Name, COLI_OrderDetailText, COLI_OrderStartDate,COLI_SenderIP,COLI_WebCode,COLI_ApplyDate from ConfirmLineInfo
|
|
where 1=1
|
|
and COLI_WebCode in ('cht','ah','gh','ct','yz','sht','gl','gm','jp','ru','it','vac','vc','gmhw','jphw','ruhw','ithw','vachw','vchw','gh_vac','gh_vc','gh_jp','gh_ru','gh_it','gh_gm','ghtobzg','ghtobhw')
|
|
and not exists (select top 1 1 from InfoManager.dbo.wwwlogs where wl_COLI_SN=COLI_SN )
|
|
and COLI_SenderIP is not null
|
|
and DeleteFlag=0
|
|
and COLI_ApplyDate>=DATEADD(day,-7,GETDATE())
|
|
";
|
|
$this->where ? $sql .= $this->where : false;
|
|
$this->orderby ? $sql .= $this->orderby : false;
|
|
$query = $this->HT->query($sql);
|
|
// print_r($this->INFO->queries);
|
|
if ($this->topnum === 1) {
|
|
if ($query->num_rows() > 0) {
|
|
$row = $query->row();
|
|
return $row;
|
|
} else {
|
|
return false;
|
|
}
|
|
} else {
|
|
return $query->result();
|
|
}
|
|
}
|
|
|
|
} |