Merge remote-tracking branch 'origin/master'
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,3 +3,4 @@
|
|||||||
/vendor
|
/vendor
|
||||||
*.log
|
*.log
|
||||||
.env
|
.env
|
||||||
|
composer.lock
|
||||||
@@ -9,15 +9,68 @@ class Wechat
|
|||||||
{
|
{
|
||||||
private Application $app;
|
private Application $app;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes : 初始化微信
|
||||||
|
*
|
||||||
|
* @Date : 2022/9/9 11:30
|
||||||
|
* @Author : <Jason.C>
|
||||||
|
*/
|
||||||
private function initWechat()
|
private function initWechat()
|
||||||
{
|
{
|
||||||
$this->app = Factory::officialAccount(config('wechat'));
|
$this->app = Factory::officialAccount(config('wechat'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function config()
|
/**
|
||||||
|
* Notes : 获取微信授权的地址并跳转
|
||||||
|
*
|
||||||
|
* @Date : 2022/9/9 11:29
|
||||||
|
* @Author : <Jason.C>
|
||||||
|
*/
|
||||||
|
public function url()
|
||||||
{
|
{
|
||||||
$this->initWechat();
|
$this->initWechat();
|
||||||
redirect($this->app->oauth->scopes(['snsapi_userinfo'])->redirect());
|
redirect($this->app->oauth->scopes(['snsapi_userinfo'])->redirect());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes : 微信授权回调地址,获取到用户信息后,自行保存
|
||||||
|
*
|
||||||
|
* @Date : 2022/9/9 11:29
|
||||||
|
* @Author : <Jason.C>
|
||||||
|
*/
|
||||||
|
public function callback()
|
||||||
|
{
|
||||||
|
$this->initWechat();
|
||||||
|
$user = $this->app->oauth->user();
|
||||||
|
// $user 可以用的方法:
|
||||||
|
// $user->getId(); // 对应微信的 OPENID
|
||||||
|
// $user->getNickname(); // 对应微信的 nickname
|
||||||
|
// $user->getName(); // 对应微信的 nickname
|
||||||
|
// $user->getAvatar(); // 头像网址
|
||||||
|
// $user->getOriginal(); // 原始API返回的结果
|
||||||
|
// $user->getToken(); // access_token, 比如用于地址共享时使用
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes : 显示支付的页面,支付逻辑
|
||||||
|
*
|
||||||
|
* @Date : 2022/9/9 11:32
|
||||||
|
* @Author : <Jason.C>
|
||||||
|
*/
|
||||||
|
public function payment()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes : 支付完成回调
|
||||||
|
*
|
||||||
|
* @Date : 2022/9/9 11:33
|
||||||
|
* @Author : <Jason.C>
|
||||||
|
*/
|
||||||
|
public function paid()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -20,11 +20,13 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=7.2.5",
|
"php": ">=7.4",
|
||||||
"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",
|
||||||
|
"overtrue/wechat": "~5.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"symfony/var-dumper": "^4.2",
|
"symfony/var-dumper": "^4.2",
|
||||||
@@ -39,7 +41,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"preferred-install": "dist"
|
"preferred-install": "dist",
|
||||||
|
"allow-plugins": {
|
||||||
|
"easywechat-composer/easywechat-composer": true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"post-autoload-dump": [
|
"post-autoload-dump": [
|
||||||
|
|||||||
2253
composer.lock
generated
2253
composer.lock
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user