@ -257,18 +257,24 @@ class IPayLinksService extends CI_Controller
return;
}
public function query_pay($orderid,$ day_offset = 3)
public function query_pay($day_offset = 3, $orderid=NULL )
{
$this->query_info_arr["queryOrderId"] = $this->create_guid();
$this->query_info_arr["orderId"] = $orderid;
$this->query_info_arr["beginTime"] = date('YmdHis',strtotime("-$day_offset days"));
$this->query_info_arr["endTime"] = date('YmdHis',strtotime("+$day_offset days"));
$this->query_info_arr["mode"] = 1 ;
$this->query_info_arr["mode"] = 2 ;
$this->query_info_arr["signMsg"] = $this->generate_sign($this->query_info_arr);
$resp = $this->curl($this->queryUrl,$this->query_info_arr);
// echo $resp;
var_export($resp);
$resp_obj = simplexml_load_string($resp);
foreach ($resp_obj->details->detail as $key => $query_order) {
$order = new stdClass();
$order->check = true;
$order->data = $query_order;
$this->ipaylinks_notice($order);
}
// $this->output->set_content_type('application/json')->set_output(json_encode(simplexml_load_string($resp)));
return;
}
@ -335,7 +341,7 @@ class IPayLinksService extends CI_Controller
foreach ($data['unsend_list'] as $item) {
//已经发送的不处理,防止重复发送
if ($item->IPL_sent == 'send') {
if ($item->IPL_sent == 'send' & & empty($pn_txn_id) ) {
continue;
}
@ -346,7 +352,7 @@ class IPayLinksService extends CI_Controller
}
//只处理完成状态,其他状态由陆燕处理
if (strcmp(trim($item->IPL_resultCode), "0000")) {
if (strcmp(trim($item->IPL_resultCode), "0000") & & empty($pn_txn_id) ) {
$this->Note_model->update_send($item->IPL_dealId, 'send');
continue;
}
@ -384,7 +390,6 @@ class IPayLinksService extends CI_Controller
$this->Note_model->update_send($item->IPL_dealId, 'send');
continue;
}
//添加支付信息入库
//没有分配订单之前先添加付款记录,这个过程可能会执行多次,必须在添加记录前查找是否有数据
if (!empty($orderid_info)) {
@ -417,12 +422,14 @@ class IPayLinksService extends CI_Controller
$item->IPL_dealId,
$ht_memo
);
// 更新订单主表付款方式,防止没访问thankyou-train.asp
$this->IPayLinks_model->update_paymanner($GAI_COLI_SN);
if ($advisor_info->COLI_Department == 10) {
// 把订单状态设置为13-新订单已支付
$this->IPayLinks_model->update_biz_coli_state($GAI_COLI_SN, 13);
}
// 更新订单主表付款方式,防止没访问thankyou-train.asp
if (empty($advisor_info->COLI_PayManner)) {
$this->IPayLinks_model->update_paymanner($GAI_COLI_SN);
}
}
}
//更新还没有填的客邮和交易号de收款记录( 传统订单)
@ -476,9 +483,8 @@ class IPayLinksService extends CI_Controller
$subject2 = $orderid_info->orderid . '_' . $orderid_info->ordertype . ' / ' . $item->IPL_orderAmount . $item->IPL_currencyCode . ' / China Highlights';
// lang
$remark_info = json_decode($item->IPL_memo);
$remark_info = json_decode($remark_info->remark);
$ln = $remark_info->ln;
$ln = $ln ? $ln : "en";
(isset($remark_info->remark)) ? $remark_info = json_decode($remark_info->remark) : NULL;
$ln = (isset($remark_info->ln)) ? $remark_info->ln : "en";
$this->lang->load('ipl_common',$ln);
$this->lang->load('ipl_buyer_email',$ln);
$item->text = $this->lang->language;
@ -597,12 +603,12 @@ class IPayLinksService extends CI_Controller
public function ipaylinks_notice($resp=NULL)
{
if ($resp !== NULL) {
$resp_arr = $resp;
$asyns_resp = $ resp_arr = $resp;
} else {
$resp_arr = $this->input->post();
log_message('error','iPayLinks asyn notify: ' . $this->input->post("orderId"));
$asyns_resp = $this->verify_sign($resp_arr);
}
$asyns_resp = $this->verify_sign($resp_arr);
// 未得到结果
if (empty($asyns_resp->data->orderId)) {
echo "200";