Merge remote-tracking branch 'origin/master'
# Conflicts: # composer.json # composer.lock
This commit is contained in:
23
app/controller/Wechat.php
Normal file
23
app/controller/Wechat.php
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\controller;
|
||||||
|
|
||||||
|
use EasyWeChat\Factory;
|
||||||
|
use EasyWeChat\OfficialAccount\Application;
|
||||||
|
|
||||||
|
class Wechat
|
||||||
|
{
|
||||||
|
private Application $app;
|
||||||
|
|
||||||
|
private function initWechat()
|
||||||
|
{
|
||||||
|
$this->app = Factory::officialAccount(config('wechat'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function config()
|
||||||
|
{
|
||||||
|
$this->initWechat();
|
||||||
|
redirect($this->app->oauth->scopes(['snsapi_userinfo'])->redirect());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -24,8 +24,7 @@
|
|||||||
"topthink/framework": "^6.0.0",
|
"topthink/framework": "^6.0.0",
|
||||||
"topthink/think-orm": "^2.0",
|
"topthink/think-orm": "^2.0",
|
||||||
"alibabacloud/client": "^1.5",
|
"alibabacloud/client": "^1.5",
|
||||||
"aliyuncs/oss-sdk-php": "^2.6",
|
"aliyuncs/oss-sdk-php": "^2.6"
|
||||||
"topthink/think-view": "^1.0"
|
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"symfony/var-dumper": "^4.2",
|
"symfony/var-dumper": "^4.2",
|
||||||
|
|||||||
96
composer.lock
generated
96
composer.lock
generated
@@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "e9f35a9e755994ce58619da2bf6d572b",
|
"content-hash": "c6bc90a1bccad5f43e5e82d326d82fe7",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "adbario/php-dot-notation",
|
"name": "adbario/php-dot-notation",
|
||||||
@@ -1913,100 +1913,6 @@
|
|||||||
"source": "https://github.com/top-think/think-orm/tree/v2.0.54"
|
"source": "https://github.com/top-think/think-orm/tree/v2.0.54"
|
||||||
},
|
},
|
||||||
"time": "2022-07-05T05:25:51+00:00"
|
"time": "2022-07-05T05:25:51+00:00"
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "topthink/think-template",
|
|
||||||
"version": "v2.0.8",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/top-think/think-template.git",
|
|
||||||
"reference": "abfc293f74f9ef5127b5c416310a01fe42e59368"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/top-think/think-template/zipball/abfc293f74f9ef5127b5c416310a01fe42e59368",
|
|
||||||
"reference": "abfc293f74f9ef5127b5c416310a01fe42e59368",
|
|
||||||
"shasum": "",
|
|
||||||
"mirrors": [
|
|
||||||
{
|
|
||||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
|
||||||
"preferred": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"php": ">=7.1.0",
|
|
||||||
"psr/simple-cache": "^1.0"
|
|
||||||
},
|
|
||||||
"type": "library",
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"think\\": "src"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"Apache-2.0"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "liu21st",
|
|
||||||
"email": "liu21st@gmail.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "the php template engine",
|
|
||||||
"support": {
|
|
||||||
"issues": "https://github.com/top-think/think-template/issues",
|
|
||||||
"source": "https://github.com/top-think/think-template/tree/v2.0.8"
|
|
||||||
},
|
|
||||||
"time": "2020-12-10T07:52:03+00:00"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "topthink/think-view",
|
|
||||||
"version": "v1.0.14",
|
|
||||||
"source": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/top-think/think-view.git",
|
|
||||||
"reference": "edce0ae2c9551ab65f9e94a222604b0dead3576d"
|
|
||||||
},
|
|
||||||
"dist": {
|
|
||||||
"type": "zip",
|
|
||||||
"url": "https://api.github.com/repos/top-think/think-view/zipball/edce0ae2c9551ab65f9e94a222604b0dead3576d",
|
|
||||||
"reference": "edce0ae2c9551ab65f9e94a222604b0dead3576d",
|
|
||||||
"shasum": "",
|
|
||||||
"mirrors": [
|
|
||||||
{
|
|
||||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
|
||||||
"preferred": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"require": {
|
|
||||||
"php": ">=7.1.0",
|
|
||||||
"topthink/think-template": "^2.0"
|
|
||||||
},
|
|
||||||
"type": "library",
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"think\\view\\driver\\": "src"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"notification-url": "https://packagist.org/downloads/",
|
|
||||||
"license": [
|
|
||||||
"Apache-2.0"
|
|
||||||
],
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "liu21st",
|
|
||||||
"email": "liu21st@gmail.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "thinkphp template driver",
|
|
||||||
"support": {
|
|
||||||
"issues": "https://github.com/top-think/think-view/issues",
|
|
||||||
"source": "https://github.com/top-think/think-view/tree/v1.0.14"
|
|
||||||
},
|
|
||||||
"time": "2019-11-06T11:40:13+00:00"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"packages-dev": [
|
"packages-dev": [
|
||||||
|
|||||||
68
config/wechat.php
Normal file
68
config/wechat.php
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
/**
|
||||||
|
* 账号基本信息,请从微信公众平台/开放平台获取
|
||||||
|
*/
|
||||||
|
'app_id' => 'wx3793a03c18984e4f', // AppID
|
||||||
|
'secret' => 'f1c242f4f28f735d4687abb469072xxx', // AppSecret
|
||||||
|
'token' => 'iQoSaqys8cQawIusDZn6H5LPYTMIOWVg', // Token
|
||||||
|
'aes_key' => 'fmkgnwli1JaabwxlcZdkI6bZ2lwxiVGnxg5o0mSHsuB', // EncodingAESKey,兼容与安全模式下请一定要填写!!!
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 指定 API 调用返回结果的类型:array(default)/collection/object/raw/自定义类名
|
||||||
|
* 使用自定义类名时,构造函数将会接收一个 `EasyWeChat\Kernel\Http\Response` 实例
|
||||||
|
*/
|
||||||
|
'response_type' => 'array',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日志配置
|
||||||
|
*
|
||||||
|
* level: 日志级别, 可选为:
|
||||||
|
* debug/info/notice/warning/error/critical/alert/emergency
|
||||||
|
* path:日志文件位置(绝对路径!!!),要求可写权限
|
||||||
|
*/
|
||||||
|
'log' => [
|
||||||
|
'default' => 'dev', // 默认使用的 channel,生产环境可以改为下面的 prod
|
||||||
|
'channels' => [
|
||||||
|
// 测试环境
|
||||||
|
'dev' => [
|
||||||
|
'driver' => 'single',
|
||||||
|
'path' => '/tmp/easywechat.log',
|
||||||
|
'level' => 'debug',
|
||||||
|
],
|
||||||
|
// 生产环境
|
||||||
|
'prod' => [
|
||||||
|
'driver' => 'daily',
|
||||||
|
'path' => '/tmp/easywechat.log',
|
||||||
|
'level' => 'info',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接口请求相关配置,超时时间等,具体可用参数请参考:
|
||||||
|
* http://docs.guzzlephp.org/en/stable/request-config.html
|
||||||
|
*
|
||||||
|
* - retries: 重试次数,默认 1,指定当 http 请求失败时重试的次数。
|
||||||
|
* - retry_delay: 重试延迟间隔(单位:ms),默认 500
|
||||||
|
* - log_template: 指定 HTTP 日志模板,请参考:https://github.com/guzzle/guzzle/blob/master/src/MessageFormatter.php
|
||||||
|
*/
|
||||||
|
'http' => [
|
||||||
|
'max_retries' => 1,
|
||||||
|
'retry_delay' => 500,
|
||||||
|
'timeout' => 5.0,
|
||||||
|
// 'base_uri' => 'https://api.weixin.qq.com/', // 如果你在国外想要覆盖默认的 url 的时候才使用,根据不同的模块配置不同的 uri
|
||||||
|
],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OAuth 配置
|
||||||
|
*
|
||||||
|
* scopes:公众平台(snsapi_userinfo / snsapi_base),开放平台:snsapi_login
|
||||||
|
* callback:OAuth授权完成后的回调页地址
|
||||||
|
*/
|
||||||
|
'oauth' => [
|
||||||
|
'scopes' => ['snsapi_userinfo'],
|
||||||
|
'callback' => '/wechat/callback',
|
||||||
|
],
|
||||||
|
];
|
||||||
Reference in New Issue
Block a user