From 31bb3236b8c97351aa758d6708badaf23e5ddac8 Mon Sep 17 00:00:00 2001 From: Waset <55943270+waset@users.noreply.github.com> Date: Sat, 16 Apr 2022 11:24:54 +0800 Subject: [PATCH] =?UTF-8?q?chore(instructions):=20=F0=9F=94=A7=20=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E4=BD=BF=E7=94=A8=E8=AF=B4=E6=98=8E=20(#5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs(config): 📝 默认配置 * docs(readme): 📝 更新使用说明 --- README.md | 35 +++++++++++++++-------------------- config/config.php | 33 ++++++++++++++++++++++++++++----- 2 files changed, 43 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 5db3acc..fca2ae8 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ composer require waset/short-video-distribution #### 配置 ```php -// config/distribute.php +// config/distribute.php (ThinkPHP6 会自动生成) [ - 'client_key' => '', - 'client_secret' => '', - 'scope' => [ - 'user_info', - // ... - ] - ], - // 西瓜 - "xigua" => [ - 'client_key' => '', - 'client_secret' => '', - 'scope' => [ - 'user_info', - // ... - ] - ], // ... + + // "平台名" => [ + // '密钥' => '', + // '密码' => '', + // '权限' => [ + // ... + // ] + // ], ]; +``` +#### 平台 => `$model` +``` +抖音 => 'douyin' +今日头条 => 'toutiao' +西瓜视频 => 'xigua' ``` #### 使用 @@ -84,7 +80,6 @@ $data = Distribute::app($model)->oauth()->token($code); // 获取用户信息 $user_info = Distribute::app($model)->user()->info($data['access_token'], $data['open_id']); // $user_info = $user_info->toArray(); - ``` # 鸣谢 diff --git a/config/config.php b/config/config.php index ad3202d..7424443 100644 --- a/config/config.php +++ b/config/config.php @@ -1,13 +1,36 @@ [ - "client_key" => "", - "client_secret" => "", + // 抖音 + "douyin" => [ + 'client_key' => env('douyin.client_key', ''), + 'client_secret' => env('douyin.client_secret', ''), + 'scope' => env('douyin.scope', [ + 'trial.whitelist', + 'user_info', + // ... + ]), + ], + // 头条 + "toutiao" => [ + 'client_key' => env('toutiao.client_key', ''), + 'client_secret' => env('toutiao.client_secret', ''), + 'scope' => env('toutiao.scope', [ + 'user_info', + // ... + ]) + ], + // 西瓜 + "xigua" => [ + 'client_key' => env('xigua.client_key', ''), + 'client_secret' => env('xigua.client_secret', ''), + 'scope' => env('xigua.scope', [ + 'user_info', + // ... + ]) ], ];