diff --git a/webht/third_party/pay/config/wxpay.php b/webht/third_party/pay/config/wxpay.php
index ac42b017..2f0f4888 100644
--- a/webht/third_party/pay/config/wxpay.php
+++ b/webht/third_party/pay/config/wxpay.php
@@ -4,6 +4,7 @@ $config["trade_type"] = "NATIVE";
$config["currency"] = "CNY";
$config["currency_unit"] = 100;
$config["method_code"] = 15016;
+$config["send_notify_url"] = "https://www.mycht.cn/webht.php/apps/pay/paymentservice/send_notify";
/*!
* 各账号的设置
*/
diff --git a/webht/third_party/pay/controllers/PaymentService.php b/webht/third_party/pay/controllers/PaymentService.php
index f75ef175..df8bd6b7 100644
--- a/webht/third_party/pay/controllers/PaymentService.php
+++ b/webht/third_party/pay/controllers/PaymentService.php
@@ -32,6 +32,27 @@ class PaymentService extends CI_Controller {
} else {
$data['notelist'] = $this->note_model->search_date($data['date']);
}
+ array_walk($data["notelist"], function(&$ele, $key)
+ {
+ $ele->brand_name = "none";
+ switch ($ele->OPN_accountMethod) {
+ case '15016':
+ $ele->brand_name = "WeChat";
+ break;
+ case '15010':
+ case '15002':
+ $ele->brand_name = "PayPal";
+ break;
+ case '15018':
+ $ele->brand_name = "Credit Card";
+ break;
+ case '15015':
+ $ele->brand_name = "Alipay";
+ break;
+ default:
+ break;
+ }
+ });
/**
* 导出记录用的记录节点
@@ -56,6 +77,7 @@ class PaymentService extends CI_Controller {
public function send_notify($opn_id=NULL, $old_ssje=NULL)
{
ignore_user_abort(true);
+ $output = "处理交易记录:
";
$data = array();
$show_index = 0;
//优先处理指定的交易号,用于修正交易号直接发送通知
@@ -254,11 +276,12 @@ class PaymentService extends CI_Controller {
//显示处理记录
if (empty($opn_id)) {
- echo ++$show_index . ' ' . $item->OPN_transactionId . '
';
+ $output .= (++$show_index) . ' ' . $item->OPN_transactionId . '
';
}
}
- return;
+ echo $output;
+ return $output;
// return $this->output->set_content_type('application/json')->set_output(json_encode($data));
}
diff --git a/webht/third_party/pay/controllers/WxpayService.php b/webht/third_party/pay/controllers/WxpayService.php
index ff844983..b7268920 100644
--- a/webht/third_party/pay/controllers/WxpayService.php
+++ b/webht/third_party/pay/controllers/WxpayService.php
@@ -91,6 +91,7 @@ class WxpayService extends CI_Controller {
foreach ($all_account as $account) {
$this->download_bill($account);
}
+ async_curl($this->config->item('send_notify_url', 'wxpay'));
return;
}
diff --git a/webht/third_party/pay/helpers/payment_helper.php b/webht/third_party/pay/helpers/payment_helper.php
index 27ff11e9..6eb7f5b7 100644
--- a/webht/third_party/pay/helpers/payment_helper.php
+++ b/webht/third_party/pay/helpers/payment_helper.php
@@ -1,17 +1,17 @@
$v)
- {
- $temp[$k] = explode(",",$v); //再将拆开的数组重新组装
- }
- return $temp;
+ foreach ($array2D as $v)
+ {
+ $v = join(",",$v); //降维,也可以用implode,将一维数组转换为用逗号连接的字符串
+ $temp[] = $v;
+ }
+ $temp = array_unique($temp); //去掉重复的字符串,也就是重复的一维数组
+ foreach ($temp as $k => $v)
+ {
+ $temp[$k] = explode(",",$v); //再将拆开的数组重新组装
+ }
+ return $temp;
}
function my_array_unique($array, $keep_key_assoc = false)
@@ -39,30 +39,69 @@ function my_array_unique($array, $keep_key_assoc = false)
//根据URL获取月份
function getaqiMonth($url){
- $monArr = array('January','February','March','April','May','June','July','August','September','October','November','December');
- $monObj = array(
- 'January' => '01',
- 'February' => '02',
- 'March' => '03',
- 'April' => '04',
- 'May' => '05' ,
- 'June' => '06',
- 'July' => '07',
- 'August' => '08',
- 'September' => '09',
- 'October' => '10',
- 'November' => '11',
- 'December' => '12');
- $urlarr = explode("/",$url);
- $tmp = $urlarr[(count($urlarr)-1)];
- $tmp = ucfirst(str_ireplace('.htm','',$tmp));
- //$d=strtotime("00:01am ".$tmp." 15 2015");
- if(in_array($tmp,$monArr)){
- return $monObj[$tmp];
- }else{
- return false;
- }
+ $monArr = array('January','February','March','April','May','June','July','August','September','October','November','December');
+ $monObj = array(
+ 'January' => '01',
+ 'February' => '02',
+ 'March' => '03',
+ 'April' => '04',
+ 'May' => '05' ,
+ 'June' => '06',
+ 'July' => '07',
+ 'August' => '08',
+ 'September' => '09',
+ 'October' => '10',
+ 'November' => '11',
+ 'December' => '12');
+ $urlarr = explode("/",$url);
+ $tmp = $urlarr[(count($urlarr)-1)];
+ $tmp = ucfirst(str_ireplace('.htm','',$tmp));
+ //$d=strtotime("00:01am ".$tmp." 15 2015");
+ if(in_array($tmp,$monArr)){
+ return $monObj[$tmp];
+ }else{
+ return false;
+ }
}
+/*!
+ * @Author: LYT
+ * @Date: 2019-06-27 10:32:11
+ * @Desc: 异步的curl,1秒超时,被请求的地址需要设置: ignore_user_abort(true);
+ */
+function async_curl($url, $second = 1)
+{
+ $ch = curl_init();
+ $curlVersion = curl_version();
+ $ua = "Webht (".PHP_OS.") PHP/".PHP_VERSION." CURL/".$curlVersion['version']." " . "AsyncJob";
+ //设置超时
+ curl_setopt($ch, CURLOPT_TIMEOUT, $second);
+ curl_setopt($ch,CURLOPT_URL, $url);
+ if(stripos($url,"https://")!==FALSE){
+ curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
+ curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
+ curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
+ } else {
+ curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,TRUE);
+ curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,2);//严格校验
+ }
+ curl_setopt($ch,CURLOPT_USERAGENT, $ua);
+ //设置header
+ curl_setopt($ch, CURLOPT_HEADER, FALSE);
+ //要求结果为字符串且输出到屏幕上
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
+
+ //运行curl
+ $data = curl_exec($ch);
+ if (curl_errno($ch) && !in_array(curl_errno($ch),array(0,28)) ) {
+ log_message('error',"Webht Async Curl Call 出错,错误码:" . curl_errno($ch) . ": " . curl_error($ch) . ", url: " . $url);
+ }
+ if (!in_array(curl_getinfo($ch, CURLINFO_HTTP_CODE),array(0,200)) ) {
+ log_message('error', "Webht Async Curl Call Request html Status Code: ".curl_getinfo($ch, CURLINFO_HTTP_CODE)."; curl url: ".$url);
+ }
+ curl_close($ch);
+ return $data;
+}
+
/*
* 把数组元素组合为字符串
* $container:用来包含元素的符号
diff --git a/webht/third_party/pay/libraries/wxpay_call.php b/webht/third_party/pay/libraries/wxpay_call.php
index f493e7f0..85f29fdd 100644
--- a/webht/third_party/pay/libraries/wxpay_call.php
+++ b/webht/third_party/pay/libraries/wxpay_call.php
@@ -164,6 +164,7 @@ class Wxpay_call
log_message('error',"curl出错,错误码:$error " . curl_error($ch));
curl_close($ch);
}
+ return;
}
diff --git a/webht/third_party/pay/views/payment_list.php b/webht/third_party/pay/views/payment_list.php
index 87fcf563..b568e59e 100644
--- a/webht/third_party/pay/views/payment_list.php
+++ b/webht/third_party/pay/views/payment_list.php
@@ -21,6 +21,12 @@
.search-btn{cursor: pointer; background: url(//data.chinahighlights.com/css/images/global/site-search-button.png) no-repeat center center;}
.input-check{width: 20px;height: 20px;}
label span{vertical-align: super;}
+ .brand_text {color: #fff; padding: 2px 3px; border-radius: 4px;font-style: italic;}
+ /* .wechat-color {background-color: #00C800;} */
+ .wechat-color {background-color: #62B900;}
+ .paypal-color {background-color: #002D89;}
+ .alipay-color {background-color: #00AAEE;}
+ .ipaylinks-color,.creditcard-color {background-color: #A31022;}