diff --git a/wchat/qq/Redhat.php b/wchat/qq/Redhat.php index 9f7031b..4a42786 100644 --- a/wchat/qq/Redhat.php +++ b/wchat/qq/Redhat.php @@ -11,12 +11,9 @@ class Redhat extends SmallProgram { private string $charset = 'UTF8'; - private string $nonce_str = ''; private string $sign = ''; private string $mch_billno = ''; - private string $mch_id = ''; private string $mch_name = ''; - private string $qqappid = ''; private string $re_openid = ''; private string $total_amount = ''; private string $total_num = ''; @@ -24,12 +21,9 @@ class Redhat extends SmallProgram private string $act_name = ''; private string $icon_id = ''; private string $banner_id = ''; - private string $notify_url = ''; private string $not_send_msg = ''; private string $min_value = ''; private string $max_value = ''; - private string $key = ''; - private string $signType = ''; private string $sendUrl = '/cgi-bin/hongbao/qpay_hb_mch_send.cgi'; @@ -51,22 +45,6 @@ class Redhat extends SmallProgram $this->charset = $charset; } - /** - * @return string - */ - public function getNonceStr(): string - { - return $this->nonce_str; - } - - /** - * @param string $nonce_str - */ - public function setNonceStr(string $nonce_str): void - { - $this->nonce_str = $nonce_str; - } - /** * @return string */ @@ -99,22 +77,6 @@ class Redhat extends SmallProgram $this->mch_billno = $mch_billno; } - /** - * @return string - */ - public function getMchId(): string - { - return $this->mch_id; - } - - /** - * @param string $mch_id - */ - public function setMchId(string $mch_id): void - { - $this->mch_id = $mch_id; - } - /** * @return string */ @@ -131,21 +93,6 @@ class Redhat extends SmallProgram $this->mch_name = $mch_name; } - /** - * @return string - */ - public function getQqappid(): string - { - return $this->qqappid; - } - - /** - * @param string $qqappid - */ - public function setQqappid(string $qqappid): void - { - $this->qqappid = $qqappid; - } /** * @return string @@ -259,22 +206,6 @@ class Redhat extends SmallProgram $this->banner_id = $banner_id; } - /** - * @return string - */ - public function getNotifyUrl(): string - { - return $this->notify_url; - } - - /** - * @param string $notify_url - */ - public function setNotifyUrl(string $notify_url): void - { - $this->notify_url = $notify_url; - } - /** * @return string */ @@ -323,70 +254,6 @@ class Redhat extends SmallProgram $this->max_value = $max_value; } - /** - * @return string - */ - public function getKey(): string - { - return $this->key; - } - - /** - * @param string $key - */ - public function setKey(string $key): void - { - $this->key = $key; - } - - /** - * @return string - */ - public function getSignType(): string - { - return $this->signType; - } - - /** - * @param string $signType - */ - public function setSignType(string $signType): void - { - $this->signType = $signType; - } - - /** - * @return string - */ - public function getSendUrl(): string - { - return $this->sendUrl; - } - - /** - * @param string $sendUrl - */ - public function setSendUrl(string $sendUrl): void - { - $this->sendUrl = $sendUrl; - } - - /** - * @return string - */ - public function getSearchUrl(): string - { - return $this->searchUrl; - } - - /** - * @param string $searchUrl - */ - public function setSearchUrl(string $searchUrl): void - { - $this->searchUrl = $searchUrl; - } - /** * @return mixed @@ -400,7 +267,7 @@ class Redhat extends SmallProgram $requestParam['mch_billno'] = $this->getMchBillno(); $requestParam['mch_id'] = $this->config->getMchId(); $requestParam['mch_name'] = $this->getMchName(); - $requestParam['qqappid'] = $this->getQqappid(); + $requestParam['qqappid'] = $this->config->getAppid(); $requestParam['re_openid'] = $this->getReOpenid(); $requestParam['total_amount'] = $this->getTotalAmount() * 100; $requestParam['min_value'] = $this->getMinValue() * 100; @@ -409,7 +276,7 @@ class Redhat extends SmallProgram $requestParam['wishing'] = $this->getWishing(); $requestParam['act_name'] = $this->getActName(); $requestParam['icon_id'] = $this->getIconId(); - $requestParam['notify_url'] = $this->getNotifyUrl(); + $requestParam['notify_url'] = $this->config->getNotifyUrl(); $requestParam['sign'] = $this->builderSign($requestParam); @@ -423,7 +290,7 @@ class Redhat extends SmallProgram */ private function builderSign($requestParam): string { - return Help::sign($requestParam, $this->getKey(), $this->getSignType()); + return Help::sign($requestParam, $this->config->getKey(), $this->config->getSignType()); } /** @@ -460,8 +327,8 @@ class Redhat extends SmallProgram */ public function searchByOrderNo($listid, $orderNo = null): Result { - $requestParam['nonce_str'] = $this->getNonceStr(); - $requestParam['mch_id'] = $this->getMchId(); + $requestParam['nonce_str'] = Help::random(31); + $requestParam['mch_id'] = $this->config->getMchId(); $requestParam['listid'] = $listid; if (!empty($orderNo)) { $requestParam['mch_billno'] = $orderNo;