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
-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;
}