hotfix/paypal-note
LMR 2 years ago
parent e0deb7c7d0
commit 78fe1f03cc

@ -1,24 +1,28 @@
<?php <?php
class wwwlogs_model extends CI_Model { class wwwlogs_model extends CI_Model
{
var $topnum = false; //返回记录数 public $topnum = false; //返回记录数
var $orderby = false; public $orderby = false;
var $where = false; //查询条件 public $where = false; //查询条件
function __construct() { public function __construct()
{
parent::__construct(); parent::__construct();
$this->HT = $this->load->database('HT', TRUE); $this->HT = $this->load->database('HT', true);
$this->INFO = $this->load->database('INFO', TRUE); $this->INFO = $this->load->database('INFO', true);
} }
public function init() { public function init()
{
$this->topnum = false; $this->topnum = false;
$this->where = false; $this->where = false;
$this->orderby = ' order by COLI_ApplyDate desc '; $this->orderby = ' order by COLI_ApplyDate desc ';
} }
public function detail($psd_URL, $psd_SiteCode) { public function detail($psd_URL, $psd_SiteCode)
{
$this->init(); $this->init();
$this->topnum = 1; $this->topnum = 1;
$this->where = ' AND psd.psd_URL=N' . $this->INFO->escape($psd_URL); $this->where = ' AND psd.psd_URL=N' . $this->INFO->escape($psd_URL);
@ -26,7 +30,8 @@ class wwwlogs_model extends CI_Model {
return $this->get_list(); return $this->get_list();
} }
public function add($table, $data) { public function add($table, $data)
{
if ($this->INFO->insert($table, $data)) { if ($this->INFO->insert($table, $data)) {
return $this->INFO->last_id($table); return $this->INFO->last_id($table);
} else { } else {
@ -34,13 +39,15 @@ class wwwlogs_model extends CI_Model {
} }
} }
public function get_update_list($topnum = 10) { public function get_update_list($topnum = 10)
{
$this->init(); $this->init();
$this->topnum = $topnum; $this->topnum = $topnum;
return $this->get_list(); return $this->get_list();
} }
public function update($table, $data, $where) { public function update($table, $data, $where)
{
$this->INFO->update($table, $data, $where); $this->INFO->update($table, $data, $where);
} }
@ -50,19 +57,21 @@ class wwwlogs_model extends CI_Model {
// return $this->INFO->query($sql, array($psd_id)); // return $this->INFO->query($sql, array($psd_id));
// } // }
public function get_list() { public function get_list()
{
$this->topnum ? $sql = "SELECT TOP " . $this->topnum : $sql = "SELECT "; $this->topnum ? $sql = "SELECT TOP " . $this->topnum : $sql = "SELECT ";
// 国际暂时不需要从这个里获取 - lmr - 移除 'gm','jp','ru','it','vac','vc'
$sql .= " $sql .= "
COLI_SN,COLI_ID, COLI_WebCode,COLI_Name, COLI_OrderDetailText, COLI_OrderStartDate,COLI_SenderIP,COLI_WebCode,COLI_ApplyDate from ConfirmLineInfo COLI_SN,COLI_ID, COLI_WebCode,COLI_Name, COLI_OrderDetailText, COLI_OrderStartDate,COLI_SenderIP,COLI_WebCode,COLI_ApplyDate from ConfirmLineInfo
where 1=1 where 1=1
and COLI_WebCode in ('cht','ah','gh','ct','yz','sht','gl','gm','jp','ru','it','vac','vc') and COLI_WebCode in ('cht','ah','gh','ct','yz','sht','gl')
and not exists (select top 1 1 from InfoManager.dbo.wwwlogs where wl_COLI_SN=COLI_SN ) and not exists (select top 1 1 from InfoManager.dbo.wwwlogs where wl_COLI_SN=COLI_SN )
and COLI_SenderIP is not null and COLI_SenderIP is not null
and DeleteFlag=0 and DeleteFlag=0
and COLI_ApplyDate>=DATEADD(day,-7,GETDATE()) and COLI_ApplyDate>=DATEADD(day,-7,GETDATE())
"; ";
$this->where ? $sql.=$this->where : false; $this->where ? $sql .= $this->where : false;
$this->orderby ? $sql.=$this->orderby : false; $this->orderby ? $sql .= $this->orderby : false;
$query = $this->HT->query($sql); $query = $this->HT->query($sql);
//print_r($this->INFO->queries); //print_r($this->INFO->queries);
if ($this->topnum === 1) { if ($this->topnum === 1) {
@ -70,7 +79,7 @@ class wwwlogs_model extends CI_Model {
$row = $query->row(); $row = $query->row();
return $row; return $row;
} else { } else {
return FALSE; return false;
} }
} else { } else {
return $query->result(); return $query->result();

Loading…
Cancel
Save