eee
This commit is contained in:
@@ -8,7 +8,6 @@
|
||||
|
||||
namespace wchat\qq;
|
||||
|
||||
use Kiri\Client;
|
||||
use wchat\common\Result;
|
||||
|
||||
class Account extends SmallProgram
|
||||
|
||||
+69
-69
@@ -12,83 +12,83 @@ use wchat\common\Help;
|
||||
*/
|
||||
class Notify extends SmallProgram
|
||||
{
|
||||
public mixed $appid = null;
|
||||
public mixed $mch_id = null;
|
||||
public mixed $nonce_str = null;
|
||||
public mixed $sign = null;
|
||||
public mixed $device_info = null;
|
||||
public mixed $trade_type = null;
|
||||
public mixed $trade_state = null;
|
||||
public mixed $bank_type = null;
|
||||
public mixed $fee_type = null;
|
||||
public mixed $total_fee = null;
|
||||
public mixed $cash_fee = null;
|
||||
public mixed $coupon_fee = null;
|
||||
public mixed $transaction_id = null;
|
||||
public mixed $out_trade_no = null;
|
||||
public mixed $attach = null;
|
||||
public mixed $time_end = null;
|
||||
public mixed $openid = null;
|
||||
public mixed $appid = null;
|
||||
public mixed $mch_id = null;
|
||||
public mixed $nonce_str = null;
|
||||
public mixed $sign = null;
|
||||
public mixed $device_info = null;
|
||||
public mixed $trade_type = null;
|
||||
public mixed $trade_state = null;
|
||||
public mixed $bank_type = null;
|
||||
public mixed $fee_type = null;
|
||||
public mixed $total_fee = null;
|
||||
public mixed $cash_fee = null;
|
||||
public mixed $coupon_fee = null;
|
||||
public mixed $transaction_id = null;
|
||||
public mixed $out_trade_no = null;
|
||||
public mixed $attach = null;
|
||||
public mixed $time_end = null;
|
||||
public mixed $openid = null;
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* 判断是否完成支付
|
||||
*/
|
||||
public function isSuccess(): bool
|
||||
{
|
||||
return $this->trade_state === 'SUCCESS';
|
||||
}
|
||||
/**
|
||||
* @return bool
|
||||
* 判断是否完成支付
|
||||
*/
|
||||
public function isSuccess(): bool
|
||||
{
|
||||
return $this->trade_state === 'SUCCESS';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $params
|
||||
* @return $this
|
||||
* @throws Exception
|
||||
*/
|
||||
public function setPayNotifyData(array $params): static
|
||||
{
|
||||
if (!$this->validation($params)) {
|
||||
throw new Exception('签名错误!');
|
||||
}
|
||||
foreach ($params as $key => $val) {
|
||||
$this->$key = $val;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* @param array $params
|
||||
* @return $this
|
||||
* @throws
|
||||
*/
|
||||
public function setPayNotifyData(array $params): static
|
||||
{
|
||||
if (!$this->validation($params)) {
|
||||
throw new Exception('签名错误!');
|
||||
}
|
||||
foreach ($params as $key => $val) {
|
||||
$this->$key = $val;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function __set(string $name, $value): void
|
||||
{
|
||||
if (property_exists($this, $name)) {
|
||||
$this->{$name} = $value;
|
||||
}
|
||||
}
|
||||
public function __set(string $name, $value): void
|
||||
{
|
||||
if (property_exists($this, $name)) {
|
||||
$this->{$name} = $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param array $params
|
||||
* @return bool
|
||||
*/
|
||||
public function validation(array $params): bool
|
||||
{
|
||||
$sign = $params['sign'];
|
||||
unset($params['sign']);
|
||||
/**
|
||||
* @param array $params
|
||||
* @return bool
|
||||
*/
|
||||
public function validation(array $params): bool
|
||||
{
|
||||
$sign = $params['sign'];
|
||||
unset($params['sign']);
|
||||
|
||||
$signType = $this->payConfig->getSignType();
|
||||
$privateKey = $this->payConfig->pay->qq->mchSecret;
|
||||
$nowSign = Help::sign($params, $privateKey, $signType);
|
||||
if ($sign === $nowSign) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
$signType = $this->payConfig->getSignType();
|
||||
$privateKey = $this->payConfig->pay->qq->mchSecret;
|
||||
$nowSign = Help::sign($params, $privateKey, $signType);
|
||||
if ($sign === $nowSign) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null
|
||||
*/
|
||||
public function getAppid()
|
||||
{
|
||||
return $this->appid;
|
||||
}
|
||||
/**
|
||||
* @return null
|
||||
*/
|
||||
public function getAppid(): mixed
|
||||
{
|
||||
return $this->appid;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+8
-9
@@ -3,7 +3,6 @@
|
||||
namespace wchat\wx;
|
||||
|
||||
use Kiri\Di\Container;
|
||||
use ReflectionException;
|
||||
use wchat\common\AppConfig;
|
||||
|
||||
class QqFactory
|
||||
@@ -14,15 +13,15 @@ class QqFactory
|
||||
* @param $class
|
||||
* @param AppConfig $config
|
||||
* @return mixed
|
||||
* @throws ReflectionException
|
||||
* @throws
|
||||
*/
|
||||
public static function get($class, AppConfig $config): mixed
|
||||
{
|
||||
$container = Container::instance();
|
||||
$object = $container->get($class);
|
||||
$object->setPayConfig($config);
|
||||
return $object;
|
||||
}
|
||||
public static function get($class, AppConfig $config): mixed
|
||||
{
|
||||
$container = Container::instance();
|
||||
$object = $container->get($class);
|
||||
$object->setPayConfig($config);
|
||||
return $object;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+1
-3
@@ -8,8 +8,6 @@
|
||||
|
||||
namespace wchat\qq;
|
||||
|
||||
use Exception;
|
||||
use Kiri\Client;
|
||||
use wchat\common\Result;
|
||||
use wchat\common\Help;
|
||||
|
||||
@@ -30,7 +28,7 @@ class Recharge extends SmallProgram
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setSpillCreateIp(string $value)
|
||||
public function setSpillCreateIp(string $value): void
|
||||
{
|
||||
$this->spill_create_ip = $value;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
namespace wchat\qq;
|
||||
|
||||
|
||||
use Kiri\Client;
|
||||
use wchat\common\Result;
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
namespace wchat\qq;
|
||||
|
||||
|
||||
use wchat\common\Result;
|
||||
|
||||
/**
|
||||
* Class Subject
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
namespace wchat\qq;
|
||||
|
||||
|
||||
use Kiri\Client;
|
||||
use wchat\common\Result;
|
||||
|
||||
class Token extends SmallProgram
|
||||
|
||||
@@ -37,7 +37,7 @@ class Cash_Bonus extends SmallProgram
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setMchName(string $value)
|
||||
public function setMchName(string $value): void
|
||||
{
|
||||
$this->_requestParams['mch_name'] = $value;
|
||||
}
|
||||
@@ -45,7 +45,7 @@ class Cash_Bonus extends SmallProgram
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setActName(string $value)
|
||||
public function setActName(string $value): void
|
||||
{
|
||||
$this->_requestParams['act_name'] = $value;
|
||||
}
|
||||
@@ -53,7 +53,7 @@ class Cash_Bonus extends SmallProgram
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setWishing(string $value)
|
||||
public function setWishing(string $value): void
|
||||
{
|
||||
$this->_requestParams['wishing'] = $value;
|
||||
}
|
||||
@@ -61,7 +61,7 @@ class Cash_Bonus extends SmallProgram
|
||||
/**
|
||||
* @param int $value
|
||||
*/
|
||||
public function setIconId(int $value)
|
||||
public function setIconId(int $value): void
|
||||
{
|
||||
$this->_requestParams['icon_id'] = $value;
|
||||
}
|
||||
@@ -69,7 +69,7 @@ class Cash_Bonus extends SmallProgram
|
||||
/**
|
||||
* @param int $value
|
||||
*/
|
||||
public function setBannerId(int $value)
|
||||
public function setBannerId(int $value): void
|
||||
{
|
||||
$this->_requestParams['banner_id'] = $value;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class Enterprise_payment extends SmallProgram
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setOpUserId(string $value)
|
||||
public function setOpUserId(string $value): void
|
||||
{
|
||||
$this->_requestParams['op_user_id'] = $value;
|
||||
}
|
||||
@@ -48,7 +48,7 @@ class Enterprise_payment extends SmallProgram
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setOpUserPassword(string $value)
|
||||
public function setOpUserPassword(string $value): void
|
||||
{
|
||||
$this->_requestParams['op_user_passwd'] = $value;
|
||||
}
|
||||
@@ -56,7 +56,7 @@ class Enterprise_payment extends SmallProgram
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setSpbillCreateIp(string $value)
|
||||
public function setSpbillCreateIp(string $value): void
|
||||
{
|
||||
$this->_requestParams['spbill_create_ip'] = $value;
|
||||
}
|
||||
|
||||
@@ -23,10 +23,10 @@ class RedHatResult
|
||||
public mixed $uin;
|
||||
|
||||
|
||||
const RED_HAT_STATUS_PAID = 1;
|
||||
const RED_HAT_STATUS_SNATCHED = 2;
|
||||
const RED_HAT_STATUS_EXPIRED = 3;
|
||||
const RED_HAT_STATUS_REFUNDED = 4;
|
||||
const int RED_HAT_STATUS_PAID = 1;
|
||||
const int RED_HAT_STATUS_SNATCHED = 2;
|
||||
const int RED_HAT_STATUS_EXPIRED = 3;
|
||||
const int RED_HAT_STATUS_REFUNDED = 4;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user