Skip to content
拼多多API SDK【拼多多开放平台】
Branch: master
Clone or download
Latest commit 0c5d32f Jun 26, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Update FUNDING.yml Jun 26, 2019
src 升级依赖,优化代码 Mar 17, 2019
tests init Oct 16, 2018
.editorconfig init Oct 16, 2018
.gitattributes init Oct 16, 2018
.php_cs init Oct 16, 2018
LICENSE Initial commit Oct 16, 2018
README.md Add license scan report and status May 20, 2019
composer.json 升级依赖,优化代码 Mar 17, 2019
phpunit.xml.dist init Oct 16, 2018

README.md

拼多多API SDK【拼多多开放平台】

styleci PHP from Packagist Latest Stable Version GitHub stars Latest Unstable Version License

要求

  1. PHP >= 7.0
  2. Composer
  3. ext-curl 拓展
  4. ext-json 拓展

安装

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),
    '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_id_list' => ['395581006']]);

调用需授权接口示例

  • 获取授权 URL
$url = $pinduoduo->pre_auth->authorizationUrl();
  • 重定向到授权页面
    $pinduoduo->pre_auth->authorizationRedirect();
  • 在重定向页面,你可以获取此次授权账号的 token
$token = $pinduoduo->pre_auth->getAccessToken();
//也可以通过上面得到的 refresh_token 去刷新令牌
//$token = $pinduoduo->pre_auth->refreshToken($token['refresh_token']);

获取当前账号下有多少推广位 pdd.ddk.oauth.goods.pid.query

$result   = $pinduoduo->auth_api->request('pdd.ddk.oauth.goods.pid.query');

文档

拼多多开放平台 · 官方文档

感谢

License

MIT

FOSSA Status

You can’t perform that action at this time.