Files
liche/admin/controllers/app/Profinish.php
T
2021-09-02 20:55:30 +08:00

88 lines
2.3 KiB
PHP

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Created by PhpStorm.
* User: lcc
* Date: 2021/09/02
* Time: 17:45
*/
require_once COMMPATH.'libraries/WechatPayV3.php';
class Profinish extends HD_Controller
{
private $log_file = 'profinish.log';
function __construct()
{
parent::__construct();
}
public function index()
{
$this->data['log_file'] = $this->log_file;
$this->data['_title'] = '结束分账';
return $this->show_view('app/profinish',true);
}
public function lists()
{
}
public function get()
{
}
public function add()
{
}
public function edit()
{
$sub_mchid = $this->input->post('sub_mchid');
$transaction_id = $this->input->post('transaction_id');
$description = $this->input->post('description');
if(!$transaction_id || !$description || !$sub_mchid){
return $this->show_json(SYS_CODE_FAIL, '参数错误');
}
$this->load->helper('order');
$out_order_no = create_order_no();
$this->config->load('wxpay');
$wx_config = $this->config->item('default');
$params = [
'merchantId' => $wx_config['mchid'],
'merchantSerialNumber' => $wx_config['merchantSerialNumber'],
'merchantPrivateKey' => $wx_config['merchantPrivateKey'],
'wechatpayCertificate' => $wx_config['wechatpayCertificate'],
];
$WechatPayV3 = new WechatPayV3($params);
$json = [
'sub_mchid' => $sub_mchid,
'transaction_id' => $transaction_id,
'out_order_no' => $out_order_no,
'description' => $description,
];
$noncestr = getNonceStr(20);
$resq = $WechatPayV3->unfreeze($json,$noncestr);
debug_log("[结束分账返回参数]:" .json_encode($resq,JSON_UNESCAPED_UNICODE), $this->log_file,'wxapi');
if(!$resq['code']){
return $this->show_json(SYS_CODE_FAIL, $resq['msg']);
}
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
}
public function del()
{
}
public function batch()
{
// TODO: Implement batch() method.
}
public function export()
{
// TODO: Implement export() method.
}
}