add clear
This commit is contained in:
+22
-20
@@ -77,10 +77,10 @@ class Recharge extends SmallProgram
|
|||||||
public function reception($prepay_id)
|
public function reception($prepay_id)
|
||||||
{
|
{
|
||||||
$array = [
|
$array = [
|
||||||
'appId' => $this->config->getAppid(),
|
'appId' => $this->config->getAppid(),
|
||||||
'nonceStr' => Help::random(32),
|
'nonceStr' => Help::random(32),
|
||||||
'package' => 'prepay_id=' . $prepay_id,
|
'package' => 'prepay_id=' . $prepay_id,
|
||||||
'signType' => 'MD5',
|
'signType' => 'MD5',
|
||||||
'timeStamp' => (string)time(),
|
'timeStamp' => (string)time(),
|
||||||
];
|
];
|
||||||
$key = $this->config->getKey();
|
$key = $this->config->getKey();
|
||||||
@@ -95,15 +95,15 @@ class Recharge extends SmallProgram
|
|||||||
protected function builder()
|
protected function builder()
|
||||||
{
|
{
|
||||||
$data = [
|
$data = [
|
||||||
'appid' => $this->config->getAppid(),
|
'appid' => $this->config->getAppid(),
|
||||||
'mch_id' => $this->config->getMchId(),
|
'mch_id' => $this->config->getMchId(),
|
||||||
'nonce_str' => Help::random(32),
|
'nonce_str' => Help::random(32),
|
||||||
'body' => $this->config->getBody(),
|
'body' => $this->config->getBody(),
|
||||||
'out_trade_no' => $this->orderNo,
|
'out_trade_no' => $this->orderNo,
|
||||||
'total_fee' => $this->money,
|
'total_fee' => $this->money,
|
||||||
'spbill_create_ip' => $_SERVER['REMOTE_ADDR'],
|
'spbill_create_ip' => $_SERVER['REMOTE_ADDR'],
|
||||||
'notify_url' => $this->config->getNotifyUrl(),
|
'notify_url' => $this->config->getNotifyUrl(),
|
||||||
'trade_type' => $this->config->getTradeType(),
|
'trade_type' => $this->config->getTradeType(),
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->data = array_merge($data, $this->data);
|
$this->data = array_merge($data, $this->data);
|
||||||
@@ -137,15 +137,15 @@ class Recharge extends SmallProgram
|
|||||||
public function cashWithdrawal($money, $openid, $order, $desc = '零钱提现')
|
public function cashWithdrawal($money, $openid, $order, $desc = '零钱提现')
|
||||||
{
|
{
|
||||||
$array = [
|
$array = [
|
||||||
'nonce_str' => Help::random(32),
|
'nonce_str' => Help::random(32),
|
||||||
'partner_trade_no' => $order,
|
'partner_trade_no' => $order,
|
||||||
'mchid' => $this->config->getMchId(),
|
'mchid' => $this->config->getMchId(),
|
||||||
'mch_appid' => $this->config->getAppid(),
|
'mch_appid' => $this->config->getAppid(),
|
||||||
'openid' => $openid,
|
'openid' => $openid,
|
||||||
'check_name' => 'NO_CHECK',
|
'check_name' => 'NO_CHECK',
|
||||||
'amount' => $money * 100,
|
'amount' => $money * 100,
|
||||||
'spbill_create_ip' => $this->config->getRemoteAddr(),
|
'spbill_create_ip' => $this->config->getRemoteAddr(),
|
||||||
'desc' => $desc,
|
'desc' => $desc,
|
||||||
];
|
];
|
||||||
|
|
||||||
$key = $this->config->getKey();
|
$key = $this->config->getKey();
|
||||||
@@ -154,7 +154,9 @@ class Recharge extends SmallProgram
|
|||||||
|
|
||||||
$this->request->setCallback(function ($data) {
|
$this->request->setCallback(function ($data) {
|
||||||
$array = Help::toArray($data);
|
$array = Help::toArray($data);
|
||||||
if ($array['result_code'] != 'SUCCESS') {
|
if ($array['return_code'] != 'SUCCESS') {
|
||||||
|
$data = ['code' => $array['return_code'], 'message' => $array['return_msg']];
|
||||||
|
} else if ($array['result_code'] != 'SUCCESS') {
|
||||||
$data = ['code' => $array['err_code'], 'message' => $array['err_code_des']];
|
$data = ['code' => $array['err_code'], 'message' => $array['err_code_des']];
|
||||||
} else {
|
} else {
|
||||||
$data = ['code' => 0, 'message' => '支付成功'];
|
$data = ['code' => 0, 'message' => '支付成功'];
|
||||||
|
|||||||
Reference in New Issue
Block a user