This commit is contained in:
Alone
2024-09-14 15:10:43 +08:00
parent 6c64bbd82a
commit 610dee88cd
4241 changed files with 0 additions and 622695 deletions
-171
View File
@@ -1,171 +0,0 @@
<?php
declare(strict_types=1);
namespace app\index;
use think\App;
use EasyWeChat\Factory;
use app\model\Conf as ConfModel;
use app\model\User as UserModel;
/**
* 控制器基础类
*/
abstract class QfShop
{
protected $confModel;
protected $UserModel;
protected $access_token;
protected $wechat_appid;
protected $wechat_appkey;
protected $easyWeChat;
//微信用户数据数组
protected $user;
/**
* Request实例
* @var \think\Request
*/
protected $request;
/**
* 应用实例
* @var \think\App
*/
protected $app;
protected $module;
protected $controller;
protected $action;
/**
* 构造方法
* @access public
* @param App $app 应用对象
*/
public function __construct(App $app)
{
$this->app = $app;
$this->request = $this->app->request;
// 控制器初始化
// $this->initialize();
}
// 初始化
protected function initialize()
{
$this->module = "index";
$this->controller = "index";
$this->action = strtolower($this->request->action()) ? strtolower($this->request->action()) : "index";
$this->confModel = new ConfModel();
$this->UserModel = new UserModel();
$configs = $this->confModel->select()->toArray();
$c = [];
foreach ($configs as $config) {
$c[$config['conf_key']] = $config['conf_value'];
}
config($c, 'qfshop');
$this->initWechatConfig();
}
/**
* 微信服务登录 $this->user将为用户数据
*
* @param mixed $openid
* @return void
*/
protected function updateWechatUserInfo($openid)
{
$user = $this->easyWeChat->user->get($openid);
if (array_key_exists("errcode", $user)) {
return false;
} else {
$nickname = $user['nickname']??"";
$sex = $user['sex']??"";
$headimgurl = empty($user['headimgurl'])?'' : str_replace("http://", 'https://', $user['headimgurl']);
$this->user = $this->UserModel->where('openid', $openid)->find();
if (!$this->user) {
//注册
$data = ["openid" => $openid, "nickname" => $nickname, "head_pic" => $headimgurl, "sex" => $sex, "create_time" => time(), "update_time" => time()];
$this->UserModel->insert($data);
} else {
//更新
$this->UserModel->where('openid', $openid)->update(["nickname" => $nickname, "head_pic" => $headimgurl, "sex" => $sex,"update_time" => time()]);
}
$this->user = $this->UserModel->where('openid', $openid)->find();
return $this->user;
}
}
protected function initWechatConfig()
{
$this->wechat_appid = config("qfshop.mp_appid");
$this->wechat_appkey = config("qfshop.mp_appsecret");
if (!$this->wechat_appid || !$this->wechat_appkey) {
die('Input wechat appid and appkey first!');
}
$this->wechat_config = [
'app_id' => $this->wechat_appid,
'secret' => $this->wechat_appkey,
'token' => 'qfshop',
'aes_key' => 'qfshop',
//必须添加部分
'http' => [ // 配置
'verify' => false,
'timeout' => 4.0,
],
];
$this->easyWeChat = Factory::officialAccount($this->wechat_config);
$user_id = cookie('user_id');
$user_ticket = cookie('user_ticket');
if ($user_ticket == getTicket($user_id)) {
$this->user = $this->UserModel->where('user_id', $user_id)->find();
if ($this->user) {
$this->user = $this->user->toArray();
}
}
}
/**
* 调用微信授权
*
* @return void
*/
protected function authorize()
{
if ($this->user) {
return null;
}
//生成授权所需要的回调地址 并重定向到Authorize控制器进行微信授权
$callback = '/';
if ($this->module != "index") {
$callback .= strtolower($this->module) . '/';
} else {
if ($this->controller != "Index" && $this->action != "index") {
$callback .= strtolower($this->module) . '/';
}
}
if ($this->controller != "Index") {
$callback .= strtolower($this->controller) . '/';
} else {
if ($this->action != "index") {
$callback .= strtolower($this->controller) . '/';
}
}
if ($this->action != "index") {
$callback .= strtolower($this->action) . '/';
}
$i = 0;
foreach (input('get.') as $k => $v) {
if ($i == 0) {
$callback .= "?";
} else {
$callback .= "&";
}
if (!in_array($k, ['code', 'state', 'from', 'isappinstalled'])) {
$callback .= $k . "=" . $v;
}
$i++;
}
return redirect('/index/authorize?callback=' . urlencode($callback));
}
}
-43
View File
@@ -1,43 +0,0 @@
<?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
@@ -1,32 +0,0 @@
<?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
@@ -1,29 +0,0 @@
<?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
@@ -1,24 +0,0 @@
<?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;
}
}
-310
View File
@@ -1,310 +0,0 @@
<!DOCTYPE html>
<html dir="ltr" lang="zh">
<head>
<meta charset="utf-8">
<meta name="theme-color" content="#fff">
<meta name="viewport" content="initial-scale=1, minimum-scale=1, width=device-width">
<title>提示</title>
<style>
a {
color: var(--link-color);
}
body {
--background-color: #fff;
--error-code-color: var(--google-gray-700);
--google-blue-100: rgb(210, 227, 252);
--google-blue-300: rgb(138, 180, 248);
--google-blue-600: rgb(26, 115, 232);
--google-blue-700: rgb(25, 103, 210);
--google-gray-100: rgb(241, 243, 244);
--google-gray-300: rgb(218, 220, 224);
--google-gray-500: rgb(154, 160, 166);
--google-gray-50: rgb(248, 249, 250);
--google-gray-600: rgb(128, 134, 139);
--google-gray-700: rgb(95, 99, 104);
--google-gray-800: rgb(60, 64, 67);
--google-gray-900: rgb(32, 33, 36);
--heading-color: var(--google-gray-900);
--primary-button-fill-color-active: var(--google-blue-700);
--primary-button-fill-color: var(--google-blue-600);
--primary-button-text-color: #fff;
--text-color: var(--google-gray-700);
background: var(--background-color);
color: var(--text-color);
word-wrap: break-word;
}
html {
-webkit-text-size-adjust: 100%;
font-size: 125%;
}
.icon {
background-repeat: no-repeat;
background-size: 100%;
}
@media (prefers-color-scheme: dark) {
body.captive-portal,
body.dark-mode-available,
body.neterror,
body.supervised-user-block,
.offline body {
--background-color: var(--google-gray-900);
--error-code-color: var(--google-gray-500);
--heading-color: var(--google-gray-500);
--link-color: var(--google-blue-300);
--primary-button-fill-color-active: rgb(129, 162, 208);
--primary-button-fill-color: var(--google-blue-300);
--primary-button-text-color: var(--google-gray-900);
--text-color: var(--google-gray-500);
}
}
</style>
<style>
button {
border: 0;
border-radius: 4px;
box-sizing: border-box;
color: var(--primary-button-text-color);
cursor: pointer;
float: right;
font-size: .875em;
margin: 0;
padding: 8px 16px;
transition: box-shadow 150ms cubic-bezier(0.4, 0, 0.2, 1);
user-select: none;
}
[dir='rtl'] button {
float: left;
}
.ssl button {
background: var(--primary-button-fill-color);
}
button:active {
background: var(--primary-button-fill-color-active);
outline: 0;
}
h1 {
color: var(--heading-color);
font-size: 1.6em;
font-weight: normal;
line-height: 1.25em;
margin-bottom: 16px;
}
h2 {
font-size: 1.2em;
font-weight: normal;
}
.icon {
height: 72px;
margin: 0 0 40px;
width: 72px;
}
.interstitial-wrapper {
box-sizing: border-box;
font-size: 1em;
line-height: 1.6em;
margin: 14vh auto 0;
max-width: 600px;
width: 100%;
}
#main-message>p {
display: inline;
}
.nav-wrapper {
margin-top: 51px;
}
.nav-wrapper::after {
clear: both;
content: '';
display: table;
width: 100%;
}
@media (max-width: 700px) {
.interstitial-wrapper {
padding: 0 10%;
}
}
@media (max-width: 420px) {
button,
[dir='rtl'] button {
float: none;
font-size: .825em;
font-weight: 500;
margin: 0;
width: 100%;
}
button {
padding: 16px 24px;
}
.interstitial-wrapper {
padding: 0 5%;
}
.nav-wrapper {
margin-top: 30px;
}
}
@media (min-width: 240px) and (max-width: 420px) and (min-height: 401px),
(min-width: 421px) and (min-height: 240px) and (max-height: 560px) {
body .nav-wrapper {
background: var(--background-color);
bottom: 0;
box-shadow: 0 -22px 40px var(--background-color);
left: 0;
margin: 0 auto;
max-width: 736px;
padding-left: 24px;
padding-right: 24px;
position: fixed;
right: 0;
width: 100%;
z-index: 2;
}
.interstitial-wrapper {
max-width: 736px;
}
}
@media (max-width: 420px) and (orientation: portrait),
(max-height: 560px) {
body {
margin: 0 auto;
}
button,
[dir='rtl'] button,
button.small-link {
font-family: Roboto-Regular, Helvetica;
font-size: .933em;
margin: 6px 0;
transform: translatez(0);
}
.nav-wrapper {
box-sizing: border-box;
padding-bottom: 8px;
width: 100%;
}
h1 {
font-size: 1.5em;
margin-bottom: 8px;
}
.icon {
margin-bottom: 5.69vh;
}
.interstitial-wrapper {
box-sizing: border-box;
margin: 7vh auto 12px;
padding: 0 24px;
position: relative;
}
.interstitial-wrapper p {
font-size: .95em;
line-height: 1.61em;
margin-top: 8px;
}
}
@media (min-width: 421px) and (min-height: 500px) and (max-height: 560px) {
.interstitial-wrapper {
margin-top: 10vh;
}
}
@media (min-height: 400px) and (orientation:portrait) {
.interstitial-wrapper {
margin-bottom: 145px;
}
}
@media (min-height: 299px) {
.nav-wrapper {
padding-bottom: 16px;
}
}
@media (min-height: 500px) and (max-height: 650px) and (max-width: 414px) and (orientation: portrait) {
.interstitial-wrapper {
margin-top: 7vh;
}
}
@media (min-height: 650px) and (max-width: 414px) and (orientation: portrait) {
.interstitial-wrapper {
margin-top: 10vh;
}
}
.ssl .icon {
background-image: -webkit-image-set(url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAMAAABiM0N1AAABAlBMVEUAAADcRTfcRDfdRET/gIDcRjr/ZmbjVTncRDfcRTfcRDfdRDzgSTncRDjeSDvcRTjbRDfbRDjeRzvcRjfbRjjcRTjcRTjcRTfdRTfcRDjdRTjcRTjbRDjbRTjbRTjbRTfcRjjdRDrcRjfbRTjZQzfcRDjZRDfZRzbWQzXXRDXXQzbXQzbWQjXYSDvWQjbbRDfOQDPSQTTUQjXCPDDNPzPJPjLGPTHVQjXMPzPRQTTWQjXLPzPDPDHYQzbAOzDTQTXHPTLIPjK8Oi++Oy/FPTHEPTHPQDTQQDTUQTXBPDDKPjK/OzC9Oi/////PQDPRQDS3OS66OS7TQTTEPDHXQjbMPjMBhLaWAAAAL3RSTlMA4tgPAhYFCcL98B4x9ie1+s49WICbqXNKZY3pjuqcgVdLZnL2qKg9zmXpjfontV8LANsAAAJrSURBVHhe7ZTnduIwFAY3ARIgBAg9vW1v173ROylby/u/yso2Fx3MNaxs9h/zAHM+Sfa8+M/s2LFjx+3tdjwH+/sHWxHVAerb8KSyANnUFkRXwLiK78llgJHJxRalwSMd11OGOeV4nsM9FO0dxhJdw4LrOJ6jYy46PoohqgEHatE9JViiFNWTPIElTpIRRXcQ4C6aJ3EJAS4TkUQXsMJFFE++CCsU8xFEBSAoiHsaQNIQ7yuQCFe3DiHUh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MAQ4ZEyKua/b+0Np175blMERDuaECFBZGqzBaxY9iAjIMbDK01U0OVZxcplE6BIjLzFRixgQDwflCJaXcC+1ToKyOYHFvCOljPiNmvurTBRI+oQoGTk2Z1YQyIeiWhlEftWnx8Yf8RcyiMCEkyhic2u4xOWSw9MBBQENTQFI83a+iL2rdgpJ1rms45mByYzhbDNwt6qTtTlQC7r6FT/CLRQ02ZLWKc8OmK+LzooCykhKpl4q7p+7B/d0SjNggRbqGOzm1gPqL3PX3niZakOQsenf1PDWzWAxr+JBtEDQxnnJTISNmvurfBK75t45bORBNGSobcqb9DqBCjdQOl5E370xthbYaDRiIjRDxKQwJk9a+o2u431gYZERBo/kcBIfvJ/TrSt6K1b+kDUHMkra2V3j5zRlprNbmADILbQ65S/z2ggyY82zL0VXsdQnnLdhSOKQzWbLWADIMpDgOrd3q958QiigrG3wusYzmNbXmY4sh+tangrVJ2Dgy97X9v0CmILzzIHcj3ZPTL+h6DN7mhYR5nxHI4mtKNbLCAmaX9QDDKFO6C36hDttcdJQFGLeTWRIupocGOj62cBb9WqesLTFwfm000MQgqz9lDLW+Hve35HM9Fnqw9HetBkNsF6+Yaet8Jf0+xbka0XbYspSMIg+5D8/8psnqdYv3qso1vsS9Hy6SaGQ6AYHP9ngLdqllVpiIB8RygRQjGEdOsc4K26RGzk6YTxjhbDDdzXcfwC8Fbd8glPnR4Y62gBAM/a1WybfYVNyyUBiZFPXYCAH70GvFW7nFRHH7EgyI8uAd6qXZ7NAqoilG6ZKuBH184D3qpdAQlIWp0p9dE7wFv1q8Y6+njLoPl+9P4C4K0GRKSjgTyywvoAeKtBxVWU6YhorovcvA14q0HtouwU0Fw/+jzN8w/cQ/zg6ug2/QAAAABJRU5ErkJggg==) 2x);
}
</style>
</head>
<body id="body" class="ssl extended-reporting-has-checkbox">
<div class="interstitial-wrapper">
<div id="main-content">
<div class="icon" id="icon"></div>
<div id="main-message">
<h1>提示</h1>
<p>{$msg}</p>
</div>
</div>
<div class="nav-wrapper">
<a href="javascript:history.go(-1);"><button id="primary-button">好的,我知道了</button></a>
</div>
</div>
<style>
html {
direction: ltr;
}
body {
font-family: system-ui, PingFang SC, STHeiti, sans-serif;
font-size: 75%;
}
button {
font-family: system-ui, PingFang SC, STHeiti, sans-serif;
}
</style>
</body>
</html>
-27
View File
@@ -1,27 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="/assets/uni.4906e6f8.css">
<meta charset="UTF-8" />
<script>
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
CSS.supports('top: constant(a)'))
document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
</script>
<title>心悦搜剧-短剧搜索</title>
<link rel="icon" href="/assets/logo-DQLPqAxx.png" />
<script src="./static/config.js"></script>
<script charset="UTF-8" id="LA_COLLECT" src="//sdk.51.la/js-sdk-pro.min.js"></script>
<script>LA.init({id:"3HsdT1GaTQzE091Y",ck:"3HsdT1GaTQzE091Y",hashMode:true})</script>
<!--preload-links-->
<!--app-context-->
<script type="module" crossorigin src="/assets/index-bFszJRU6.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-BLVVqZ0m.css">
</head>
<body>
<div id="app"><!--app-html--></div>
</body>
</html>