3 Star 13 Fork 4

justmd5 / pinduoduo-sdk

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

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

styleci PHP from Packagist Total Downloadsn GitHub stars Latest Stable 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),快团团团长(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
$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']);
  • 创建授权应用
$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')

文档

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

感谢

License

MIT

FOSSA Status

MIT License Copyright (c) 2018 独步弈城 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

拼多多API SDK【多多客&拼多多开放平台】 展开 收起
PHP
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
PHP
1
https://gitee.com/justmd5/pinduoduo-sdk.git
git@gitee.com:justmd5/pinduoduo-sdk.git
justmd5
pinduoduo-sdk
pinduoduo-sdk
master

搜索帮助