DongDavid /
notify
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Dongdavid\Notify; |
||
| 4 | |||
| 5 | use Dongdavid\Notify\utils\Http; |
||
| 6 | |||
| 7 | // 如果没有cache方法就自定义一个方法用redis做缓存 |
||
| 8 | if (!function_exists('getAccessToken')) { |
||
| 9 | function getAccessToken($type, $appId, $appSecret, $agentid = 0) |
||
|
0 ignored issues
–
show
|
|||
| 10 | { |
||
| 11 | switch ($type) { |
||
| 12 | case 'wechatoffical': |
||
| 13 | $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$appId}&secret={$appSecret}"; |
||
| 14 | break; |
||
| 15 | case 'miniprogram': |
||
| 16 | $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$appId}&secret={$appSecret}"; |
||
| 17 | break; |
||
| 18 | default: |
||
| 19 | return '类型错误'; |
||
| 20 | } |
||
| 21 | echo $url; |
||
| 22 | $res = Http::get($url); |
||
| 23 | if (isset($res['access_token'])) { |
||
| 24 | return $res; |
||
| 25 | } else { |
||
| 26 | return $res; |
||
| 27 | } |
||
| 28 | } |
||
| 29 | } |
||
| 30 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.