作者 lackoxygen

feat:结构

正在显示 70 个修改的文件 包含 711 行增加1084 行删除
... ... @@ -440,7 +440,7 @@ class Main
$metaMethods = array_map(function ($target) {
$name = ucfirst($target);
$interface = sprintf('Passage\\%s\\%sInterface', $name, $name);
$interface = sprintf('Request\\%s\\%sInterface', $name, $name);
$method = lcfirst($target);
return ' * @method ' . $interface . ' ' . $method . '()';
}, $targets);
... ... @@ -477,9 +477,9 @@ class Main
namespace Lackoxygen\TiktokShop\Facade;
use Lackoxygen\TiktokShop\Passage;
use Lackoxygen\TiktokShop\Request;
use Illuminate\Support\Facades\Facade;
use Lackoxygen\TiktokShop\Passage\Verify;
use Lackoxygen\TiktokShop\Support\Verify;
use Lackoxygen\TiktokShop\TiktokShop as TiktokShopKernel;
\${ANNOTATE}
... ... @@ -601,7 +601,7 @@ class CodeWriter
global $src_path;
$baseDir = $src_path . '/Passage';
$baseDir = $src_path . '/Request';
$directory = $baseDir . '/' . $class->toArray()['name'];
... ... @@ -626,9 +626,7 @@ class CodeGenerateInterface
{
protected static string $template = <<<temp
<?php
namespace Lackoxygen\TiktokShop\Passage\\\${SECTION};
use Lackoxygen\TiktokShop\Passage\ResultSet;
namespace Lackoxygen\TiktokShop\Request\\\${SECTION};
/**
* @note \${ANNOTATE}
... ... @@ -721,11 +719,11 @@ class CodeGenerateClass
protected static string $template = <<<temp
<?php
namespace Lackoxygen\TiktokShop\Passage\\\${SECTION};
namespace Lackoxygen\TiktokShop\Request\\\${SECTION};
use Lackoxygen\TiktokShop\Passage\Passage;
use Lackoxygen\TiktokShop\Request\Request;
class \${NAME} extends Passage implements \${INTERFACE}
class \${NAME} extends Request implements \${INTERFACE}
{
\${METHOD}
}
... ...
<?php
namespace Lackoxygen\TiktokShop\Attribute\Config;
class Config
{
/**
* @var Option
*/
protected Option $config;
/**
* @param Option $option
*/
public function __construct(Option $option)
{
$this->config = $option;
}
/**
* @return Option
*/
public function getConfig(): Option
{
return clone $this->config;
}
}
... ...
<?php
namespace Lackoxygen\TiktokShop\Attribute;
namespace Lackoxygen\TiktokShop\Attribute\Config;
class Config
class Option
{
private string $appKey = '';
/**
* @var string
*/
private string $appKey;
private string $appSecret = '';
/**
* @var string
*/
private string $appSecret;
private bool $enableMock = false;
/**
* @var bool
*/
private bool $enableMock;
private string $baseUri = '';
/**
* @var string
*/
private string $baseUri;
/**
* @var string
*/
private string $accessToken = '';
/**
* @var float
*/
private float $timeout;
/**
* @param string $appKey
* @param string $appSecret
* @param string $baseUri
* @param float $timeout
* @param bool $enableMock
*/
public function __construct(
string $appKey = '',
string $appSecret = '',
... ...
... ... @@ -2,39 +2,44 @@
namespace Lackoxygen\TiktokShop\Attribute;
class Request
use Lackoxygen\TiktokShop\Attribute\Config\Config;
class Request extends Config
{
/**
* @var string
*/
private string $service = '';
/**
* @var string
*/
private string $timestamp = '';
/**
* @var string
*/
private string $v = '2';
/**
* @var string
*/
private string $method = 'GET';
/**
* @var array
*/
private array $params = [];
protected string $path = '';
private bool $signature = true;
private Config $config;
/**
* @param mixed $config
* @var string
*/
public function setConfig(Config $config): void
{
$this->config = $config;
}
protected string $path = '';
/**
* @return mixed
* @var bool
*/
public function getConfig(): Config
{
return $this->config;
}
private bool $signature = true;
/**
* @return string
... ...
<?php
namespace Lackoxygen\TiktokShop\Command;
use Lackoxygen\TiktokShop\Supervisor\Session\SessionHeart;
use Illuminate\Console\Command;
class RefreshToken extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'tiktok-shop:refresh.token';
/**
* The console command description.
*
* @var string
*/
protected $description = 'The refresh tiktok shop token';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
SessionHeart::new()->keepalive();
return 0;
}
}
<?php
namespace Lackoxygen\TiktokShop\Contracts;
interface SessionInterface
{
public function id(): string;
public function unEffective(): bool;
public function effective(): bool;
public function discard();
public function watch(): bool;
public function appKey(): string;
}
... ... @@ -2,38 +2,38 @@
namespace Lackoxygen\TiktokShop\Facade;
use Lackoxygen\TiktokShop\Passage;
use Lackoxygen\TiktokShop\Request;
use Illuminate\Support\Facades\Facade;
use Lackoxygen\TiktokShop\Passage\Verify;
use Lackoxygen\TiktokShop\Support\Verify;
use Lackoxygen\TiktokShop\TiktokShop as TiktokShopKernel;
/**
* @method static TiktokShopKernel setAccessToken(string $accessToken)
* @method static TiktokShopKernel use ($options)
* @method static Verify verify()
* @method static Passage\Pigeon\PigeonInterface pigeon()
* @method static Passage\Sms\SmsInterface sms()
* @method static Passage\SupplyChain\SupplyChainInterface supplyChain()
* @method static Passage\Topup\TopupInterface topup()
* @method static Passage\OpenCloud\OpenCloudInterface openCloud()
* @method static Passage\Btas\BtasInterface btas()
* @method static Passage\Recycle\RecycleInterface recycle()
* @method static Passage\Member\MemberInterface member()
* @method static Passage\Buyin\BuyinInterface buyin()
* @method static Passage\Yunc\YuncInterface yunc()
* @method static Passage\OrderCode\OrderCodeInterface orderCode()
* @method static Passage\Coupons\CouponsInterface coupons()
* @method static Passage\Crossborder\CrossborderInterface crossborder()
* @method static Passage\Iop\IopInterface iop()
* @method static Passage\Antispam\AntispamInterface antispam()
* @method static Passage\Token\TokenInterface token()
* @method static Passage\Order\OrderInterface order()
* @method static Passage\AfterSale\AfterSaleInterface afterSale()
* @method static Passage\Logistics\LogisticsInterface logistics()
* @method static Passage\Warehouse\WarehouseInterface warehouse()
* @method static Passage\Product\ProductInterface product()
* @method static Passage\Material\MaterialInterface material()
* @method static Passage\Address\AddressInterface address()
* @method static Request\Pigeon\PigeonInterface pigeon()
* @method static Request\Sms\SmsInterface sms()
* @method static Request\SupplyChain\SupplyChainInterface supplyChain()
* @method static Request\Topup\TopupInterface topup()
* @method static Request\OpenCloud\OpenCloudInterface openCloud()
* @method static Request\Btas\BtasInterface btas()
* @method static Request\Recycle\RecycleInterface recycle()
* @method static Request\Member\MemberInterface member()
* @method static Request\Buyin\BuyinInterface buyin()
* @method static Request\Yunc\YuncInterface yunc()
* @method static Request\OrderCode\OrderCodeInterface orderCode()
* @method static Request\Coupons\CouponsInterface coupons()
* @method static Request\Crossborder\CrossborderInterface crossborder()
* @method static Request\Iop\IopInterface iop()
* @method static Request\Antispam\AntispamInterface antispam()
* @method static Request\Token\TokenInterface token()
* @method static Request\Order\OrderInterface order()
* @method static Request\AfterSale\AfterSaleInterface afterSale()
* @method static Request\Logistics\LogisticsInterface logistics()
* @method static Request\Warehouse\WarehouseInterface warehouse()
* @method static Request\Product\ProductInterface product()
* @method static Request\Material\MaterialInterface material()
* @method static Request\Address\AddressInterface address()
*/
class TiktokShop extends Facade
... ...
... ... @@ -2,16 +2,13 @@
namespace Lackoxygen\TiktokShop\Mock;
use Lackoxygen\TiktokShop\Attribute\Config;
use Lackoxygen\TiktokShop\Attribute\Request;
use Lackoxygen\TiktokShop\Exception\ClientException;
use Lackoxygen\TiktokShop\Exception\MockException;
use Lackoxygen\TiktokShop\Util\Json;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Psr7\Response;
use GuzzleHttp\RequestOptions;
use Illuminate\Support\Arr;
use Lackoxygen\TiktokShop\Exception\ClientException;
use Lackoxygen\TiktokShop\Exception\MockException;
use Lackoxygen\TiktokShop\Util\Json;
class Mock
{
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage;
use Lackoxygen\TiktokShop\Attribute\Config;
use Lackoxygen\TiktokShop\Exception\ClientException;
class PassageProxy
{
protected string $passage;
protected Config $config;
protected function __construct(string $passage, Config $config)
{
$this->passage = $passage;
$this->config = $config;
}
public static function proxy(string $passage, Config $config): PassageProxy
{
return new self($passage, $config);
}
/**
* @throws ClientException
*/
public function __call($name, $arguments): ResultSet
{
/**
* @var Passage $passage
*/
$passage = new $this->passage($this->config, $name);
$result = call_user_func_array([$passage, $name], $arguments);
if (!is_null($result)) {
return new ResultSet($result);
}
return new ResultSet($passage());
}
}
<?php
namespace Lackoxygen\TiktokShop\Passage\Address;
namespace Lackoxygen\TiktokShop\Request\Address;
use Lackoxygen\TiktokShop\Passage\Passage;
use Lackoxygen\TiktokShop\Request\Request;
class Address extends Passage implements AddressInterface
class Address extends Request implements AddressInterface
{
/**
* @inheritDoc
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Address;
use Lackoxygen\TiktokShop\Passage\ResultSet;
namespace Lackoxygen\TiktokShop\Request\Address;
/**
* @note 店铺API
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\AfterSale;
namespace Lackoxygen\TiktokShop\Request\AfterSale;
use Lackoxygen\TiktokShop\Passage\Passage;
use Lackoxygen\TiktokShop\Request\Request;
class AfterSale extends Passage implements AfterSaleInterface
class AfterSale extends Request implements AfterSaleInterface
{
/**
* @inheritDoc
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\AfterSale;
use Lackoxygen\TiktokShop\Passage\ResultSet;
namespace Lackoxygen\TiktokShop\Request\AfterSale;
/**
* @note 售后退款API
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Antispam;
namespace Lackoxygen\TiktokShop\Request\Antispam;
use Lackoxygen\TiktokShop\Passage\Passage;
use Lackoxygen\TiktokShop\Request\Request;
class Antispam extends Passage implements AntispamInterface
class Antispam extends Request implements AntispamInterface
{
/**
* @inheritDoc
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Antispam;
use Lackoxygen\TiktokShop\Passage\ResultSet;
namespace Lackoxygen\TiktokShop\Request\Antispam;
/**
* @note 风控安全API
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Btas;
namespace Lackoxygen\TiktokShop\Request\Btas;
use Lackoxygen\TiktokShop\Passage\Passage;
use Lackoxygen\TiktokShop\Request\Request;
class Btas extends Passage implements BtasInterface
class Btas extends Request implements BtasInterface
{
/**
* @inheritDoc
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Btas;
use Lackoxygen\TiktokShop\Passage\ResultSet;
namespace Lackoxygen\TiktokShop\Request\Btas;
/**
* @note BTAS质检API
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Buyin;
namespace Lackoxygen\TiktokShop\Request\Buyin;
use Lackoxygen\TiktokShop\Passage\Passage;
use Lackoxygen\TiktokShop\Request\Request;
class Buyin extends Passage implements BuyinInterface
class Buyin extends Request implements BuyinInterface
{
/**
* @inheritDoc
*/
public function buyinSimplePlan(array $params)
function buyinSimplePlan(array $params)
{
$this->builder->method('POST')
->service('buyin.simplePlan')
... ... @@ -20,7 +20,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinShopActivityList(array $params)
function buyinShopActivityList(array $params)
{
$this->builder->method('POST')
->service('buyin.ShopActivityList')
... ... @@ -31,7 +31,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinShopActivityDetail(array $params)
function buyinShopActivityDetail(array $params)
{
$this->builder->method('POST')
->service('buyin.shopActivityDetail')
... ... @@ -42,7 +42,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinApplyActivities(array $params)
function buyinApplyActivities(array $params)
{
$this->builder->method('POST')
->service('buyin.applyActivities')
... ... @@ -53,7 +53,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinActivityProductExtendList(array $params)
function buyinActivityProductExtendList(array $params)
{
$this->builder->method('POST')
->service('buyin.activityProductExtendList')
... ... @@ -64,7 +64,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinActivityProductExtendApprove(array $params)
function buyinActivityProductExtendApprove(array $params)
{
$this->builder->method('POST')
->service('buyin.activityProductExtendApprove')
... ... @@ -75,7 +75,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinCreateOrUpdateOrienPlan(array $params)
function buyinCreateOrUpdateOrienPlan(array $params)
{
$this->builder->method('POST')
->service('buyin.createOrUpdateOrienPlan')
... ... @@ -86,7 +86,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinOrienPlanList(array $params)
function buyinOrienPlanList(array $params)
{
$this->builder->method('POST')
->service('buyin.orienPlanList')
... ... @@ -97,7 +97,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinOrienPlanCtrl(array $params)
function buyinOrienPlanCtrl(array $params)
{
$this->builder->method('POST')
->service('buyin.orienPlanCtrl')
... ... @@ -108,7 +108,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinOrienPlanAuthors(array $params)
function buyinOrienPlanAuthors(array $params)
{
$this->builder->method('POST')
->service('buyin.orienPlanAuthors')
... ... @@ -119,7 +119,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinOrienPlanAuthorsAdd(array $params)
function buyinOrienPlanAuthorsAdd(array $params)
{
$this->builder->method('POST')
->service('buyin.orienPlanAuthorsAdd')
... ... @@ -130,7 +130,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinOrienPlanAudit(array $params)
function buyinOrienPlanAudit(array $params)
{
$this->builder->method('POST')
->service('buyin.orienPlanAudit')
... ... @@ -141,7 +141,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinExclusivePlan(array $params)
function buyinExclusivePlan(array $params)
{
$this->builder->method('POST')
->service('buyin.exclusivePlan')
... ... @@ -152,7 +152,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinExclusivePlanAuthorOperate(array $params)
function buyinExclusivePlanAuthorOperate(array $params)
{
$this->builder->method('POST')
->service('buyin.exclusivePlanAuthorOperate')
... ... @@ -163,7 +163,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function allianceColonelActivityCreateOrUpdate(array $params)
function allianceColonelActivityCreateOrUpdate(array $params)
{
$this->builder->method('POST')
->service('alliance.colonelActivityCreateOrUpdate')
... ... @@ -174,7 +174,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function allianceActivityProductCategoryList(array $params)
function allianceActivityProductCategoryList(array $params)
{
$this->builder->method('POST')
->service('alliance.activityProductCategoryList')
... ... @@ -185,7 +185,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function allianceInstituteColonelActivityList(array $params)
function allianceInstituteColonelActivityList(array $params)
{
$this->builder->method('POST')
->service('alliance.instituteColonelActivityList')
... ... @@ -196,7 +196,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function allianceInstituteColonelActivityOperate(array $params)
function allianceInstituteColonelActivityOperate(array $params)
{
$this->builder->method('POST')
->service('alliance.instituteColonelActivityOperate')
... ... @@ -207,7 +207,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function allianceColonelActivityProduct(array $params)
function allianceColonelActivityProduct(array $params)
{
$this->builder->method('POST')
->service('alliance.colonelActivityProduct')
... ... @@ -218,7 +218,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function allianceColonelActivityProductAudit(array $params)
function allianceColonelActivityProductAudit(array $params)
{
$this->builder->method('POST')
->service('alliance.colonelActivityProductAudit')
... ... @@ -229,7 +229,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinColonelspecialApplyList(array $params)
function buyinColonel/specialApplyList(array $params)
{
$this->builder->method('POST')
->service('buyin.colonel/specialApplyList')
... ... @@ -240,7 +240,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function allianceColonelActivityProductExtension(array $params)
function allianceColonelActivityProductExtension(array $params)
{
$this->builder->method('POST')
->service('alliance.colonelActivityProductExtension')
... ... @@ -251,7 +251,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinColonelspecialApplyDeal(array $params)
function buyinColonel/specialApplyDeal(array $params)
{
$this->builder->method('POST')
->service('buyin.colonel/specialApplyDeal')
... ... @@ -262,7 +262,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinOriginColonelEnrollableActivityList(array $params)
function buyinOriginColonelEnrollableActivityList(array $params)
{
$this->builder->method('POST')
->service('buyin.originColonelEnrollableActivityList')
... ... @@ -273,7 +273,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinColonelActivityDetail(array $params)
function buyinColonelActivityDetail(array $params)
{
$this->builder->method('POST')
->service('buyin.colonelActivityDetail')
... ... @@ -284,7 +284,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinOriginColonelUnappliedProductList(array $params)
function buyinOriginColonelUnappliedProductList(array $params)
{
$this->builder->method('POST')
->service('buyin.originColonelUnappliedProductList')
... ... @@ -295,7 +295,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinOriginColonelApplyActivities(array $params)
function buyinOriginColonelApplyActivities(array $params)
{
$this->builder->method('POST')
->service('buyin.originColonelApplyActivities')
... ... @@ -306,7 +306,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinActivityProductList(array $params)
function buyinActivityProductList(array $params)
{
$this->builder->method('POST')
->service('buyin.activityProductList')
... ... @@ -317,7 +317,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinActivityProductCancel(array $params)
function buyinActivityProductCancel(array $params)
{
$this->builder->method('POST')
->service('buyin.activityProductCancel')
... ... @@ -328,7 +328,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function allianceMaterialsProductsSearch(array $params)
function allianceMaterialsProductsSearch(array $params)
{
$this->builder->method('POST')
->service('alliance.materialsProductsSearch')
... ... @@ -339,7 +339,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinSimplePlanList(array $params)
function buyinSimplePlanList(array $params)
{
$this->builder->method('POST')
->service('buyin.simplePlanList')
... ... @@ -350,7 +350,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function allianceMaterialsProductsDetails(array $params)
function allianceMaterialsProductsDetails(array $params)
{
$this->builder->method('POST')
->service('alliance.materialsProductsDetails')
... ... @@ -361,7 +361,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinProductSkus(array $params)
function buyinProductSkus(array $params)
{
$this->builder->method('POST')
->service('buyin.productSkus')
... ... @@ -372,7 +372,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function allianceMaterialsProductCategory(array $params)
function allianceMaterialsProductCategory(array $params)
{
$this->builder->method('POST')
->service('alliance.materialsProductCategory')
... ... @@ -383,7 +383,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinMaterialsProductStatus(array $params)
function buyinMaterialsProductStatus(array $params)
{
$this->builder->method('POST')
->service('buyin.materialsProductStatus')
... ... @@ -394,7 +394,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinKolMaterialsProductsSearch(array $params)
function buyinKolMaterialsProductsSearch(array $params)
{
$this->builder->method('POST')
->service('buyin.kolMaterialsProductsSearch')
... ... @@ -405,7 +405,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinKolMaterialsProductsDetails(array $params)
function buyinKolMaterialsProductsDetails(array $params)
{
$this->builder->method('POST')
->service('buyin.kolMaterialsProductsDetails')
... ... @@ -416,7 +416,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinQueryInstituteOrders(array $params)
function buyinQueryInstituteOrders(array $params)
{
$this->builder->method('POST')
->service('buyin.queryInstituteOrders')
... ... @@ -427,7 +427,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinInstituteOrderMCN(array $params)
function buyinInstituteOrderMCN(array $params)
{
$this->builder->method('POST')
->service('buyin.instituteOrderMCN')
... ... @@ -438,7 +438,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinInstituteOrderColonel(array $params)
function buyinInstituteOrderColonel(array $params)
{
$this->builder->method('POST')
->service('buyin.instituteOrderColonel')
... ... @@ -449,7 +449,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinInstPickSourceConvert(array $params)
function buyinInstPickSourceConvert(array $params)
{
$this->builder->method('POST')
->service('buyin.instPickSourceConvert')
... ... @@ -460,7 +460,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinInstGmv(array $params)
function buyinInstGmv(array $params)
{
$this->builder->method('POST')
->service('buyin.instGmv')
... ... @@ -471,7 +471,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinInstGmvDetail(array $params)
function buyinInstGmvDetail(array $params)
{
$this->builder->method('POST')
->service('buyin.instGmvDetail')
... ... @@ -482,7 +482,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinKolPidCreate(array $params)
function buyinKolPidCreate(array $params)
{
$this->builder->method('POST')
->service('buyin.kolPidCreate')
... ... @@ -493,7 +493,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinKolPidList(array $params)
function buyinKolPidList(array $params)
{
$this->builder->method('POST')
->service('buyin.kolPidList')
... ... @@ -504,7 +504,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinKolPidEdit(array $params)
function buyinKolPidEdit(array $params)
{
$this->builder->method('POST')
->service('buyin.kolPidEdit')
... ... @@ -515,7 +515,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinKolPidDel(array $params)
function buyinKolPidDel(array $params)
{
$this->builder->method('POST')
->service('buyin.kolPidDel')
... ... @@ -526,7 +526,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinShareCommandParse(array $params)
function buyinShareCommandParse(array $params)
{
$this->builder->method('POST')
->service('buyin.shareCommandParse')
... ... @@ -537,7 +537,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinKolProductShare(array $params)
function buyinKolProductShare(array $params)
{
$this->builder->method('POST')
->service('buyin.kolProductShare')
... ... @@ -548,7 +548,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinInstitutePidCreate(array $params)
function buyinInstitutePidCreate(array $params)
{
$this->builder->method('POST')
->service('buyin.institutePidCreate')
... ... @@ -559,7 +559,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinInstitutePidList(array $params)
function buyinInstitutePidList(array $params)
{
$this->builder->method('POST')
->service('buyin.institutePidList')
... ... @@ -570,7 +570,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinInstitutePidEdit(array $params)
function buyinInstitutePidEdit(array $params)
{
$this->builder->method('POST')
->service('buyin.institutePidEdit')
... ... @@ -581,7 +581,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinInstitutePidDel(array $params)
function buyinInstitutePidDel(array $params)
{
$this->builder->method('POST')
->service('buyin.institutePidDel')
... ... @@ -592,7 +592,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinLiveShareMaterial(array $params)
function buyinLiveShareMaterial(array $params)
{
$this->builder->method('POST')
->service('buyin.liveShareMaterial')
... ... @@ -603,7 +603,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinDistributionLiveProductList(array $params)
function buyinDistributionLiveProductList(array $params)
{
$this->builder->method('POST')
->service('buyin.distributionLiveProductList')
... ... @@ -614,7 +614,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinInstituteLiveShare(array $params)
function buyinInstituteLiveShare(array $params)
{
$this->builder->method('POST')
->service('buyin.instituteLiveShare')
... ... @@ -625,7 +625,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinInstituteOrderAds(array $params)
function buyinInstituteOrderAds(array $params)
{
$this->builder->method('POST')
->service('buyin.instituteOrderAds')
... ... @@ -636,7 +636,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinKolOrderAds(array $params)
function buyinKolOrderAds(array $params)
{
$this->builder->method('POST')
->service('buyin.kolOrderAds')
... ... @@ -647,7 +647,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinShopPidMemberCreate(array $params)
function buyinShopPidMemberCreate(array $params)
{
$this->builder->method('POST')
->service('buyin.shopPidMemberCreate')
... ... @@ -658,7 +658,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinKolLiveShare(array $params)
function buyinKolLiveShare(array $params)
{
$this->builder->method('POST')
->service('buyin.kolLiveShare')
... ... @@ -669,7 +669,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinMHandleTrusteeshipApply(array $params)
function buyinMHandleTrusteeshipApply(array $params)
{
$this->builder->method('POST')
->service('buyin.mHandleTrusteeshipApply')
... ... @@ -680,7 +680,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinColoneltrusteeshipList(array $params)
function buyinColonel/trusteeshipList(array $params)
{
$this->builder->method('POST')
->service('buyin.colonel/trusteeshipList')
... ... @@ -691,7 +691,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinInstituteOrderPick(array $params)
function buyinInstituteOrderPick(array $params)
{
$this->builder->method('POST')
->service('buyin.instituteOrderPick')
... ... @@ -702,7 +702,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinInstituteLivePreviewShare(array $params)
function buyinInstituteLivePreviewShare(array $params)
{
$this->builder->method('POST')
->service('buyin.instituteLivePreviewShare')
... ... @@ -713,7 +713,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinKolLivePreviewShare(array $params)
function buyinKolLivePreviewShare(array $params)
{
$this->builder->method('POST')
->service('buyin.kolLivePreviewShare')
... ... @@ -724,7 +724,7 @@ class Buyin extends Passage implements BuyinInterface
/**
* @inheritDoc
*/
public function buyinActivityShareConvert(array $params)
function buyinActivityShareConvert(array $params)
{
$this->builder->method('POST')
->service('buyin.activityShareConvert')
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Buyin;
use Lackoxygen\TiktokShop\Passage\ResultSet;
namespace Lackoxygen\TiktokShop\Request\Buyin;
/**
* @note 精选联盟API
... ... @@ -15,7 +12,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinSimplePlan(array $params);
function buyinSimplePlan(array $params);
/**
* 商家可参与的团长活动查询接口
... ... @@ -23,7 +20,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinShopActivityList(array $params);
function buyinShopActivityList(array $params);
/**
* 商家侧获取团长活动详情
... ... @@ -31,7 +28,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinShopActivityDetail(array $params);
function buyinShopActivityDetail(array $params);
/**
* 商品团长活动提报接口
... ... @@ -39,7 +36,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinApplyActivities(array $params);
function buyinApplyActivities(array $params);
/**
* 延长推广待处理/已处理记录查询
... ... @@ -47,7 +44,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinActivityProductExtendList(array $params);
function buyinActivityProductExtendList(array $params);
/**
* 商家处理团长活动商品的推广延期申请
... ... @@ -55,7 +52,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinActivityProductExtendApprove(array $params);
function buyinActivityProductExtendApprove(array $params);
/**
* 创建/修改商品定向计划
... ... @@ -63,7 +60,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinCreateOrUpdateOrienPlan(array $params);
function buyinCreateOrUpdateOrienPlan(array $params);
/**
* 商品定向计划查询
... ... @@ -71,7 +68,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinOrienPlanList(array $params);
function buyinOrienPlanList(array $params);
/**
* 商品定向计划管理
... ... @@ -79,7 +76,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinOrienPlanCtrl(array $params);
function buyinOrienPlanCtrl(array $params);
/**
* 查询定向计划作者列表
... ... @@ -87,7 +84,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinOrienPlanAuthors(array $params);
function buyinOrienPlanAuthors(array $params);
/**
* 向指定定向计划中添加达人
... ... @@ -95,7 +92,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinOrienPlanAuthorsAdd(array $params);
function buyinOrienPlanAuthorsAdd(array $params);
/**
* 定向计划达人申请审核
... ... @@ -103,7 +100,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinOrienPlanAudit(array $params);
function buyinOrienPlanAudit(array $params);
/**
* 创建/修改商品专属推广计划
... ... @@ -111,7 +108,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinExclusivePlan(array $params);
function buyinExclusivePlan(array $params);
/**
* 店铺专属达人管理
... ... @@ -119,7 +116,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinExclusivePlanAuthorOperate(array $params);
function buyinExclusivePlanAuthorOperate(array $params);
/**
* 团长活动创建/编辑接口
... ... @@ -127,7 +124,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function allianceColonelActivityCreateOrUpdate(array $params);
function allianceColonelActivityCreateOrUpdate(array $params);
/**
* 创建活动时候可选择的类目接口
... ... @@ -135,7 +132,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function allianceActivityProductCategoryList(array $params);
function allianceActivityProductCategoryList(array $params);
/**
* 团长活动查询接口
... ... @@ -143,7 +140,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function allianceInstituteColonelActivityList(array $params);
function allianceInstituteColonelActivityList(array $params);
/**
* 专属团长活动删除接口(下线+删除)
... ... @@ -151,7 +148,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function allianceInstituteColonelActivityOperate(array $params);
function allianceInstituteColonelActivityOperate(array $params);
/**
* 活动商品查询接口
... ... @@ -159,7 +156,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function allianceColonelActivityProduct(array $params);
function allianceColonelActivityProduct(array $params);
/**
* 专属团长活动商品审核接口
... ... @@ -167,7 +164,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function allianceColonelActivityProductAudit(array $params);
function allianceColonelActivityProductAudit(array $params);
/**
* 查询团长活动特殊申请
... ... @@ -175,7 +172,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinColonelspecialApplyList(array $params);
function buyinColonel/specialApplyList(array $params);
/**
* 专属团长活动商品延时接口
... ... @@ -183,7 +180,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function allianceColonelActivityProductExtension(array $params);
function allianceColonelActivityProductExtension(array $params);
/**
* 团长活动特殊申请审核
... ... @@ -191,7 +188,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinColonelspecialApplyDeal(array $params);
function buyinColonel/specialApplyDeal(array $params);
/**
* 团长可参与的二级团长活动查询接口
... ... @@ -199,7 +196,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinOriginColonelEnrollableActivityList(array $params);
function buyinOriginColonelEnrollableActivityList(array $params);
/**
* 获取团长活动详情
... ... @@ -207,7 +204,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinColonelActivityDetail(array $params);
function buyinColonelActivityDetail(array $params);
/**
* 团长获取可提报二级团长活动的商品列表
... ... @@ -215,7 +212,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinOriginColonelUnappliedProductList(array $params);
function buyinOriginColonelUnappliedProductList(array $params);
/**
* 团长报名二级团长活动
... ... @@ -223,7 +220,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinOriginColonelApplyActivities(array $params);
function buyinOriginColonelApplyActivities(array $params);
/**
* 一级团长查询提报活动商品
... ... @@ -231,7 +228,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinActivityProductList(array $params);
function buyinActivityProductList(array $params);
/**
* 一级团长取消活动提报申请接口
... ... @@ -239,7 +236,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinActivityProductCancel(array $params);
function buyinActivityProductCancel(array $params);
/**
* 检索精选联盟商品
... ... @@ -247,7 +244,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function allianceMaterialsProductsSearch(array $params);
function allianceMaterialsProductsSearch(array $params);
/**
* 商品推广 普通计划查询
... ... @@ -255,7 +252,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinSimplePlanList(array $params);
function buyinSimplePlanList(array $params);
/**
* 批量查询推广商品详情
... ... @@ -263,7 +260,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function allianceMaterialsProductsDetails(array $params);
function allianceMaterialsProductsDetails(array $params);
/**
* 查询商品 SKU
... ... @@ -271,7 +268,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinProductSkus(array $params);
function buyinProductSkus(array $params);
/**
* 类目查询
... ... @@ -279,7 +276,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function allianceMaterialsProductCategory(array $params);
function allianceMaterialsProductCategory(array $params);
/**
* 商品状态查询
... ... @@ -287,7 +284,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinMaterialsProductStatus(array $params);
function buyinMaterialsProductStatus(array $params);
/**
* 检索精选联盟商品,需达人授权
... ... @@ -295,7 +292,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinKolMaterialsProductsSearch(array $params);
function buyinKolMaterialsProductsSearch(array $params);
/**
* 查询达人视角商品详情
... ... @@ -303,7 +300,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinKolMaterialsProductsDetails(array $params);
function buyinKolMaterialsProductsDetails(array $params);
/**
* 【即将下线】查询机构联盟订单
... ... @@ -311,7 +308,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinQueryInstituteOrders(array $params);
function buyinQueryInstituteOrders(array $params);
/**
* 查询MCN机构订单
... ... @@ -319,7 +316,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinInstituteOrderMCN(array $params);
function buyinInstituteOrderMCN(array $params);
/**
* 机构查询团长订单
... ... @@ -327,7 +324,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinInstituteOrderColonel(array $params);
function buyinInstituteOrderColonel(array $params);
/**
* 商品选品来源转链
... ... @@ -335,7 +332,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinInstPickSourceConvert(array $params);
function buyinInstPickSourceConvert(array $params);
/**
* 机构选品GMV查询接口
... ... @@ -343,7 +340,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinInstGmv(array $params);
function buyinInstGmv(array $params);
/**
* 机构选品GMV明细查询接口
... ... @@ -351,7 +348,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinInstGmvDetail(array $params);
function buyinInstGmvDetail(array $params);
/**
* 达人PID创建
... ... @@ -359,7 +356,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinKolPidCreate(array $params);
function buyinKolPidCreate(array $params);
/**
* 达人PID查询接口
... ... @@ -367,7 +364,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinKolPidList(array $params);
function buyinKolPidList(array $params);
/**
* 达人PID 编辑
... ... @@ -375,7 +372,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinKolPidEdit(array $params);
function buyinKolPidEdit(array $params);
/**
* 达人PID删除
... ... @@ -383,7 +380,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinKolPidDel(array $params);
function buyinKolPidDel(array $params);
/**
* 商品口令转商品解析
... ... @@ -391,7 +388,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinShareCommandParse(array $params);
function buyinShareCommandParse(array $params);
/**
* 达人商品分销转链
... ... @@ -399,7 +396,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinKolProductShare(array $params);
function buyinKolProductShare(array $params);
/**
* 机构PID创建
... ... @@ -407,7 +404,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinInstitutePidCreate(array $params);
function buyinInstitutePidCreate(array $params);
/**
* 机构PID查询接口
... ... @@ -415,7 +412,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinInstitutePidList(array $params);
function buyinInstitutePidList(array $params);
/**
* 机构PID 编辑
... ... @@ -423,7 +420,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinInstitutePidEdit(array $params);
function buyinInstitutePidEdit(array $params);
/**
* 机构PID删除
... ... @@ -431,7 +428,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinInstitutePidDel(array $params);
function buyinInstitutePidDel(array $params);
/**
* 直播间分销物料查询
... ... @@ -439,7 +436,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinLiveShareMaterial(array $params);
function buyinLiveShareMaterial(array $params);
/**
* 分销直播间商品列表
... ... @@ -447,7 +444,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinDistributionLiveProductList(array $params);
function buyinDistributionLiveProductList(array $params);
/**
* 机构获取达人直播间分享链接
... ... @@ -455,7 +452,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinInstituteLiveShare(array $params);
function buyinInstituteLiveShare(array $params);
/**
* 查询抖客直播间分销订单
... ... @@ -463,7 +460,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinInstituteOrderAds(array $params);
function buyinInstituteOrderAds(array $params);
/**
* 查询达人的直播间分销、商品分销、活动页分销订单
... ... @@ -471,7 +468,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinKolOrderAds(array $params);
function buyinKolOrderAds(array $params);
/**
* 店铺会员绑定渠道关系创建
... ... @@ -479,7 +476,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinShopPidMemberCreate(array $params);
function buyinShopPidMemberCreate(array $params);
/**
* 获取达人直播间分享链接
... ... @@ -487,7 +484,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinKolLiveShare(array $params);
function buyinKolLiveShare(array $params);
/**
* 团长托管商品审核
... ... @@ -495,7 +492,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinMHandleTrusteeshipApply(array $params);
function buyinMHandleTrusteeshipApply(array $params);
/**
* 团长托管商品查询
... ... @@ -503,7 +500,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinColoneltrusteeshipList(array $params);
function buyinColonel/trusteeshipList(array $params);
/**
* 选品订单明细查询接口
... ... @@ -511,7 +508,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinInstituteOrderPick(array $params);
function buyinInstituteOrderPick(array $params);
/**
* 机构直播预告转链
... ... @@ -519,7 +516,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinInstituteLivePreviewShare(array $params);
function buyinInstituteLivePreviewShare(array $params);
/**
* 达人直播预告转链
... ... @@ -527,7 +524,7 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinKolLivePreviewShare(array $params);
function buyinKolLivePreviewShare(array $params);
/**
* 活动页转链接口
... ... @@ -535,5 +532,5 @@ interface BuyinInterface
* @param array $params
* @return ResultSet
*/
public function buyinActivityShareConvert(array $params);
function buyinActivityShareConvert(array $params);
}
\ No newline at end of file
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Coupons;
namespace Lackoxygen\TiktokShop\Request\Coupons;
use Lackoxygen\TiktokShop\Passage\Passage;
use Lackoxygen\TiktokShop\Request\Request;
class Coupons extends Passage implements CouponsInterface
class Coupons extends Request implements CouponsInterface
{
/**
* @inheritDoc
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Coupons;
use Lackoxygen\TiktokShop\Passage\ResultSet;
namespace Lackoxygen\TiktokShop\Request\Coupons;
/**
* @note 卡券API
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Crossborder;
namespace Lackoxygen\TiktokShop\Request\Crossborder;
use Lackoxygen\TiktokShop\Passage\Passage;
use Lackoxygen\TiktokShop\Request\Request;
class Crossborder extends Passage implements CrossborderInterface
class Crossborder extends Request implements CrossborderInterface
{
/**
* @inheritDoc
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Crossborder;
use Lackoxygen\TiktokShop\Passage\ResultSet;
namespace Lackoxygen\TiktokShop\Request\Crossborder;
/**
* @note 跨境API
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Iop;
namespace Lackoxygen\TiktokShop\Request\Iop;
use Lackoxygen\TiktokShop\Passage\Passage;
use Lackoxygen\TiktokShop\Request\Request;
class Iop extends Passage implements IopInterface
class Iop extends Request implements IopInterface
{
/**
* @inheritDoc
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Iop;
use Lackoxygen\TiktokShop\Passage\ResultSet;
namespace Lackoxygen\TiktokShop\Request\Iop;
/**
* @note 代发API
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Logistics;
namespace Lackoxygen\TiktokShop\Request\Logistics;
use Lackoxygen\TiktokShop\Passage\Passage;
use Lackoxygen\TiktokShop\Request\Request;
class Logistics extends Passage implements LogisticsInterface
class Logistics extends Request implements LogisticsInterface
{
/**
* @inheritDoc
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Logistics;
use Lackoxygen\TiktokShop\Passage\ResultSet;
namespace Lackoxygen\TiktokShop\Request\Logistics;
/**
* @note 物流发货API
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Material;
namespace Lackoxygen\TiktokShop\Request\Material;
use Lackoxygen\TiktokShop\Passage\Passage;
use Lackoxygen\TiktokShop\Request\Request;
class Material extends Passage implements MaterialInterface
class Material extends Request implements MaterialInterface
{
/**
* @inheritDoc
... ... @@ -207,6 +207,17 @@ class Material extends Passage implements MaterialInterface
/**
* @inheritDoc
*/
public function materialMGetPlayInfo(array $params)
{
$this->builder->method('POST')
->service('material.mGetPlayInfo')
->path('/material/mGetPlayInfo')
->params($params);
}
/**
* @inheritDoc
*/
public function materialEasyShuttle(array $params)
{
$this->builder->method('POST')
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Material;
use Lackoxygen\TiktokShop\Passage\ResultSet;
namespace Lackoxygen\TiktokShop\Request\Material;
/**
* @note 素材中心API
... ... @@ -154,6 +152,14 @@ interface MaterialInterface
public function materialGetCapInfo(array $params);
/**
* 批量获取视频信息
* @link https://op.jinritemai.com/docs/api-docs/69/2164
* @param array $params
* @return ResultSet
*/
public function materialMGetPlayInfo(array $params);
/**
* 一键删除
* @link https://op.jinritemai.com/docs/api-docs/69/1955
* @param array $params
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Member;
namespace Lackoxygen\TiktokShop\Request\Member;
use Lackoxygen\TiktokShop\Passage\Passage;
use Lackoxygen\TiktokShop\Request\Request;
class Member extends Passage implements MemberInterface
class Member extends Request implements MemberInterface
{
/**
* @inheritDoc
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Member;
use Lackoxygen\TiktokShop\Passage\ResultSet;
namespace Lackoxygen\TiktokShop\Request\Member;
/**
* @note 会员中心API
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\OpenCloud;
namespace Lackoxygen\TiktokShop\Request\OpenCloud;
use Lackoxygen\TiktokShop\Passage\Passage;
use Lackoxygen\TiktokShop\Request\Request;
class OpenCloud extends Passage implements OpenCloudInterface
class OpenCloud extends Request implements OpenCloudInterface
{
/**
* @inheritDoc
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\OpenCloud;
use Lackoxygen\TiktokShop\Passage\ResultSet;
namespace Lackoxygen\TiktokShop\Request\OpenCloud;
/**
* @note 电商云API
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Order;
namespace Lackoxygen\TiktokShop\Request\Order;
use Lackoxygen\TiktokShop\Passage\Passage;
use Lackoxygen\TiktokShop\Request\Request;
class Order extends Passage implements OrderInterface
class Order extends Request implements OrderInterface
{
/**
* @inheritDoc
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Order;
use Lackoxygen\TiktokShop\Passage\ResultSet;
namespace Lackoxygen\TiktokShop\Request\Order;
/**
* @note 订单API
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\OrderCode;
namespace Lackoxygen\TiktokShop\Request\OrderCode;
use Lackoxygen\TiktokShop\Passage\Passage;
use Lackoxygen\TiktokShop\Request\Request;
class OrderCode extends Passage implements OrderCodeInterface
class OrderCode extends Request implements OrderCodeInterface
{
/**
* @inheritDoc
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\OrderCode;
use Lackoxygen\TiktokShop\Passage\ResultSet;
namespace Lackoxygen\TiktokShop\Request\OrderCode;
/**
* @note BIC质检API
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Pigeon;
namespace Lackoxygen\TiktokShop\Request\Pigeon;
use Lackoxygen\TiktokShop\Passage\Passage;
use Lackoxygen\TiktokShop\Request\Request;
class Pigeon extends Passage implements PigeonInterface
class Pigeon extends Request implements PigeonInterface
{
/**
* @inheritDoc
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Pigeon;
use Lackoxygen\TiktokShop\Passage\ResultSet;
namespace Lackoxygen\TiktokShop\Request\Pigeon;
/**
* @note 飞鸽API
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Product;
namespace Lackoxygen\TiktokShop\Request\Product;
use Lackoxygen\TiktokShop\Passage\Passage;
use Lackoxygen\TiktokShop\Request\Request;
class Product extends Passage implements ProductInterface
class Product extends Request implements ProductInterface
{
/**
* @inheritDoc
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Product;
use Lackoxygen\TiktokShop\Passage\ResultSet;
namespace Lackoxygen\TiktokShop\Request\Product;
/**
* @note 商品API
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Recycle;
namespace Lackoxygen\TiktokShop\Request\Recycle;
use Lackoxygen\TiktokShop\Passage\Passage;
use Lackoxygen\TiktokShop\Request\Request;
class Recycle extends Passage implements RecycleInterface
class Recycle extends Request implements RecycleInterface
{
/**
* @inheritDoc
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Recycle;
use Lackoxygen\TiktokShop\Passage\ResultSet;
namespace Lackoxygen\TiktokShop\Request\Recycle;
/**
* @note 回收寄卖API
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage;
namespace Lackoxygen\TiktokShop\Request;
use Lackoxygen\TiktokShop\Attribute\Config;
use Lackoxygen\TiktokShop\Attribute\Config\Config;
use Lackoxygen\TiktokShop\Attribute\Config\Option;
use Lackoxygen\TiktokShop\Exception\ClientException;
use Lackoxygen\TiktokShop\Transmit\Builder;
use Lackoxygen\TiktokShop\Support\Client\Builder;
use Psr\Http\Message\ResponseInterface;
abstract class Passage
abstract class Request extends Config
{
protected Config $config;
/**
* @var Builder
*/
protected Builder $builder;
/**
* @param Config $config
* @param Option $config
* @param string $method
*/
public function __construct(Config $config, string $method)
public function __construct(Option $config, string $method)
{
$this->config = $config;
$this->builder = Builder::create($config, get_class($this), $method);
parent::__construct($config);
$this->builder = Builder::create(
$config,
get_class($this),
$method
);
}
/**
... ...
<?php
namespace Lackoxygen\TiktokShop\Request;
use Lackoxygen\TiktokShop\Attribute\Config\Config;
use Lackoxygen\TiktokShop\Attribute\Config\Option;
use Lackoxygen\TiktokShop\Exception\ClientException;
use Lackoxygen\TiktokShop\Response\ResultSet;
class RequestProxy extends Config
{
/**
* @var string
*/
protected string $request;
/**
* @param Option $config
* @param string $request
*/
protected function __construct(Option $config, string $request)
{
parent::__construct($config);
$this->request = $request;
}
/**
* @param string $request
* @param Option $config
* @return RequestProxy
*/
public static function proxy(string $request, Option $config): RequestProxy
{
return new self($config, $request);
}
/**
* @throws ClientException
*/
public function __call($name, $arguments): ResultSet
{
/**
* @var Request $request
*/
$request = new $this->request($this->config, $name);
$result = call_user_func_array([$request, $name], $arguments);
if (!is_null($result)) {
return new ResultSet($result);
}
return new ResultSet($request());
}
}
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Sms;
namespace Lackoxygen\TiktokShop\Request\Sms;
use Lackoxygen\TiktokShop\Passage\Passage;
use Lackoxygen\TiktokShop\Request\Request;
class Sms extends Passage implements SmsInterface
class Sms extends Request implements SmsInterface
{
/**
* @inheritDoc
*/
public function smsTemplateapply(array $params)
function smsTemplate/apply(array $params)
{
$this->builder->method('POST')
->service('sms.template/apply')
... ... @@ -20,7 +20,7 @@ class Sms extends Passage implements SmsInterface
/**
* @inheritDoc
*/
public function smsPublictemplate(array $params)
function smsPublic/template(array $params)
{
$this->builder->method('POST')
->service('sms.public/template')
... ... @@ -31,7 +31,7 @@ class Sms extends Passage implements SmsInterface
/**
* @inheritDoc
*/
public function smsSignapply(array $params)
function smsSign/apply(array $params)
{
$this->builder->method('POST')
->service('sms.sign/apply')
... ... @@ -42,7 +42,7 @@ class Sms extends Passage implements SmsInterface
/**
* @inheritDoc
*/
public function smsTemplaterevoke(array $params)
function smsTemplate/revoke(array $params)
{
$this->builder->method('POST')
->service('sms.template/revoke')
... ... @@ -53,7 +53,7 @@ class Sms extends Passage implements SmsInterface
/**
* @inheritDoc
*/
public function smsSignapplylist(array $params)
function smsSign/apply/list(array $params)
{
$this->builder->method('POST')
->service('sms.sign/apply/list')
... ... @@ -64,7 +64,7 @@ class Sms extends Passage implements SmsInterface
/**
* @inheritDoc
*/
public function smsSend(array $params)
function smsSend(array $params)
{
$this->builder->method('POST')
->service('sms.send')
... ... @@ -75,7 +75,7 @@ class Sms extends Passage implements SmsInterface
/**
* @inheritDoc
*/
public function smsBatchSend(array $params)
function smsBatchSend(array $params)
{
$this->builder->method('POST')
->service('sms.batchSend')
... ... @@ -86,7 +86,7 @@ class Sms extends Passage implements SmsInterface
/**
* @inheritDoc
*/
public function smsSigndelete(array $params)
function smsSign/delete(array $params)
{
$this->builder->method('POST')
->service('sms.sign/delete')
... ... @@ -97,7 +97,7 @@ class Sms extends Passage implements SmsInterface
/**
* @inheritDoc
*/
public function smsSignapplyrevoke(array $params)
function smsSign/apply/revoke(array $params)
{
$this->builder->method('POST')
->service('sms.sign/apply/revoke')
... ... @@ -108,7 +108,7 @@ class Sms extends Passage implements SmsInterface
/**
* @inheritDoc
*/
public function smsTemplatedelete(array $params)
function smsTemplate/delete(array $params)
{
$this->builder->method('POST')
->service('sms.template/delete')
... ... @@ -119,7 +119,7 @@ class Sms extends Passage implements SmsInterface
/**
* @inheritDoc
*/
public function smsSendResult(array $params)
function smsSendResult(array $params)
{
$this->builder->method('POST')
->service('sms.sendResult')
... ... @@ -130,7 +130,7 @@ class Sms extends Passage implements SmsInterface
/**
* @inheritDoc
*/
public function smsTemplateapplylist(array $params)
function smsTemplate/apply/list(array $params)
{
$this->builder->method('POST')
->service('sms.template/apply/list')
... ... @@ -141,7 +141,7 @@ class Sms extends Passage implements SmsInterface
/**
* @inheritDoc
*/
public function smsSignsearch(array $params)
function smsSign/search(array $params)
{
$this->builder->method('POST')
->service('sms.sign/search')
... ... @@ -152,7 +152,7 @@ class Sms extends Passage implements SmsInterface
/**
* @inheritDoc
*/
public function smsTemplatesearch(array $params)
function smsTemplate/search(array $params)
{
$this->builder->method('POST')
->service('sms.template/search')
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Sms;
use Lackoxygen\TiktokShop\Passage\ResultSet;
namespace Lackoxygen\TiktokShop\Request\Sms;
/**
* @note 短信API
... ... @@ -15,7 +12,7 @@ interface SmsInterface
* @param array $params
* @return ResultSet
*/
public function smsTemplateapply(array $params);
function smsTemplate/apply(array $params);
/**
* 公共模版查询接口
... ... @@ -23,7 +20,7 @@ interface SmsInterface
* @param array $params
* @return ResultSet
*/
public function smsPublictemplate(array $params);
function smsPublic/template(array $params);
/**
* 提交短信签名申请单
... ... @@ -31,7 +28,7 @@ interface SmsInterface
* @param array $params
* @return ResultSet
*/
public function smsSignapply(array $params);
function smsSign/apply(array $params);
/**
* 撤销短信模板申请单
... ... @@ -39,7 +36,7 @@ interface SmsInterface
* @param array $params
* @return ResultSet
*/
public function smsTemplaterevoke(array $params);
function smsTemplate/revoke(array $params);
/**
* 查看短信签名申请单
... ... @@ -47,7 +44,7 @@ interface SmsInterface
* @param array $params
* @return ResultSet
*/
public function smsSignapplylist(array $params);
function smsSign/apply/list(array $params);
/**
* 短信发送
... ... @@ -55,7 +52,7 @@ interface SmsInterface
* @param array $params
* @return ResultSet
*/
public function smsSend(array $params);
function smsSend(array $params);
/**
* 批量短信发送
... ... @@ -63,7 +60,7 @@ interface SmsInterface
* @param array $params
* @return ResultSet
*/
public function smsBatchSend(array $params);
function smsBatchSend(array $params);
/**
* 删除短信签名
... ... @@ -71,7 +68,7 @@ interface SmsInterface
* @param array $params
* @return ResultSet
*/
public function smsSigndelete(array $params);
function smsSign/delete(array $params);
/**
* 撤销短信签名申请单
... ... @@ -79,7 +76,7 @@ interface SmsInterface
* @param array $params
* @return ResultSet
*/
public function smsSignapplyrevoke(array $params);
function smsSign/apply/revoke(array $params);
/**
* 删除短信模板
... ... @@ -87,7 +84,7 @@ interface SmsInterface
* @param array $params
* @return ResultSet
*/
public function smsTemplatedelete(array $params);
function smsTemplate/delete(array $params);
/**
* 查询短信发送结果
... ... @@ -95,7 +92,7 @@ interface SmsInterface
* @param array $params
* @return ResultSet
*/
public function smsSendResult(array $params);
function smsSendResult(array $params);
/**
* 查询短信模板申请单
... ... @@ -103,7 +100,7 @@ interface SmsInterface
* @param array $params
* @return ResultSet
*/
public function smsTemplateapplylist(array $params);
function smsTemplate/apply/list(array $params);
/**
* 查看短信签名
... ... @@ -111,7 +108,7 @@ interface SmsInterface
* @param array $params
* @return ResultSet
*/
public function smsSignsearch(array $params);
function smsSign/search(array $params);
/**
* 查询短信模板
... ... @@ -119,5 +116,5 @@ interface SmsInterface
* @param array $params
* @return ResultSet
*/
public function smsTemplatesearch(array $params);
function smsTemplate/search(array $params);
}
\ No newline at end of file
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\SupplyChain;
namespace Lackoxygen\TiktokShop\Request\SupplyChain;
use Lackoxygen\TiktokShop\Passage\Passage;
use Lackoxygen\TiktokShop\Request\Request;
class SupplyChain extends Passage implements SupplyChainInterface
class SupplyChain extends Request implements SupplyChainInterface
{
/**
* @inheritDoc
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\SupplyChain;
use Lackoxygen\TiktokShop\Passage\ResultSet;
namespace Lackoxygen\TiktokShop\Request\SupplyChain;
/**
* @note 供销平台API
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Token;
namespace Lackoxygen\TiktokShop\Request\Token;
use Lackoxygen\TiktokShop\Passage\Passage;
use Lackoxygen\TiktokShop\Request\Request;
class Token extends Passage implements TokenInterface
class Token extends Request implements TokenInterface
{
/**
* @inheritDoc
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Token;
use Lackoxygen\TiktokShop\Passage\ResultSet;
namespace Lackoxygen\TiktokShop\Request\Token;
/**
* @note 工具API
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Topup;
namespace Lackoxygen\TiktokShop\Request\Topup;
use Lackoxygen\TiktokShop\Passage\Passage;
use Lackoxygen\TiktokShop\Request\Request;
class Topup extends Passage implements TopupInterface
class Topup extends Request implements TopupInterface
{
/**
* @inheritDoc
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Topup;
use Lackoxygen\TiktokShop\Passage\ResultSet;
namespace Lackoxygen\TiktokShop\Request\Topup;
/**
* @note 虚拟充值API
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Warehouse;
namespace Lackoxygen\TiktokShop\Request\Warehouse;
use Lackoxygen\TiktokShop\Passage\Passage;
use Lackoxygen\TiktokShop\Request\Request;
class Warehouse extends Passage implements WarehouseInterface
class Warehouse extends Request implements WarehouseInterface
{
/**
* @inheritDoc
*/
public function skuStockNum(array $params)
function skuStockNum(array $params)
{
$this->builder->method('POST')
->service('sku.stockNum')
... ... @@ -20,7 +20,7 @@ class Warehouse extends Passage implements WarehouseInterface
/**
* @inheritDoc
*/
public function skuSyncStock(array $params)
function skuSyncStock(array $params)
{
$this->builder->method('POST')
->service('sku.syncStock')
... ... @@ -31,7 +31,7 @@ class Warehouse extends Passage implements WarehouseInterface
/**
* @inheritDoc
*/
public function warehouseadjustInventory(array $params)
function /warehouse/adjustInventory(array $params)
{
$this->builder->method('POST')
->service('/warehouse/adjustInventory')
... ... @@ -42,7 +42,7 @@ class Warehouse extends Passage implements WarehouseInterface
/**
* @inheritDoc
*/
public function skuSyncStockBatch(array $params)
function skuSyncStockBatch(array $params)
{
$this->builder->method('POST')
->service('sku.syncStockBatch')
... ... @@ -53,7 +53,7 @@ class Warehouse extends Passage implements WarehouseInterface
/**
* @inheritDoc
*/
public function warehouseSetFence(array $params)
function warehouseSetFence(array $params)
{
$this->builder->method('POST')
->service('warehouse.setFence')
... ... @@ -64,7 +64,7 @@ class Warehouse extends Passage implements WarehouseInterface
/**
* @inheritDoc
*/
public function warehouseGetFences(array $params)
function warehouseGetFences(array $params)
{
$this->builder->method('POST')
->service('warehouse.getFences')
... ... @@ -75,7 +75,7 @@ class Warehouse extends Passage implements WarehouseInterface
/**
* @inheritDoc
*/
public function warehouseCreateFence(array $params)
function warehouseCreateFence(array $params)
{
$this->builder->method('POST')
->service('warehouse.createFence')
... ... @@ -86,7 +86,7 @@ class Warehouse extends Passage implements WarehouseInterface
/**
* @inheritDoc
*/
public function warehouseUnbindFences(array $params)
function warehouseUnbindFences(array $params)
{
$this->builder->method('POST')
->service('warehouse.unbindFences')
... ... @@ -97,7 +97,7 @@ class Warehouse extends Passage implements WarehouseInterface
/**
* @inheritDoc
*/
public function warehouseRemoveAddr(array $params)
function warehouseRemoveAddr(array $params)
{
$this->builder->method('POST')
->service('warehouse.removeAddr')
... ... @@ -108,7 +108,7 @@ class Warehouse extends Passage implements WarehouseInterface
/**
* @inheritDoc
*/
public function promiseSetSkuShipTime(array $params)
function promiseSetSkuShipTime(array $params)
{
$this->builder->method('POST')
->service('promise.setSkuShipTime')
... ... @@ -119,7 +119,7 @@ class Warehouse extends Passage implements WarehouseInterface
/**
* @inheritDoc
*/
public function warehouseInfo(array $params)
function warehouseInfo(array $params)
{
$this->builder->method('POST')
->service('warehouse.info')
... ... @@ -130,7 +130,7 @@ class Warehouse extends Passage implements WarehouseInterface
/**
* @inheritDoc
*/
public function warehouseEdit(array $params)
function warehouseEdit(array $params)
{
$this->builder->method('POST')
->service('warehouse.edit')
... ... @@ -141,7 +141,7 @@ class Warehouse extends Passage implements WarehouseInterface
/**
* @inheritDoc
*/
public function warehouseCreate(array $params)
function warehouseCreate(array $params)
{
$this->builder->method('POST')
->service('warehouse.create')
... ... @@ -152,7 +152,7 @@ class Warehouse extends Passage implements WarehouseInterface
/**
* @inheritDoc
*/
public function warehouseSetAddr(array $params)
function warehouseSetAddr(array $params)
{
$this->builder->method('POST')
->service('warehouse.setAddr')
... ... @@ -163,7 +163,7 @@ class Warehouse extends Passage implements WarehouseInterface
/**
* @inheritDoc
*/
public function warehouseList(array $params)
function warehouseList(array $params)
{
$this->builder->method('POST')
->service('warehouse.list')
... ... @@ -174,7 +174,7 @@ class Warehouse extends Passage implements WarehouseInterface
/**
* @inheritDoc
*/
public function warehouseSetAddrBatch(array $params)
function warehouseSetAddrBatch(array $params)
{
$this->builder->method('POST')
->service('warehouse.setAddrBatch')
... ... @@ -185,7 +185,7 @@ class Warehouse extends Passage implements WarehouseInterface
/**
* @inheritDoc
*/
public function warehouseCreateBatch(array $params)
function warehouseCreateBatch(array $params)
{
$this->builder->method('POST')
->service('warehouse.createBatch')
... ... @@ -196,7 +196,7 @@ class Warehouse extends Passage implements WarehouseInterface
/**
* @inheritDoc
*/
public function warehouseSetPriority(array $params)
function warehouseSetPriority(array $params)
{
$this->builder->method('POST')
->service('warehouse.setPriority')
... ... @@ -207,7 +207,7 @@ class Warehouse extends Passage implements WarehouseInterface
/**
* @inheritDoc
*/
public function warehouseDelFence(array $params)
function warehouseDelFence(array $params)
{
$this->builder->method('POST')
->service('warehouse.delFence')
... ... @@ -218,7 +218,7 @@ class Warehouse extends Passage implements WarehouseInterface
/**
* @inheritDoc
*/
public function warehouseBindFences(array $params)
function warehouseBindFences(array $params)
{
$this->builder->method('POST')
->service('warehouse.bindFences')
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Warehouse;
use Lackoxygen\TiktokShop\Passage\ResultSet;
namespace Lackoxygen\TiktokShop\Request\Warehouse;
/**
* @note 库存API
... ... @@ -15,7 +12,7 @@ interface WarehouseInterface
* @param array $params
* @return ResultSet
*/
public function skuStockNum(array $params);
function skuStockNum(array $params);
/**
* 修改sku库存
... ... @@ -23,7 +20,7 @@ interface WarehouseInterface
* @param array $params
* @return ResultSet
*/
public function skuSyncStock(array $params);
function skuSyncStock(array $params);
/**
* 库存调整(盘点和转移)
... ... @@ -31,7 +28,7 @@ interface WarehouseInterface
* @param array $params
* @return ResultSet
*/
public function warehouseadjustInventory(array $params);
function /warehouse/adjustInventory(array $params);
/**
* 批量同步接口
... ... @@ -39,7 +36,7 @@ interface WarehouseInterface
* @param array $params
* @return ResultSet
*/
public function skuSyncStockBatch(array $params);
function skuSyncStockBatch(array $params);
/**
* 修改围栏信息
... ... @@ -47,7 +44,7 @@ interface WarehouseInterface
* @param array $params
* @return ResultSet
*/
public function warehouseSetFence(array $params);
function warehouseSetFence(array $params);
/**
* 获取电子围栏信息/列表
... ... @@ -55,7 +52,7 @@ interface WarehouseInterface
* @param array $params
* @return ResultSet
*/
public function warehouseGetFences(array $params);
function warehouseGetFences(array $params);
/**
* 创建电子围栏
... ... @@ -63,7 +60,7 @@ interface WarehouseInterface
* @param array $params
* @return ResultSet
*/
public function warehouseCreateFence(array $params);
function warehouseCreateFence(array $params);
/**
* 接绑电子围栏
... ... @@ -71,7 +68,7 @@ interface WarehouseInterface
* @param array $params
* @return ResultSet
*/
public function warehouseUnbindFences(array $params);
function warehouseUnbindFences(array $params);
/**
* 地址与区域仓解绑
... ... @@ -79,7 +76,7 @@ interface WarehouseInterface
* @param array $params
* @return ResultSet
*/
public function warehouseRemoveAddr(array $params);
function warehouseRemoveAddr(array $params);
/**
* 设置sku发货时效
... ... @@ -87,7 +84,7 @@ interface WarehouseInterface
* @param array $params
* @return ResultSet
*/
public function promiseSetSkuShipTime(array $params);
function promiseSetSkuShipTime(array $params);
/**
* 查询区域仓
... ... @@ -95,7 +92,7 @@ interface WarehouseInterface
* @param array $params
* @return ResultSet
*/
public function warehouseInfo(array $params);
function warehouseInfo(array $params);
/**
* 编辑区域仓
... ... @@ -103,7 +100,7 @@ interface WarehouseInterface
* @param array $params
* @return ResultSet
*/
public function warehouseEdit(array $params);
function warehouseEdit(array $params);
/**
* 创建单个区域仓
... ... @@ -111,7 +108,7 @@ interface WarehouseInterface
* @param array $params
* @return ResultSet
*/
public function warehouseCreate(array $params);
function warehouseCreate(array $params);
/**
* 绑定单个地址到区域仓
... ... @@ -119,7 +116,7 @@ interface WarehouseInterface
* @param array $params
* @return ResultSet
*/
public function warehouseSetAddr(array $params);
function warehouseSetAddr(array $params);
/**
* 批量查询区域仓
... ... @@ -127,7 +124,7 @@ interface WarehouseInterface
* @param array $params
* @return ResultSet
*/
public function warehouseList(array $params);
function warehouseList(array $params);
/**
* 批量绑定地址与区域仓
... ... @@ -135,7 +132,7 @@ interface WarehouseInterface
* @param array $params
* @return ResultSet
*/
public function warehouseSetAddrBatch(array $params);
function warehouseSetAddrBatch(array $params);
/**
* 批量创建区域仓
... ... @@ -143,7 +140,7 @@ interface WarehouseInterface
* @param array $params
* @return ResultSet
*/
public function warehouseCreateBatch(array $params);
function warehouseCreateBatch(array $params);
/**
* 设置指定地址下的仓的优先级
... ... @@ -151,7 +148,7 @@ interface WarehouseInterface
* @param array $params
* @return ResultSet
*/
public function warehouseSetPriority(array $params);
function warehouseSetPriority(array $params);
/**
* 删除电子围栏
... ... @@ -159,7 +156,7 @@ interface WarehouseInterface
* @param array $params
* @return ResultSet
*/
public function warehouseDelFence(array $params);
function warehouseDelFence(array $params);
/**
* 仓绑定电子围栏
... ... @@ -167,5 +164,5 @@ interface WarehouseInterface
* @param array $params
* @return ResultSet
*/
public function warehouseBindFences(array $params);
function warehouseBindFences(array $params);
}
\ No newline at end of file
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Yunc;
namespace Lackoxygen\TiktokShop\Request\Yunc;
use Lackoxygen\TiktokShop\Passage\Passage;
use Lackoxygen\TiktokShop\Request\Request;
class Yunc extends Passage implements YuncInterface
class Yunc extends Request implements YuncInterface
{
/**
* @inheritDoc
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage\Yunc;
use Lackoxygen\TiktokShop\Passage\ResultSet;
namespace Lackoxygen\TiktokShop\Request\Yunc;
/**
* @note 仓库作业API
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage;
namespace Lackoxygen\TiktokShop\Response;
use Lackoxygen\TiktokShop\Util\Json;
use GuzzleHttp\Psr7\Response;
use Illuminate\Support\Arr;
use Lackoxygen\TiktokShop\Util\Json;
class ResultSet
{
/**
* @var array|mixed
*/
protected array $items = [];
protected $result;
public function __construct($result)
{
$this->result = $result;
if ($this->isResponse()) {
$this->items = Json::unmarshal($result->getBody()->getContents());
} else {
$this->items = is_array($result) ? $result : [$result];
}
}
/**
* @var Response
*/
protected Response $response;
protected function isResponse(): bool
/**
* @param Response $response
*/
public function __construct(Response $response)
{
return $this->result instanceof Response;
}
$this->response = $response;
public function toArray(): array
{
return $this->items;
$this->items = Json::unmarshal($response->getBody()->getContents());
}
/**
* @return bool
*/
public function isSuccess(): bool
{
$array = $this->toArray();
if ($this->isResponse()) {
return 10000 === $array['code'];
}
return true === Arr::first($array);
}
/**
* @return string
*/
public function getMessage(): string
{
$array = $this->toArray();
... ... @@ -52,6 +48,9 @@ class ResultSet
return (string)$array['message'] ?? '';
}
/**
* @return array
*/
public function getData(): array
{
$array = $this->toArray();
... ... @@ -59,8 +58,41 @@ class ResultSet
return (array)Arr::get($array, 'data', []);
}
public function get(string $key, $default = '')
/**
* @param string $key
* @param string $default
* @return array|\ArrayAccess|mixed
*/
public function get(string $key, string $default = '')
{
return Arr::get($this->getData(), $key, $default);
}
/**
* @return array
*/
public function toArray(): array
{
return $this->items;
}
/**
* @return false|string
*/
public function toJson()
{
return Json::marshal($this->toArray());
}
/**
* @return string
*/
public function raw(): string
{
$body = $this->response->getBody();
$body->rewind();
return $body->getContents();
}
}
... ...
<?php
namespace Lackoxygen\TiktokShop\Supervisor\Session;
use Lackoxygen\TiktokShop\Util\Json;
class Factory
{
protected \Closure $callback;
public function __construct(\Closure $callback)
{
$this->callback = $callback;
}
public function load(string $raw)
{
if (!$raw) {
return;
}
$array = Json::unmarshal($raw);
$callback = $this->callback;
foreach ($array as $row) {
$callback($this->create($row));
}
}
protected function create($row)
{
return unserialize($row);
}
}
<?php
namespace Lackoxygen\TiktokShop\Supervisor\Session;
use Carbon\Carbon;
use Lackoxygen\TiktokShop\Contracts\SessionInterface;
class Session implements SessionInterface
{
use Swap;
protected Store $store;
protected string $index = '';
protected string $appKey = '';
public function __construct(string $appKey, Store $store)
{
$this->appKey = $appKey;
$this->store = $store;
$this->index = $this->id();
}
public function id(): string
{
return md5(serialize($this->store));
}
public function unEffective(): bool
{
return !$this->effective();
}
public function effective(): bool
{
return $this->store->getExpiredAt()->gt(Carbon::now());
}
public function discard()
{
$this->store->setExpiredAt(Carbon::now()->subMinutes(30));
}
public function watch(): bool
{
return $this->index !== $this->id();
}
public function appKey(): string
{
return $this->appKey;
}
}
<?php
namespace Lackoxygen\TiktokShop\Supervisor\Session;
use Lackoxygen\TiktokShop\Contracts\SessionInterface;
use Lackoxygen\TiktokShop\Util\Json;
class SessionHeart
{
protected static ?SessionHeart $sessionHeart = null;
public function __construct()
{
SessionMemory::init();
}
public static function new(): SessionHeart
{
if (is_null(static::$sessionHeart)) {
static::$sessionHeart = new static();
}
return static::$sessionHeart;
}
public function keepalive()
{
SessionMemory::each(function (SessionInterface $session) {
if ($session->effective()) {
return;
}
$session->refresh();
});
}
public function __destruct()
{
$watch = false;
$serializes = [];
SessionMemory::each(function (SessionInterface $session) use (&$watch, &$serializes) {
$serializes[] = serialize($session);
if (!$watch && $session->watch()) {
$watch = true;
}
});
if ($watch) {
SessionMemory::persistence(Json::marshal($serializes));
}
}
}
<?php
namespace Lackoxygen\TiktokShop\Supervisor\Session;
use Lackoxygen\TiktokShop\Contracts\SessionInterface;
class SessionMemory
{
/**
* @var Session [] $sessions
*/
protected static array $sessions = [];
/**
* @var string
*/
protected static string $cachePrefix = 'tiktok.shop:session:';
protected static function cache()
{
static $cacheManager;
if (is_null($cacheManager)) {
$cacheManager = app('cache');
}
return $cacheManager;
}
public static function init()
{
$factory = new Factory(function (Session $session) {
static::$sessions[$session->appKey()] = $session;
});
if ($raw = static::persistence()) {
$factory->load($raw);
}
}
public static function persistence()
{
$key = static::$cachePrefix . 'keepalive_table';
try {
if (func_get_args()) {
static::cache()->set($key, func_get_arg(0));
} else {
$raw = static::cache()->get($key);
if (is_null($raw)) {
return null;
}
return $raw;
}
} catch (\Exception $e) {
}
}
public static function each(\Closure $callback)
{
foreach (static::$sessions as $session) {
$callback($session);
}
}
public static function get(string $appKey = null)
{
if (is_null($appKey)) {
return static::$sessions;
}
return static::exist($appKey) ? static::$sessions[$appKey] : null;
}
public static function exist(string $appKey): bool
{
return array_key_exists($appKey, static::$sessions);
}
public static function put(SessionInterface $session, $force = true)
{
if (static::exist($session->appKey()) && !$force) {
return;
}
static::$sessions[$session->appKey()] = $session;
}
}
<?php
namespace Lackoxygen\TiktokShop\Supervisor\Session;
use Carbon\Carbon;
use Illuminate\Queue\SerializesModels;
class Store
{
use SerializesModels;
/**
* The ID.
*
* @var string
*/
protected string $id;
/**
* The access token.
*
* @var string
*/
protected string $accessToken;
/**
* The refresh token.
*
* @var string
*/
protected string $refreshToken;
/**
* The created at.
*
* @var Carbon
*/
protected Carbon $createdAt;
/**
* The expired at.
*
* @var Carbon
*/
protected Carbon $expiredAt;
/**
* The expires in.
*
* @var int
*/
protected int $expiresIn;
/**
* the more data.
*
* @var array
*/
protected array $extras = [];
/**
* the refresh num.
*
* @var int
*/
protected int $refreshNum = 0;
/**
* @return string
*/
public function getId(): string
{
return $this->id;
}
/**
* @param string $id
*/
public function setId(string $id): void
{
$this->id = $id;
}
/**
* @return string
*/
public function getAccessToken(): string
{
return $this->accessToken;
}
/**
* @param string $accessToken
*/
public function setAccessToken(string $accessToken): void
{
$this->accessToken = $accessToken;
}
/**
* @return string
*/
public function getRefreshToken(): string
{
return $this->refreshToken;
}
/**
* @param string $refreshToken
*/
public function setRefreshToken(string $refreshToken): void
{
$this->refreshToken = $refreshToken;
}
/**
* @return Carbon
*/
public function getCreatedAt(): Carbon
{
return $this->createdAt;
}
/**
* @param Carbon $createdAt
*/
public function setCreatedAt(Carbon $createdAt): void
{
$this->createdAt = $createdAt;
}
/**
* @return Carbon
*/
public function getExpiredAt(): Carbon
{
return $this->expiredAt;
}
/**
* @param Carbon $expiredAt
*/
public function setExpiredAt(Carbon $expiredAt): void
{
$this->expiredAt = $expiredAt;
}
/**
* @return int
*/
public function getExpiresIn(): int
{
return $this->expiresIn;
}
/**
* @param int $expiresIn
*/
public function setExpiresIn(int $expiresIn): void
{
$this->expiresIn = $expiresIn;
}
/**
* @return array
*/
public function getExtras(): array
{
return $this->extras;
}
/**
* @param array $extras
*/
public function setExtras(array $extras): void
{
$this->extras = $extras;
}
/**
* @return int
*/
public function getRefreshNum(): int
{
return $this->refreshNum;
}
/**
* @param int $refreshNum
*/
public function setRefreshNum(int $refreshNum): void
{
$this->refreshNum = $refreshNum;
}
}
<?php
namespace Lackoxygen\TiktokShop\Supervisor\Session;
use Lackoxygen\TiktokShop\Exception\ClientException;
use Lackoxygen\TiktokShop\Passage\ResultSet;
trait Swap
{
public function refresh()
{
$app = app('tiktok.shop');
try {
/**
* @var ResultSet $result
*/
$result = $app->authorize->refresh($this->store->getRefreshToken());
if ($result->isSuccess()) {
$this->store->setAccessToken($result->get('access_token'));
$this->store->setRefreshToken($result->get('refresh_token'));
$this->store->setRefreshNum($this->store->getRefreshNum() + 1);
$this->store->setCreatedAt(now());
$this->store->setExpiredAt(now()->addMicroseconds($result->get('expired_in')));
}
} catch (ClientException $exception) {
$this->discard();
}
}
}
<?php
namespace Lackoxygen\TiktokShop\Transmit;
namespace Lackoxygen\TiktokShop\Support\Client;
use Lackoxygen\TiktokShop\Attribute\Config;
use GuzzleHttp\Exception\GuzzleException;
use Lackoxygen\TiktokShop\Attribute\Config\Config;
use Lackoxygen\TiktokShop\Attribute\Config\Option;
use Lackoxygen\TiktokShop\Attribute\Request;
use Lackoxygen\TiktokShop\Exception\ClientException;
use Lackoxygen\TiktokShop\Mock\Mock;
use GuzzleHttp\Exception\GuzzleException;
use Psr\Http\Message\ResponseInterface;
class Builder
class Builder extends Config
{
protected Request $request;
protected Config $config;
/**
* @var Request
*/
protected Request $requestHandler;
protected string $passage;
/**
* @var string
*/
protected string $request;
/**
* @var string
*/
protected string $method;
public function __construct(Config $config, string $passage, string $method)
public function __construct(Option $config, string $request, string $method)
{
$this->request = new Request();
$this->config = $config;
$this->request->setConfig($config);
$this->passage = $passage;
parent::__construct($config);
$this->requestHandler = new Request($config);
$this->request = $request;
$this->method = $method;
}
public static function create(Config $config, string $passage, string $method): Builder
/**
* @param Option $config
* @param string $passage
* @param string $method
* @return Builder
*/
public static function create(Option $config, string $passage, string $method): Builder
{
return new static(...func_get_args());
}
/**
* @param string $method
* @return $this
*/
public function method(string $method): Builder
{
$this->request->setMethod($method);
$this->requestHandler->setMethod($method);
return $this;
}
/**
* @param array $params
* @return $this
*/
public function params(array $params): Builder
{
$this->request->setParams($params);
$this->requestHandler->setParams($params);
return $this;
}
/**
* @param string $v
* @return $this
*/
public function v(string $v): Builder
{
$this->request->setV($v);
$this->requestHandler->setV($v);
return $this;
}
/**
* @param $timestamp
* @return $this
*/
public function timestamp($timestamp): Builder
{
$this->request->setTimestamp($timestamp);
$this->requestHandler->setTimestamp($timestamp);
return $this;
}
/**
* @param string|null $service
* @return $this
*/
public function service(?string $service): Builder
{
$this->request->setService($service);
$this->requestHandler->setService($service);
return $this;
}
/**
* @param bool $signature
* @return $this
*/
public function signature(bool $signature): Builder
{
$this->request->setSignature($signature);
$this->requestHandler->setSignature($signature);
return $this;
}
/**
* @param string $path
* @return $this
*/
public function path(string $path): Builder
{
$this->request->setPath($path);
$this->requestHandler->setPath($path);
return $this;
}
... ... @@ -80,7 +121,7 @@ class Builder
*/
public function getRequest(): Request
{
return $this->request;
return $this->requestHandler;
}
/**
... ... @@ -91,11 +132,11 @@ class Builder
{
$client = Client::create();
if ($this->config->isEnableMock()) {
$mock = new Mock($this->passage, $this->method);
$mock = new Mock($this->request, $this->method);
return $mock->response();
}
try {
return $client->request($this->request);
return $client->request($this->requestHandler);
} catch (GuzzleException $e) {
throw new ClientException($e);
}
... ...
<?php
namespace Lackoxygen\TiktokShop\Transmit;
namespace Lackoxygen\TiktokShop\Support\Client;
use Lackoxygen\TiktokShop\Attribute\Config;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\ServerException;
use GuzzleHttp\RequestOptions;
use Illuminate\Support\Str;
use Lackoxygen\TiktokShop\Attribute\Config\Option;
use Lackoxygen\TiktokShop\Attribute\Request;
use Lackoxygen\TiktokShop\Exception\ClientException;
use Lackoxygen\TiktokShop\Exception\RetryException;
use Lackoxygen\TiktokShop\Util\Json;
use Lackoxygen\TiktokShop\Util\Signature;
use Lackoxygen\TiktokShop\Util\Sort;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\ServerException;
use GuzzleHttp\RequestOptions;
use Illuminate\Support\Str;
use Psr\Http\Message\ResponseInterface;
class Client
{
/**
* @return Client
*/
public static function create(): Client
{
return new self();
... ... @@ -74,6 +77,10 @@ class Client
];
}
/**
* @param Request $request
* @return array
*/
protected function withQuery(Request $request): array
{
return [
... ... @@ -82,7 +89,11 @@ class Client
];
}
public function guzzleHttp(Config $config): \GuzzleHttp\Client
/**
* @param Option $config
* @return \GuzzleHttp\Client
*/
public function guzzleHttp(Option $config): \GuzzleHttp\Client
{
return new \GuzzleHttp\Client([
'base_uri' => $config->getBaseUri(),
... ...
<?php
namespace Lackoxygen\TiktokShop\Transmit;
namespace Lackoxygen\TiktokShop\Support\Client;
use Lackoxygen\TiktokShop\Exception\ClientException;
use Lackoxygen\TiktokShop\Exception\RetryException;
class Retry
{
/**
* @var \Closure
*/
protected \Closure $execute;
/**
* @var \Closure
*/
protected \Closure $when;
/**
... ...
<?php
namespace Lackoxygen\TiktokShop\Passage;
namespace Lackoxygen\TiktokShop\Support;
class Verify extends Passage
use Lackoxygen\TiktokShop\Attribute\Config\Config;
class Verify extends Config
{
/**
* @param $sign
* @param string $body
* @return bool
*/
public function md5($sign, string $body): bool
{
$md5 = md5($this->config->getAppKey() .
$md5 = md5(
$this->config->getAppKey() .
$body .
$this->config->getAppSecret());
$this->config->getAppSecret()
);
return $md5 === $sign;
}
}
... ...
... ... @@ -3,47 +3,48 @@
namespace Lackoxygen\TiktokShop;
use Illuminate\Support\Arr;
use Lackoxygen\TiktokShop\Attribute\Config;
use Lackoxygen\TiktokShop\Passage\PassageProxy;
use Lackoxygen\TiktokShop\Passage\Verify;
use Lackoxygen\TiktokShop\Attribute\Config\Config;
use Lackoxygen\TiktokShop\Attribute\Config\Option;
use Lackoxygen\TiktokShop\Request\RequestProxy;
use Lackoxygen\TiktokShop\Support\Verify;
/**
* @method Verify verify()
* @method Passage\Pigeon\PigeonInterface pigeon()
* @method Passage\Sms\SmsInterface sms()
* @method Passage\SupplyChain\SupplyChainInterface supplyChain()
* @method Passage\Topup\TopupInterface topup()
* @method Passage\OpenCloud\OpenCloudInterface openCloud()
* @method Passage\Btas\BtasInterface btas()
* @method Passage\Recycle\RecycleInterface recycle()
* @method Passage\Member\MemberInterface member()
* @method Passage\Buyin\BuyinInterface buyin()
* @method Passage\Yunc\YuncInterface yunc()
* @method Passage\OrderCode\OrderCodeInterface orderCode()
* @method Passage\Coupons\CouponsInterface coupons()
* @method Passage\Crossborder\CrossborderInterface crossborder()
* @method Passage\Iop\IopInterface iop()
* @method Passage\Antispam\AntispamInterface antispam()
* @method Passage\Token\TokenInterface token()
* @method Passage\Order\OrderInterface order()
* @method Passage\AfterSale\AfterSaleInterface afterSale()
* @method Passage\Logistics\LogisticsInterface logistics()
* @method Passage\Warehouse\WarehouseInterface warehouse()
* @method Passage\Product\ProductInterface product()
* @method Passage\Material\MaterialInterface material()
* @method Passage\Address\AddressInterface address()
* @method Request\Pigeon\PigeonInterface pigeon()
* @method Request\Sms\SmsInterface sms()
* @method Request\SupplyChain\SupplyChainInterface supplyChain()
* @method Request\Topup\TopupInterface topup()
* @method Request\OpenCloud\OpenCloudInterface openCloud()
* @method Request\Btas\BtasInterface btas()
* @method Request\Recycle\RecycleInterface recycle()
* @method Request\Member\MemberInterface member()
* @method Request\Buyin\BuyinInterface buyin()
* @method Request\Yunc\YuncInterface yunc()
* @method Request\OrderCode\OrderCodeInterface orderCode()
* @method Request\Coupons\CouponsInterface coupons()
* @method Request\Crossborder\CrossborderInterface crossborder()
* @method Request\Iop\IopInterface iop()
* @method Request\Antispam\AntispamInterface antispam()
* @method Request\Token\TokenInterface token()
* @method Request\Order\OrderInterface order()
* @method Request\AfterSale\AfterSaleInterface afterSale()
* @method Request\Logistics\LogisticsInterface logistics()
* @method Request\Warehouse\WarehouseInterface warehouse()
* @method Request\Product\ProductInterface product()
* @method Request\Material\MaterialInterface material()
* @method Request\Address\AddressInterface address()
*/
class TiktokShop
{
/**
* @var Config
* @var Option
*/
protected Config $config;
protected Option $config;
/**
* @var array|string[]
*/
protected array $fixedPassages = [
protected array $fixedPriority = [
'verify' => Verify::class
];
... ... @@ -76,11 +77,11 @@ class TiktokShop
/**
* @param array $options
*
* @return Config
* @return Option
*/
public static function newConfig(array $options): Config
public static function newConfig(array $options): Option
{
return new Config(
return new Option(
Arr::get($options, 'app_key'),
Arr::get($options, 'app_secret'),
Arr::get($options, 'base_uri'),
... ... @@ -113,40 +114,45 @@ class TiktokShop
/**
* @param string $name
* @return string
* @return RequestProxy|object
*/
private function guide(string $name): string
private function guide(string $name)
{
if (isset($this->fixedPassages[$name])) {
return $this->fixedPassages[$name];
if (array_key_exists($name, $this->fixedPriority)) {
return new $this->fixedPriority[$name]($this->config);
}
$name = ucfirst($name);
$target = '\Lackoxygen\TiktokShop\Passage\\' . $name . '\\' . $name;
$request = '\Lackoxygen\TiktokShop\Request\\' . $name . '\\' . $name;
if (!class_exists($target)) {
throw new \OverflowException('class file(' . $target . ') not found');
if (!class_exists($request)) {
throw new \OverflowException('class file(' . $request . ') not found');
}
return $target;
return RequestProxy::proxy($request, $this->config);
}
/**
* @param $name
* @param array $arguments
*
* @return PassageProxy
* @return RequestProxy
*/
public function __call($name, array $arguments = [])
{
$passage = $this->guide($name);
$guide = $this->guide($name);
if ($guide instanceof RequestProxy) {
try {
return PassageProxy::proxy($passage, $this->config);
return $guide;
} finally {
register_shutdown_function(function () {
$this->config->setAccessToken('');
});
}
}
return call_user_func_array([$guide, $name], $arguments);
}
}
... ...
... ... @@ -3,8 +3,6 @@
namespace Lackoxygen\TiktokShop;
use Illuminate\Support\ServiceProvider;
use Lackoxygen\TiktokShop\Command\RefreshToken;
use Release;
class TiktokShopProvider extends ServiceProvider
{
... ... @@ -16,9 +14,7 @@ class TiktokShopProvider extends ServiceProvider
/**
* @var array|string[]
*/
protected array $commands = [
RefreshToken::class
];
protected array $commands = [];
/**
* @return void
... ...