60 lines
1.2 KiB
PHP
60 lines
1.2 KiB
PHP
<?php
|
|
namespace App\Services\Platform;
|
|
|
|
use App\Models\ShopAuth;
|
|
use Illuminate\Support\Facades\Http;
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
class PddClient
|
|
{
|
|
protected $shopAuth;
|
|
protected $clientId;
|
|
protected $clientSecret;
|
|
|
|
public function __construct(ShopAuth $shopAuth)
|
|
{
|
|
$this->shopAuth = $shopAuth;
|
|
$this->clientId = config('platforms.pdd.client_id');
|
|
$this->clientSecret = config('platforms.pdd.client_secret');
|
|
}
|
|
|
|
/**
|
|
* 拉取订单列表(待实现)
|
|
*
|
|
* @param array $params
|
|
* @return array
|
|
*/
|
|
public function getOrders(array $params = [])
|
|
{
|
|
Log::warning('拼多多订单拉取尚未实现');
|
|
return [];
|
|
}
|
|
|
|
protected function refreshToken()
|
|
{
|
|
// TODO: 实现拼多多 token 刷新
|
|
}
|
|
|
|
protected function ensureToken()
|
|
{
|
|
if ($this->shopAuth->expires_at && $this->shopAuth->expires_at->isPast()) {
|
|
$this->refreshToken();
|
|
}
|
|
}
|
|
|
|
protected function generateSign($params)
|
|
{
|
|
// TODO: 实现拼多多签名算法
|
|
return '';
|
|
}
|
|
|
|
protected function transformOrders($orders)
|
|
{
|
|
return [];
|
|
}
|
|
|
|
protected function transformItems($items)
|
|
{
|
|
return [];
|
|
}
|
|
} |