From c323b971122a1dc0eb5a448bca5ffc33c1eb2a25 Mon Sep 17 00:00:00 2001 From: "as2252258@163.com" Date: Mon, 19 Aug 2019 15:51:29 +0800 Subject: [PATCH] add clear --- wx/Recharge.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/wx/Recharge.php b/wx/Recharge.php index 4084dd8..6c1ebdd 100644 --- a/wx/Recharge.php +++ b/wx/Recharge.php @@ -69,6 +69,29 @@ class Recharge extends Miniprogarampage return $return; } + /** + * 'appId' => $result['appid'], + 'nonceStr' => $result['nonce_str'], + 'package' => 'prepay_id=' . $result['prepay_id'], + 'signType' => 'MD5', + 'timeStamp' => (string)time(), + * @param $prepay_id + * @return array + */ + public function toJson($prepay_id) + { + $array = [ + 'appId' => $this->config->getAppid(), + 'nonceStr' => Help::random(32), + 'package' => 'prepay_id=' . $prepay_id, + 'signType' => 'MD5', + 'timeStamp' => (string)time(), + ]; + $key = $this->config->getKey(); + $sign_type = $this->config->getSignType(); + $array['paySign'] = Help::sign($array, $key, $sign_type); + return $array; + } /** * @return string