From e4d694a3ff8b670a27b4bd37347f74adc83ece70 Mon Sep 17 00:00:00 2001 From: justmd5 Date: Fri, 8 Oct 2021 12:01:26 +0800 Subject: [PATCH] modify the readme.md --- README.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 73a052c..876b764 100644 --- a/README.md +++ b/README.md @@ -49,11 +49,13 @@ $pinduoduo = new PinDuoDuo($config); ### 调用示例 >因目前我只有多多客角色账号,所以示例以多多客接口为例,其他两种角色理论相同,请自行尝试 + #### 调用无需授权接口示例 + > 多多进宝商品详情查询 pdd.ddk.goods.detail -```php -$result = $pinduoduo->api->request('pdd.ddk.goods.detail', ['goods_id_list' => ['395581006']]); +```php +$result = $pinduoduo->api->auth(false)->request('pdd.ddk.goods.detail',['goods_sign'=>'Y9X2o23Pb-lfwWc1wvfZk0N5-QNj-R7b_JlrlXGK3D']); ``` #### 调用需授权接口示例 @@ -62,24 +64,33 @@ $result = $pinduoduo->api->request('pdd.ddk.goods.detail', ['goods_id_list' => $url = $pinduoduo->pre_auth->authorizationUrl(); ``` * 重定向到授权页面 + ```php $pinduoduo->pre_auth->authorizationRedirect(); ``` + * 在重定向页面,你可以获取此次授权账号的 token + ```php $token = $pinduoduo->pre_auth->getAccessToken(); //也可以通过上面得到的 refresh_token 去刷新令牌 //$token = $pinduoduo->pre_auth->refreshToken($token['refresh_token']); ``` + * 创建授权应用 + ```php $pinduoduo = $pinduoduo->oauth->createAuthorization($token['token']); ``` + > 获取当前账号下有多少推广位 pdd.ddk.oauth.goods.pid.query + ```php $result = $pinduoduo->auth_api->request('pdd.ddk.oauth.goods.pid.query'); ``` + ### 文档 + [拼多多开放平台](http://open.pinduoduo.com/) · [官方文档](http://open.pinduoduo.com/#/apidocument)