This commit is contained in:
xl
2023-11-13 23:52:41 +08:00
parent 494a7e48c0
commit d64ffe4b07
7 changed files with 265 additions and 93 deletions
+13 -64
View File
@@ -2,81 +2,30 @@
namespace wchat\common;
use JetBrains\PhpStorm\ArrayShape;
use wchat\common\libs\Aliyun;
use wchat\common\libs\Qq;
use wchat\common\libs\Wx;
class PayConfig
{
/**
* @var array|string[]
* @var Qq
*/
#[ArrayShape(["appId" => "string", "mchCa" => "string", "mchId" => "string", "mchKey" => "string", "mchCert" => "string", "appSecret" => "string", "mchSecret" => "string"])]
protected array $qq = ["appId" => "", "mchCa" => "", "mchId" => "", "mchKey" => "", "mchCert" => "", "appSecret" => "", "mchSecret" => ""];
public Qq $qq;
/**
* @var array|string[]
* @var Wx
*/
#[ArrayShape(["appId" => "string", "mchId" => "string", "schema" => "string", "mchKey" => "string", "secret" => "string", "mchCert" => "string", "appSecret" => "string", "SerialNumber" => "string"])]
protected array $wx = ["appId" => "", "mchId" => "", "schema" => "", "mchKey" => "", "secret" => "", "mchCert" => "", "appSecret" => "", "SerialNumber" => ""];
public Wx $wx;
/**
* @var array|string[]
* @var Aliyun
*/
#[ArrayShape(["appId" => "string", "appKey" => "string", "appSecret" => "string", "aliPubSecret" => "string", "appPubSecret" => "string", "aliRootSecret" => "string", "openFileState" => "string"])]
protected array $ali = ["appId" => "", "appKey" => "", "appSecret" => "", "aliPubSecret" => "", "appPubSecret" => "", "aliRootSecret" => "", "openFileState" => "0"];
/**
* @return array|string[]
*/
#[ArrayShape(["appId" => "string", "mchCa" => "string", "mchId" => "string", "mchKey" => "string", "mchCert" => "string", "appSecret" => "string", "mchSecret" => "string"])] public function getQq(): array
{
return $this->qq;
}
/**
* @param array|string[] $qq
*/
public function setQq(array $qq): void
{
$this->qq = $qq;
}
/**
* @return array|string[]
*/
#[ArrayShape(["appId" => "string", "mchId" => "string", "schema" => "string", "mchKey" => "string", "secret" => "string", "mchCert" => "string", "appSecret" => "string", "SerialNumber" => "string"])] public function getWx(): array
{
return $this->wx;
}
/**
* @param array|string[] $wx
*/
public function setWx(array $wx): void
{
$this->wx = $wx;
}
/**
* @return array|string[]
*/
#[ArrayShape(["appId" => "string", "appKey" => "string", "appSecret" => "string", "aliPubSecret" => "string", "appPubSecret" => "string", "aliRootSecret" => "string", "openFileState" => "string"])]
public function getAli(): array
{
return $this->ali;
}
/**
* @param array|string[] $ali
*/
public function setAli(array $ali): void
{
$this->ali = $ali;
}
public Aliyun $ali;
/**
@@ -88,10 +37,10 @@ class PayConfig
if (is_string($pay)) {
$pay = json_decode($pay, true);
}
$model = new static();
foreach ($pay as $key => $value) {
$model->$key = $value;
}
$model = new static();
$model->ali = \Kiri::configure(new Aliyun(), $pay['ali']);
$model->qq = \Kiri::configure(new Qq(), $pay['qq']);
$model->wx = \Kiri::configure(new Wx(), $pay['wx']);
return $model;
}