|
|
|
@ -5,12 +5,12 @@ if (!defined('BASEPATH'))
|
|
|
|
|
|
|
|
|
|
class Note_model extends CI_Model {
|
|
|
|
|
|
|
|
|
|
var $topnum = false;
|
|
|
|
|
var $orderby = false;
|
|
|
|
|
var $send = false;
|
|
|
|
|
var $search = false;
|
|
|
|
|
var $dealId = false;
|
|
|
|
|
var $payment_status = false;
|
|
|
|
|
var $topnum = null;
|
|
|
|
|
var $orderby = null;
|
|
|
|
|
var $send = null;
|
|
|
|
|
var $search = null;
|
|
|
|
|
var $dealId = null;
|
|
|
|
|
var $payment_status = null;
|
|
|
|
|
|
|
|
|
|
function __construct() {
|
|
|
|
|
parent::__construct();
|
|
|
|
@ -18,12 +18,12 @@ class Note_model extends CI_Model {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function init() {
|
|
|
|
|
$this->topnum = false;
|
|
|
|
|
$this->send = false;
|
|
|
|
|
$this->search = false;
|
|
|
|
|
$this->payment_status = false;
|
|
|
|
|
$this->dealId = false;
|
|
|
|
|
$this->orderby = ' ORDER BY pn.IPL_sn DESC ';
|
|
|
|
|
$this->topnum = null;
|
|
|
|
|
$this->send = null;
|
|
|
|
|
$this->search = null;
|
|
|
|
|
$this->payment_status = null;
|
|
|
|
|
$this->dealId = null;
|
|
|
|
|
$this->orderby = ' ORDER BY IPL_sn DESC ';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function unsend($topnum = 2) {
|
|
|
|
@ -42,16 +42,16 @@ class Note_model extends CI_Model {
|
|
|
|
|
|
|
|
|
|
public function search_date($date) {
|
|
|
|
|
$this->init();
|
|
|
|
|
$search_sql = " AND (pn.IPL_noticeTime BETWEEN '$date 00:00:00' AND '$date 23:59:59' or IPL_sent<>'send') ";
|
|
|
|
|
$search_sql = " AND (IPL_noticeTime BETWEEN '$date 00:00:00' AND '$date 23:59:59' or IPL_sent<>'send') ";
|
|
|
|
|
$this->search = $search_sql;
|
|
|
|
|
$this->orderby=" ORDER BY CASE pn.IPL_sent WHEN 'sendfail' THEN 1 ELSE 2 END ,pn.IPL_sn DESC ";
|
|
|
|
|
$this->orderby=" ORDER BY IPL_sent DESC ,IPL_sn DESC ";
|
|
|
|
|
return $this->get_list();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function note($txn_id){
|
|
|
|
|
$this->init();
|
|
|
|
|
$this->topnum=1;
|
|
|
|
|
$this->dealId=" AND pn.IPL_dealId=".$this->INFO->escape($txn_id);
|
|
|
|
|
$this->dealId=" AND IPL_dealId=".$this->INFO->escape($txn_id);
|
|
|
|
|
return $this->get_list();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -59,7 +59,7 @@ class Note_model extends CI_Model {
|
|
|
|
|
{
|
|
|
|
|
$this->init();
|
|
|
|
|
$this->topnum=1;
|
|
|
|
|
$this->dealId=" AND pn.IPL_orderId=".$this->INFO->escape($orderid)." AND pn.IPL_noticeTime=".$this->INFO->escape($notice_time);
|
|
|
|
|
$this->dealId=" AND IPL_orderId=".$this->INFO->escape($orderid)." AND IPL_noticeTime=".$this->INFO->escape($notice_time);
|
|
|
|
|
return $this->get_list();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -69,9 +69,9 @@ class Note_model extends CI_Model {
|
|
|
|
|
$search_sql = '';
|
|
|
|
|
$search_key = trim($search_key);
|
|
|
|
|
if (!empty($search_key)) {
|
|
|
|
|
$search_sql.=" AND ( pn.IPL_dealId = '$search_key'
|
|
|
|
|
OR pn.IPL_orderId like '%$search_key%'
|
|
|
|
|
OR pn.IPL_memo like '%$search_key%' )";
|
|
|
|
|
$search_sql.=" AND ( IPL_dealId = '$search_key'
|
|
|
|
|
OR IPL_orderId like '%$search_key%'
|
|
|
|
|
OR IPL_memo like '%$search_key%' )";
|
|
|
|
|
}
|
|
|
|
|
$this->search = $search_sql;
|
|
|
|
|
return $this->get_list();
|
|
|
|
@ -81,7 +81,7 @@ class Note_model extends CI_Model {
|
|
|
|
|
{
|
|
|
|
|
$this->init();
|
|
|
|
|
$this->topnum = 1;
|
|
|
|
|
$this->search = " AND pn.IPL_dealId = '".$dealId."' ";
|
|
|
|
|
$this->search = " AND IPL_dealId = '".$dealId."' ";
|
|
|
|
|
return $this->get_list();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -124,31 +124,23 @@ class Note_model extends CI_Model {
|
|
|
|
|
public function get_list() {
|
|
|
|
|
$this->topnum ? $sql = "SELECT TOP " . $this->topnum : $sql = "SELECT ";
|
|
|
|
|
$sql .= "
|
|
|
|
|
pn.IPL_sn
|
|
|
|
|
,pn.IPL_dealId
|
|
|
|
|
,pn.IPL_orderId
|
|
|
|
|
,pn.IPL_currencyCode
|
|
|
|
|
,pn.IPL_orderAmount
|
|
|
|
|
,pn.IPL_payAmount
|
|
|
|
|
,pn.IPL_stateCode
|
|
|
|
|
,pn.IPL_resultCode
|
|
|
|
|
,pn.IPL_resultMsg
|
|
|
|
|
,pn.IPL_acquiringTime
|
|
|
|
|
,pn.IPL_completeTime
|
|
|
|
|
,pn.IPL_memo
|
|
|
|
|
,pn.IPL_sent
|
|
|
|
|
,pn.IPL_payType
|
|
|
|
|
,pn.IPL_noticeTime
|
|
|
|
|
,pn.IPL_payerName
|
|
|
|
|
,pn.IPL_payerEmail
|
|
|
|
|
pn.*
|
|
|
|
|
FROM IPayLinksLog pn
|
|
|
|
|
WHERE 1=1
|
|
|
|
|
AND IPL_stateCode<>3
|
|
|
|
|
";
|
|
|
|
|
$this->send ? $sql.=$this->send : false;
|
|
|
|
|
$this->search ? $sql.=$this->search : false;
|
|
|
|
|
$this->dealId ? $sql.=$this->dealId : false;
|
|
|
|
|
$this->orderby ? $sql.=$this->orderby : false;
|
|
|
|
|
and pn.IPL_payType='pay'
|
|
|
|
|
and (pn.IPL_stateCode=2 or pn.IPL_resultCode='0000')
|
|
|
|
|
$this->send
|
|
|
|
|
$this->search
|
|
|
|
|
$this->dealId
|
|
|
|
|
UNION ALL
|
|
|
|
|
select * from InfoManager.dbo.IPayLinksLog ipl2
|
|
|
|
|
where 1=1
|
|
|
|
|
and ipl2.IPL_payType='refund'
|
|
|
|
|
and ipl2.IPL_stateCode=2
|
|
|
|
|
$this->search
|
|
|
|
|
$this->dealId
|
|
|
|
|
$this->orderby
|
|
|
|
|
";
|
|
|
|
|
$query = $this->INFO->query($sql);
|
|
|
|
|
if ($this->topnum === 1) {
|
|
|
|
|
if ($query->num_rows() > 0) {
|
|
|
|
@ -197,7 +189,7 @@ class Note_model extends CI_Model {
|
|
|
|
|
$sql = "IF NOT EXISTS(
|
|
|
|
|
SELECT TOP 1 1
|
|
|
|
|
FROM IPayLinksLog
|
|
|
|
|
WHERE IPL_dealId = ?
|
|
|
|
|
WHERE IPL_dealId = ? AND IPL_payType='refund'
|
|
|
|
|
)
|
|
|
|
|
INSERT INTO IPayLinksLog
|
|
|
|
|
(
|
|
|
|
@ -277,8 +269,8 @@ class Note_model extends CI_Model {
|
|
|
|
|
public function date_range($from, $to, $currency=NULL)
|
|
|
|
|
{
|
|
|
|
|
$this->init();
|
|
|
|
|
$search_sql = " AND pn.IPL_resultCode='0000' ";
|
|
|
|
|
$search_sql .= " AND pn.IPL_acquiringTime BETWEEN '$from 00:00:00' AND '$to 23:59:59' ";
|
|
|
|
|
$search_sql = " AND IPL_resultCode='0000' ";
|
|
|
|
|
$search_sql .= " AND IPL_acquiringTime BETWEEN '$from 00:00:00' AND '$to 23:59:59' ";
|
|
|
|
|
if ( ! empty($currency)) {
|
|
|
|
|
$search_sql .= " AND IPL_currencyCode = '$currency' ";
|
|
|
|
|
}
|
|
|
|
@ -287,4 +279,11 @@ class Note_model extends CI_Model {
|
|
|
|
|
return $this->get_list();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function test()
|
|
|
|
|
{
|
|
|
|
|
$sql = " ";
|
|
|
|
|
$this->INFO->query($sql);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|