Stars: 181
Forks: 43
Pull Requests: 10
Issues: 17
Watchers: 6
Last Updated: 2023-09-07 01:25:28
composer require justmd5/pinduoduo-sdk
use \Justmd5\PinDuoDuo\PinDuoDuo;
require __DIR__ . '/vendor/autoload.php';
$config = [
'client_id' => 'xxxxxx69e3940c6b93xxxxxx',
'client_secret' => 'c2eda0c398xxxxxxbd63ff57bf22c05xxxxxx',
'debug' => true,
'member_type' => 'JINBAO',//用户角色 :MERCHANT(商家授权),H5(移动端),多多进宝推手(JINBAO),快团团团长(KTT),拼多多电子面单用户(LOGISTICS)
'redirect_uri' => 'https://test.xxx.com/callback',
'log' => [
'name' => 'pinduoduo',
'file' => __DIR__ . '/pinduoduo.log',
'level' => 'debug',
'permission' => 0777,
],
];
$pinduoduo = new PinDuoDuo($config);
因目前我只有多多客角色账号,所以示例以多多客接口为例,其他两种角色理论相同,请自行尝试
多多进宝商品详情查询 pdd.ddk.goods.detail
$result = $pinduoduo->api->request('pdd.ddk.goods.detail',['goods_sign'=>'Y9X2o23Pb-lfwWc1wvfZk0N5-QNj-R7b_JlrlXGK3D']);
$url = $pinduoduo->pre_auth->authorizationUrl();
$pinduoduo->pre_auth->authorizationRedirect();
$token = $pinduoduo->pre_auth->getAccessToken();
//也可以通过上面得到的 refresh_token 去刷新令牌
//$token = $pinduoduo->pre_auth->refreshToken($token['refresh_token']);
$pinduoduo = $pinduoduo->oauth->createAuthorization($token['token']);
获取当前账号下有多少推广位 pdd.ddk.oauth.goods.pid.query
$result = $pinduoduo->auth_api->request('pdd.ddk.oauth.goods.pid.query');
$result = $pinduoduo->api->auth()->request('pdd.ddk.goods.pid.query')
MIT