|
...
|
...
|
@@ -31,26 +31,34 @@ class TiktokShop |
|
|
|
* @var array|string[]
|
|
|
|
*/
|
|
|
|
protected static array $passages = [
|
|
|
|
'order' => Passage\Order\Order::class,
|
|
|
|
'shop' => Passage\Shop\Shop::class,
|
|
|
|
'product' => Passage\Product\Product::class,
|
|
|
|
'authorize' => Authorize::class,
|
|
|
|
'verify' => Verify::class,
|
|
|
|
'order' => Passage\Order\Order::class, 'shop' => Passage\Shop\Shop::class,
|
|
|
|
'product' => Passage\Product\Product::class, 'authorize' => Authorize::class, 'verify' => Verify::class,
|
|
|
|
'alliance' => Alliance::class
|
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param $config
|
|
|
|
* @param $options
|
|
|
|
*/
|
|
|
|
public function __construct($config = null)
|
|
|
|
public function __construct($options = null)
|
|
|
|
{
|
|
|
|
if (!$config instanceof Config) {
|
|
|
|
$default = \config(TiktokShopProvider::$name);
|
|
|
|
if (!is_array($default)) {
|
|
|
|
return;
|
|
|
|
if (!$options instanceof Config) {
|
|
|
|
if (is_array($options)) {
|
|
|
|
$config = static::newConfig($options);
|
|
|
|
goto next;
|
|
|
|
}
|
|
|
|
$config = static::newConfig($default);
|
|
|
|
|
|
|
|
$app = $options ?: 'default';
|
|
|
|
|
|
|
|
$config = \config(TiktokShopProvider::$name.'.'.$app);
|
|
|
|
|
|
|
|
if (!is_array($config)) {
|
|
|
|
throw new \InvalidArgumentException('config file not found');
|
|
|
|
}
|
|
|
|
$config = static::newConfig($config);
|
|
|
|
} else {
|
|
|
|
$config = $options;
|
|
|
|
}
|
|
|
|
next:
|
|
|
|
$this->config = $config;
|
|
|
|
}
|
|
|
|
|
...
|
...
|
|