Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Commit

Permalink
chore(instructions): 🔧 更新使用说明 (#5)
Browse files Browse the repository at this point in the history
* docs(config): 📝 默认配置

* docs(readme): 📝 更新使用说明
  • Loading branch information
waset authored Apr 16, 2022
1 parent 599c1ce commit 31bb323
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 25 deletions.
35 changes: 15 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ composer require waset/short-video-distribution
#### 配置

```php
// config/distribute.php
// config/distribute.php (ThinkPHP6 会自动生成)
<?php
// 因各平台使用 scope 不一致,所以还是单独定义吧,不会太麻烦,毕竟只定这一次
return [
Expand All @@ -44,28 +44,24 @@ return [
// ...
]
],
// 头条
"toutiao" => [
'client_key' => '',
'client_secret' => '',
'scope' => [
'user_info',
// ...
]
],
// 西瓜
"xigua" => [
'client_key' => '',
'client_secret' => '',
'scope' => [
'user_info',
// ...
]
],
// ...

// "平台名" => [
// '密钥' => '',
// '密码' => '',
// '权限' => [
// ...
// ]
// ],
];
```

#### 平台 => `$model`

```
抖音 => 'douyin'
今日头条 => 'toutiao'
西瓜视频 => 'xigua'
```

#### 使用
Expand All @@ -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();

```

# 鸣谢
Expand Down
33 changes: 28 additions & 5 deletions config/config.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,36 @@
<?php

// +----------------------------------------------------------------------
// | 平台设置
// | 平台配置
// +----------------------------------------------------------------------

return [
// 字节跳动开放平台(抖音、头条、西瓜)
"bytedance" => [
"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',
// ...
])
],
];

0 comments on commit 31bb323

Please sign in to comment.