5年前
⋅
0
//微擎获取支付密钥文件pem的方法
public function doPageTest(){
global $_W;
$setting = uni_setting_load('payment', $_W['uniacid']);
$refund_setting = $setting['payment']['wechat_refund'];
if (empty($refund_setting['key']) || empty($refund_setting['cert'])) {
return error(1, '缺少微信证书!');
}
$cert = authcode($refund_setting['cert'], 'DECODE');
$key = authcode($refund_setting['key'], 'DECODE');
$cert_path = IA_ROOT . "/addons/zz_fsdfs/cert/apiclient_cert_" . $_W['uniacid'] . ".pem";
$key_path = IA_ROOT . "/addons/zz_fsdfs/cert/apiclient_key_" . $_W['uniacid'] . ".pem";
file_put_contents($cert_path, $cert);
file_put_contents($key_path, $key);
$res = array('cert'=>$cert_path,'key'=>$key_path);
return json_encode($res);
}