GithubHelp home page GithubHelp logo

justmd5 / pinduoduo-sdk Goto Github PK

View Code? Open in Web Editor NEW
205.0 6.0 45.0 69 KB

拼多多API SDK【多多客|多多进宝&拼多多开放平台】

License: MIT License

PHP 100.00%
pin-duo-duo pinduoduo sdk-php pinduoduo-sdk duoduoke-sdk duoduoke jin-bao duoduojinbao jinbao api-sdk

pinduoduo-sdk's Introduction

拼多多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')

文档

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

Star History

Star History Chart

感谢

License

MIT

FOSSA Status

pinduoduo-sdk's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pinduoduo-sdk's Issues

laravel8.x下安装报错

Your requirements could not be resolved to an installable set of packages.

Problem 1
- justmd5/pinduoduo-sdk[v1.5.0, ..., v1.5.1] require hanson/foundation-sdk 4.0.2 -> satisfiable by hanson/foundation-sdk[4.0.2].
- hanson/foundation-sdk 4.0.2 requires guzzlehttp/guzzle ^6.2 -> found guzzlehttp/guzzle[6.2.0, ..., 6.5.x-dev] but it conflicts with your root composer.json require (^7.0.1).
- Root composer.json requires justmd5/pinduoduo-sdk ^1.5 -> satisfiable by justmd5/pinduoduo-sdk[v1.5.0, v1.5.1].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

thinkphp5 报错

php 7.2
foundation-sdk 4.0.2
pinduoduo-sdk 1.4

AbstractAccessToken.php line 221
Trying to get property 'http' of non-object

[8] ErrorException in AccessToken.php line 72 报错 未定义数组索引: code

        $config = [
        'client_id' => 'xxx',
        'client_secret' => 'xxxx',
        'debug' => true,
        'member_type' => 'MERCHANT', //用户角色 :MERCHANT(商家授权),H5(移动端),多多客(JINBAO),
        'redirect_uri' => 'http://text.dev/index.php/pdd/index/test.html',
        'log' => [
            'name' => 'pinduoduo',
            'file' => APP_ROOT_PATH . '/runtime/log/pinduoduo.log',
            'level' => 'debug',
            'permission' => 0777,
        ],
    ];
    $this->oPdd = new PinDuoDuo($config);

$result = $this->oPdd->auth_api->request('pdd.order.list.get', [
'order_status' => 1,
'refund_status' => 5,
'page' => 1,
'page_size' => 100,
'start_confirm_at' => strtotime(date('Y-m-d 00:00:00')),
'end_confirm_at' => strtotime(date('Y-m-d 23:59:59')),
]);
print_r($result);

thinkphp5调用出现错误提示

        $pinduoduo = new PinDuoDuo($this->config);
        $result = $pinduoduo->auth_api->request('pdd.ddk.oauth.goods.pid.query');
        print_r($result);

报错:致命错误: Cannot call constructor(Api.php line 25)

注释掉Api.php的第二十五行parent::__construct($pinduoduo);
报错:Trying to get property of non-object(vendor\hanson\foundation-sdk\src\AbstractAccessToken.php line 221)

请问该怎么处理呢?

文件上传超过1M,CURL错误

您好,问一下 之前的那个文件上传。上传文件大于1M有问题 cURL error 0: The cURL request was retried 3 times and did not succeed. The most likely reason for the failure is that cURL was unable to rewind the body of the request and subsequent retries resulted in the same error. Turn on the debug option to see what went wrong. See https://bugs.php.net/bug.php?id=47204 for more information. (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://gw-upload.pinduoduo.com/api/upload。 是我本地配置问题吗? 详细可以QQ回复我 谢谢

文件上传网关

文件上传的时候 应该接受什么样的参数 为什么网关总是替换不了 //文件上传兼容
if (!empty($params['file'])) {
$method = 'upload';
array_push($data, [], ['file' => $params['file']]);
unset($params['file']);
} 里面的方法也调用了

签名验证失败

array(1) {
["error_response"]=>
array(5) {
["error_msg"]=>
string(18) "签名验证失败"
["sub_msg"]=>
string(18) "签名验证失败"
["sub_code"]=>
string(5) "20004"
["error_code"]=>
int(20004)
["request_id"]=>
string(17) "16176873891122238"
}
}

issue

Hello, I'm outside china and I can't get the Pinduoduo API, how can I get it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.