first commit

This commit is contained in:
675061370@qq.com
2024-04-04 21:28:09 +08:00
commit fe9661855e
4192 changed files with 618218 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
<?php
namespace app\index\controller;
use app\index\QfShop;
class Authorize extends QfShop
{
public function index()
{
$callback = '';
if (input('callback')) {
$callback = urldecode(input('callback'));
}
$callbackWechat = urlencode(getFullDomain() . "/index/authorize/callback/");
return redirect("https://open.weixin.qq.com/connect/oauth2/authorize?appid=" . $this->wechat_appid . "&redirect_uri=" . $callbackWechat . "&response_type=code&scope=snsapi_base&state=" . urlencode($callback) . "#wechat_redirect");
}
public function callback()
{
$callback = '/index';
if (input('state')) {
$callback = urldecode(input('state'));
}
if (!input('code')) {
return redirect($callback);
}
$code = input('code');
$retStr = curlHelper("https://api.weixin.qq.com/sns/oauth2/access_token?appid=" . $this->wechat_appid . "&secret=" . $this->wechat_appkey . "&code={$code}&grant_type=authorization_code")['body'];
$retObj = json_decode($retStr);
if (isset($retObj->errcode)) {
return redirect($callback);
} else {
$access_token = $retObj->access_token;
$openid = $retObj->openid;
if (!$this->updateWechatUserInfo($openid)) {
return redirect($callback);
}
cookie('user_id', $this->user['user_id'], 3600000);
cookie('user_ticket', getTicket($this->user['user_id']), 3600000);
return redirect($callback);
}
}
}
+32
View File
@@ -0,0 +1,32 @@
<?php
namespace app\index\controller;
use app\index\QfShop;
use think\facade\View;
class Error extends QfShop
{
public function __call($method, $args)
{
$error = $this->authorize();
if ($error) {
return $error;
}
View::assign('wechat', $this->wechat);
if (file_exists(app_path() . "/view/" . strtolower($this->request->controller()) . "/" . $method . ".html")) {
if (key_exists('callback', $args)) {
View::assign('callback', $args['callback']);
} else {
View::assign('callback', '/admin');
}
return View::fetch();
} else {
return 404;
}
}
public static function show($msg = null)
{
View::assign('msg', $msg);
return View::fetch("/error");
}
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace app\index\controller;
use think\App;
use think\facade\View;
use think\facade\Request;
use think\facade\Cache;
use app\index\QfShop;
class Index extends QfShop
{
public function __construct(App $app)
{
parent::__construct($app);
}
/**
* @description: 报名页面
* @param {*}
* @return {*}
*/
public function index()
{
return View::fetch();
}
}
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace app\index\controller;
use app\index\QfShop;
class Jssdk extends QfShop
{
protected $ServiceToken = 'QfShop';
protected $wechat;
public function index()
{
$this->easyWeChat->jssdk->setUrl(input('url'));
$ret = $this->easyWeChat->jssdk->buildConfig([
'scanQRCode',
'closeWindow',
'showMenuItems',
'hideAllNonBaseMenuItem',
'updateAppMessageShareData',
'updateTimelineShareData'
], false, false, false);
return $ret;
}
}