mirror of
				https://gitee.com/zoujingli/WeChatDeveloper.git
				synced 2025-11-04 19:02:09 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			61 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			61 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						||
 | 
						||
// +----------------------------------------------------------------------
 | 
						||
// | WeChatDeveloper
 | 
						||
// +----------------------------------------------------------------------
 | 
						||
// | 版权所有 2014~2018 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
 | 
						||
// +----------------------------------------------------------------------
 | 
						||
// | 官方网站: http://think.ctolog.com
 | 
						||
// +----------------------------------------------------------------------
 | 
						||
// | 开源协议 ( https://mit-license.org )
 | 
						||
// +----------------------------------------------------------------------
 | 
						||
// | github开源项目:https://github.com/zoujingli/WeChatDeveloper
 | 
						||
// +----------------------------------------------------------------------
 | 
						||
 | 
						||
namespace WePay;
 | 
						||
 | 
						||
use WeChat\Contracts\BasicPay;
 | 
						||
use WeChat\Contracts\Tools;
 | 
						||
use WeChat\Exceptions\InvalidResponseException;
 | 
						||
 | 
						||
/**
 | 
						||
 * 微信商户账单及评论
 | 
						||
 * Class Bill
 | 
						||
 * @package WePay
 | 
						||
 */
 | 
						||
class Bill extends BasicPay
 | 
						||
{
 | 
						||
    /**
 | 
						||
     * 下载对账单
 | 
						||
     * @param array $options 静音参数
 | 
						||
     * @param null|string $outType 输出类型
 | 
						||
     * @return bool|string
 | 
						||
     * @throws \WeChat\Exceptions\InvalidResponseException
 | 
						||
     */
 | 
						||
    public function download(array $options, $outType = null)
 | 
						||
    {
 | 
						||
        $this->params->set('sign_type', 'MD5');
 | 
						||
        $params = $this->params->merge($options);
 | 
						||
        $params['sign'] = $this->getPaySign($params, 'MD5');
 | 
						||
        $result = Tools::post('https://api.mch.weixin.qq.com/pay/downloadbill', Tools::arr2xml($params));
 | 
						||
        if (($jsonData = Tools::xml2arr($result))) {
 | 
						||
            if ($jsonData['return_code'] !== 'SUCCESS') {
 | 
						||
                throw new InvalidResponseException($jsonData['return_msg'], '0');
 | 
						||
            }
 | 
						||
        }
 | 
						||
        return is_null($outType) ? $result : $outType($result);
 | 
						||
    }
 | 
						||
 | 
						||
 | 
						||
    /**
 | 
						||
     * 拉取订单评价数据
 | 
						||
     * @param array $options
 | 
						||
     * @return array
 | 
						||
     * @throws \WeChat\Exceptions\InvalidResponseException
 | 
						||
     */
 | 
						||
    public function commtent(array $options)
 | 
						||
    {
 | 
						||
        $url = 'https://api.mch.weixin.qq.com/billcommentsp/batchquerycomment';
 | 
						||
        return $this->callPostApi($url, $options, true);
 | 
						||
    }
 | 
						||
} |