This commit is contained in:
2023-12-12 15:35:37 +08:00
parent 6438d8affb
commit d16adba08e
32 changed files with 285 additions and 311 deletions
+11 -14
View File
@@ -27,7 +27,7 @@ abstract class Subject extends Multiprogramming
/**
* @param array $keywords
*/
public function setKeywords(array $keywords)
public function setKeywords(array $keywords): void
{
$this->keywords = $keywords;
}
@@ -35,7 +35,7 @@ abstract class Subject extends Multiprogramming
/**
* @param $templateId
*/
public function setTemplateId($templateId)
public function setTemplateId($templateId): void
{
$this->templateId = $templateId;
}
@@ -43,7 +43,7 @@ abstract class Subject extends Multiprogramming
/**
* @param $openId
*/
public function setOpenId($openId)
public function setOpenId($openId): void
{
$this->openId = $openId;
}
@@ -51,7 +51,7 @@ abstract class Subject extends Multiprogramming
/**
* @param $page
*/
public function setPage($page)
public function setPage($page): void
{
$this->page = $page;
}
@@ -59,7 +59,7 @@ abstract class Subject extends Multiprogramming
/**
* @param $emphasis_keyword
*/
public function setEmphasisKeyword($emphasis_keyword)
public function setEmphasisKeyword($emphasis_keyword): void
{
$this->emphasis_keyword = $emphasis_keyword;
}
@@ -69,7 +69,7 @@ abstract class Subject extends Multiprogramming
* @param $context
* @param string $color
*/
public function replaceKeyword($index, $context, string $color = '')
public function replaceKeyword($index, $context, string $color = ''): void
{
if (empty($color)) {
$color = '#000';
@@ -85,7 +85,7 @@ abstract class Subject extends Multiprogramming
* @param $color
* @param $context
*/
public function addKeyword($context, $color = null)
public function addKeyword($context, $color = null): void
{
if (empty($color)) {
$color = '#000';
@@ -135,7 +135,7 @@ abstract class Subject extends Multiprogramming
/**
* @return Result
* @throws \Exception
* @throws
*/
public function sendTemplate(): Result
{
@@ -158,7 +158,7 @@ abstract class Subject extends Multiprogramming
if (!empty($this->use_robot)) {
$params['use_robot'] = $this->use_robot;
}
$this->reset($result);
$this->reset();
$client = new Client($this->getHost(), 443, true);
$client->withHeader(['Content-Type' => 'application/json; charset=utf-8']);
@@ -184,17 +184,14 @@ abstract class Subject extends Multiprogramming
}
/**
* @param $result
* @return mixed
* @return void
*/
public function reset($result)
public function reset(): void
{
$this->openId = '';
$this->keywords = [];
$this->templateId = '';
$this->page = '';
return $result;
}
}
+120 -121
View File
@@ -13,126 +13,126 @@ abstract class Template extends Multiprogramming
{
private array $keywords = [];
private string $templateId = '';
private string $formId = '';
private string $openId = '';
private string $page = 'pages/index/index';
private string $emphasis_keyword = '';
private array $keywords = [];
private string $templateId = '';
private string $formId = '';
private string $openId = '';
private string $page = 'pages/index/index';
private string $emphasis_keyword = '';
/**
* @param array $keywords
*/
public function setKeywords(array $keywords)
{
$this->keywords = $keywords;
}
/**
* @param array $keywords
*/
public function setKeywords(array $keywords): void
{
$this->keywords = $keywords;
}
/**
* @param $templateId
*/
public function setTemplateId($templateId)
{
$this->templateId = $templateId;
}
/**
* @param $templateId
*/
public function setTemplateId($templateId): void
{
$this->templateId = $templateId;
}
/**
* @param $formId
*/
public function setFormId($formId)
{
$this->formId = $formId;
}
/**
* @param $formId
*/
public function setFormId($formId): void
{
$this->formId = $formId;
}
/**
* @param $openId
*/
public function setOpenId($openId)
{
$this->openId = $openId;
}
/**
* @param $openId
*/
public function setOpenId($openId): void
{
$this->openId = $openId;
}
/**
* @param $page
*/
public function setPage($page)
{
$this->page = $page;
}
/**
* @param $page
*/
public function setPage($page): void
{
$this->page = $page;
}
/**
* @param $emphasis_keyword
*/
public function setEmphasisKeyword($emphasis_keyword)
{
$this->emphasis_keyword = $emphasis_keyword;
}
/**
* @param $emphasis_keyword
*/
public function setEmphasisKeyword($emphasis_keyword): void
{
$this->emphasis_keyword = $emphasis_keyword;
}
/**
* @param $index
* @param $context
* @param string $color
*/
public function replaceKeyword($index, $context, string $color = '')
{
if (empty($color)) {
$color = '#000';
}
$this->keywords['keyword' . $index] = [
'value' => $context,
'color' => $color
];
}
public function replaceKeyword($index, $context, string $color = ''): void
{
if (empty($color)) {
$color = '#000';
}
$this->keywords['keyword' . $index] = [
'value' => $context,
'color' => $color
];
}
/**
* @param $color
* @param $context
*/
public function addKeyword($context, $color = null)
{
if (empty($color)) {
$color = '#000';
}
$this->keywords['keyword' . (count($this->keywords) + 1)] = [
'value' => $context,
'color' => $color
];
}
/**
* @param $color
* @param $context
*/
public function addKeyword($context, $color = null): void
{
if (empty($color)) {
$color = '#000';
}
$this->keywords['keyword' . (count($this->keywords) + 1)] = [
'value' => $context,
'color' => $color
];
}
abstract public function getUrl();
abstract public function getUrl();
abstract public function getHost();
abstract public function getHost();
/**
* @return Result
* @throws \Exception
*
* 奴隶交易通知
*/
public function sendTemplate(): Result
{
$access_token = $this->payConfig->getAccessToken();
if (empty($access_token)) {
throw new \Exception('request access_token con\'t null.');
}
/**
* @return Result
* @throws
*
* 奴隶交易通知
*/
public function sendTemplate(): Result
{
$access_token = $this->payConfig->getAccessToken();
if (empty($access_token)) {
throw new \Exception('request access_token con\'t null.');
}
$params = [
"touser" => $this->openId,
"template_id" => $this->templateId,
"page" => $this->page,
"form_id" => $this->formId,
"data" => $this->keywords,
];
$params = [
"touser" => $this->openId,
"template_id" => $this->templateId,
"page" => $this->page,
"form_id" => $this->formId,
"data" => $this->keywords,
];
if (!empty($this->emphasis_keyword)) {
$params['emphasis_keyword'] = $this->emphasis_keyword;
}
if (!empty($this->emphasis_keyword)) {
$params['emphasis_keyword'] = $this->emphasis_keyword;
}
$this->reset($result);
$this->reset();
$client = new Client($this->getHost(), 443, true);
$client->withHeader(['Content-Type' => 'application/json; charset=utf-8']);
$client = new Client($this->getHost(), 443, true);
$client->withHeader(['Content-Type' => 'application/json; charset=utf-8']);
$proxyHost = $this->payConfig->getProxyHost();
$proxyPort = $this->payConfig->getProxyPort();
@@ -141,29 +141,28 @@ abstract class Template extends Multiprogramming
}
$client->post($this->getUrl() . '?access_token=' . $access_token, $params);
$client->close();
$client->close();
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: $client->getBody());
}
$body = json_decode($client->getBody(), true);
if (isset($body['errcode']) && $body['errcode'] != 0) {
return new Result(code: $body['errcode'], message: $body['errmsg']);
}
return new Result(code: 0, data: $body);
}
if (!in_array($client->getStatusCode(), [101, 200, 201])) {
return new Result(code: 505, message: $client->getBody());
}
$body = json_decode($client->getBody(), true);
if (isset($body['errcode']) && $body['errcode'] != 0) {
return new Result(code: $body['errcode'], message: $body['errmsg']);
}
return new Result(code: 0, data: $body);
}
/**
* @param $result
* @return void
*/
private function reset($result): void
{
$this->openId = '';
$this->keywords = [];
$this->formId = '';
$this->templateId = '';
$this->page = '';
}
/**
* @return void
*/
private function reset(): void
{
$this->openId = '';
$this->keywords = [];
$this->formId = '';
$this->templateId = '';
$this->page = '';
}
}
+4 -4
View File
@@ -11,10 +11,10 @@ class AppConfig
{
const TYPE_WCHAT_PROJECT = 0;
const TYPE_ALI_GAME_OR_APPLET = 3;
const TYPE_QQ_GAME_OR_APPLET = 1;
const TYPE_APP_PROJECT = 2;
const int TYPE_WCHAT_PROJECT = 0;
const int TYPE_ALI_GAME_OR_APPLET = 3;
const int TYPE_QQ_GAME_OR_APPLET = 1;
const int TYPE_APP_PROJECT = 2;
/**
+2 -2
View File
@@ -37,7 +37,7 @@ abstract class Multiprogramming implements Progaram
/**
* @param $code
*/
public function setErrorCode($code)
public function setErrorCode($code): void
{
$this->errorCode = $code;
}
@@ -45,7 +45,7 @@ abstract class Multiprogramming implements Progaram
/**
* @param $message
*/
public function setErrorMessage($message)
public function setErrorMessage($message): void
{
$this->errorMsg = $message;
}
+1 -1
View File
@@ -107,7 +107,7 @@ class Result
* @param $key
* @param $data
* @return $this
* @throws Exception
* @throws
*/
public function setAttr($key, $data): static
{
-1
View File
@@ -8,7 +8,6 @@
namespace wchat\qq;
use Kiri\Client;
use wchat\common\Result;
class Account extends SmallProgram
+69 -69
View File
@@ -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
View File
@@ -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
View File
@@ -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;
}
-1
View File
@@ -4,7 +4,6 @@
namespace wchat\qq;
use Kiri\Client;
use wchat\common\Result;
/**
-1
View File
@@ -4,7 +4,6 @@
namespace wchat\qq;
use wchat\common\Result;
/**
* Class Subject
-1
View File
@@ -4,7 +4,6 @@
namespace wchat\qq;
use Kiri\Client;
use wchat\common\Result;
class Token extends SmallProgram
+5 -5
View File
@@ -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;
}
+3 -3
View File
@@ -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;
}
+4 -4
View File
@@ -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;
/**
-1
View File
@@ -8,7 +8,6 @@
namespace wchat\wx;
use Exception;
use wchat\common\Result;
class Account extends SmallProgram
+13 -14
View File
@@ -4,7 +4,6 @@
namespace wchat\wx;
use Exception;
use Kiri\Client;
use wchat\common\Result;
@@ -21,7 +20,7 @@ class Message extends SmallProgram
/**
* @param string $openid
*/
public function setOpenid(string $openid)
public function setOpenid(string $openid): void
{
$this->msgData['touser'] = $openid;
}
@@ -29,7 +28,7 @@ class Message extends SmallProgram
/**
* @param string $content
* @return Result
* @throws Exception
* @throws
*/
public function sendTextNews(string $content): Result
{
@@ -42,7 +41,7 @@ class Message extends SmallProgram
/**
* @param string $media_id
* @return Result
* @throws Exception
* @throws
*/
public function sendImageNews(string $media_id): Result
{
@@ -56,7 +55,7 @@ class Message extends SmallProgram
/**
* @param string $media_id
* @return Result
* @throws Exception
* @throws
*/
public function sendVoiceNews(string $media_id): Result
{
@@ -69,7 +68,7 @@ class Message extends SmallProgram
/**
* @param string $media_id
* @return Result
* @throws Exception
* @throws
*/
public function sendMpNewsNews(string $media_id): Result
{
@@ -86,7 +85,7 @@ class Message extends SmallProgram
* @param string $url
* @param string $picurl
* @return Result
* @throws Exception
* @throws
*/
public function sendNewsNews(string $title, string $description, string $url, string $picurl): Result
{
@@ -108,7 +107,7 @@ class Message extends SmallProgram
/**
* @param string $title
* @return Result
* @throws Exception
* @throws
*/
public function sendCardNews(string $title): Result
{
@@ -125,7 +124,7 @@ class Message extends SmallProgram
* @param string $title
* @param string $description
* @return Result
* @throws Exception
* @throws
*/
public function sendVideoNews(string $media_id, string $thumb_media_id, string $title, string $description): Result
{
@@ -149,7 +148,7 @@ class Message extends SmallProgram
* @param string $title
* @param string $description
* @return Result
* @throws Exception
* @throws
*/
public function sendMusicNews(string $musicurl, string $hqmusicurl, string $thumb_media_id, string $title, string $description): Result
{
@@ -170,7 +169,7 @@ class Message extends SmallProgram
* @param string $tail_content
* @param array $menus
* @return Result
* @throws Exception
* @throws
*/
public function sendMenuNews(string $head_content, string $tail_content, array $menus = []): Result
{
@@ -210,7 +209,7 @@ class Message extends SmallProgram
* @param string $pagepath
* @param string $thumb_media_id
* @return Result
* @throws Exception
* @throws
*/
public function sendMiniprogrampageNews(string $title, string $appid, string $pagepath, string $thumb_media_id): Result
{
@@ -231,7 +230,7 @@ class Message extends SmallProgram
* @param string $title
* @param string $introduction
* @return mixed
* @throws Exception
* @throws
*/
public function uploadFile(string $filePath, string $type, bool $isPermanent = false, string $title = '', string $introduction = ''): Result
{
@@ -268,7 +267,7 @@ class Message extends SmallProgram
/**
* @return Result
* @throws Exception
* @throws
*/
private function sendKefuMsg(): Result
{
+5 -5
View File
@@ -71,11 +71,11 @@ class Notify extends SmallProgram
}
/**
* @param string $name
* @param $value
* @return void
*/
/**
* @param string $name
* @param mixed $value
* @return void
*/
public function __set(string $name, mixed $value): void
{
if (property_exists($this, $name)) {
+7 -8
View File
@@ -8,7 +8,6 @@
namespace wchat\wx;
use Kiri\Client;
use wchat\common\Result;
class PublicTemplate extends SmallProgram
@@ -27,7 +26,7 @@ class PublicTemplate extends SmallProgram
/**
* @param array $keywords
*/
public function setKeywords(array $keywords)
public function setKeywords(array $keywords): void
{
$this->keywords = $keywords;
}
@@ -35,7 +34,7 @@ class PublicTemplate extends SmallProgram
/**
* @param string $templateId
*/
public function setTemplateId(string $templateId)
public function setTemplateId(string $templateId): void
{
$this->templateId = $templateId;
}
@@ -43,7 +42,7 @@ class PublicTemplate extends SmallProgram
/**
* @param string $openId
*/
public function setOpenId(string $openId)
public function setOpenId(string $openId): void
{
$this->openId = $openId;
}
@@ -51,7 +50,7 @@ class PublicTemplate extends SmallProgram
/**
* @param string $defaultUrl
*/
public function setDefaultUrl(string $defaultUrl)
public function setDefaultUrl(string $defaultUrl): void
{
$this->defaultUrl = $defaultUrl;
}
@@ -61,7 +60,7 @@ class PublicTemplate extends SmallProgram
* @param string $context
* @param string $color
*/
public function replaceKeyword(string $name, string $context, string $color = '')
public function replaceKeyword(string $name, string $context, string $color = ''): void
{
$this->keywords[$name] = ['value' => $context, 'color' => $color];
}
@@ -72,7 +71,7 @@ class PublicTemplate extends SmallProgram
* @param string $context
* @param null $color
*/
public function addKeyword(string $name, string $context, $color = null)
public function addKeyword(string $name, string $context, $color = null): void
{
if (empty($color)) {
$color = '#000';
@@ -124,7 +123,7 @@ class PublicTemplate extends SmallProgram
/**
* @return Result
* @throws \Exception
* @throws
*
* 奴隶交易通知
*/
+2 -3
View File
@@ -4,7 +4,6 @@
namespace wchat\wx;
use Kiri\Client;
use wchat\common\Result;
/**
@@ -17,8 +16,8 @@ class SecCheck extends SmallProgram
private string $_url = '/wxa/img_sec_check?access_token=';
private string $_msgUrl = '/wxa/msg_sec_check?access_token=';
private string $_mediaCheckAsync = '/wxa/media_check_async?access_token=';
const MEDIA_VIDEO = 1;
const MEDIA_IMAGE = 1;
const int MEDIA_VIDEO = 1;
const int MEDIA_IMAGE = 1;
/**
* @param string $path
-1
View File
@@ -4,7 +4,6 @@
namespace wchat\wx;
use wchat\common\Result;
/**
* Class Subject
-1
View File
@@ -4,7 +4,6 @@
namespace wchat\wx;
use Kiri\Client;
use wchat\common\Result;
class Token extends SmallProgram
+13 -13
View File
@@ -8,44 +8,44 @@ class NotifyModel
{
//公众号支付
const PAY_TYPE_JSAPI = 'JSAPI';
const string PAY_TYPE_JSAPI = 'JSAPI';
//扫码支付
const PAY_TYPE_NATIVE = 'NATIVE';
const string PAY_TYPE_NATIVE = 'NATIVE';
//App支付
const PAY_TYPE_App = 'App';
const string PAY_TYPE_App = 'App';
//付款码支付
const PAY_TYPE_MICROPAY = 'MICROPAY';
const string PAY_TYPE_MICROPAY = 'MICROPAY';
//H5支付
const PAY_TYPE_MWEB = 'MWEB';
const string PAY_TYPE_MWEB = 'MWEB';
//刷脸支付
const PAY_TYPE_FACEPAY = 'FACEPAY';
const string PAY_TYPE_FACEPAY = 'FACEPAY';
// 支付成功
const PAY_RESULT_SUCCESS = 'SUCCESS';
const string PAY_RESULT_SUCCESS = 'SUCCESS';
// 转入退款
const PAY_RESULT_REFUND = 'REFUND';
const string PAY_RESULT_REFUND = 'REFUND';
// 未支付
const PAY_RESULT_NOTPAY = 'NOTPAY';
const string PAY_RESULT_NOTPAY = 'NOTPAY';
// 已关闭
const PAY_RESULT_CLOSED = 'CLOSED';
const string PAY_RESULT_CLOSED = 'CLOSED';
// 已撤销(付款码支付)
const PAY_RESULT_REVOKED = 'REVOKED';
const string PAY_RESULT_REVOKED = 'REVOKED';
// 用户支付中(付款码支付)
const PAY_RESULT_USERPAYING = 'USERPAYING';
const string PAY_RESULT_USERPAYING = 'USERPAYING';
// 支付失败(其他原因,如银行返回失败)
const PAY_RESULT_PAYERROR = 'PAYERROR';
const string PAY_RESULT_PAYERROR = 'PAYERROR';
public string $appid;
+1 -4
View File
@@ -2,10 +2,7 @@
namespace wchat\wx\V3;
use Exception;
use JetBrains\PhpStorm\ArrayShape;
use Kiri\Client;
use Kiri\CurlClient;
use wchat\wx\SmallProgram;
class TransferBatches extends SmallProgram
@@ -16,7 +13,7 @@ class TransferBatches extends SmallProgram
/**
* @param TransferDetail $detail
* @return array
* @throws Exception
* @throws
*/
#[ArrayShape([])]
public function transfer(TransferDetail $detail): array
+5 -5
View File
@@ -16,11 +16,11 @@ class TransferDetail
* @param string $user_name
*/
public function __construct(
readonly public string $out_detail_no,
readonly public int|float $transfer_amount,
readonly public string $transfer_remark,
readonly public string $openid,
readonly public string $user_name = ''
public string $out_detail_no,
public int|float $transfer_amount,
public string $transfer_remark,
public string $openid,
public string $user_name = ''
)
{
}
+1 -2
View File
@@ -3,7 +3,6 @@
namespace wchat\wx\V3;
use Exception;
use Kiri\Client;
use wchat\wx\SmallProgram;
class WxV3AppPayment extends SmallProgram
@@ -19,7 +18,7 @@ class WxV3AppPayment extends SmallProgram
* @param string|null $openId
* @param string $payer_client_ip
* @return array
* @throws Exception
* @throws
*/
public function payment(string $orderNo, int $total, string $openId = NULL, string $payer_client_ip = '127.0.0.1'): array
{
+1 -2
View File
@@ -3,7 +3,6 @@
namespace wchat\wx\V3;
use Exception;
use Kiri\Client;
use JetBrains\PhpStorm\ArrayShape;
use wchat\wx\SmallProgram;
@@ -20,7 +19,7 @@ class WxV3NativePayment extends SmallProgram
* @param string|null $openId
* @param string $payer_client_ip
* @return array
* @throws Exception
* @throws
*/
#[ArrayShape(['code_url' => "string"])]
public function payment(string $orderNo, int $total, string $openId = NULL, string $payer_client_ip = '127.0.0.1'): array
+1 -2
View File
@@ -3,7 +3,6 @@
namespace wchat\wx\V3;
use Exception;
use Kiri\Client;
use wchat\wx\SmallProgram;
class WxV3Payment extends SmallProgram
@@ -19,7 +18,7 @@ class WxV3Payment extends SmallProgram
* @param string|null $openId
* @param string $payer_client_ip
* @return array
* @throws Exception
* @throws
*/
public function payment(string $orderNo, int $total, string $openId = NULL, string $payer_client_ip = '127.0.0.1'): array
{
+1 -2
View File
@@ -5,7 +5,6 @@ namespace wchat\wx\V3;
use Exception;
use OpenSSLAsymmetricKey;
use Psr\Http\Message\RequestInterface;
use wchat\common\PayConfig;
use wchat\wx\SmallProgram;
use wchat\wx\V3\Notify\GoodsDetail;
use wchat\wx\V3\Notify\NotifyModel;
@@ -50,7 +49,7 @@ class WxV3PaymentNotify extends SmallProgram
/**
* @param RequestInterface $request
* @return bool
* @throws Exception
* @throws
*/
public function verify(RequestInterface $request): bool
{
+4 -5
View File
@@ -4,7 +4,6 @@ namespace wchat\wx\V3;
use Exception;
use Kiri\Client;
use wchat\common\AppConfig;
use wchat\common\Help;
@@ -69,7 +68,7 @@ trait WxV3PaymentTait
/**
* @param string $orderNo
* @return array
* @throws Exception
* @throws
*/
public function searchByOutTradeNo(string $orderNo): array
{
@@ -80,7 +79,7 @@ trait WxV3PaymentTait
/**
* @param string $orderNo
* @return array
* @throws Exception
* @throws
*/
public function searchByTransactionId(string $orderNo): array
{
@@ -91,7 +90,7 @@ trait WxV3PaymentTait
/**
* @param string $parseUrl
* @return array
* @throws Exception
* @throws
*/
private function search(string $parseUrl): array
{
@@ -112,7 +111,7 @@ trait WxV3PaymentTait
* @param string $canonical_url
* @param string $body
* @return string
* @throws Exception
* @throws
*/
public function signature(string $http_method, string $canonical_url, string $body = ''): string
{
+1 -1
View File
@@ -20,7 +20,7 @@ class WxV3Withdrawal extends SmallProgram
* @param string $batch_remark
* @param TransferDetail[] $details
* @return array
* @throws Exception
* @throws
*/
public function payment(string $orderNo, string $batch_name, string $batch_remark, array $details): array
{
+2 -3
View File
@@ -3,7 +3,6 @@
namespace wchat\wx;
use Kiri\Di\Container;
use ReflectionException;
use wchat\common\AppConfig;
class WxFactory
@@ -14,12 +13,12 @@ class WxFactory
* @param string $class
* @param AppConfig $config
* @return object|null
* @throws ReflectionException
* @throws
*/
public static function get(string $class, AppConfig $config): ?object
{
$container = Container::instance();
$object = $container->get($class);
$object = $container->get($class);
$object->setPayConfig($config);
return $object;
}