|
|
@ -15,7 +15,7 @@ class Wxpay_call
|
|
|
|
$this->ci =& get_instance();
|
|
|
|
$this->ci =& get_instance();
|
|
|
|
$this->ci->load->helper('payment');
|
|
|
|
$this->ci->load->helper('payment');
|
|
|
|
$this->ci->config->load('wxpay', true);
|
|
|
|
$this->ci->config->load('wxpay', true);
|
|
|
|
// $this->ci->load->model('WxpayQueryContentBuilder', 'query_builder');
|
|
|
|
$this->ci->load->model('WxpayQueryContentBuilder', 'query_builder');
|
|
|
|
$this->merchant_account = $account;
|
|
|
|
$this->merchant_account = $account;
|
|
|
|
bcscale(2);
|
|
|
|
bcscale(2);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -30,6 +30,34 @@ class Wxpay_call
|
|
|
|
// $this->api_info_arr['app_secret'] = $this->wx_site_config['app_secret'];
|
|
|
|
// $this->api_info_arr['app_secret'] = $this->wx_site_config['app_secret'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function query_append_transaction($transaction_id) {
|
|
|
|
|
|
|
|
$ret = [];
|
|
|
|
|
|
|
|
$all_account = explode(",", $this->ci->config->item('all_account', 'wxpay'));
|
|
|
|
|
|
|
|
$this->merchant_account = $all_account[0];
|
|
|
|
|
|
|
|
$this->ci->query_builder->set_transaction_id($transaction_id);
|
|
|
|
|
|
|
|
// var_dump($transaction_id);
|
|
|
|
|
|
|
|
// var_dump($all_account);
|
|
|
|
|
|
|
|
foreach ($all_account as $account) {
|
|
|
|
|
|
|
|
$resultR = $this->query_order_refund($this->ci->query_builder, 0, $account);
|
|
|
|
|
|
|
|
$result = $this->query_order_refund($this->ci->query_builder, 1, $account);
|
|
|
|
|
|
|
|
// var_dump(json_encode($result));
|
|
|
|
|
|
|
|
// var_dump(json_encode($resultR));
|
|
|
|
|
|
|
|
if ($result['status'] === true) {
|
|
|
|
|
|
|
|
$ret = array_merge($ret, $result['data']);
|
|
|
|
|
|
|
|
$this->ci->note_model->add_note_wxpay($result['data'], $account, 'pay');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($resultR['status'] === true) {
|
|
|
|
|
|
|
|
$ret = array_merge($ret, $result['data']);
|
|
|
|
|
|
|
|
$this->ci->note_model->add_note_wxpay($resultR['data'], $account, 'refund');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!empty($ret)) {
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// var_dump($ret);
|
|
|
|
|
|
|
|
return $ret;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function query_order_refund($query_content, $query_refund=0, $account = '')
|
|
|
|
public function query_order_refund($query_content, $query_refund=0, $account = '')
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$ret = array('status'=>false, 'data'=>array());
|
|
|
|
$ret = array('status'=>false, 'data'=>array());
|
|
|
@ -39,16 +67,19 @@ class Wxpay_call
|
|
|
|
$query_content_input = $query_content->getBizContent(true);
|
|
|
|
$query_content_input = $query_content->getBizContent(true);
|
|
|
|
//检测必填参数
|
|
|
|
//检测必填参数
|
|
|
|
if( ! $query_content_input['transaction_id']) {
|
|
|
|
if( ! $query_content_input['transaction_id']) {
|
|
|
|
throw new WxPayException("查询接口中,缺少必填参数 transaction_id !");
|
|
|
|
throw new Exception("查询接口中,缺少必填参数 transaction_id !", 1);
|
|
|
|
|
|
|
|
// throw new WxPayException("查询接口中,缺少必填参数 transaction_id !");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->api_info_arr['nonce_str'] = ($this->get_nonce_str());//随机字符串
|
|
|
|
$this->api_info_arr['nonce_str'] = ($this->get_nonce_str());//随机字符串
|
|
|
|
|
|
|
|
|
|
|
|
$this->api_info_arr['sign'] = $this->make_sign(array_merge($this->api_info_arr, $query_content_input));//签名
|
|
|
|
$this->api_info_arr['sign'] = $this->make_sign(array_merge($this->api_info_arr, $query_content_input));//签名
|
|
|
|
$xml = to_xml(array_merge($this->api_info_arr, $query_content_input));
|
|
|
|
$xml = to_xml(array_merge($this->api_info_arr, $query_content_input));
|
|
|
|
|
|
|
|
// var_dump('api', array_merge($this->api_info_arr, $query_content_input));
|
|
|
|
// log_message('error','test: ' . __CLASS__ . PHP_EOL . var_export(array_merge($this->api_info_arr, $query_content_input), 1));
|
|
|
|
// log_message('error','test: ' . __CLASS__ . PHP_EOL . var_export(array_merge($this->api_info_arr, $query_content_input), 1));
|
|
|
|
|
|
|
|
|
|
|
|
$response = $this->post_xml_curl($this->api_info_arr, $xml, $url, 20);
|
|
|
|
$response = $this->post_xml_curl($this->api_info_arr, $xml, $url, 20);
|
|
|
|
$response_arr = from_xml($response);
|
|
|
|
$response_arr = from_xml($response);
|
|
|
|
|
|
|
|
// var_dump($response_arr);
|
|
|
|
$ret['status'] = $response_arr['return_code'] === 'SUCCESS' && $response_arr['result_code'] === 'SUCCESS';
|
|
|
|
$ret['status'] = $response_arr['return_code'] === 'SUCCESS' && $response_arr['result_code'] === 'SUCCESS';
|
|
|
|
if ($query_refund !== 0) {
|
|
|
|
if ($query_refund !== 0) {
|
|
|
|
$ret['data'] = [$response_arr];
|
|
|
|
$ret['data'] = [$response_arr];
|
|
|
|