eee
This commit is contained in:
+15
-1
@@ -3,6 +3,9 @@
|
|||||||
namespace wchat\common;
|
namespace wchat\common;
|
||||||
|
|
||||||
use JetBrains\PhpStorm\ArrayShape;
|
use JetBrains\PhpStorm\ArrayShape;
|
||||||
|
use wchat\common\libs\Aliyun;
|
||||||
|
use wchat\common\libs\Qq;
|
||||||
|
use wchat\common\libs\Wx;
|
||||||
|
|
||||||
class AppConfig
|
class AppConfig
|
||||||
{
|
{
|
||||||
@@ -55,6 +58,15 @@ class AppConfig
|
|||||||
public array $notice = ['token' => '', 'secret' => '', 'unionId' => ''];
|
public array $notice = ['token' => '', 'secret' => '', 'unionId' => ''];
|
||||||
|
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->pay = new PayConfig();
|
||||||
|
$this->pay->wx = new Wx();
|
||||||
|
$this->pay->qq = new Qq();
|
||||||
|
$this->pay->ali = new Aliyun();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param object $app
|
* @param object $app
|
||||||
* @return static
|
* @return static
|
||||||
@@ -65,7 +77,9 @@ class AppConfig
|
|||||||
$model->appId = $app->appId;
|
$model->appId = $app->appId;
|
||||||
$model->appSecret = $app->appSecret;
|
$model->appSecret = $app->appSecret;
|
||||||
$model->type = $app->type;
|
$model->type = $app->type;
|
||||||
$model->pay = PayConfig::parse($app->pay);
|
|
||||||
|
PayConfig::parse($app->pay, $model->pay);
|
||||||
|
|
||||||
return $model;
|
return $model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
-5
@@ -30,17 +30,24 @@ class PayConfig
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string|array $pay
|
* @param string|array $pay
|
||||||
|
* @param PayConfig|null $model
|
||||||
* @return static
|
* @return static
|
||||||
*/
|
*/
|
||||||
public static function parse(string|array $pay): static
|
public static function parse(string|array $pay, ?PayConfig $model = null): static
|
||||||
{
|
{
|
||||||
if (is_string($pay)) {
|
if (is_string($pay)) {
|
||||||
$pay = json_decode($pay, true);
|
$pay = json_decode($pay, true);
|
||||||
}
|
}
|
||||||
$model = new static();
|
if ($model === null) {
|
||||||
$model->ali = \Kiri::configure(new Aliyun(), $pay['ali']);
|
$model = new static();
|
||||||
$model->qq = \Kiri::configure(new Qq(), $pay['qq']);
|
$model->ali = \Kiri::configure(new Aliyun(), $pay['ali']);
|
||||||
$model->wx = \Kiri::configure(new Wx(), $pay['wx']);
|
$model->qq = \Kiri::configure(new Qq(), $pay['qq']);
|
||||||
|
$model->wx = \Kiri::configure(new Wx(), $pay['wx']);
|
||||||
|
} else {
|
||||||
|
$model->ali = \Kiri::configure($model->ali, $pay['ali']);
|
||||||
|
$model->qq = \Kiri::configure($model->qq, $pay['qq']);
|
||||||
|
$model->wx = \Kiri::configure($model->wx, $pay['wx']);
|
||||||
|
}
|
||||||
return $model;
|
return $model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user