配置gitlab仓库
"repositories": {
"lackoxygen/tiktok_shop": {
"type": "git",
"url": "http://47.107.73.162:8099/lackoxygen/tiktok_shop.git"
},
},
"config": {
"secure-http": false
},
安装
composer require lackoxygen/tiktok_shop
配置文件
//路径 config/tiktok.shop.php
[
'app_key' => env('TIKTOK_APP_KEY', ''),
'app_secret' => env('TIKTOK_APP_SECRET', ''),
'enable_mock' => env('TIKTOK_ENABLE_MOCK', false),
'base_uri' => env('TIKTOK_BASE_URI', 'https://openapi-sandbox.jinritemai.com'),
'timeout' => env('TIKTOK_TIMEOUT', 30),
];
使用方法
- 门面调用
use Lackoxygen\TiktokShop\Facade\TiktokShop;
$obj = TiktokShop::alliance();
- 直接使用
use Lackoxygen\TiktokShop\TiktokShop;
$config = Lackoxygen\TiktokShop\TiktokShop::newConfig(config('some'));
$obj = new Lackoxygen\TiktokShop\TiktokShop($config);
3.接口判断请求成功
use Lackoxygen\TiktokShop\Facade\TiktokShop;
$resultSet = TiktokShop::alliance()->materialsProductsSearch([]);
if ($resultSet->isSuccess()){
exit(0)
}
exit(1)
4.签名(只支持md5)
use Lackoxygen\TiktokShop\Facade\TiktokShop;
$resultSet = TiktokShop::verify()->md5('some', 'body');
if ($resultSet->isSuccess()){
exit(0)
}
exit(1)
5.超时异常
use Lackoxygen\TiktokShop\Facade\TiktokShop;
try {
$resultSet = TiktokShop::alliance()->materialsProductsSearch([]);
}catch (\Lackoxygen\TiktokShop\Exception\RetryException $retryException){
exit(0)
}
exit(1)
6.生成请求代码
php bin/release.php