This commit is contained in:
xl
2023-11-14 14:14:42 +08:00
parent 70222819b9
commit e7220b6aba
5 changed files with 114 additions and 116 deletions
+2 -2
View File
@@ -28,9 +28,9 @@ class Recharge extends SmallProgram
protected string $host = 'qpay.qq.com'; protected string $host = 'qpay.qq.com';
/** /**
* @param $value * @param string $value
*/ */
public function setSpillCreateIp($value) public function setSpillCreateIp(string $value)
{ {
$this->spill_create_ip = $value; $this->spill_create_ip = $value;
} }
+5 -5
View File
@@ -284,10 +284,10 @@ class Redhat extends SmallProgram
/** /**
* @param $requestParam * @param array $requestParam
* @return string * @return string
*/ */
private function builderSign($requestParam): string private function builderSign(array $requestParam): string
{ {
return Help::sign($requestParam, $this->payConfig->pay->qq->mchSecret, $this->payConfig->getSignType()); return Help::sign($requestParam, $this->payConfig->pay->qq->mchSecret, $this->payConfig->getSignType());
} }
@@ -325,11 +325,11 @@ class Redhat extends SmallProgram
/** /**
* @param $listid * @param string $listid
* @param $orderNo * @param string|null $orderNo
* @return Result * @return Result
*/ */
public function searchByOrderNo($listid, $orderNo = null): Result public function searchByOrderNo(string $listid, ?string $orderNo = null): Result
{ {
$requestParam['nonce_str'] = Help::random(31); $requestParam['nonce_str'] = Help::random(31);
$requestParam['mch_id'] = $this->payConfig->pay->qq->mchId; $requestParam['mch_id'] = $this->payConfig->pay->qq->mchId;
+18 -19
View File
@@ -35,54 +35,53 @@ class Cash_Bonus extends SmallProgram
private array $_requestParams = []; private array $_requestParams = [];
/** /**
* @param $value * @param string $value
*/ */
public function setMchName($value) public function setMchName(string $value)
{ {
$this->_requestParams['mch_name'] = $value; $this->_requestParams['mch_name'] = $value;
} }
/** /**
* @param $value * @param string $value
*/ */
public function setActName($value) public function setActName(string $value)
{ {
$this->_requestParams['act_name'] = $value; $this->_requestParams['act_name'] = $value;
} }
/** /**
* @param $value * @param string $value
*/ */
public function setWishing($value) public function setWishing(string $value)
{ {
$this->_requestParams['wishing'] = $value; $this->_requestParams['wishing'] = $value;
} }
/** /**
* @param $value * @param int $value
*/ */
public function setIconId($value) public function setIconId(int $value)
{ {
$this->_requestParams['icon_id'] = $value; $this->_requestParams['icon_id'] = $value;
} }
/** /**
* @param $value * @param int $value
*/ */
public function setBannerId($value) public function setBannerId(int $value)
{ {
$this->_requestParams['banner_id'] = $value; $this->_requestParams['banner_id'] = $value;
} }
/** /**
* @param $mch_billno * @param string $mch_billno
* @param $openId * @param string $openId
* @param $price * @param float $price
* @return mixed * @return mixed
* @throws Exception
*/ */
public function mch_send($mch_billno, $openId, $price): Result public function mch_send(string $mch_billno, string $openId, float $price): Result
{ {
$client = $this->createClient($this->_cash, $this->orderConfig($mch_billno, $openId, $price)); $client = $this->createClient($this->_cash, $this->orderConfig($mch_billno, $openId, $price));
if (!in_array($client->getStatusCode(), [101, 200, 201])) { if (!in_array($client->getStatusCode(), [101, 200, 201])) {
@@ -103,12 +102,12 @@ class Cash_Bonus extends SmallProgram
} }
/** /**
* @param $mch_billno * @param string $mch_billno
* @param $openId * @param string $openId
* @param $price * @param float $price
* @return array * @return array
*/ */
private function orderConfig($mch_billno, $openId, $price): array private function orderConfig(string $mch_billno, string $openId, float $price): array
{ {
$requestParam['charset'] = 1; $requestParam['charset'] = 1;
$requestParam['nonce_str'] = Help::random(32); $requestParam['nonce_str'] = Help::random(32);
+16 -17
View File
@@ -17,7 +17,7 @@ class Enterprise_payment extends SmallProgram
{ {
public string $_cash = '/cgi-bin/epay/qpay_epay_b2c.cgi'; public string $_cash = '/cgi-bin/epay/qpay_epay_b2c.cgi';
private $_errors = [ private array $_errors = [
'SYSTEMERROR' => '系统错误', 'SYSTEMERROR' => '系统错误',
'PARAM_ERROR' => '请求参数未按指引进行填写', 'PARAM_ERROR' => '请求参数未按指引进行填写',
'SIGNERROR' => '参数签名结果不正确', 'SIGNERROR' => '参数签名结果不正确',
@@ -35,40 +35,39 @@ class Enterprise_payment extends SmallProgram
'INVALID_CERTIFICATE' => '证书非法', 'INVALID_CERTIFICATE' => '证书非法',
]; ];
private $_requestParams = []; private array $_requestParams = [];
/** /**
* @param $value * @param string $value
*/ */
public function setOpUserId($value) public function setOpUserId(string $value)
{ {
$this->_requestParams['op_user_id'] = $value; $this->_requestParams['op_user_id'] = $value;
} }
/** /**
* @param $value * @param string $value
*/ */
public function setOpUserPassword($value) public function setOpUserPassword(string $value)
{ {
$this->_requestParams['op_user_passwd'] = $value; $this->_requestParams['op_user_passwd'] = $value;
} }
/** /**
* @param $value * @param string $value
*/ */
public function setSpbillCreateIp($value) public function setSpbillCreateIp(string $value)
{ {
$this->_requestParams['spbill_create_ip'] = $value; $this->_requestParams['spbill_create_ip'] = $value;
} }
/** /**
* @param $mch_billno * @param string $mch_billno
* @param $openId * @param string $openId
* @param $price * @param float $price
* @return Result * @return Result
* @throws Exception
*/ */
public function mch_send($mch_billno, $openId, $price): Result public function mch_send(string $mch_billno, string $openId, float $price): Result
{ {
$client = $this->createClient($this->_cash, $this->orderConfig($mch_billno, $openId, $price)); $client = $this->createClient($this->_cash, $this->orderConfig($mch_billno, $openId, $price));
if (!in_array($client->getStatusCode(), [101, 200, 201])) { if (!in_array($client->getStatusCode(), [101, 200, 201])) {
@@ -85,12 +84,12 @@ class Enterprise_payment extends SmallProgram
} }
/** /**
* @param $mch_billno * @param string $mch_billno
* @param $openId * @param string $openId
* @param $price * @param float $price
* @return array * @return array
*/ */
private function orderConfig($mch_billno, $openId, $price): array private function orderConfig(string $mch_billno, string $openId, float $price): array
{ {
$requestParam['input_charset'] = 'UTF-8'; $requestParam['input_charset'] = 'UTF-8';
$requestParam['nonce_str'] = Help::random(32); $requestParam['nonce_str'] = Help::random(32);
+4 -4
View File
@@ -39,10 +39,10 @@ class RedHatResult
} }
/** /**
* @param $array * @param array $array
* @return void * @return void
*/ */
private function init($array): void private function init(array $array): void
{ {
foreach ($array as $key => $value) { foreach ($array as $key => $value) {
if (!property_exists($this, $key)) { if (!property_exists($this, $key)) {
@@ -54,10 +54,10 @@ class RedHatResult
/** /**
* @param $field * @param string $field
* @return mixed * @return mixed
*/ */
public function get($field): mixed public function get(string $field): mixed
{ {
return $this->$field; return $this->$field;
} }