Compare commits

...

82 Commits

Author SHA1 Message Date
Rico 5ddb11226f Merge branch 'A-dev' into merge_upstream
# Conflicts:
#	app/Command/Job.php
#	app/Controllers/Admin/UserController.php
#	app/Controllers/Client/ClientApiController.php
#	app/Controllers/HomeController.php
#	app/Controllers/LinkController.php
#	app/Controllers/UserController.php
#	app/Middleware/Mod_Mu.php
#	app/Models/User.php
#	app/Services/Config.php
#	app/Services/Gateway/TomatoPay.php
#	app/Services/Gateway/TrimePay.php
#	app/Services/Payment.php
#	app/Utils/TelegramProcess.php
#	app/Utils/Tools.php
#	app/Utils/URL.php
#	composer.json
#	config/.config.example.php
#	resources/clients/ss-win/使用注意.txt
#	resources/clients/ssd-win/使用注意.txt
#	resources/clients/ssr-win/使用注意.txt
#	resources/views/material/user/index.tpl
#	sql/glzjin_all.sql
7 years ago
Rico 5c7c9c59e6 add tomatoPay.php 7 years ago
Rico aea2272677 merge Merge branch 'dev' of https://github.com/Anankke/SSPanel-Uim into A-dev 7 years ago
SakuraSa233 57de09ea4a
fix(vue-controller): default return 7 years ago
SakuraSa233 ab60f5c7c8
fix(vue): return type, logic, bad code style(incompletely) 7 years ago
laurieryayoi d68337872e fix console.log warning 7 years ago
Sukka b6135efc88
github(issue_template): add zh-CN version 7 years ago
laurieryayoi e7ac0b9562 布尔值判断去引号 & 添加nodeinfo相关代码 7 years ago
laurieryayoi d809788106 Merge branch 'dev' of https://github.com/Anankke/SSPanel-Uim into dev 7 years ago
laurieryayoi c2bf1dc952 添加nodeinfo api 7 years ago
SakuraSa233 be32a13c9b
feat(github): multi issue template 7 years ago
SakuraSa233 30654b7cd2
clean(trimepay): clean template file 7 years ago
SakuraSa233 a647590326
Revert "clean(payment): remove unused paymentwall"
This reverts commit 67af63b052.
7 years ago
SakuraSa233 931eb9d1d2
refactor(controller): base slim-http native json output 7 years ago
SakuraSa233 e1127e863a
refactor(qrcode): local decode with better perf 7 years ago
SakuraSa233 9b0cd43a2e
clean(services): remove empty cache class 7 years ago
SakuraSa233 e9e59e4dcb
clean(service): remove unused "token" 7 years ago
SakuraSa233 6996425e9b
clean(auth): remove empty class 7 years ago
SakuraSa233 67af63b052
clean(payment): remove unused paymentwall 7 years ago
SakuraSa233 0449eed1fe
fix(ci): boolean config variable 7 years ago
Anankke d69fb6b1b8
Merge pull request #870 from regendsoh/patch-1
Fix: Remove preset value of $_ENV['reg_obfs_param']
7 years ago
Anankke 000abaa4d7
Merge pull request #872 from xcxnig/dev
clean(discord): remove invalid discord config
7 years ago
Miku 9dfd9e992a
Update UserController.php 7 years ago
Miku 90f11f9e50
Update config.php 7 years ago
Miku 8bfa574c7f
Update Config.php 7 years ago
Regend Soh ad160e46f7
Fix: Remove preset value of $_ENV['reg_obfs_param']
To avoid problem when setting up SSPanel for idiotic user.
防止傻逼不会弄单端口
7 years ago
TheCGDF 38283cf96d 调整:当余额高于auto_clean_min_money时,即使账户到期后也不会被删除。避免歧义 7 years ago
錢爸爸 67334f8abf
Change style 7 years ago
錢爸爸 56ebebf928
Change style 7 years ago
Anankke ccac5960ff
Merge pull request #867 from xcxnig/dev
Optimize link alignment
7 years ago
Miku 9c905ff215
Optimize link alignment 7 years ago
SakuraSa233 051ffc57f9
clean(cloudxns): remove mostly unused cloudxns 7 years ago
SakuraSa233 74e5f87b84
feat(conf): un-string variable type 7 years ago
SakuraSa233 d01adce482
clean(discord): remove invalid discord bot 7 years ago
SakuraSa233 8d7e1f9293
refactor(middleware): refactor ModMu for better perf(?) 7 years ago
SakuraSa233 0fecd8600b
perf(auth): user identification cache 7 years ago
SakuraSa233 082f7c5a00
fix(middleware): correct comment 7 years ago
SakuraSa233 e40e820135
clean(utils): remove unused Helper class 7 years ago
SakuraSa233 d06ebb83c4
refactor(middleware): style refactor and optimize 7 years ago
SakuraSa233 2dbdf2a25c
clean(controller): remove prorietary ApiController 7 years ago
SakuraSa233 a98ff85079
clean(utils): remove unused utils classes 7 years ago
SakuraSa233 6be1abfaf1
fix(tmt-pay): response return 7 years ago
SakuraSa233 83db32626f
clean(services): remove unused Slim class 7 years ago
SakuraSa233 b56272fe07
clean(controller): remove prorietary client api controller 7 years ago
Rico 62d3b91540 mergeMerge branch 'dev' of https://github.com/Anankke/SSPanel-Uim into A-dev 7 years ago
Anankke be379f66a9
Merge pull request #860 from zeva20/bugfix
fix(user) Fix missing obfs_param data
7 years ago
zeva20 accd82e754 fix(user) Fix missing obfs_param data 7 years ago
錢爸爸 0a4f629226
random gravatar avatar 7 years ago
Rico 8839d3c7a6 merge upstream Merge branch 'dev' of https://github.com/Anankke/SSPanel-Uim into A-dev 7 years ago
錢爸爸 da7ca38780
admin/user add obfs_param
就是喜歡在web直接水Commit
7 years ago
錢爸爸 30e24b24c3
admin/user add obfs_param 7 years ago
SakuraSa233 c0eee00f74
refactor(tmtpay): style refactor and code optimize 7 years ago
SakuraSa233 6d918b8c11
feat(payment): add comments for AbstractPayment function 7 years ago
SakuraSa233 1c6b49555d
fix(routes): remove Mu middleware and controller 7 years ago
SakuraSa233 04899474d3
fix(tree): remove unused files 7 years ago
SakuraSa233 c358c7ae45
fix(payment): remove invalid DoiAmPay 7 years ago
SakuraSa233 fd4aa61bb9
fix(payment): remove invalid TrimePay 7 years ago
Regend Soh 1279aea9cf Fix: MySQL 8.0 support for income calculation (#856)
* Fix: MySQL 8.0 support for income calculation

* Fix: MySQL 8.0 support for income calculation
7 years ago
Regend Soh 110229fe5a feat: 接入番茄支付平台 (#855)
这是好的
7 years ago
錢爸爸 6c2830c0db
Update README.md 7 years ago
Anankke 9b0005b013
Merge pull request #850 from regendsoh/patch-3
Fix bug: display last month Income
7 years ago
Regend Soh e4329a7661
Fix bug: display last month Income
Ref: https://stackoverflow.com/questions/19727274/strtotime-bug-when-using-1-month-from-january
7 years ago
Anankke 9f24cffb73
Merge pull request #849 from GeekQu/Anankke_dev
包含订阅信息的客户端下载方式
7 years ago
GeekQu 2db61fb807 包含订阅信息的客户端下载方式 7 years ago
GeekQu cf4b62966c
Merge pull request #42 from Anankke/dev
merge 20191027
7 years ago
Anankke 1a8dd4d873
Merge pull request #846 from regendsoh/patch-2
Simplify if...else statement from previous commit
7 years ago
Regend Soh d217000ca2
Simplify if...else statement from previous commit
as mentioned.
7 years ago
SakuraSa233 a2e471d9f9
fix(composer): lost pagination
fix #844
7 years ago
Anankke 2782c532cc
Merge pull request #845 from regendsoh/patch-1
Fix bug for income calculation
7 years ago
Regend Soh 532f2f457f
Fix bug for income calculation
Fix bug as mentioned by @topjohncian
7 years ago
Anankke 9601dd3aa6
Merge pull request #835 from lifespy/dev
新增易付支付
7 years ago
TheCGDF c7140d35ad 修复签到后流量显示异常 7 years ago
laurieryayoi 0e3e64b952 fix no-empty bug 7 years ago
laurieryayoi 2806ea97fa 节点列表v1 7 years ago
SakuraSa233 972bd1ede8
feat(git): update contribute guide 7 years ago
SakuraSa233 8082ea7bb2
feat(controller): refactor HomeController as standard 7 years ago
SakuraSa233 093dbc3d48
fix(composer): clean php dependencies 7 years ago
lifespy c4e38e84d3 yft 7 years ago
GeekQu bb805d65a4 Merge branch 'pr/40' into Anankke_dev 7 years ago
Rico 50c55ea309 排除已经中止的套餐 7 years ago
GeekQu 0a94ae0778 +1 8 years ago
GeekQu c9b0573f43 修正 Clash ss 节点异常输出 obfs-host 8 years ago

@ -1,22 +0,0 @@
# https://editorconfig.org/
root = true
[*]
tab_width = 4
[*.php]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
charset = utf-8
end_of_line = lf
indent_style = space
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 80

2
.gitattributes vendored

@ -1,2 +0,0 @@
# Auto detect text files and perform LF normalization
* text=auto

@ -0,0 +1,34 @@
---
name: Bug report
about: Create a bug report
title: "[BUG]"
labels: bug
---
请将 [ ] 替换为 [x] 。Please relpace [ ] with [x] .
- [ ] 我已知晓并同意,如果我不遵循以下格式提交 issue,或者我使用的并非最新版本的 SSPanel UIM,或者我没有提供足够的信息,或者我没有选中这些框,则我的 issue 将会被无条件关闭和锁定。 I acknowledge if I don't follow the format below, or I'm on an old commit, or I fail to provide sufficient information, or I don't check these box, my issue could be closed without any notice.
- [ ] 我已确认我已经阅读过使用文档、Wiki,并在 issue 列表中查找相似的问题。I certify that I have read project Wiki and other issue may related to this one.
- [ ] 我已知晓并同意,如果我不同意上述条件却仍然提交 issue,或即使同意上述条件但在提交 issue 时不按照条件执行,我的 issue 可被 SSPanel UIM 维护团队视为 spam、并在必要时会被举报到 GitHub。 I acknowledge if I disagree with the conditions above but still submit a issue, or if I agree conditions above but do not follow them when submitting a issue, my issue could be considered as spam by the SSPanel UIM maintenance team, and might be reported to GitHub if necessary.
**Environment 环境**
Your OS info, PHP/MySQL version and so on... 你的操作系统信息、PHP/MySQL 版本、以及其它所有可能相关的信息。
**Commit**
The commit you on. 你当前的 SSPanel UIM 位于哪条 commit。
**Bug**
The bug information. 请描述你遇到的 Bug。
**Reproduce**
Steps to reproduce the bug. 请逐步描述如何复现 Bug。
**Expected behavior**
What you expected to happen. 请描述你预期的行为。
**Logs**
If applicable, add your PHP logs here. 如果需要,请在这里粘贴 PHP Log。
**Addition**
Additional context here. 如有可能,请提供更多相关资料。

@ -0,0 +1,19 @@
---
name: Feature request
about: Suggest an new idea for this project
title: "[Feature Request]"
labels: enhancement
---
- [ ] I acknowledge if I don't follow the format below or I don't check these box, my issue could be closed without any notice.
- [ ] I certify that I have read project Wiki and other issue may related to this one.
**Feature**
The feature you want.
**Solution**
If you have some solution about this issue, type it here.
**Addition**
Additional context here.

@ -1,49 +0,0 @@
---
name: issue
about: temlpate
---
<!--
如果你不仔细填写下面的内容,我们可能会直接关闭你的 issue。
如果你没有仔细阅读 Wiki ,或者无关问题,我们可能会直接关闭你的 issue。
注意:Wiki 可能随时都会更新。在提交一个 issue 前,请重新查看相关内容。
如果你还有什么别的小问题请加入群组 https://t.me/SSUnion
不要用你的 issue 污染几百个 watchers 的邮箱
-->
**我确认我已经阅读了** (使用 "x" 选择)
- [ ] [项目 Wiki ](https://github.com/Anankke/SSPanel-Uim/wiki)
- [ ] [项目其他 issue](https://github.com/Anankke/SSPanel-Uim/issues?utf8=%E2%9C%93&q=is%3Aissue)
**我确认我做到了** (使用 "x" 选择)
- [ ] [将项目升级到当前分支最新版本](https://github.com/Anankke/SSPanel-Uim/wiki/%E5%8D%87%E7%B4%9A%E7%89%88%E6%9C%AC)
- [ ] 在[项目演示站](https://demo.nimaqu.com)成功复现问题
**我正在申请** (使用 "x" 选择)
- [ ] 反馈一个 bug
- [ ] 申请添加新的特性或功能或者好的想法
<!--
**反馈BUG**
1. 反馈之前先升级到分支的最新版本。
2.如果是页面问题(500 或 Slim Application Error ),请在 config 开启 debug 模式后截图或贴出输出内容,如果是某个按钮点击没反应,请打开浏览器开发者控制台(通常为 F12 ) ,贴出 console 输出内容。
-->
<!--从这一行往下写--我是分割线-->

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ss-panel-v3-mod_UIChanges</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.aptana.ide.core.unifiedBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.aptana.projects.webnature</nature>
</natures>
<filteredResources>
<filter>
<id>1522297588605</id>
<name></name>
<type>26</type>
<matcher>
<id>org.eclipse.ui.ide.multiFilter</id>
<arguments>1.0-name-matches-false-false-node_modules</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>

@ -16,14 +16,19 @@ pull request for each branch. This allows each feature or improvement to be revi
### Coding Style
All pull requests and commits **must** adhere to the [PSR-2 standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) at least.
All pull requests and commits **must** adhere to the [PSR-2 standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) at least.
And we **recommend** adhering to the [PSR-12 standard](https://github.com/php-fig/fig-standards/blob/master/proposed/extended-coding-style-guide.md).
### Commit message
The Commit message **must** containe all the changes you maked in sort.
The Commit message **must** containe all the changes you maked in sort.
Please **do not** use words like "fix", "improve" only.
### Rule
If you want to add a new function for router callback, please follow the structure of the HomeController.
Please use the function from PSR-7 like `$request->getParsedBodyParam()`, `getParsedBodyParam()` as possible.
## 简体中文
### Pull Request
@ -36,9 +41,14 @@ Please **do not** use words like "fix", "improve" only.
### 代码风格
所有的 Pull request 和 commit 都至少**必须**遵守 [PSR-2 标准](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)。
所有的 Pull request 和 commit 都至少**必须**遵守 [PSR-2 标准](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)。
我们建议**最好**遵守 [PSR-12 标准](https://github.com/php-fig/fig-standards/blob/master/proposed/extended-coding-style-guide.md)。
### Commit 消息
Commit 消息必须简洁地包含你所有的修改。请不要仅使用「修复」、「改进」等字样。
### 规范
若你需要新增/修改 Router callback,请依照类似 HomeController 的形式。
如无必要,请不要使用`$request->getParam()`并尽量使用 PSR-7 中的`$request->getParsedBodyParam()`、`getParsedBodyParam()`等一系列用于获取参数的方法。

@ -167,6 +167,7 @@ SSPanel UIM 离不开所有 [贡献代码](https://github.com/Anankke/SSPanel-Ui
#### galaxychuck
- [hkserversolution-推荐UIM面板服务器放置](https://www.hkserversolution.com/aff.php?aff=60)
- [moecloud-美國VPS](https://moecloud.asia/aff.php?aff=56)
#### laurieryayoi

@ -83,7 +83,7 @@ class FinanceMail
}
}
if (Config::get('finance_public') == 'true') {
if (Config::get('finance_public') == true) {
$sts = new Analytics();
Telegram::Send(
'新鲜出炉的财务日报~' . PHP_EOL .
@ -150,7 +150,7 @@ class FinanceMail
}
}
if (Config::get('finance_public') == 'true') {
if (Config::get('finance_public') == true) {
$sts = new Analytics();
Telegram::Send(
'新鲜出炉的财务周报~' . PHP_EOL .
@ -197,7 +197,7 @@ class FinanceMail
}
}
if (Config::get('finance_public') == 'true') {
if (Config::get('finance_public') == true) {
$sts = new Analytics();
Telegram::Send(
'新鲜出炉的财务月报~' . PHP_EOL .

@ -29,7 +29,6 @@ use App\Utils\QQWry;
use App\Utils\GA;
use App\Utils\Telegram;
use ArrayObject;
use CloudXNS\Api;
use App\Models\Disconnect;
use App\Models\UnblockIp;
use Exception;
@ -75,7 +74,7 @@ class Job
'mysqldump --opt --user=' . Config::get('db_username') . ' --password=' . Config::get('db_password') . ' --host=' . $db_address_array[0] . ' ' . (isset($db_address_array[1]) ? '-P ' . $db_address_array[1] : '') . ' -d ' . Config::get('db_database') . ' alive_ip ss_node_info ss_node_online_log user_traffic_log detect_log telegram_session >> /tmp/ssmodbackup/mod.sql',
$ret
);
if (Config::get('enable_radius') == 'true') {
if (Config::get('enable_radius') == true) {
$db_address_array = explode(':', Config::get('radius_db_host'));
system(
'mysqldump --user=' . Config::get('radius_db_user') . ' --password=' . Config::get('radius_db_password') . ' --host=' . $db_address_array[0] . ' ' . (isset($db_address_array[1]) ? '-P ' . $db_address_array[1] : '') . '' . Config::get('radius_db_database') . '> /tmp/ssmodbackup/radius.sql',
@ -101,7 +100,7 @@ class Job
system('rm -rf /tmp/ssmodbackup', $ret);
system('rm /tmp/ssmodbackup.zip', $ret);
if (Config::get('backup_notify') == 'true') {
if (Config::get('backup_notify') == true) {
Telegram::Send('备份完毕了喵~今天又是安全祥和的一天呢。');
}
}
@ -166,7 +165,7 @@ class Job
}
//auto reset
$boughts = Bought::all();
$boughts = Bought::where('renew', '<>', 0)->get();
$boughted_users = array();
foreach ($boughts as $bought) {
$user = User::where('id', $bought->userid)->first();
@ -446,12 +445,12 @@ class Job
$adminUser = User::where('is_admin', '=', '1')->get();
//节点掉线检测
if (Config::get('enable_detect_offline') == 'true') {
if (Config::get('enable_detect_offline') == true) {
$nodes = Node::all();
foreach ($nodes as $node) {
if ($node->isNodeOnline() === false && !file_exists(BASE_PATH . '/storage/' . $node->id . '.offline')) {
if (Config::get('useScFtqq') == 'true' && Config::get('enable_detect_offline_useScFtqq') == 'true') {
if (Config::get('useScFtqq') == true && Config::get('enable_detect_offline_useScFtqq') == true) {
$ScFtqq_SCKEY = Config::get('ScFtqq_SCKEY');
$text = '管理员您好,系统发现节点 ' . $node->name . ' 掉线了,请您及时处理。';
$postdata = http_build_query(
@ -481,71 +480,15 @@ class Job
Mail::send($to, $subject, 'news/warn.tpl', [
'user' => $user,
'text' => $text
], [
]);
} catch (Exception $e) {
echo $e->getMessage();
}
if (Config::get('enable_cloudxns') == 'true' && ($node->sort == 0 || $node->sort == 10 || $node->sort == 12 || $node->sort == 13)) {
$api = new Api();
$api->setApiKey(Config::get('cloudxns_apikey'));//修改成自己API KEY
$api->setSecretKey(Config::get('cloudxns_apisecret'));//修改成自己的SECERET KEY
$api->setProtocol(true);
$domain_json = json_decode($api->domain->domainList());
foreach ($domain_json->data as $domain) {
if (strpos($domain->domain, Config::get('cloudxns_domain')) !== false) {
$domain_id = $domain->id;
}
}
$record_json = json_decode($api->record->recordList($domain_id, 0, 0, 2000));
foreach ($record_json->data as $record) {
if (($record->host . '.' . Config::get('cloudxns_domain')) == $node->server) {
$record_id = $record->record_id;
$Temp_node = Node::where('node_class', '<=', $node->node_class)->where(
static function ($query) use ($node) {
$query->where('node_group', '=', $node->node_group)
->orWhere('node_group', '=', 0);
}
)->whereRaw('UNIX_TIMESTAMP()-`node_heartbeat`<300')->first();
if ($Temp_node != null) {
$api->record->recordUpdate(
$domain_id,
$record->host,
$Temp_node->server,
'CNAME',
55,
60,
1,
'',
$record_id
);
}
$notice_text = str_replace(
array('%node_name%', '%Temp_node_name%'),
array($node->name, $Temp_node->name),
Config::get('sendNodeOffline_Update_Msg')
);
}
}
} else {
$notice_text = str_replace(
'%node_name%',
$node->name,
Config::get('sendNodeOffline_Msg')
);
}
$notice_text = '喵喵喵~ ' . $node->name . ' 节点掉线了喵~';
}
if (Config::get('sendNodeOffline_Telegram') == 'true') {
if (Config::get('sendNodeOffline_Telegram') == true) {
Telegram::Send($notice_text);
}
@ -557,7 +500,7 @@ class Job
fwrite($myfile, $txt);
fclose($myfile);
} elseif ($node->isNodeOnline() === true && file_exists(BASE_PATH . '/storage/' . $node->id . '.offline')) {
if (Config::get('useScFtqq') == 'true' && Config::get('enable_detect_offline_useScFtqq') == 'true') {
if (Config::get('useScFtqq') == true && Config::get('enable_detect_offline_useScFtqq') == true) {
$ScFtqq_SCKEY = Config::get('ScFtqq_SCKEY');
$text = '管理员您好,系统发现节点 ' . $node->name . ' 恢复上线了。';
$postdata = http_build_query(
@ -587,61 +530,15 @@ class Job
Mail::send($to, $subject, 'news/warn.tpl', [
'user' => $user,
'text' => $text
], [
]);
} catch (Exception $e) {
echo $e->getMessage();
}
if (Config::get('enable_cloudxns') == 'true' && ($node->sort == 0 || $node->sort == 10 || $node->sort == 12 || $node->sort == 13)) {
$api = new Api();
$api->setApiKey(Config::get('cloudxns_apikey'));//修改成自己API KEY
$api->setSecretKey(Config::get('cloudxns_apisecret'));//修改成自己的SECERET KEY
$api->setProtocol(true);
$domain_json = json_decode($api->domain->domainList());
foreach ($domain_json->data as $domain) {
if (strpos($domain->domain, Config::get('cloudxns_domain')) !== false) {
$domain_id = $domain->id;
}
}
$record_json = json_decode($api->record->recordList($domain_id, 0, 0, 2000));
foreach ($record_json->data as $record) {
if (($record->host . '.' . Config::get('cloudxns_domain')) == $node->server) {
$record_id = $record->record_id;
$api->record->recordUpdate(
$domain_id,
$record->host,
$node->getNodeIp(),
'A',
55,
600,
1,
'',
$record_id
);
}
}
$notice_text = str_replace(
'%node_name%',
$node->name,
Config::get('sendNodeOnline_Update_Msg')
);
} else {
$notice_text = str_replace(
'%node_name%',
$node->name,
Config::get('sendNodeOnline_Msg')
);
}
$notice_text = '喵喵喵~ ' . $node->name . ' 节点恢复了喵~';
}
if (Config::get('sendNodeOnline_Telegram') == 'true') {
if (Config::get('sendNodeOnline_Telegram') == true) {
Telegram::Send($notice_text);
}
@ -652,7 +549,7 @@ class Job
//登录地检测
if (Config::get('login_warn') == 'true') {
if (Config::get('login_warn') == true) {
$iplocation = new QQWry();
$Logs = LoginIp::where('datetime', '>', time() - 60)->get();
foreach ($Logs as $log) {
@ -746,7 +643,7 @@ class Job
if (!file_exists(BASE_PATH . '/storage/traffic_notified/') && !mkdir($concurrentDirectory = BASE_PATH . '/storage/traffic_notified/') && !is_dir($concurrentDirectory)) {
throw new RuntimeException(sprintf('Directory "%s" was not created', $concurrentDirectory));
}
if (Config::get('notify_limit_mode') != 'false') {
if (Config::get('notify_limit_mode') != false) {
$user_traffic_left = $user->transfer_enable - $user->u - $user->d;
$under_limit = 'false';
@ -788,7 +685,9 @@ class Job
}
if (Config::get('account_expire_delete_days') >= 0 &&
strtotime($user->expire_in) + Config::get('account_expire_delete_days') * 86400 < time()
strtotime($user->expire_in) + Config::get('account_expire_delete_days') * 86400 < time() &&
$user->money <= Config::get('auto_clean_min_money')
) {
$subject = Config::get('appName') . '-您的用户账户已经被删除了';
$to = $user->email;
@ -962,58 +861,9 @@ class Job
} catch (Exception $e) {
echo $e->getMessage();
}
if (Config::get('enable_cloudxns') == 'true' && ($node->sort == 0 || $node->sort == 10 || $node->sort == 12 || $node->sort == 13)) {
$api = new Api();
$api->setApiKey(Config::get('cloudxns_apikey'));
//修改成自己API KEY
$api->setSecretKey(Config::get('cloudxns_apisecret'));
//修改成自己的SECERET KEY
$api->setProtocol(true);
$domain_json = json_decode($api->domain->domainList());
foreach ($domain_json->data as $domain) {
if (strpos($domain->domain, Config::get('cloudxns_domain')) !== false) {
$domain_id = $domain->id;
}
}
$record_json = json_decode($api->record->recordList($domain_id, 0, 0, 2000));
foreach ($record_json->data as $record) {
if (($record->host . '.' . Config::get('cloudxns_domain')) == $node->server) {
$record_id = $record->record_id;
$Temp_node = Node::where('node_class', '<=', $node->node_class)->where(
static function ($query) use ($node) {
$query->where('node_group', '=', $node->node_group)
->orWhere('node_group', '=', 0);
}
)->whereRaw('UNIX_TIMESTAMP()-`node_heartbeat`<300')->first();
if ($Temp_node != null) {
$api->record->recordUpdate(
$domain_id,
$record->host,
$Temp_node->server,
'CNAME',
55,
60,
1,
'',
$record_id
);
}
$notice_text = str_replace(
array('%node_name%', '%Temp_node_name%'),
array($node->name, $Temp_node->name),
Config::get('sendNodeGFW_Update_Msg')
);
}
}
} else {
$notice_text = str_replace(
'%node_name%',
$node->name,
Config::get('sendNodeGFW_Msg')
);
}
$notice_text = '喵喵喵~ ' . $node->name . ' 节点被墙了喵~';
}
if (Config::get('sendNodeGFW_Telegram') == 'true') {
if (Config::get('sendNodeGFW_Telegram') == true) {
Telegram::Send($notice_text);
}
$file_node = fopen(BASE_PATH . '/storage/' . $node->id . '.gfw', 'wb+');
@ -1038,50 +888,9 @@ class Job
} catch (Exception $e) {
echo $e->getMessage();
}
if (Config::get('enable_cloudxns') == 'true' && ($node->sort == 0 || $node->sort == 10 || $node->sort == 12 || $node->sort == 13)) {
$api = new Api();
$api->setApiKey(Config::get('cloudxns_apikey'));
//修改成自己API KEY
$api->setSecretKey(Config::get('cloudxns_apisecret'));
//修改成自己的SECERET KEY
$api->setProtocol(true);
$domain_json = json_decode($api->domain->domainList());
foreach ($domain_json->data as $domain) {
if (strpos($domain->domain, Config::get('cloudxns_domain')) !== false) {
$domain_id = $domain->id;
}
}
$record_json = json_decode($api->record->recordList($domain_id, 0, 0, 2000));
foreach ($record_json->data as $record) {
if (($record->host . '.' . Config::get('cloudxns_domain')) == $node->server) {
$record_id = $record->record_id;
$api->record->recordUpdate(
$domain_id,
$record->host,
$node->getNodeIp(),
'A',
55,
600,
1,
'',
$record_id
);
}
}
$notice_text = str_replace(
'%node_name%',
$node->name,
Config::get('sendNodeGFW_recover_Update_Msg')
);
} else {
$notice_text = str_replace(
'%node_name%',
$node->name,
Config::get('sendNodeGFW_recover_Msg')
);
}
$notice_text = '喵喵喵~ ' . $node->name . ' 节点恢复了喵~';
}
if (Config::get('sendNodeGFW_recover_Telegram') == 'true') {
if (Config::get('sendNodeGFW_recover_Telegram') == true) {
Telegram::Send($notice_text);
}
unlink(BASE_PATH . '/storage/' . $node->id . '.gfw');

@ -20,7 +20,7 @@ class SyncRadius
{
public static function synclogin()
{
if (Config::get('enable_radius') == 'false') {
if (Config::get('enable_radius') == false) {
return;
}
$tempuserbox = array();

@ -132,10 +132,5 @@ class Update
public static function old_to_new($version_old)
{
if ($version_old <= 0) {
echo('执行升级:0 -> 1');
$conn = mysqli_connect(Config::get('db_host'), Config::get('db_username'), Config::get('db_password'), Config::get('db_database'));
mysqli_query($conn, 'ALTER TABLE user ADD discord BIGINT NULL AFTER telegram_id');
}
}
}

@ -12,7 +12,6 @@ use App\Models\Relay;
use App\Services\Gateway\ChenPay;
use App\Utils\Hash;
use App\Utils\Tools;
use App\Utils\Discord;
use App\Services\Config;
use App\Utils\GA;
@ -41,8 +40,6 @@ class XCat
return $this->createAdmin();
case ('resetTraffic'):
return $this->resetTraffic();
case ('setDiscord'):
return Discord::set();
case ('setTelegram'):
return $this->setTelegram();
case ('initQQWry'):
@ -117,7 +114,6 @@ class XCat
echo(PHP_EOL . '用法: php xcat [选项]' . PHP_EOL);
echo('常用选项:' . PHP_EOL);
echo(' createAdmin - 创建管理员帐号' . PHP_EOL);
echo(' setDiscord - 设置 Discord 机器人' . PHP_EOL);
echo(' setTelegram - 设置 Telegram 机器人' . PHP_EOL);
echo(' cleanRelayRule - 清除所有中转规则' . PHP_EOL);
echo(' resetPort - 重置单个用户端口' . PHP_EOL);

@ -93,7 +93,7 @@ class NodeController extends AdminController
$node->save();
$domain_name = explode('.' . Config::get('cloudflare_name'), $node->server);
if (Config::get('cloudflare_enable') == 'true') {
if (Config::get('cloudflare_enable') == true) {
CloudflareDriver::updateRecord($domain_name[0], $node->node_ip);
}

@ -2,42 +2,58 @@
namespace App\Controllers\Admin;
use App\Models\User;
use App\Models\Ip;
use App\Controllers\AdminController;
use App\Models\Bought;
use App\Models\Ip;
use App\Models\Relay;
use App\Models\DetectBanLog;
use App\Controllers\AdminController;
use App\Services\Config;
use App\Models\User;
use App\Services\Auth;
use App\Services\Config;
use App\Services\Mail;
use App\Utils;
use App\Utils\GA;
use App\Utils\Hash;
use App\Utils\Radius;
use App\Utils\QQWry;
use App\Utils\Check;
use App\Utils\Radius;
use App\Utils\Tools;
use App\Utils\GA;
use Exception;
class UserController extends AdminController
{
public function index($request, $response, $args)
{
$table_config['total_column'] = array('op' => '操作', 'id' => 'ID', 'user_name' => '用户名',
'remark' => '备注', 'email' => '邮箱', 'money' => '金钱',
'im_type' => '联络方式类型', 'im_value' => '联络方式详情',
'node_group' => '群组', 'expire_in' => '账户过期时间',
'class' => '等级', 'class_expire' => '等级过期时间',
'passwd' => '连接密码', 'port' => '连接端口', 'method' => '加密方式',
'protocol' => '连接协议', 'obfs' => '连接混淆方式',
'online_ip_count' => '在线IP数', 'last_ss_time' => '上次使用时间',
'used_traffic' => '已用流量/GB', 'enable_traffic' => '总流量/GB',
'last_checkin_time' => '上次签到时间', 'today_traffic' => '今日流量/MB',
'enable' => '是否启用', 'reg_date' => '注册时间',
'reg_ip' => '注册IP', 'auto_reset_day' => '自动重置流量日',
'auto_reset_bandwidth' => '自动重置流量/GB', 'ref_by' => '邀请人ID', 'ref_by_user_name' => '邀请人用户名',
$table_config['total_column'] = array(
'op' => '操作',
'id' => 'ID',
'user_name' => '用户名',
'remark' => '备注',
'email' => '邮箱',
'money' => '金钱',
'im_type' => '联络方式类型',
'im_value' => '联络方式详情',
'node_group' => '群组',
'expire_in' => '账户过期时间',
'class' => '等级',
'class_expire' => '等级过期时间',
'passwd' => '连接密码',
'port' => '连接端口',
'method' => '加密方式',
'protocol' => '连接协议',
'obfs' => '混淆方式',
'obfs_param' => '混淆参数',
'online_ip_count' => '在线IP数',
'last_ss_time' => '上次使用时间',
'used_traffic' => '已用流量/GB',
'enable_traffic' => '总流量/GB',
'last_checkin_time' => '上次签到时间',
'today_traffic' => '今日流量/MB',
'enable' => '是否启用',
'reg_date' => '注册时间',
'reg_ip' => '注册IP',
'auto_reset_day' => '自动重置流量日',
'auto_reset_bandwidth' => '自动重置流量/GB',
'ref_by' => '邀请人ID',
'ref_by_user_name' => '邀请人用户名',
'top_up' => '累计充值');
$table_config['default_show_column'] = array('op', 'id', 'user_name', 'remark', 'email');
$table_config['ajax_url'] = 'user/ajax';
@ -116,7 +132,7 @@ class UserController extends AdminController
$text = '您好,管理员已经为您生成账户,用户名: ' . $email . ',登录密码为:' . $pass . ',感谢您的支持。 ';
try {
Mail::send($to, $subject, 'newuser.tpl', [
'user' => $user, 'text' => $text
'user' => $user, 'text' => $text,
], [
]);
} catch (Exception $e) {
@ -177,7 +193,6 @@ class UserController extends AdminController
return $response->getBody()->write(json_encode($result));
}
public function search($request, $response, $args)
{
$pageNum = 1;
@ -189,11 +204,9 @@ class UserController extends AdminController
$users = User::where('email', 'LIKE', '%' . $text . '%')->orWhere('user_name', 'LIKE', '%' . $text . '%')->orWhere('im_value', 'LIKE', '%' . $text . '%')->orWhere('port', 'LIKE', '%' . $text . '%')->orWhere('remark', 'LIKE', '%' . $text . '%')->paginate(20, ['*'], 'page', $pageNum);
$users->setPath('/admin/user/search/' . $text);
//Ip::where("datetime","<",time()-90)->get()->delete();
$total = Ip::where('datetime', '>=', time() - 90)->orderBy('userid', 'desc')->get();
$userip = array();
$useripcount = array();
$regloc = array();
@ -207,7 +220,6 @@ class UserController extends AdminController
$regloc[$user->id] = iconv('gbk', 'utf-8//IGNORE', $location['country'] . $location['area']);
}
foreach ($total as $single) {
if (isset($useripcount[$single->userid]) && !isset($userip[$single->userid][$single->ip])) {
++$useripcount[$single->userid];
@ -216,7 +228,6 @@ class UserController extends AdminController
}
}
return $this->view()->assign('users', $users)->assign('regloc', $regloc)->assign('useripcount', $useripcount)->assign('userip', $userip)->display('admin/user/index.tpl');
}
@ -229,14 +240,11 @@ class UserController extends AdminController
$pageNum = $request->getQueryParams()['page'];
}
$users->setPath('/admin/user/sort/' . $text . '/' . $asc);
//Ip::where("datetime","<",time()-90)->get()->delete();
$total = Ip::where('datetime', '>=', time() - 90)->orderBy('userid', 'desc')->get();
$userip = array();
$useripcount = array();
$regloc = array();
@ -250,7 +258,6 @@ class UserController extends AdminController
$regloc[$user->id] = iconv('gbk', 'utf-8//IGNORE', $location['country'] . $location['area']);
}
foreach ($total as $single) {
if (isset($useripcount[$single->userid]) && !isset($userip[$single->userid][$single->ip])) {
++$useripcount[$single->userid];
@ -259,11 +266,9 @@ class UserController extends AdminController
}
}
return $this->view()->assign('users', $users)->assign('regloc', $regloc)->assign('useripcount', $useripcount)->assign('userip', $userip)->display('admin/user/index.tpl');
}
public function edit($request, $response, $args)
{
$id = $args['id'];
@ -286,7 +291,6 @@ class UserController extends AdminController
Radius::ChangeUserName($email1, $email2, $passwd);
if ($request->getParam('pass') != '') {
$user->pass = Hash::passwordHash($request->getParam('pass'));
$user->clean_link();
@ -328,33 +332,6 @@ class UserController extends AdminController
$user->forbidden_ip = str_replace(PHP_EOL, ',', $request->getParam('forbidden_ip'));
$user->forbidden_port = str_replace(PHP_EOL, ',', $request->getParam('forbidden_port'));
$detect_ban = (int)$request->getParam('detect_ban');
// 手动解封
if ($user->detect_ban == 1 && $detect_ban == 0) {
$user->detect_ban = 0;
}
// 手动封禁
if ($user->detect_ban == 0 && $detect_ban == 1) {
if ((int)$request->getParam('ban_time') == 0) {
$rs['ret'] = 0;
$rs['msg'] = "修改失败,封禁时长不能为 0";
return $response->getBody()->write(json_encode($rs));
}
$user->detect_ban = 1;
$end_time = date('Y-m-d H:i:s');
$user->last_detect_ban_time = $end_time;
$DetectBanLog = new DetectBanLog();
$DetectBanLog->user_name = $user->user_name;
$DetectBanLog->user_id = $user->id;
$DetectBanLog->email = $user->email;
$DetectBanLog->detect_number = '0';
$DetectBanLog->ban_time = (int)$request->getParam('ban_time');
$DetectBanLog->start_time = strtotime('1989-06-04 00:05:00');
$DetectBanLog->end_time = strtotime($end_time);
$DetectBanLog->all_detect_number = $user->all_detect_number;
$DetectBanLog->save();
}
if (!$user->save()) {
$rs['ret'] = 0;
$rs['msg'] = '修改失败';
@ -407,7 +384,7 @@ class UserController extends AdminController
'old_key' => Utils\Cookie::get('key'),
'old_ip' => Utils\Cookie::get('ip'),
'old_expire_in' => Utils\Cookie::get('expire_in'),
'old_local' => $request->getParam('local')
'old_local' => $request->getParam('local'),
], $expire_in);
$rs['ret'] = 1;
$rs['msg'] = '切换成功';
@ -540,6 +517,7 @@ class UserController extends AdminController
$tempdata['method'] = $user->method;
$tempdata['protocol'] = $user->protocol;
$tempdata['obfs'] = $user->obfs;
$tempdata['obfs_param'] = $user->obfs_param;
$tempdata['online_ip_count'] = $user->online_ip_count();
$tempdata['last_ss_time'] = $user->lastSsTime();
$tempdata['used_traffic'] = Tools::flowToGB($user->u + $user->d);

@ -1,162 +0,0 @@
<?php
namespace App\Controllers;
use App\Models\Node;
use App\Models\User;
use App\Services\Factory;
use App\Services\Config;
use App\Utils\Tools;
use App\Utils\Hash;
use App\Utils\Helper;
/**
* ApiController
*/
class ApiController extends BaseController
{
public function index()
{
}
public function token($request, $response, $args)
{
$accessToken = $id = $args['token'];
$storage = Factory::createTokenStorage();
$token = $storage->get($accessToken);
if ($token == null) {
$res['ret'] = 0;
$res['msg'] = 'token is null';
return $this->echoJson($response, $res);
}
$res['ret'] = 1;
$res['msg'] = 'ok';
$res['data'] = $token;
return $this->echoJson($response, $res);
}
public function newToken($request, $response, $args)
{
// $data = $request->post('sdf');
$email = $request->getParam('email');
$email = strtolower($email);
$passwd = $request->getParam('passwd');
// Handle Login
$user = User::where('email', '=', $email)->first();
if ($user == null) {
$res['ret'] = 0;
$res['msg'] = '401 邮箱或者密码错误';
return $this->echoJson($response, $res);
}
if (!Hash::checkPassword($user->pass, $passwd)) {
$res['ret'] = 0;
$res['msg'] = '402 邮箱或者密码错误';
return $this->echoJson($response, $res);
}
$tokenStr = Tools::genToken();
$storage = Factory::createTokenStorage();
$expireTime = time() + 3600 * 24 * 7;
if ($storage->store($tokenStr, $user, $expireTime)) {
$res['ret'] = 1;
$res['msg'] = 'ok';
$res['data']['token'] = $tokenStr;
$res['data']['user_id'] = $user->id;
return $this->echoJson($response, $res);
}
$res['ret'] = 0;
$res['msg'] = 'system error';
return $this->echoJson($response, $res);
}
public function node($request, $response, $args)
{
$accessToken = Helper::getParam($request, 'access_token');
$storage = Factory::createTokenStorage();
$token = $storage->get($accessToken);
$user = User::find($token->userId);
$nodes = Node::where('sort', 0)->where('type', '1')->where(
static function ($query) use ($user) {
$query->where('node_group', '=', $user->node_group)
->orWhere('node_group', '=', 0);
}
)->orderBy('name')->get();
$mu_nodes = Node::where('sort', 9)->where('node_class', '<=', $user->class)->where('type', '1')->where(
static function ($query) use ($user) {
$query->where('node_group', '=', $user->node_group)
->orWhere('node_group', '=', 0);
}
)->orderBy('name')->get();
$temparray = array();
foreach ($nodes as $node) {
if ($node->mu_only == 0) {
$temparray[] = array('remarks' => $node->name,
'server' => $node->server,
'server_port' => $user->port,
'method' => $node->custom_method == 1 ? $user->method : $node->method,
'obfs' => str_replace('_compatible', '', (($node->custom_rss == 1 && !($user->obfs == 'plain' && $user->protocol == 'origin')) ? $user->obfs : 'plain')),
'obfsparam' => ($node->custom_rss == 1 && !($user->obfs == 'plain' && $user->protocol == 'origin')) ? $user->obfs_param : '',
'remarks_base64' => base64_encode($node->name),
'password' => $user->passwd,
'tcp_over_udp' => false,
'udp_over_tcp' => false,
'group' => Config::get('appName'),
'protocol' => str_replace('_compatible', '', (($node->custom_rss == 1 && !($user->obfs == 'plain' && $user->protocol == 'origin')) ? $user->protocol : 'origin')),
'obfs_udp' => false,
'enable' => true);
}
if ($node->custom_rss == 1) {
foreach ($mu_nodes as $mu_node) {
$mu_user = User::where('port', '=', $mu_node->server)->first();
$mu_user->obfs_param = $user->getMuMd5();
$temparray[] = array('remarks' => $node->name . '- ' . $mu_node->server . ' 单端口',
'server' => $node->server,
'server_port' => $mu_user->port,
'method' => $mu_user->method,
'group' => Config::get('appName'),
'obfs' => str_replace('_compatible', '', (($node->custom_rss == 1 && !($mu_user->obfs == 'plain' && $mu_user->protocol == 'origin')) ? $mu_user->obfs : 'plain')),
'obfsparam' => ($node->custom_rss == 1 && !($mu_user->obfs == 'plain' && $mu_user->protocol == 'origin')) ? $mu_user->obfs_param : '',
'remarks_base64' => base64_encode($node->name . '- ' . $mu_node->server . ' 单端口'),
'password' => $mu_user->passwd,
'tcp_over_udp' => false,
'udp_over_tcp' => false,
'protocol' => str_replace('_compatible', '', (($node->custom_rss == 1 && !($mu_user->obfs == 'plain' && $mu_user->protocol == 'origin')) ? $mu_user->protocol : 'origin')),
'obfs_udp' => false,
'enable' => true);
}
}
}
$res['ret'] = 1;
$res['msg'] = 'ok';
$res['data'] = $temparray;
return $this->echoJson($response, $res);
}
public function userInfo($request, $response, $args)
{
$id = $args['id'];
$accessToken = Helper::getParam($request, 'access_token');
$storage = Factory::createTokenStorage();
$token = $storage->get($accessToken);
if ($id != $token->userId) {
$res['ret'] = 0;
$res['msg'] = 'access denied';
return $this->echoJson($response, $res);
}
$user = User::find($token->userId);
$user->pass = null;
$data = $user;
$res['ret'] = 1;
$res['msg'] = 'ok';
$res['data'] = $data;
return $this->echoJson($response, $res);
}
}

@ -29,7 +29,7 @@ class AuthController extends BaseController
{
$GtSdk = null;
$recaptcha_sitekey = null;
if (Config::get('enable_login_captcha') === 'true') {
if (Config::get('enable_login_captcha') === true) {
switch (Config::get('captcha_provider')) {
case 'recaptcha':
$recaptcha_sitekey = Config::get('recaptcha_sitekey');
@ -41,7 +41,7 @@ class AuthController extends BaseController
}
}
if (Config::get('enable_telegram') === 'true') {
if (Config::get('enable_telegram') === true) {
$login_text = TelegramSessionManager::add_login_session();
$login = explode('|', $login_text);
$login_token = $login[0];
@ -93,7 +93,7 @@ class AuthController extends BaseController
$code = $request->getParam('code');
$rememberMe = $request->getParam('remember_me');
if (Config::get('enable_login_captcha') === 'true') {
if (Config::get('enable_login_captcha') === true) {
switch (Config::get('captcha_provider')) {
case 'recaptcha':
$recaptcha = $request->getParam('recaptcha');
@ -218,7 +218,7 @@ class AuthController extends BaseController
$GtSdk = null;
$recaptcha_sitekey = null;
if (Config::get('enable_reg_captcha') === 'true') {
if (Config::get('enable_reg_captcha') === true) {
switch (Config::get('captcha_provider')) {
case 'recaptcha':
$recaptcha_sitekey = Config::get('recaptcha_sitekey');
@ -242,7 +242,7 @@ class AuthController extends BaseController
public function sendVerify($request, $response, $next)
{
if (Config::get('enable_email_verify') === 'true') {
if (Config::get('enable_email_verify') == true) {
$email = $request->getParam('email');
$email = trim($email);
@ -335,7 +335,7 @@ class AuthController extends BaseController
// check code
if (Config::get('enable_reg_captcha') === 'true') {
if (Config::get('enable_reg_captcha') === true) {
switch (Config::get('captcha_provider')) {
case 'recaptcha':
$recaptcha = $request->getParam('recaptcha');
@ -402,7 +402,7 @@ class AuthController extends BaseController
return $response->getBody()->write(json_encode($res));
}
if (Config::get('enable_email_verify') === 'true') {
if (Config::get('enable_email_verify') == true) {
$mailcount = EmailVerify::where('email', '=', $email)->where('code', '=', $emailcode)->where('expire_in', '>', time())->first();
if ($mailcount == null) {
$res['ret'] = 0;
@ -437,7 +437,7 @@ class AuthController extends BaseController
$res['msg'] = '此联络方式已注册';
return $response->getBody()->write(json_encode($res));
}
if (Config::get('enable_email_verify') === 'true') {
if (Config::get('enable_email_verify') == true) {
EmailVerify::where('email', '=', $email)->delete();
}
// do reg user
@ -530,7 +530,7 @@ class AuthController extends BaseController
return $response->getBody()->write(json_encode($res));
}
if (Config::get('enable_telegram') === 'true') {
if (Config::get('enable_telegram') === true) {
$ret = TelegramSessionManager::check_login_session($token, $number);
$res['ret'] = $ret;
return $response->getBody()->write(json_encode($res));
@ -542,7 +542,7 @@ class AuthController extends BaseController
public function telegram_oauth($request, $response, $args)
{
if (Config::get('enable_telegram') === 'true') {
if (Config::get('enable_telegram') === true) {
$auth_data = $request->getQueryParams();
if ($this->telegram_oauth_check($auth_data) === true) { // Looks good, proceed.
$telegram_id = $auth_data['id'];

@ -5,6 +5,8 @@ namespace App\Controllers;
use App\Models\User;
use App\Services\View;
use App\Services\Auth;
use Slim\Http\Response;
use Psr\Http\Message\ResponseInterface;
use Smarty;
/**
@ -40,13 +42,18 @@ class BaseController
{
return $this->view;
}
// TODO: remove
/**
* @param $response
* @param $res
* @return mixed
* Output JSON
*
* @param Response $response
* @param array|object $resource
*
* @return ResponseInterface
*/
public function echoJson($response, $res)
public function echoJson(Response $response, $resource)
{
return $response->getBody()->write(json_encode($res));
return $response->withJson($resource);
}
}

@ -8,16 +8,22 @@ use App\Services\Config;
use App\Utils\AliPay;
use App\Utils\TelegramSessionManager;
use App\Utils\TelegramProcess;
use App\Utils\Spay_tool;
use App\Utils\Geetest;
use App\Utils\Tools;
use Slim\Http\{Request, Response};
use Psr\Http\Message\ResponseInterface;
/**
* HomeController
*/
class HomeController extends BaseController
{
public function index()
/**
* @param Request $request
* @param Response $response
* @param array $args
*/
public function index($request, $response, $args): ResponseInterface
{
$GtSdk = null;
$recaptcha_sitekey = null;
@ -33,7 +39,7 @@ class HomeController extends BaseController
}
}
if (Config::get('enable_telegram') == 'true') {
if (Config::get('enable_telegram')) {
$login_text = TelegramSessionManager::add_login_session();
$login = explode('|', $login_text);
$login_token = $login[0];
@ -43,10 +49,11 @@ class HomeController extends BaseController
$login_number = '';
}
if (Config::get('newIndex') != 'true' && Config::get('theme') == 'material') {
return $this->view()->display('indexold.tpl');
if ( !Config::get('newIndex') && Config::get('theme') == 'material') {
return $response->write($this->view()->display('indexold.tpl'));
} else {
return $this->view()
return $response->write($this->view()
->assign('geetest_html', $GtSdk)
->assign('login_token', $login_token)
->assign('login_number', $login_number)
@ -55,72 +62,123 @@ class HomeController extends BaseController
->assign('enable_regcaptcha', Config::get('enable_reg_captcha'))
->assign('base_url', Config::get('baseUrl'))
->assign('recaptcha_sitekey', $recaptcha_sitekey)
->display('index.tpl');
->fetch('index.tpl'));
}
}
public function indexold()
/**
* @param Request $request
* @param Response $response
* @param array $args
*/
public function indexold($request, $response, $args): ResponseInterface
{
return $this->view()->display('indexold.tpl');
return $response->write($this->view()->fetch('indexold.tpl'));
}
public function code()
/**
* @param Request $request
* @param Response $response
* @param array $args
*/
public function code($request, $response, $args): ResponseInterface
{
$codes = InviteCode::where('user_id', '=', '0')->take(10)->get();
return $this->view()->assign('codes', $codes)->display('code.tpl');
return $response->write($this->view()->assign('codes', $codes)->fetch('code.tpl'));
}
public function down()
{ }
public function tos()
/**
* @param Request $request
* @param Response $response
* @param array $args
*/
public function tos($request, $response, $args): ResponseInterface
{
return $this->view()->display('tos.tpl');
return $response->write($this->view()->fetch('tos.tpl'));
}
public function staff()
/**
* @param Request $request
* @param Response $response
* @param array $args
*/
public function staff($request, $response, $args): ResponseInterface
{
return $this->view()->display('staff.tpl');
return $response->write($this->view()->fetch('staff.tpl'));
}
public function telegram($request, $response, $args)
/**
* @param Request $request
* @param Response $response
* @param array $args
*/
public function telegram($request, $response, $args): ResponseInterface
{
$token = $request->getQueryParams()['token'] ?? '';
$token = $request->getQueryParam('token');
if ($token == Config::get('telegram_request_token')) {
TelegramProcess::process();
$result = '1';
} else {
echo ('不正确请求!');
$result = '0';
}
return $response->write($result);
}
public function page404($request, $response, $args)
/**
* @param Request $request
* @param Response $response
* @param array $args
*/
public function page404($request, $response, $args): ResponseInterface
{
return $this->view()->display('404.tpl');
return $response->write($this->view()->fetch('404.tpl'));
}
public function page405($request, $response, $args)
/**
* @param Request $request
* @param Response $response
* @param array $args
*/
public function page405($request, $response, $args): ResponseInterface
{
return $this->view()->display('405.tpl');
return $response->write($this->view()->fetch('405.tpl'));
}
public function page500($request, $response, $args)
/**
* @param Request $request
* @param Response $response
* @param array $args
*/
public function page500($request, $response, $args): ResponseInterface
{
return $this->view()->display('500.tpl');
return $response->write($this->view()->fetch('500.tpl'));
}
public function getOrderList($request, $response, $args)
/**
* @param Request $request
* @param Response $response
* @param array $args
*/
public function getOrderList($request, $response, $args): ResponseInterface
{
$key = $request->getParam('key');
if (!$key || $key != Config::get('key')) {
$res['ret'] = 0;
$res['msg'] = '错误';
return $response->getBody()->write(json_encode($res));
return $response->write(json_encode($res));
}
return $response->getBody()->write(json_encode(['data' => AliPay::getList()]));
return $response->write(json_encode(['data' => AliPay::getList()]));
}
public function setOrder($request, $response, $args)
/**
* @param Request $request
* @param Response $response
* @param array $args
*/
public function setOrder($request, $response, $args): ResponseInterface
{
$key = $request->getParam('key');
$sn = $request->getParam('sn');
@ -128,23 +186,23 @@ class HomeController extends BaseController
if (!$key || $key != Config::get('key')) {
$res['ret'] = 0;
$res['msg'] = '错误';
return $response->getBody()->write(json_encode($res));
return $response->write(json_encode($res));
}
return $response->getBody()->write(json_encode(['res' => AliPay::setOrder($sn, $url)]));
return $response->write(json_encode(['res' => AliPay::setOrder($sn, $url)]));
}
public function getDocCenter($request, $response, $args)
{
$user = Auth::getUser();
if (!$user->isLogin && Config::get('enable_documents') != 'true') {
if (!$user->isLogin && !Config::get('enable_documents')) {
$newResponse = $response->withStatus(302)->withHeader('Location', '/');
return $newResponse;
return $response->write($newResponse);
}
$basePath = Config::get('remote_documents') == 'true' ? Config::get('documents_source') : '/docs/GeekQu';
return $this->view()
return $response->write($this->view()
->assign('appName', Config::get('documents_name'))
->assign('basePath', $basePath)
->display('doc/index.tpl');
->display('doc/index.tpl'));
}
public function getSubLink($request, $response, $args)
@ -254,6 +312,6 @@ class HomeController extends BaseController
break;
}
}
return implode(PHP_EOL, $msg);
return $response(implode(PHP_EOL, $msg));
}
}

@ -1,57 +0,0 @@
<?php
namespace App\Controllers\Mu;
use App\Controllers\BaseController;
use App\Models\NodeOnlineLog;
use App\Models\NodeInfoLog;
class NodeController extends BaseController
{
public function onlineUserLog($request, $response, $args)
{
$node_id = $args['id'];
$count = $request->getParam('count');
$log = new NodeOnlineLog();
$log->node_id = $node_id;
$log->online_user = $count;
$log->log_time = time();
if (!$log->save()) {
$res = [
'ret' => 0,
'msg' => 'update failed',
];
return $this->echoJson($response, $res);
}
$res = [
'ret' => 1,
'msg' => 'ok',
];
return $this->echoJson($response, $res);
}
public function info($request, $response, $args)
{
$node_id = $args['id'];
$load = $request->getParam('load');
$uptime = $request->getParam('uptime');
$log = new NodeInfoLog();
$log->node_id = $node_id;
$log->load = $load;
$log->uptime = $uptime;
$log->log_time = time();
if (!$log->save()) {
$res = [
'ret' => 0,
'msg' => 'update failed',
];
return $this->echoJson($response, $res);
}
$res = [
'ret' => 1,
'msg' => 'ok',
];
return $this->echoJson($response, $res);
}
}

@ -1,122 +0,0 @@
<?php
namespace App\Controllers\Mu;
use App\Models\Node;
use App\Models\TrafficLog;
use App\Models\User;
use App\Controllers\BaseController;
use App\Utils\Tools;
class UserController extends BaseController
{
// User List
public function index($request, $response, $args)
{
$node = Node::where('node_ip', '=', $_SERVER['REMOTE_ADDR'])->where(
static function ($query) {
$query->where('sort', '=', 0)
->orWhere('sort', '=', 10)->orWhere('sort', '=', 12);
}
)->first();
$node->node_heartbeat = time();
$node->save();
if ($node->node_group != 0) {
$users_raw = User::where(
static function ($query) use ($node) {
$query->where(
static function ($query1) use ($node) {
$query1->where('class', '>=', $node->node_class)
->where('node_group', '=', $node->node_group);
}
)->orwhere('is_admin', 1);
}
)
->where('enable', 1)->where('expire_in', '>', date('Y-m-d H:i:s'))->get();
} else {
$users_raw = User::where(
static function ($query) use ($node) {
$query->where(
static function ($query1) use ($node) {
$query1->where('class', '>=', $node->node_class);
}
)->orwhere('is_admin', 1);
}
)->where('enable', 1)->where('expire_in', '>', date('Y-m-d H:i:s'))->get();
}
if (($node->node_bandwidth_limit != 0) && $node->node_bandwidth_limit < $node->node_bandwidth) {
$users = null;
$res = [
'ret' => 1,
'data' => $users
];
return $this->echoJson($response, $res);
}
$key_list = array('method', 'id', 'port', 'passwd', 'u', 'd', 'enable',
't', 'transfer_enable', 'switch', 'email');
$users_output = array();
foreach ($users_raw as $user_raw) {
if ($user_raw->transfer_enable > $user_raw->u + $user_raw->d) {
$user_raw = Tools::keyFilter($user_raw, $key_list);
$users_output[] = $user_raw;
}
}
$res = [
'ret' => 1,
'msg' => 'ok',
'data' => $users_output
];
return $this->echoJson($response, $res);
}
// Update Traffic
public function addTraffic($request, $response, $args)
{
$id = $args['id'];
$u = $request->getParam('u');
$d = $request->getParam('d');
$nodeId = $request->getParam('node_id');
$node = Node::find($nodeId);
$node->node_bandwidth = $node->node_bandwidth + $d + $u;
$node->save();
$rate = $node->traffic_rate;
$user = User::find($id);
$user->t = time();
$user->u += ($u * $rate);
$user->d += ($d * $rate);
if (!$user->save()) {
$res = [
'ret' => 0,
'msg' => 'update failed',
];
//return $this->echoJson($response, $res);
}
// log
$traffic = new TrafficLog();
$traffic->user_id = $id;
$traffic->u = $u;
$traffic->d = $d;
$traffic->node_id = $nodeId;
$traffic->rate = $rate;
$traffic->traffic = Tools::flowAutoShow(($u + $d) * $rate);
$traffic->log_time = time();
$traffic->save();
$res = [
'ret' => 1,
'msg' => 'ok',
];
return $this->echoJson($response, $res);
}
}

@ -59,7 +59,7 @@ class UserController extends BaseController
$GtSdk = null;
$recaptcha_sitekey = null;
if (Config::get('enable_checkin_captcha') == 'true') {
if (Config::get('enable_checkin_captcha') == true) {
switch (Config::get('captcha_provider')) {
case 'recaptcha':
$recaptcha_sitekey = Config::get('recaptcha_sitekey');
@ -73,6 +73,7 @@ class UserController extends BaseController
$Ann = Ann::orderBy('date', 'desc')->first();
return $this->view()
->assign('subInfo', LinkController::getSubinfo($this->user, 0))
->assign('ssr_sub_token', $ssr_sub_token)
@ -113,7 +114,7 @@ class UserController extends BaseController
public function donate($request, $response, $args)
{
if (Config::get('enable_donate') != 'true') {
if (Config::get('enable_donate') != true) {
exit(0);
}
@ -269,7 +270,7 @@ class UserController extends BaseController
$res['ret'] = 1;
$res['msg'] = '充值成功,充值的金额为' . $codeq->number . '元。';
if (Config::get('enable_donate') == 'true') {
if (Config::get('enable_donate') == true) {
if ($this->user->is_hide == 1) {
Telegram::Send('姐姐姐姐,一位不愿透露姓名的大老爷给我们捐了 ' . $codeq->number . ' 元呢~');
} else {
@ -659,7 +660,7 @@ class UserController extends BaseController
$node_prefix[$name_cheif][] = $node;
if (Config::get('enable_flag') == 'true') {
if (Config::get('enable_flag') == true) {
$regex = Config::get('flag_regex');
$matches = array();
preg_match($regex, $name_cheif, $matches);
@ -1196,7 +1197,7 @@ class UserController extends BaseController
public function ticket($request, $response, $args)
{
if (Config::get('enable_ticket') != 'true') {
if (Config::get('enable_ticket') != true) {
exit(0);
}
$pageNum = $request->getQueryParams()['page'] ?? 1;
@ -1239,7 +1240,7 @@ class UserController extends BaseController
$ticket->datetime = time();
$ticket->save();
if (Config::get('mail_ticket') == 'true' && $markdown != '') {
if (Config::get('mail_ticket') == true && $markdown != '') {
$adminUser = User::where('is_admin', '=', '1')->get();
foreach ($adminUser as $user) {
$subject = Config::get('appName') . '-新工单被开启';
@ -1255,7 +1256,7 @@ class UserController extends BaseController
}
}
if (Config::get('useScFtqq') == 'true' && $markdown != '') {
if (Config::get('useScFtqq') == true && $markdown != '') {
$ScFtqq_SCKEY = Config::get('ScFtqq_SCKEY');
$postdata = http_build_query(
array(
@ -1305,7 +1306,7 @@ class UserController extends BaseController
}
if ($status == 1 && $ticket_main->status != $status) {
if (Config::get('mail_ticket') == 'true' && $markdown != '') {
if (Config::get('mail_ticket') == true && $markdown != '') {
$adminUser = User::where('is_admin', '=', '1')->get();
foreach ($adminUser as $user) {
$subject = Config::get('appName') . '-工单被重新开启';
@ -1320,7 +1321,7 @@ class UserController extends BaseController
}
}
}
if (Config::get('useScFtqq') == 'true' && $markdown != '') {
if (Config::get('useScFtqq') == true && $markdown != '') {
$ScFtqq_SCKEY = Config::get('ScFtqq_SCKEY');
$postdata = http_build_query(
array(
@ -1339,7 +1340,7 @@ class UserController extends BaseController
$useScFtqq = Config::get('ScFtqq_SCKEY');
}
} else {
if (Config::get('mail_ticket') == 'true' && $markdown != '') {
if (Config::get('mail_ticket') == true && $markdown != '') {
$adminUser = User::where('is_admin', '=', '1')->get();
foreach ($adminUser as $user) {
$subject = Config::get('appName') . '-工单被回复';
@ -1354,7 +1355,7 @@ class UserController extends BaseController
}
}
}
if (Config::get('useScFtqq') == 'true' && $markdown != '') {
if (Config::get('useScFtqq') == true && $markdown != '') {
$ScFtqq_SCKEY = Config::get('ScFtqq_SCKEY');
$postdata = http_build_query(
array(
@ -1426,12 +1427,6 @@ class UserController extends BaseController
return $response->getBody()->write(json_encode($res));
}
if ($user->discord != 0) {
$res['ret'] = 0;
$res['msg'] = '您绑定了 Discord ,所以此项并不能被修改。';
return $response->getBody()->write(json_encode($res));
}
if ($wechat == '' || $type == '') {
$res['ret'] = 0;
$res['msg'] = '非法输入';
@ -1671,7 +1666,7 @@ class UserController extends BaseController
public function doCheckIn($request, $response, $args)
{
if (Config::get('enable_checkin_captcha') == 'true') {
if (Config::get('enable_checkin_captcha') == true) {
switch (Config::get('captcha_provider')) {
case 'recaptcha':
$recaptcha = $request->getParam('recaptcha');
@ -1740,7 +1735,7 @@ class UserController extends BaseController
return $this->echoJson($response, $res);
}
if (Config::get('enable_kill') == 'true') {
if (Config::get('enable_kill') == true) {
Auth::logout();
$user->kill_user();
$res['ret'] = 1;
@ -1780,14 +1775,6 @@ class UserController extends BaseController
return $this->view()->display('user/disable.tpl');
}
public function discord_reset($request, $response, $args)
{
$user = $this->user;
$user->discord = 0;
$user->save();
return $response->withStatus(302)->withHeader('Location', '/user/edit');
}
public function telegram_reset($request, $response, $args)
{
$user = $this->user;

@ -10,15 +10,15 @@ use App\Models\Ann;
use App\Models\Shop;
use App\Services\Auth;
use App\Services\Config;
use App\Utils\AliPay;
use App\Utils\Tools;
use App\Utils\TelegramSessionManager;
use App\Utils\Spay_tool;
use App\Utils\Geetest;
use App\Utils\URL;
use App\Models\Node;
use App\Models\Relay;
use Slim\Http\{Request, Response};
use Psr\Http\Message\ResponseInterface;
class VueController extends BaseController
{
@ -39,7 +39,7 @@ class VueController extends BaseController
}
}
if (Config::get('enable_telegram') == 'true') {
if (Config::get('enable_telegram') == true) {
$login_text = TelegramSessionManager::add_login_session();
$login = explode('|', $login_text);
$login_token = $login[0];
@ -68,6 +68,7 @@ class VueController extends BaseController
'isLogin' => $user->isLogin,
'enable_telegram' => Config::get('enable_telegram'),
'enable_mylivechat' => Config::get('enable_mylivechat'),
'enable_flag' => Config::get('enable_flag'),
'payment_type' => Config::get('payment_system'),
);
@ -437,4 +438,126 @@ class VueController extends BaseController
return $response->getBody()->write(json_encode($res));
}
/**
* @param Request $requesr
* @param Response $response
* @param array $args
*/
public function getNodeInfo($request, $response, $args): ResponseInterface
{
$user = $this->user;
$id = $args['id'];
$mu = $request->getQueryParam('ismu');
$relay_rule_id = $request->getQueryParam('relay_rule');
$node = Node::find($id);
if ($node == null) {
return $response->withJson([null]);
}
switch ($node->sort) {
case 0:
if ((($user->class >= $node->node_class
&& ($user->node_group == $node->node_group || $node->node_group == 0)) || $user->is_admin)
&& ($node->node_bandwidth_limit == 0 || $node->node_bandwidth < $node->node_bandwidth_limit)
) {
return $response->withJson([
'ret' => 1,
'nodeInfo' => [
'node' => $node,
'user' => $user,
'mu' => $mu,
'relay_rule_id' => $relay_rule_id,
'URL' => URL::class,
],
]);
}
break;
case 1:
if ($user->class >= $node->node_class
&& ($user->node_group == $node->node_group || $node->node_group == 0)
) {
$email = $user->email;
$email = Radius::GetUserName($email);
$json_show = 'VPN 信息<br>地址:' . $node->server
. '<br>用户名:' . $email . '<br>密码:' . $this->user->passwd
. '<br>支持方式:' . $node->method . '<br>备注:' . $node->info;
return $response->write(
$this->view()->assign('json_show', $json_show)->fetch('user/nodeinfovpn.tpl')
);
}
break;
case 2:
if ($user->class >= $node->node_class
&& ($user->node_group == $node->node_group || $node->node_group == 0)) {
$email = $user->email;
$email = Radius::GetUserName($email);
$json_show = 'SSH 信息<br>地址:' . $node->server
. '<br>用户名:' . $email . '<br>密码:' . $this->user->passwd
. '<br>支持方式:' . $node->method . '<br>备注:' . $node->info;
return $response->write(
$this->view()->assign('json_show', $json_show)->fetch('user/nodeinfossh.tpl')
);
}
break;
case 5:
if ($user->class >= $node->node_class
&& ($user->node_group == $node->node_group || $node->node_group == 0)) {
$email = $user->email;
$email = Radius::GetUserName($email);
$json_show = 'Anyconnect 信息<br>地址:' . $node->server
. '<br>用户名:' . $email . '<br>密码:' . $this->user->passwd
. '<br>支持方式:' . $node->method . '<br>备注:' . $node->info;
return $response->write(
$this->view()->assign('json_show', $json_show)->fetch('user/nodeinfoanyconnect.tpl')
);
}
break;
case 10:
if ((($user->class >= $node->node_class
&& ($user->node_group == $node->node_group || $node->node_group == 0)) || $user->is_admin)
&& ($node->node_bandwidth_limit == 0 || $node->node_bandwidth < $node->node_bandwidth_limit)) {
return $response->withJson([
'ret' => 1,
'nodeInfo' => [
'node' => $node,
'user' => $user,
'mu' => $mu,
'relay_rule_id' => $relay_rule_id,
'URL' => URL::class,
],
]);
}
break;
case 13:
if ((($user->class >= $node->node_class
&& ($user->node_group == $node->node_group || $node->node_group == 0)) || $user->is_admin)
&& ($node->node_bandwidth_limit == 0 || $node->node_bandwidth < $node->node_bandwidth_limit)) {
return $response->withJson([
'ret' => 1,
'nodeInfo' => [
'node' => $node,
'user' => $user,
'mu' => $mu,
'relay_rule_id' => $relay_rule_id,
'URL' => URL::class,
],
]);
}
break;
}
// Default and judgement fail return
return $response->withJson([
'ret' => 0,
'nodeInfo' => [
'message' => ':)',
],
]);
}
}

@ -2,27 +2,26 @@
namespace App\Middleware;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use App\Services\Auth as AuthService;
class Admin
{
public function __invoke(ServerRequestInterface $request, ResponseInterface $response, $next)
/**
* @param \Slim\Http\Request $request
* @param \Slim\Http\Response $response
* @param callable $next
*
* @return \Slim\Http\Response
*/
public function __invoke($request, $response, $next)
{
//$response->getBody()->write('BEFORE');
$user = AuthService::getUser();
if (!$user->isLogin) {
$newResponse = $response->withStatus(302)->withHeader('Location', '/auth/login');
return $newResponse;
return $response->withStatus(302)->withHeader('Location', '/auth/login');
}
if (!$user->isAdmin()) {
$newResponse = $response->withStatus(302)->withHeader('Location', '/user');
return $newResponse;
return $response->withStatus(302)->withHeader('Location', '/user');
}
$response = $next($request, $response);
return $response;
return $next($request, $response);
}
}

@ -1,38 +0,0 @@
<?php
namespace App\Middleware;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use App\Services\Factory;
use App\Utils\Helper;
class Api
{
public function __invoke(ServerRequestInterface $request, ResponseInterface $response, $next)
{
$accessToken = Helper::getParam($request, 'access_token');
if ($accessToken == null) {
$res['ret'] = 0;
$res['msg'] = 'token is null';
$response->getBody()->write(json_encode($res));
return $response;
}
$storage = Factory::createTokenStorage();
$token = $storage->get($accessToken);
if ($token == null) {
$res['ret'] = 0;
$res['msg'] = 'token is null';
$response->getBody()->write(json_encode($res));
return $response;
}
if ($token->expireTime < time()) {
$res['ret'] = 0;
$res['msg'] = 'token is expire';
$response->getBody()->write(json_encode($res));
return $response;
}
$response = $next($request, $response);
return $response;
}
}

@ -2,25 +2,27 @@
namespace App\Middleware;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use App\Services\Auth as AuthService;
class Auth
{
public function __invoke(ServerRequestInterface $request, ResponseInterface $response, $next)
/**
* @param \Slim\Http\Request $request
* @param \Slim\Http\Response $response
* @param callable $next
*
* @return \Slim\Http\Response
*/
public function __invoke($request, $response, $next)
{
$user = AuthService::getUser();
if (!$user->isLogin) {
$newResponse = $response->withStatus(302)->withHeader('Location', '/auth/login');
return $newResponse;
return $response->withStatus(302)->withHeader('Location', '/auth/login');
}
$enablePages = array('/user/disable', '/user/backtoadmin', '/user/logout');
if ($user->enable == 0 && !in_array($_SERVER['REQUEST_URI'], $enablePages)) {
$newResponse = $response->withStatus(302)->withHeader('Location', '/user/disable');
return $newResponse;
return $response->withStatus(302)->withHeader('Location', '/user/disable');
}
$response = $next($request, $response);
return $response;
return $next($request, $response);
}
}

@ -2,19 +2,23 @@
namespace App\Middleware;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use App\Services\Auth as AuthService;
class Guest
{
public function __invoke(ServerRequestInterface $request, ResponseInterface $response, $next)
/**
* @param \Slim\Http\Request $request
* @param \Slim\Http\Response $response
* @param callable $next
*
* @return \Slim\Http\Response
*/
public function __invoke($request, $response, $next)
{
$user = AuthService::getUser();
if ($user->isLogin) {
return $response->withStatus(302)->withHeader('Location', '/user');
}
$response = $next($request, $response);
return $response;
return $next($request, $response);
}
}

@ -1,55 +1,44 @@
<?php
namespace App\Middleware;
use App\Services\Config;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use App\Utils\Helper;
use App\Models\Node;
class Mod_Mu
{
public function __invoke(ServerRequestInterface $request, ResponseInterface $response, $next)
/**
* @param \Slim\Http\Request $request
* @param \Slim\Http\Response $response
* @param callable $next
*
* @return \Slim\Http\Response
*/
public function __invoke($request, $response, $next)
{
$key = Helper::getParam($request, 'key');
$key = $request->getQueryParam('key');
if ($key === null) {
$res['ret'] = 0;
$res['data'] = 'null';
$response->getBody()->write(json_encode($res));
return $response;
return $response->withjson([
'ret' => 0,
'data' => 'Your key is null.'
]);
}
$auth = false;
$keys = Config::getMuKey();
foreach ($keys as $k) {
if ($key == $k) {
$auth = true;
break;
}
}
$auth = in_array($key, $keys);
if (Config::get('checkNodeIp')){
$node = Node::where('node_ip', 'LIKE', $_SERVER['REMOTE_ADDR'] . '%')->first();
if ($node == null && $_SERVER['REMOTE_ADDR'] != '127.0.0.1') {
$res['ret'] = 0;
$res['data'] = 'source is invalid, Your ip address is ' . $_SERVER['REMOTE_ADDR'];
$response->getBody()->write(json_encode($res));
return $response;
if ($auth === false
|| ($node === null && $_SERVER['REMOTE_ADDR'] != '127.0.0.1')
) {
return $response->withJson([
'ret' => 0,
'data' => 'Token or IP is invalid. Now, your IP address is ' . $_SERVER['REMOTE_ADDR']
]);
}
}
if ($auth == false) {
$res['ret'] = 0;
$res['data'] = 'token is invalid';
$response->getBody()->write(json_encode($res));
return $response;
}
$response = $next($request, $response);
return $response;
return $next($request, $response);
}
}

@ -1,51 +0,0 @@
<?php
namespace App\Middleware;
use App\Services\Config;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use App\Utils\Helper;
use App\Models\Node;
class Mu
{
public function __invoke(ServerRequestInterface $request, ResponseInterface $response, $next)
{
$key = Helper::getParam($request, 'key');
if ($key === null) {
$res['ret'] = 0;
$res['msg'] = 'key is null';
$response->getBody()->write(json_encode($res));
return $response;
}
$auth = false;
$keyset = explode(',', Config::get('muKey'));
foreach ($keyset as $sinkey) {
if ($key == $sinkey) {
$auth = true;
break;
}
}
if ($auth == false) {
$res['ret'] = 0;
$res['msg'] = 'token or source is invalid';
$response->getBody()->write(json_encode($res));
return $response;
}
$node = Node::where('node_ip', 'LIKE', $_SERVER['REMOTE_ADDR'] . '%')->first();
if ($node == null && $_SERVER['REMOTE_ADDR'] != '127.0.0.1') {
$res['ret'] = 0;
$res['msg'] = 'token or source is invalid';
$response->getBody()->write(json_encode($res));
return $response;
}
$response = $next($request, $response);
return $response;
}
}

@ -135,7 +135,7 @@ class Shop extends Model
switch ($key) {
case 'bandwidth':
if ($is_renew == 0) {
if (Config::get('enable_bought_reset') == 'true') {
if (Config::get('enable_bought_reset') == true) {
$user->transfer_enable = $value * 1024 * 1024 * 1024;
$user->u = 0;
$user->d = 0;
@ -160,7 +160,7 @@ class Shop extends Model
}
break;
case 'class':
if (Config::get('enable_bought_extend') == 'true') {
if (Config::get('enable_bought_extend') == true) {
if ($user->class == $value) {
$user->class_expire = date('Y-m-d H:i:s', strtotime($user->class_expire) + $content['class_expire'] * 86400);
} else {

@ -40,7 +40,7 @@ class User extends Model
public function getGravatarAttribute()
{
$hash = md5(strtolower(trim($this->attributes['email'])));
return 'https://gravatar.loli.net/avatar/' . $hash;
return 'https://gravatar.loli.net/avatar/' . $hash."?&d=identicon";
}
public function isAdmin()
@ -417,33 +417,28 @@ class User extends Model
$logs = DetectBanLog::where('user_id', $this->attributes['id'])->orderBy("id", "desc")->first();
return $logs->detect_number;
}
public function yesterdayIncome()
{ $number = Code::where('usedatetime', 'like', date('Y-m-d%', strtotime('-1 days')))->sum('number');
return is_null($number)?0:$number;
}
public function todayIncome()
{
$number = Code::where('usedatetime', 'like', date('Y-m-d%'))->sum('number');
return is_null($number)?0:$number;
}
public function thisMonthIncome()
{
$number = Code::where('usedatetime', 'like', date('Y-m%'))->sum('number');
return is_null($number)?0:$number;
}
public function lastMonthIncome()
{
$number = Code::where('usedatetime', 'like', date('Y-m%', strtotime('-1 months')))->sum('number');
return is_null($number)?0:$number;
}
public function totalIncome()
{
$number = Code::where('usedatetime', 'like', date('%'))->sum('number');
return is_null($number)?0:$number;
public function calIncome($req)
{
switch($req)
{
case "yesterday":
$number = Code::whereDate('usedatetime', '=', date('Y-m-d',strtotime('-1 days')))->sum('number');
break;
case "today":
$number = Code::whereDate('usedatetime', '=', date('Y-m-d'))->sum('number');
break;
case "this month":
$number = Code::whereMonth('usedatetime', '=', date('m'))->sum('number');
break;
case "last month":
$number = Code::whereMonth('usedatetime', '=', date('m',strtotime('last month')))->sum('number');
break;
default:
$number = Code::sum('number');
break;
}
return is_null($number)?0:$number;
}
public function paidUserCount()

@ -4,11 +4,8 @@ namespace App\Services;
class Auth
{
protected $driver;
public function __construct()
{
}
protected $user;
private static function getDriver()
{
@ -20,9 +17,18 @@ class Auth
self::getDriver()->login($uid, $time);
}
/**
* Get current user(cached)
*
* @return \App\Models\User
*/
public static function getUser()
{
return self::getDriver()->getUser();
global $user;
if ($user === null) {
$user = self::getDriver()->getUser();
}
return $user;
}
public static function logout()

@ -43,7 +43,7 @@ class Cookie extends Base
return $user;
}
if (Config::get('enable_login_bind_ip') == 'true') {
if (Config::get('enable_login_bind_ip') == true) {
$nodes = Node::where('node_ip', '=', $_SERVER['REMOTE_ADDR'])->first();
if (($nodes == null) && $ipHash != md5($_SERVER['REMOTE_ADDR'] . Config::get('key') . $uid . $expire_in)) {
return $user;

@ -1,7 +0,0 @@
<?php
namespace App\Services\Auth;
class File
{
}

@ -48,7 +48,7 @@ class Redis extends Base
$ip = $this->client->get($sid . 'ip');
$nodes = Node::where('node_ip', '=', $_SERVER['REMOTE_ADDR'])->first();
if ($ip != $_SERVER['REMOTE_ADDR'] && $nodes == null && Config::get('enable_login_bind_ip') == 'true') {
if ($ip != $_SERVER['REMOTE_ADDR'] && $nodes == null && Config::get('enable_login_bind_ip') == true) {
$user = new User();
$user->isLogin = false;
return $user;

@ -1,31 +0,0 @@
<?php
namespace App\Services\Auth;
use App\Services\Factory;
class Token extends Base
{
protected $storage;
public function __construct()
{
$this->storage = Factory::createTokenStorage();
}
public function login($uid, $time)
{
// TODO: Implement getUser() method.
}
public function logout()
{
// TODO: Implement logout() method.
}
public function getUser()
{
$token = Cookie::get('token');
}
}

@ -28,7 +28,7 @@ class Boot
// Init Eloquent ORM Connection
$capsule = new Capsule();
$capsule->addConnection(Config::getDbConfig());
if (Config::get('enable_radius') == 'true') {
if (Config::get('enable_radius') == true) {
$capsule->addConnection(Config::getRadiusDbConfig(), 'radius');
}
$capsule->bootEloquent();

@ -1,7 +0,0 @@
<?php
namespace App\Services;
class Cache
{
}

@ -31,7 +31,6 @@ class Config
'sspanelAnalysis' => self::get('sspanelAnalysis'),
'enable_donate' => self::get('enable_donate'),
'enable_telegram' => self::get('enable_telegram'),
'enable_discord' => self::get('enable_discord'),
'payment_system' => self::get('payment_system'),
'enable_mylivechat' => self::get('enable_mylivechat'),
'mylivechat_id' => self::get('mylivechat_id'),
@ -46,6 +45,8 @@ class Config
'custom_invite_price' => self::get('custom_invite_price'),
'captcha_provider' => self::get('captcha_provider'),
'enable_email_verify' => self::get('enable_email_verify'),
'subscribe_client' => self::get('subscribe_client')
'enable_email_verify' => self::get('enable_email_verify'),
'protocol_specify' => self::get('protocol_specify'),
'subscribeLog' => self::get('subscribeLog'),
'subscribeLog_keep_days' => self::get('subscribeLog_keep_days'),
@ -54,8 +55,7 @@ class Config
'auto_detect_ban_number' => self::get('auto_detect_ban_number'),
'auto_detect_ban_time' => self::get('auto_detect_ban_time'),
'auto_detect_ban' => self::get('auto_detect_ban'),
'subscribe_client' => self::get('subscribe_client')
];
];
}
public static function getDbConfig()

@ -5,8 +5,6 @@ namespace App\Services;
use App\Services\Auth\Cookie;
use App\Services\Auth\Redis;
use App\Services\Auth\JwtToken;
use App\Services\Token\DB;
use App\Services\Token\Dynamodb;
class Factory
{
@ -23,24 +21,4 @@ class Factory
}
return new Redis();
}
public static function createCache()
{
}
public static function createMail()
{
}
public static function createTokenStorage()
{
switch (Config::get('tokenDriver')) {
case 'db':
return new DB();
case 'dynamodb':
return new Dynamodb();
default:
return new DB();
}
}
}

@ -14,19 +14,40 @@ use App\Models\User;
use App\Models\Code;
use App\Services\Config;
use App\Utils\Telegram;
use Slim\Http\{Request, Response};
abstract class AbstractPayment
{
/**
* @param Request $request
* @param Response $response
* @param array $args
*/
abstract public function purchase($request, $response, $args);
/**
* @param Request $request
* @param Response $response
* @param array $args
*/
abstract public function notify($request, $response, $args);
abstract public function getPurchaseHTML();
/**
* @param Request $request
* @param Response $response
* @param array $args
*/
abstract public function getReturnHTML($request, $response, $args);
/**
* @param Request $request
* @param Response $response
* @param array $args
*/
abstract public function getStatus($request, $response, $args);
abstract public function getPurchaseHTML();
public function postPayment($pid, $method)
{
$p = Paylist::where('tradeno', $pid)->first();
@ -62,7 +83,7 @@ abstract class AbstractPayment
$Payback->save();
}
if (Config::get('enable_donate') == 'true') {
if (Config::get('enable_donate') == true) {
if ($user->is_hide == 1) {
Telegram::Send('一位不愿透露姓名的大老爷给我们捐了 ' . $codeq->number . ' 元!');
} else {

@ -1,161 +0,0 @@
<?php
/**
* Created by PhpStorm.
* User: tonyzou
* Author:
* Date: 2018/9/24
* Time: 下午4:01
*/
/**
* Made By Leo
* 黛米付接口
* 2.1.4版本
* 适用于 V1 API 黛米付面板V1
* copyright all rights reserved
*/
namespace App\Services\Gateway;
use App\Services\View;
use App\Services\Auth;
use App\Services\Config;
use App\Models\Paylist;
class DoiAMPay extends AbstractPayment
{
public function getPurchaseHTML()
{
return View::getSmarty()->assign('enabled', Config::get('doiampay')['enabled'])->fetch('user/doiam.tpl');
}
public function notify($request, $response, $args)
{
$order_data = $_POST;
$status = $order_data['status']; //获取传递过来的交易状态
$invoiceid = $order_data['out_trade_no']; //订单号
$transid = $order_data['trade_no']; //转账交易号
$amount = $order_data['money']; //获取递过来的总价格
if (!DoiAM::checksign($_POST, Config::get('doiampay')['mchdata'][$args['type']]['token'])) {
return json_encode(array('errcode' => 2333));
}
if ($status == 'success') {
$this->postPayment($invoiceid, '黛米付' . ['wepay' => '(微信)', 'qqpay' => '(QQ支付)', 'alipay' => '(支付宝)'][$args['type']]);
return json_encode(['errcode' => 0]);
}
return 1;
}
public function purchase($request, $response, $args)
{
$type = $request->getParam('type');
$price = $request->getParam('price');
if (Config::get('doiampay')['enabled'][$type] == 0) {
return json_encode(['errcode' => -1, 'errmsg' => '非法的支付方式.']);
}
if ($price <= 0) {
return json_encode(['errcode' => -1, 'errmsg' => '非法的金额.']);
}
$user = Auth::getUser();
$settings = Config::get('doiampay')['mchdata'][$type];
$pl = new Paylist();
$pl->userid = $user->id;
$pl->total = $price;
$pl->tradeno = self::generateGuid();
$pl->save();
$data = [
'trade' => $pl->tradeno,
'price' => $price,
'phone' => $settings['phone'],
'mchid' => $settings['mchid'],
'subject' => Config::get('appName') . '充值' . $price . '元',
'body' => Config::get('appName') . '充值' . $price . '元',
'type' => 'Mod',
];
$data = DoiAM::sign($data, $settings['token']);
$ret = DoiAM::post('https://api.daimiyun.cn/v2/' . $type . '/create', $data);
$result = json_decode($ret, true);
if ($result && $result['errcode'] == 0) {
$result['pid'] = $pl->tradeno;
return json_encode($result);
}
return json_encode([
'errcode' => -1,
'errmsg' => '接口调用失败!' . $ret,
]);
}
public function getReturnHTML($request, $response, $args)
{
$money = $_GET['money'];
echo "您已经成功支付 $money 元,正在跳转..";
echo <<<HTML
<script>
location.href="/user/code";
</script>
HTML;
}
public function getStatus($request, $response, $args)
{
$p = Paylist::where('tradeno', $_POST['pid'])->first();
$return['ret'] = 1;
$return['result'] = $p->status;
return json_encode($return);
}
}
class DoiAM
{
public static function sort(&$array)
{
ksort($array);
}
public static function getsign($array, $key)
{
unset($array['sign']);
self::sort($array);
$sss = http_build_query($array);
$sign = hash('sha256', $sss . $key);
$sign = sha1($sign . hash('sha256', $key));
return $sign;
}
public static function sign($array, $key)
{
$array['sign'] = self::getSign($array, $key);
return $array;
}
public static function checksign($array, $key)
{
$new = $array;
$new = self::sign($new, $key);
if (!isset($array['sign'])) {
return false;
}
return $array['sign'] == $new['sign'];
}
public static function post($url, $data = null)
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
if (!empty($data)) {
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
}
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($curl);
curl_close($curl);
return $output;
}
}

@ -64,7 +64,7 @@ class PaymentWall extends AbstractPayment
$Payback->save();
}
echo 'OK'; // Paymentwall expects response to be OK, otherwise the pingback will be resent
if (Config::get('enable_donate') == 'true') {
if (Config::get('enable_donate') == true) {
if ($user->is_hide == 1) {
Telegram::Send('姐姐姐姐,一位不愿透露姓名的大老爷给我们捐了 ' . $codeq->number . ' 元呢~');
} else {

@ -0,0 +1,148 @@
<?php
namespace App\Services\Gateway;
use App\Services\Auth;
use App\Models\Paylist;
class TomatoPay extends AbstractPayment
{
public function purchase($request, $response, $args)
{
$type = $request->getParsedBodyParam('type');
$price = $request->getParsedBodyParam('price');
if ($price <= 0) {
return $response->write(json_encode(['errcode' => -1, 'errmsg' => "非法的金额."]));
}
$user = Auth::getUser();
$settings = $_ENV['tomatopay'][$type];
$pl = new Paylist();
$pl->userid = $user->id;
$pl->total = $price;
$pl->tradeno = self::generateGuid();
$pl->save();
$fqaccount = $settings['account'];
$fqkey = $settings['token'];
$fqmchid = $settings['mchid'];
$fqtrade = $pl->tradeno;
$fqcny = $price;
$signs = md5(
'mchid=' . $fqmchid . '&account=' . $fqaccount . '&cny=' . $fqcny . '&type=1&trade=' . $fqtrade . $fqkey
);
$url = 'https://b.fanqieui.com/gateways/' . $type . '.php?account='
. $fqaccount . '&mchid=' . $fqmchid . '&type=1'
. '&trade=' . $fqtrade . '&cny=' . $fqcny . '&signs=' . $signs;
$result = "<script language='javascript' type='text/javascript'>window.location.href='" . $url . "';</script>";
return $response->write(json_encode(['code' => $result, 'errcode' => 0, 'pid' => $pl->id]));
}
public function notify($request, $response, $args)
{
$type = $args['type'];
$settings = $_ENV['tomatopay'][$type];
$order_data = $request->getParsedBody();
$signs = $order_data['sign'];
unset($order_data['sign']);
$security = $order_data;
$o = '';
foreach ($security as $k => $v) {
$o .= "$k=" . urlencode($v) . "&";
}
$sign = md5(substr($o, 0, -1) . $settings['token']);
if ($sign == $signs) {
$this->postPayment($order_data['out_trade_no'], "在线支付");
return $response->write('success');
} else {
return $response->write('failed');
}
}
public function getPurchaseHTML()
{
return '
<div class="card-inner">
<p class="card-heading">充值</p>
<h5>支付方式:</h5>
<h5 style="color:red">推荐使用支付宝支付,更快到账!</h5>
<br/>
<nav class="tab-nav margin-top-no">
<ul class="nav nav-list">
<li>
<a class="waves-attach waves-effect type active" data-toggle="tab" data-pay="alipay"><img src="/images/alipay.jpg" height="50px"></img></a>
</li>
<li>
<a class="waves-attach waves-effect type" data-toggle="tab" data-pay="wxpay"><img src="/images/weixin.jpg" height="50px"></img></a>
</li>
</ul>
<div class="tab-nav-indicator"></div>
</nav>
<div class="form-group form-group-label">
<label class="floating-label" for="amount">金额</label>
<input class="form-control" id="amount" type="text">
</div>
</div>
<div class="card-action">
<div class="card-action-btn pull-left">
<button class="btn btn-flat waves-attach" id="tomato_pay" ><span class="icon">check</span>&nbsp;充值</NOtton>
</div>
</div>
<script>
var type = "wxpay";
var type = "alipay";
var pid = 0;
$(".type").click(function(){
type = $(this).data("pay");
});
$("#tomato_pay").click(function(){
var price = parseFloat($("#amount").val());
console.log("将要使用"+type+"方法充值"+price+"元")
if(isNaN(price)){
$("#result").modal();
$("#msg").html("非法的金额!");
}
$.ajax({
\'url\':"/user/payment/purchase",
\'data\':{
\'price\':price,
\'type\':type,
},
\'dataType\':\'json\',
\'type\':"POST",
success:function(data){
console.log(data);
if(data.errcode==-1){
$("#result").modal();
$("#msg").html(data.errmsg);
}
if(data.errcode==0){
pid = data.pid;
if(type=="wxpay"){
$("#result").modal();
$("#msg").html("正在跳转到微信..."+data.code);
}else if(type=="alipay"){
$("#result").modal();
$("#msg").html("正在跳转到支付宝..."+data.code);
}
}
}
});
setTimeout(f, 1000);
});
</script>
';
}
public function getReturnHTML($request, $response, $args)
{
// TODO: Implement getReturnHTML() method.
}
public function getStatus($request, $response, $args)
{
// TODO: Implement getStatus() method.
}
}

@ -1,211 +0,0 @@
<?php
/**
* Created by PhpStorm.
* User: tonyzou
* Date: 2018/9/28
* Time: 9:08 PM
*/
namespace App\Services\Gateway;
use App\Services\View;
use App\Services\Auth;
use App\Services\Config;
use App\Models\Paylist;
class TrimePay extends AbstractPayment
{
private $appSecret;
private $gatewayUri;
/**
* 签名初始化
* @param merKey 签名密钥
*/
public function __construct($appSecret)
{
$this->appSecret = $appSecret;
$this->gatewayUri = 'https://api.payease.io/gateway/';
}
/**
* @name 准备签名/验签字符串
*/
public function prepareSign($data)
{
ksort($data);
return http_build_query($data);
}
/**
* @name 生成签名
* @param sourceData
* @return 签名数据
*/
public function sign($data)
{
return strtolower(md5(md5($data) . $this->appSecret));
}
/*
* @name 验证签名
* @param signData 签名数据
* @param sourceData 原数据
* @return
*/
public function verify($data, $signature)
{
$mySign = $this->sign($data);
return $mySign === $signature;
}
public function post($data, $type = 'pay')
{
if ($type == 'pay') {
$this->gatewayUri .= 'pay/go';
} elseif ($type == 'refund') {
$this->gatewayUri .= 'refund/go';
} elseif ($type == 'pre') {
$this->gatewayUri .= 'pay/pre';
} else {
$this->gatewayUri .= 'query/go';
}
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $this->gatewayUri);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
$data = curl_exec($curl);
curl_close($curl);
return $data;
}
public function purchase($request, $response, $args)
{
$price = $request->getParam('price');
$type = $request->getParam('type');
if ($price <= 0) {
return json_encode(['code' => -1, 'errmsg' => '非法的金额.']);
}
$user = Auth::getUser();
$pl = new Paylist();
$pl->userid = $user->id;
$pl->total = $price;
$pl->tradeno = self::generateGuid();
$pl->save();
$data['appId'] = Config::get('trimepay_appid');
$data['payType'] = $type;
$data['merchantTradeNo'] = $pl->tradeno;
$data['totalFee'] = (float)$price * 100;
$data['notifyUrl'] = Config::get('baseUrl') . '/payment/notify';
$data['returnUrl'] = Config::get('baseUrl') . '/user/payment/return';
$params = $this->prepareSign($data);
$data['sign'] = $this->sign($params);
switch ($type) {
case ('WEPAY_JSAPI'):
$result = json_decode($this->post($data, $type = 'pre'), true);
break;
default:
$result = json_decode($this->post($data), true);
}
$result['pid'] = $pl->tradeno;
return json_encode($result);
}
public function query($tradeNo)
{
$data['appId'] = Config::get('trimepay_appid');
$data['merchantTradeNo'] = $tradeNo;
$params = $this->prepareSign($data);
$data['sign'] = $this->sign($params);
return json_decode($this->post($data, $type = 'query'), true);
}
public function notify($request, $response, $args)
{
$data = array();
$data['payStatus'] = $request->getParam('payStatus');
$data['payFee'] = $request->getParam('payFee');
$data['callbackTradeNo'] = $request->getParam('callbackTradeNo');
$data['payType'] = $request->getParam('payType');
$data['merchantTradeNo'] = $request->getParam('merchantTradeNo');
//file_put_contents(BASE_PATH.'/storage/trimepay_notify.log', json_encode($data)."\r\n", FILE_APPEND);
// 准备待签名数据
$str_to_sign = $this->prepareSign($data);
// 验证签名
$resultVerify = $this->verify($str_to_sign, $request->getParam('sign'));
if ($resultVerify) {
//file_put_contents('./trimepay_notify_success.log', json_encode($data)."\r\n", FILE_APPEND);
$this->postPayment($data['merchantTradeNo'], 'TrimePay');
echo 'SUCCESS';
} else {
echo 'FAIL';
}
}
public function refund($merchantTradeNo)
{
$data['appId'] = Config::get('trimepay_appid');
$data['merchantTradeNo'] = $merchantTradeNo;
$params = $this->prepareSign($data);
$data['sign'] = $this->sign($params);
return $this->post($data, 'refund');
}
public function getPurchaseHTML()
{
return View::getSmarty()->fetch('user/trimepay.tpl');
}
public function getReturnHTML($request, $response, $args)
{
$pid = $_GET['merchantTradeNo'];
$p = Paylist::where('tradeno', '=', $pid)->first();
$money = $p->total;
if ($p->status == 1) {
$success = 1;
} else {
$data = array();
$data['payStatus'] = $request->getParam('payStatus');
$data['payFee'] = $request->getParam('payFee');
$data['callbackTradeNo'] = $request->getParam('callbackTradeNo');
$data['payType'] = $request->getParam('payType');
$data['merchantTradeNo'] = $request->getParam('merchantTradeNo');
// 准备待签名数据
$str_to_sign = $this->prepareSign($data);
// 验证签名
$resultVerify = $this->verify($str_to_sign, $request->getParam('sign'));
if ($resultVerify) {
$this->postPayment($data['merchantTradeNo'], 'TrimePay');
$success = 1;
} else {
$success = 0;
}
}
return View::getSmarty()->assign('money', $money)->assign('success', $success)->fetch('user/pay_success.tpl');
}
public function getStatus($request, $response, $args)
{
$return = [];
$p = Paylist::where('tradeno', $_POST['pid'])->first();
$return['ret'] = 1;
$return['result'] = $p->status;
return json_encode($return);
}
}

@ -0,0 +1,335 @@
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2019/10/10
* Time: 17:03
*/
namespace App\Services\Gateway;
use App\Models\Paylist;
use App\Services\Auth;
use App\Services\Config;
class YftPay extends AbstractPayment
{
private $user;
public function __construct()
{
$this->user = Auth::getUser();
}
public function purchase($request, $response, $args)
{
return $this->constructPayPara($request);
}
public function notify($request, $response, $args)
{
$yftUtil = new YftPayUtil();
$pay_config = new YftPayConfig();
$pay_config->init();
//价格
$total_fee = $request->getParam("total_fee");
//易付通返回的订单号
$yft_order_no = $request->getParam("trade_no");
//面板生成的订单号
$ss_order_no = $request->getParam("out_trade_no");
//订单说明
$subject = $request->getParam("subject");
//付款状态
$trade_status = $request->getParam("trade_status");
//加密验证字符串
$sign = $request->getParam("sign");
$verifyNotify = $yftUtil->md5Verify(floatval($total_fee), $ss_order_no, $yft_order_no, $trade_status, $sign);
if ($verifyNotify && $trade_status == 'TRADE_SUCCESS') {//验证成功
/*
加入您的入库及判断代码;
>>>>>>>!!!为了保证数据传达到回调地址,会请求4次。所以必须要先判断订单状态,然后再插入到数据库,这样后面即使请求3次,也不会造成订单重复!!!!<<<<<<<
判断返回金额与实金额是否想同;
判断订单当前状态;
完成以上才视为支付成功
*/
$order = Paylist::where('tradeno', $ss_order_no)->first();
if ($order->status == 0) {
$this->postPayment($ss_order_no, '易付 充值');
return "success";
}
return "fail";
} else {
//验证失败
return "fail";
}
}
/**
* @param $request
* @return string
*/
private function constructPayPara($request)
{
$yftLib = new YftPayUtil();
$pay_config = new YftPayConfig();
$pay_config->init();
/**************************请求参数**************************/
//订单名称
$subject = $request->getParams()['subject'];//必填
//付款金额
$total_fee = $request->getParams()['total_fee'];//必填 需为整数
//服务器异步通知页面路径
$notify_url = $request->getUri()->getScheme() . "://" . $request->getUri()->getHost() . "/payment/notify";
//需http://格式的完整路径,不能加?id=123这类自定义参数
//页面跳转同步通知页面路径
$return_url = $request->getUri()->getScheme() . "://" . $request->getUri()->getHost() . $pay_config->pay_config["return_url"];
//需http://格式的完整路径,不能加?id=123这类自定义参数,不能写成http://localhost/
$secret = Config::get('yft_secret');
$ss_order_no = self::genOrderNumber();
/************************************************************/
//构造要请求的参数数组,无需改动
$parameter = [
"total_fee" => $total_fee,
"notify_url" => $notify_url,
"return_url" => $return_url,
"secret" => $secret,
"out_trade_no" => $ss_order_no
];
//向数据库插入订单信息
$order = new Paylist();
$order->userid = $this->user->id;
$order->total = $total_fee;
$order->status = 0;
$order->tradeno = $ss_order_no;
$order->save();
//建立请求
$html_text = $yftLib->buildRequestForm($parameter, $ss_order_no, $pay_config);
return $html_text;
}
public function getPurchaseHTML()
{
return '
<div class="card-main">
<div class="card-inner">
<form action="/user/payment/purchase" method="post" target="_blank" onsubmit="return checkPost();">
<p class="card-heading">在线充值</p>
<div class="form-group form-group-label">
<label class="floating-label" for="total_fee">充值金额</label>
<input class="form-control" id="total_fee" name="total_fee" type="text">
<input class="form-control" name="subject" value="余额充值" type="hidden">
</div>
<div class="card-action">
<div class="card-action-btn pull-left">
<button type="submit" class="btn btn-flat waves-attach" ><span class="icon">check</span>&nbsp;充值</button>
</div>
</div>
</form>
</div>
</div>
<script>
function checkPost(){
var price = document.getElementById("total_fee");
if (price.value == ""){
$("#result").modal();
$$.getElementById("msg").innerHTML = "请填写充值金额";
document.getElementById("total_fee").focus();
return false;
}
if (price.value < 0.01){
$("#result").modal();
$$.getElementById("msg").innerHTML = "请填写充值金额";
document.getElementById("total_fee").focus();
return false;
}
return true;
}
</script>
<script>
//jquery控制只输入数字或小数点后几位
$(function () {
$.fn.decimalinput = function (intLen, decimallen, isNegative) {
curIntLen = intLen || 11;
decimallen = decimallen || 0;
isNegative = typeof isNegative == \'boolean\' ? isNegative : false;
$(this).css("ime-mode", "disabled");
/*
KeyPress (主要用来接收字母、数字等ANSI字符)
1.不区分小键盘和主键盘的数字字符。
2.区分大小写。
数字 1
主键盘区keyCode:49
小键盘区keyCode:49
KeyDown 、KeyUp (可以捕获键盘上除了PrScrn(在键盘右上角)之外的所有按键,可以捕获组合键)
1.区分小键盘和主键盘的数字字符。
2.不区分大小写。
数字 1
主键盘区keyCode:49
小键盘区keyCode:97
*/
this.bind("keypress", function (e) {
//微软中文输入法 状态下,无法监听 keypress
var _v = this.value;
if (e.charCode === 0) return true; //非字符键 for firefox
var keyCode = (e.keyCode ? e.keyCode : e.which); //兼容火狐 IE
var curPos = getCurPosition(this);
var selText = getSelectedText(this);
var dotPos = _v.indexOf(".");
var curLength = _v.length;
console.log(curPos)
if (isNegative && keyCode == 45 && curPos == 0) {
curIntLen = intLen + 1;
return true;
}
curIntLen = _v.indexOf(\'-\') > -1 ? intLen + 1 : intLen;
if (keyCode >= 48 && keyCode <= 57) {
//整数位 长度控制
if (dotPos > -1) { //存在小数点情况
if (curPos <= dotPos && dotPos >= curIntLen) {
return false;
}
} else {
if ((curLength + 1) > curIntLen && keyCode != 46) {
return false;
}
}
//小数位 长度控制
if (dotPos > 0 && curPos > dotPos) {
if (curPos > dotPos + decimallen) return false;
if (selText.length > 0 || _v.substr(dotPos + 1).length < decimallen)
return true;
else
return false;
}
return true;
}
//输入"."
// 输入的是小数点,并且参数可以有小数,不可在字符首位输入小数点,不存在小数点
if (keyCode == 46 && decimallen > 0 && curPos > 0 && _v.indexOf(".") < 0) {
return true;
}
return false;
});
this.bind("keydown", function (e) {
var _v = this.value;
var dotPos = _v.indexOf(".");
var curPos = getCurPosition(this);
var selText = getSelectedText(this);
//只能全选删除
if (e.keyCode == 8 && selText.length > 0 && selText.length != _v.length) {
return false;
}
//删除键,存在小数点,光标在小数点后 ,删除小数点的后的长度不能超过 整数长度限制,
if (e.keyCode == 8 &&
dotPos > 0 &&
curPos == (dotPos + 1) &&
(_v.length - 1) > curIntLen) {
return false;
}
})
this.bind("blur", function () {
if (this.value.lastIndexOf(".") == (this.value.length - 1)) {
this.value = this.value.substr(0, this.value.length - 1);
} else if (isNaN(this.value)) {
this.value = "";
}
if (this.value) {
var v = parseFloat(this.value).toFixed(decimallen);
if (v.indexOf(\'.\') > curIntLen) {
v = v.substr(v.indexOf(\'.\') - curIntLen)
}
this.value = v;
}
$(this).trigger("input");
});
this.bind("paste", function () {
return false;
});
this.bind("dragenter", function () { return false; });
this.bind("propertychange", function (e) {
if (isNaN(this.value))
this.value = this.value.replace(/[^0-9\.-]/g, "");
});
this.bind("input", function (e) {
if (isNaN(this.value))
this.value = this.value.replace(/[^0-9\.-]/g, "");
});
//获取当前光标在文本框的位置
function getCurPosition(domObj) {
var curPosition = 0;
if (domObj.selectionStart || domObj.selectionStart == \'0\') {
curPosition = domObj.selectionStart;
} else if (document.selection) { //for IE
domObj.focus();
var currentRange = document.selection.createRange();
var workRange = currentRange.duplicate();
domObj.select();
var allRange = document.selection.createRange();
while (workRange.compareEndPoints("StartToStart", allRange) > 0) {
workRange.moveStart("character", -1);
curPosition++;
}
currentRange.select();
}
return curPosition;
}
//获取当前文本框选中的文本
function getSelectedText(domObj) {
if (domObj.selectionStart || domObj.selectionStart == \'0\') {
return domObj.value.substring(domObj.selectionStart, domObj.selectionEnd);
} else if (document.selection) { //for IE
domObj.focus();
var sel = document.selection.createRange();
return sel.text;
} else return \'\';
}
};
$(\'#total_fee\').decimalinput(5, 2, true);
})
</script>
';
}
public function getReturnHTML($request, $response, $args)
{
// TODO: Implement getReturnHTML() method.
}
public function getStatus($request, $response, $args)
{
// TODO: Implement getStatus() method.
}
private function genOrderNumber()
{
//生成订单号
// 密码字符集,可任意添加你需要的字符
$date = time();
$date = "yft" . date("YmdHis", $date);
$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
$password = "";
for ($i = 0; $i < 8; $i++) {
// 这里提供两种字符获取方式
// 第一种是使用 substr 截取$chars中的任意一位字符;
// 第二种是取字符数组 $chars 的任意元素
$password .= substr($chars, mt_rand(0, strlen($chars) - 1), 1);
}
return $date . $password;
}
}

@ -0,0 +1,19 @@
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2019/10/10
* Time: 17:05
*/
namespace App\Services\Gateway;
class YftPayConfig{
public $pay_config;
public function init()
{
$this->pay_config = [
"return_url" => "/user/code",
"type" => "aliPay"
];
}
}

@ -0,0 +1,119 @@
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2019/10/10
* Time: 17:21
*/
namespace App\Services\Gateway;
class YftPayUtil
{
public function md5Verify($p1, $p2, $p3, $p4, $sign)
{
$preStr = $p1 . $p2 . $p3 . $p4 . "yft";
$mySign = md5($preStr);
if ($mySign == $sign) {
return true;
} else {
return false;
}
}
/**
* 建立请求,以表单HTML形式构造(默认)
* @param $para_temp 请求参数数组
*
*/
public function buildRequestForm($para_temp, $ss_order_no, $pay_config)
{
//待请求参数数组
$para = YftPayUtil::buildRequestPara($para_temp);
$sHtml = "<form id='paysubmit' name='paysubmit' action='https://payment.pi.do/pay/subOrder/zfb' accept-charset='utf-8' method='POST'>";
foreach ($para as $key => $val) {
$sHtml .= "<input type='hidden' name='" . $key . "' value='" . $val . "'/>";
}
if ($pay_config->pay_config["type"] == "aliPay") {
$sHtml .= "<input type='hidden' name='subject' value='余额充值'/>";
} else {
$sHtml .= "<input type='hidden' name='trade_no' value='" . $ss_order_no . "'/>";
}
//submit按钮控件请不要含有name属性
$sHtml = $sHtml . "</form>";
$sHtml = $sHtml . "<script>document.forms['paysubmit'].submit();</script>";
return $sHtml;
}
/**
* 生成要请求给易付的参数数组
* @param $para_temp 请求前的参数数组
* @return 要请求的参数数组
*/
static function buildRequestPara($para_temp)
{
//除去待签名参数数组中的空值和签名参数
$para_filter = YftPayUtil::paraFilter($para_temp);
//生成签名结果
$mysign = YftPayUtil::buildRequestMysign($para_filter);
//签名结果与签名方式加入请求提交参数组中
$para_filter['sign'] = $mysign;
return $para_filter;
}
/**
* 除去数组中的空值和签名参数
* @param $para 签名参数组
* return 去掉空值与签名参数后的新签名参数组
*/
static function paraFilter($para)
{
$para_filter = array();
foreach ($para as $key => $val) {
if ($key == "sign" || $val == "") continue;
else $para_filter[$key] = $para[$key];
}
return $para_filter;
}
/**
* 生成签名结果
* @param $para_filter 要签名的数组
* return 签名结果字符串
*/
static function buildRequestMysign($para_filter)
{
//把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串
$prestr = YftPayUtil::createLinkstring($para_filter);
$mysign = MD5($prestr);
return $mysign;
}
static function md5Sign($prestr)
{
return md5($prestr);
}
/**
* 把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串
* @param $para 需要拼接的数组
* return 拼接完成以后的字符串
*/
static function createLinkstring($para)
{
$arg = "";
foreach ($para as $key => $val) {
$arg .= $key . "=" . $val . "&";
}
//去掉最后一个&字符
$arg = substr($arg, 0, strlen($arg) - 1);
//如果存在转义字符,那么去掉转义
if (get_magic_quotes_gpc()) {
$arg = stripslashes($arg);
}
return $arg;
}
}

@ -21,7 +21,7 @@ class Smtp extends Base
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = $this->config['username']; // SMTP username
$mail->Password = $this->config['passsword']; // SMTP password
if (Config::get('smtp_ssl') == 'true') {
if ($_ENV['smtp_ssl'] == true) {
$mail->SMTPSecure = (Config::get('smtp_port') == '587' ? 'tls' : 'ssl'); // Enable TLS encryption, `ssl` also accepted
}
$mail->Port = $this->config['port']; // TCP port to connect to

@ -9,7 +9,7 @@
namespace App\Services;
use App\Services\Gateway\{
AopF2F, Codepay, DoiAMPay, PaymentWall, ChenPay, SPay, TrimePay, PAYJS, BitPayX
AopF2F, Codepay, PaymentWall, ChenPay, SPay, PAYJS, YftPay,BitPayX
};
class Payment
@ -20,8 +20,6 @@ class Payment
switch ($method) {
case ('codepay'):
return new Codepay();
case ('doiampay'):
return new DoiAMPay();
case ('paymentwall'):
return new PaymentWall();
case ('spay'):
@ -30,12 +28,12 @@ class Payment
return new AopF2F();
case ('chenAlipay'):
return new ChenPay();
case ('trimepay'):
return new TrimePay(Config::get('trimepay_secret'));
case ('bitpayx'):
return new BitPayX(Config::get('bitpay_secret'));
case ('payjs'):
return new PAYJS(Config::get('payjs_key'));
case ('yftpay'):
return new YftPay();
default:
return null;
}

@ -1,39 +0,0 @@
<?php
namespace App\Services;
use Slim\App;
use Zeuxisoo\Whoops\Provider\Slim\WhoopsMiddleware;
/***
* The slim documents: http://www.slimframework.com/docs/objects/router.html
*/
class Slim
{
public $app;
public function newApp()
{
// config
$debug = false;
if (defined('DEBUG')) {
$debug = true;
}
// Make a Slim App
$app = new App([
'settings' => [
'debug' => $debug,
'whoops.editor' => 'sublime',
'displayErrorDetails' => $debug
]
]);
$app->add(new WhoopsMiddleware());
$this->app = $app;
}
public function run()
{
$this->app->run();
}
}

@ -1,14 +0,0 @@
<?php
namespace App\Services\Token;
use App\Models\User;
abstract class Base
{
abstract public function store($token, User $user, $expireTime);
abstract public function delete($token);
abstract public function get($token);
}

@ -1,49 +0,0 @@
<?php
namespace App\Services\Token;
use App\Models\User;
use App\Models\Token as TokenModel;
use Illuminate\Database\Eloquent\ModelNotFoundException;
class DB extends Base
{
public function store($tokenStr, User $user, $expireTime)
{
$token = new TokenModel();
$token->token = $tokenStr;
$token->user_id = $user->id;
$token->create_time = time();
$token->expire_time = $expireTime;
if ($token->save()) {
return true;
}
return false;
}
public function delete($token)
{
$token = TokenModel::where('token', $token)->first();
if ($token == null) {
return false;
}
$token->delete();
return true;
}
public function get($token)
{
try {
$tokenModel = TokenModel::where('token', $token)->firstOrFail();
} catch (ModelNotFoundException $e) {
return null;
}
$token = new Token();
$token->token = $tokenModel->token;
$token->userId = $tokenModel->user_id;
$token->createTime = $tokenModel->create_time;
$token->expireTime = $tokenModel->expire_time;
return $token;
}
}

@ -1,60 +0,0 @@
<?php
namespace App\Services\Token;
use App\Models\User;
use App\Services\Aws\Factory;
class Dynamodb extends Base
{
protected $client;
protected $tableName = 'token';
public function __construct()
{
$this->client = Factory::createDynamodb();
$this->tableName = 'token';
}
public function store($token, User $user, $expireTime)
{
$result = $this->client->putItem(array(
'TableName' => $this->tableName,
'Item' => array(
'token' => array('S' => $token),
'user_id' => array('N' => (string)$user->id),
'create_time' => array('N' => (string)time()),
'expire_time' => array('N' => (string)$expireTime)
)
));
return true;
}
public function delete($token)
{
$this->client->deleteItem(array(
'TableName' => $this->tableName,
'Key' => array(
'token' => array('S' => $token),
)
));
}
public function get($token)
{
$result = $this->client->getItem(array(
'ConsistentRead' => true,
'TableName' => $this->tableName,
'Key' => array(
'token' => array('S' => $token),
)
));
$token = new Token();
$token->token = $result['Item']['token']['S'];
$token->userId = $result['Item']['user_id']['N'];
$token->createTime = $result['Item']['create_time']['N'];
$token->expireTime = $result['Item']['expire_time']['N'];
return $token;
}
}

@ -1,12 +0,0 @@
<?php
namespace App\Services\Token;
class Token
{
public $token;
public $userId;
public $createTime;
public $expireTime;
}

@ -1,73 +0,0 @@
<?php
namespace App\Utils;
use App\Models\User;
use App\Services\Config;
class Discord
{
public static function set()
{
$loop = \React\EventLoop\Factory::create();
$client = new \CharlotteDunois\Yasmin\Client(array(), $loop);
$client->on('error', static function ($error) {
echo $error . PHP_EOL;
});
$client->on('ready', static function () use ($client) {
echo 'Logged in as ' . $client->user->tag . ' created on ' . $client->user->createdAt->format('d.m.Y H:i:s') . PHP_EOL;
});
$client->on('message', static function ($message) {
//echo 'Received Message from '.$message->author->tag.' in '.($message->channel->type === 'text' ? 'channel #'.$message->channel->name : 'DM').' with '.$message->attachments->count().' attachment(s) and '.\count($message->embeds).' embed(s)'.PHP_EOL;
if (strpos($message->content, '!bind') === 0) {
bindQR($client, $message);
} elseif (strpos($message->content, '!checkin') === 0) {
checkin($client, $message);
} elseif (strpos($message->content, '!traffic') === 0) {
traffic($client, $message);
}
});
$client->login(Config::get('discord_token'))->done();
$loop->run();
echo('<27><><EFBFBD>óɹ<C3B3><C9B9><EFBFBD>' . PHP_EOL);
}
public static function bindQR($client, $message)
{
$message->channel->send('<27><><EFBFBD>ڽ<EFBFBD><DABD>룬<EFBFBD><EBA3AC><EFBFBD>Ժ󡣡<D4BA><F3A1A3A1><EFBFBD>');
$attachments = $message->attachments->toArray();
reset($attachments);
$qrcode_text = QRcode::decod(current($attachments)->url);
if ($qrcode_text == null) {
$message->channel->send('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>');
return;
}
if (strpos($qrcode_text, 'mod://bind/') === 0 && strlen($qrcode_text) == 27) {
$uid = TelegramSessionManager::verify_bind_session(substr($qrcode_text, 11));
if ($uid == 0) {
$message->channel->send('<27><>ʧ<EFBFBD>ܣ<EFBFBD><DCA3><EFBFBD>ά<EFBFBD><CEAC><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7>' . substr($qrcode_text, 11) . '<27><>ά<EFBFBD><CEAC><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7>Ϊ10<31><30><EFBFBD>ӣ<EFBFBD><D3A3>볢<EFBFBD><EBB3A2>ˢ<EFBFBD><CBA2><EFBFBD><EFBFBD>վ<EFBFBD>ġ<EFBFBD><C4A1><EFBFBD><EFBFBD>ϱ༭<CFB1><E0BCAD>ҳ<EFBFBD><D2B3><EFBFBD>Ը<EFBFBD><D4B8><EFBFBD>ά<EFBFBD><CEAC>');
return;
}
$user = User::where('id', $uid)->first();
$user->discord = $message->author->id;
$user->im_type = 5;
$user->im_value = $message->author->username;
$user->save();
$reply['message'] = '<27>󶨳ɹ<F3B6A8B3><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>䣺' . $user->email;
}
$message->channel->send('δ֪<CEB4><D6AA><EFBFBD>ݶ<EFBFBD>ά<EFBFBD><CEAC>');
}
public static function checkin($client, $message)
{
}
public static function traffic($client, $message)
{
}
}

@ -1,179 +0,0 @@
<?php
namespace App\Utils;
/**
* Made By Leo
* 黛米付接口
* 2.1.4版本
* 适用于 V1 API 黛米付面板V1
* copyright all rights reserved
*/
use App\Services\View;
use App\Services\Auth;
use App\Services\Config;
use App\Models\User;
use App\Models\Code;
use App\Models\Paylist;
use App\Models\Payback;
class DoiAMPay
{
public static function render()
{
return View::getSmarty()->assign('enabled', Config::get('doiampay')['enabled'])->fetch('user/doiam.tpl');
}
public function handle($request, $response, $args)
{
$type = $request->getParam('type');
$price = $request->getParam('price');
if (Config::get('doiampay')['enabled'][$type] == 0) {
return json_encode(['errcode' => -1, 'errmsg' => '非法的支付方式.']);
}
if ($price <= 0) {
return json_encode(['errcode' => -1, 'errmsg' => '非法的金额.']);
}
$user = Auth::getUser();
$settings = Config::get('doiampay')['mchdata'][$type];
$pl = new Paylist();
$pl->userid = $user->id;
$pl->total = $price;
$pl->save();
$data = [
'trade' => $pl->id,
'price' => $price,
'phone' => $settings['phone'],
'mchid' => $settings['mchid'],
'subject' => Config::get('appName') . '充值' . $price . '元',
'body' => Config::get('appName') . '充值' . $price . '元',
'type' => 'Mod',
];
$data = DoiAM::sign($data, $settings['token']);
$ret = DoiAM::post('https://api.daimiyun.cn/v2/' . $type . '/create', $data);
$result = json_decode($ret, true);
if ($result and $result['errcode'] == 0) {
$result['pid'] = $pl->id;
return json_Encode($result);
}
return json_encode([
'errcode' => -1,
'errmsg' => '接口调用失败!' . $ret,
]);
}
public function status($request, $response, $args)
{
return json_encode(Paylist::find($_POST['pid']));
}
public function handle_return($request, $response, $args)
{
$money = $_GET['money'];
echo "您已经成功支付 $money 元,正在跳转..";
echo <<<HTML
<script>
location.href="/user/code";
</script>
HTML;
}
public function handle_callback($request, $response, $args)
{
$order_data = $_POST;
$status = $order_data['status']; //获取传递过来的交易状态
$invoiceid = $order_data['out_trade_no']; //订单号
$transid = $order_data['trade_no']; //转账交易号
$amount = $order_data['money']; //获取递过来的总价格
if (!DoiAM::checksign($_POST, Config::get('doiampay')['mchdata'][$args['type']]['token'])) {
return json_encode(array('errcode' => 2333));
}
if ($status == 'success') {
$p = Paylist::find($invoiceid);
if ($p->status == 1) {
return json_encode(['errcode' => 0]);
}
$p->status = 1;
$p->save();
$user = User::find($p->userid);
$user->money += $p->total;
$user->save();
$codeq = new Code();
$codeq->code = ['wepay' => '微信', 'qqpay' => 'QQ支付', 'alipay' => '支付宝'][$args['type']] . '充值';
$codeq->isused = 1;
$codeq->type = -1;
$codeq->number = $p->total;
$codeq->usedatetime = date('Y-m-d H:i:s');
$codeq->userid = $user->id;
$codeq->save();
if ($user->ref_by != '' && $user->ref_by != 0 && $user->ref_by != null) {
$gift_user = User::where('id', '=', $user->ref_by)->first();
$gift_user->money += ($codeq->number * (Config::get('code_payback') / 100));
$gift_user->save();
$Payback = new Payback();
$Payback->total = $codeq->number;
$Payback->userid = $user->id;
$Payback->ref_by = $user->ref_by;
$Payback->ref_get = $codeq->number * (Config::get('code_payback') / 100);
$Payback->datetime = time();
$Payback->save();
}
return json_encode(['errcode' => 0]);
}
return '';
}
}
class DoiAM
{
public static function sort(&$array)
{
ksort($array);
}
public static function getsign($array, $key)
{
unset($array['sign']);
self::sort($array);
$sss = http_build_query($array);
$sign = hash('sha256', $sss . $key);
$sign = sha1($sign . hash('sha256', $key));
return $sign;
}
public static function sign($array, $key)
{
$array['sign'] = self::getSign($array, $key);
return $array;
}
public static function checksign($array, $key)
{
$new = $array;
$new = self::sign($new, $key);
if (!isset($array['sign'])) {
return false;
}
return $array['sign'] == $new['sign'];
}
public static function post($url, $data = null)
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
if (!empty($data)) {
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
}
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($curl);
curl_close($curl);
return $output;
}
}

@ -1,420 +0,0 @@
<?php
namespace App\Utils;
/**
* Socket communication class.
*
* Originally designed for use with DirectAdmin's API, this class will fill any HTTP socket need.
*
* Very, very basic usage:
* $Socket = new HTTPSocket;
* echo $Socket->get('http://user:pass@somesite.com/somedir/some.file?query=string&this=that');
*
* @author Phi1 'l0rdphi1' Stier <l0rdphi1@liquenox.net>
* @package HTTPSocket
* @version 2.7.2
* 2.7.2
* added x-use-https header check
* added max number of location redirects
* added custom settable message if x-use-https is found, so users can be told where to set their scripts
* if a redirect host is https, add ssl:// to remote_host
* 2.7.1
* added isset to headers['location'], line 306
*/
class HTTPSocket
{
public $version = '2.7.2';
/* all vars are private except $error, $query_cache, and $doFollowLocationHeader */
public $method = 'GET';
public $remote_host;
public $remote_port;
public $remote_uname;
public $remote_passwd;
public $result;
public $result_header;
public $result_body;
public $result_status_code;
public $lastTransferSpeed;
public $bind_host;
public $error = array();
public $warn = array();
public $query_cache = array();
public $doFollowLocationHeader = true;
public $redirectURL;
public $max_redirects = 5;
public $ssl_setting_message = 'DirectAdmin appears to be using SSL. Change your script to connect to ssl://';
public $extra_headers = array();
/**
* Create server "connection".
*
*/
public function connect($host, $port = '')
{
if (!is_numeric($port)) {
$port = 80;
}
$this->remote_host = $host;
$this->remote_port = $port;
}
public function bind($ip = '')
{
if ($ip == '') {
$ip = $_SERVER['SERVER_ADDR'];
}
$this->bind_host = $ip;
}
/**
* Change the method being used to communicate.
*
* @param string|null request method. supports GET, POST, and HEAD. default is GET
*/
public function set_method($method = 'GET')
{
$this->method = strtoupper($method);
}
/**
* Specify a username and password.
*
* @param string|null username. defualt is null
* @param string|null password. defualt is null
*/
public function set_login($uname = '', $passwd = '')
{
if ($uname !== '') {
$this->remote_uname = $uname;
}
if ($passwd !== '') {
$this->remote_passwd = $passwd;
}
}
/**
* Query the server
*
* @param string containing properly formatted server API. See DA API docs and examples. Http:// URLs O.K. too.
* @param string|array query to pass to url
* @param int if connection KB/s drops below value here, will drop connection
*/
public function query($request, $content = '', $doSpeedCheck = 0)
{
$this->error = $this->warn = array();
$this->result_status_code = null;
// is our request a http:// ... ?
if (preg_match('!^http://!i', $request) || preg_match('!^https://!i', $request)) {
$location = parse_url($request);
if (preg_match('!^https://!i', $request)) {
$this->connect('ssl://' . $location['host'], $location['port']);
} else {
$this->connect($location['host'], $location['port']);
}
$this->set_login($location['user'], $location['pass']);
$request = $location['path'];
$content = $location['query'];
if ($request == '') {
$request = '/';
}
}
$array_headers = array(
'User-Agent' => "HTTPSocket/$this->version",
'Host' => $this->remote_port == 80 ? $this->remote_host : "$this->remote_host:$this->remote_port",
'Accept' => '*/*',
'Connection' => 'Close');
foreach ($this->extra_headers as $key => $value) {
$array_headers[$key] = $value;
}
$this->result = $this->result_header = $this->result_body = '';
// was content sent as an array? if so, turn it into a string
if (is_array($content)) {
$pairs = array();
foreach ($content as $key => $value) {
$pairs[] = "$key=" . urlencode($value);
}
$content = implode('&', $pairs);
unset($pairs);
}
$OK = true;
// instance connection
if ($this->bind_host) {
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_bind($socket, $this->bind_host);
if (!@socket_connect($socket, $this->remote_host, $this->remote_port)) {
$OK = false;
}
} else {
$socket = @fsockopen($this->remote_host, $this->remote_port, $sock_errno, $sock_errstr, 10);
}
if (!$socket || !$OK) {
$this->error[] = "Can't create socket connection to $this->remote_host:$this->remote_port.";
return 0;
}
// if we have a username and password, add the header
if (isset($this->remote_uname, $this->remote_passwd)) {
$array_headers['Authorization'] = 'Basic ' . base64_encode("$this->remote_uname:$this->remote_passwd");
}
// for DA skins: if $this->remote_passwd is NULL, try to use the login key system
if (isset($this->remote_uname) && $this->remote_passwd == null) {
$array_headers['Cookie'] = "session={$_SERVER['SESSION_ID']}; key={$_SERVER['SESSION_KEY']}";
}
// if method is POST, add content length & type headers
if ($this->method == 'POST') {
$array_headers['Content-type'] = 'application/x-www-form-urlencoded';
$array_headers['Content-length'] = strlen($content);
} // else method is GET or HEAD. we don't support anything else right now.
elseif ($content) {
$request .= "?$content";
}
// prepare query
$query = "$this->method $request HTTP/1.0\r\n";
foreach ($array_headers as $key => $value) {
$query .= "$key: $value\r\n";
}
$query .= "\r\n";
// if POST we need to append our content
if ($this->method == 'POST' && $content) {
$query .= "$content\r\n\r\n";
}
// query connection
if ($this->bind_host) {
socket_write($socket, $query);
// now load results
while ($out = socket_read($socket, 2048)) {
$this->result .= $out;
}
} else {
fwrite($socket, $query, strlen($query));
// now load results
$this->lastTransferSpeed = 0;
$status = stream_get_meta_data($socket);
$startTime = time();
$length = 0;
$prevSecond = 0;
while (!feof($socket) && !$status['timed_out']) {
$chunk = fgets($socket, 1024);
$length += strlen($chunk);
$this->result .= $chunk;
$elapsedTime = time() - $startTime;
if ($elapsedTime > 0) {
$this->lastTransferSpeed = ($length / 1024) / $elapsedTime;
}
if ($doSpeedCheck > 0 && $elapsedTime > 5 && $this->lastTransferSpeed < $doSpeedCheck) {
$this->warn[] = 'kB/s for last 5 seconds is below 50 kB/s (~' . (($length / 1024) / $elapsedTime) . '), dropping connection...';
$this->result_status_code = 503;
break;
}
}
if ($this->lastTransferSpeed == 0) {
$this->lastTransferSpeed = $length / 1024;
}
}
[$this->result_header, $this->result_body] = preg_split("/\r\n\r\n/", $this->result, 2);
if ($this->bind_host) {
socket_close($socket);
} else {
fclose($socket);
}
$this->query_cache[] = $query;
$headers = $this->fetch_header();
// what return status did we get?
if (!$this->result_status_code) {
preg_match("#HTTP/1\.. (\d+)#", $headers[0], $matches);
$this->result_status_code = $matches[1];
}
// did we get the full file?
if (!empty($headers['content-length']) && $headers['content-length'] != strlen($this->result_body)) {
$this->result_status_code = 206;
}
// now, if we're being passed a location header, should we follow it?
if ($this->doFollowLocationHeader) {
//dont bother if we didn't even setup the script correctly
if (isset($headers['x-use-https']) && $headers['x-use-https'] == 'yes') {
die($this->ssl_setting_message);
}
if (isset($headers['location'])) {
if ($this->max_redirects <= 0) {
die('Too many redirects on: ' . $headers['location']);
}
$this->max_redirects--;
$this->redirectURL = $headers['location'];
$this->query($headers['location']);
}
}
}
public function getTransferSpeed()
{
return $this->lastTransferSpeed;
}
/**
* The quick way to get a URL's content :)
*
* @param string URL
* @param boolean return as array? (like PHP's file() command)
* @return string result body
*/
public function get($location, $asArray = false)
{
$this->query($location);
if ($this->get_status_code() == 200) {
if ($asArray) {
return explode("\n", $this->fetch_body());
}
return $this->fetch_body();
}
return false;
}
/**
* Returns the last status code.
* 200 = OK;
* 403 = FORBIDDEN;
* etc.
*
* @return int status code
*/
public function get_status_code()
{
return $this->result_status_code;
}
/**
* Adds a header, sent with the next query.
*
* @param string header name
* @param string header value
*/
public function add_header($key, $value)
{
$this->extra_headers[$key] = $value;
}
/**
* Clears any extra headers.
*
*/
public function clear_headers()
{
$this->extra_headers = array();
}
/**
* Return the result of a query.
*
* @return string result
*/
public function fetch_result()
{
return $this->result;
}
/**
* Return the header of result (stuff before body).
*
* @param string (optional) header to return
* @return array result header
*/
public function fetch_header($header = '')
{
$array_headers = preg_split("/\r\n/", $this->result_header);
$array_return = array(0 => $array_headers[0]);
unset($array_headers[0]);
foreach ($array_headers as $pair) {
[$key, $value] = explode(': ', $pair, 2);
$array_return[strtolower($key)] = $value;
}
if ($header != '') {
return $array_return[strtolower($header)];
}
return $array_return;
}
/**
* Return the body of result (stuff after header).
*
* @return string result body
*/
public function fetch_body()
{
return $this->result_body;
}
/**
* Return parsed body in array format.
*
* @return array result parsed
*/
public function fetch_parsed_body()
{
parse_str($this->result_body, $x);
return $x;
}
/**
* Set a specifc message on how to change the SSL setting, in the event that it's not set correctly.
*/
public function set_ssl_setting_message($str)
{
$this->ssl_setting_message = $str;
}
}

@ -1,18 +0,0 @@
<?php
namespace App\Utils;
class Helper
{
public static function getParam($request, $queryString): ?string
{
return $request->getQueryParams()[$queryString] ?? null;
}
public static function getData($request, $name)
{
return $request->getParsedBody()[$name];
}
}

@ -1,9 +0,0 @@
<?php
namespace App\Utils;
class Pay
{
}

@ -1,88 +1,27 @@
<?php
declare(strict_types=1);
namespace App\Utils;
use App\Services\Config;
use Zxing\QrReader;
use ZBarCodeImage;
use ZBarCodeScanner;
class QRcode
{
public static function decode($url)
/**
* Decode QR code
*
* @param string $source QR code source url/path
*
* @return string|null Decoded string, null for empty
*/
public static function decode(string $source)
{
switch (Config::get('qrcode')) {
case 'phpzbar':
return self::phpzbar_decode($url);
case 'online':
return self::online_decode($url);
case 'zxing_local':
return self::zxing_local_decode($url);
default:
return self::zxing_decode($url);
}
}
public static function online_decode($url)
{
$data = array();
$data['fileurl'] = $url;
$param = http_build_query($data, '', '&');
$sock = new HTTPSocket();
$sock->connect('api.qrserver.com', 80);
$sock->set_method('GET');
$sock->query('/v1/read-qr-code/', $param);
$raw_text = $sock->fetch_body();
$result_array = json_decode($raw_text, true);
if (isset($result_array[0])) {
return $result_array[0]['symbol'][0]['data'];
}
return null;
}
public static function phpzbar_decode($url)
{
$filepath = BASE_PATH . '/storage/' . time() . random_int(1, 100) . '.png';
$img = file_get_contents($url);
file_put_contents($filepath, $img);
/* Create new image object */
$image = new ZBarCodeImage($filepath);
/* Create a barcode scanner */
$scanner = new ZBarCodeScanner();
/* Scan the image */
$barcode = $scanner->scan($image);
unlink($filepath);
return ($barcode[0]['data'] ?? null);
}
public static function zxing_local_decode($url)
{
$filepath = BASE_PATH . '/storage/' . time() . random_int(1, 100) . '.png';
$img = file_get_contents($url);
file_put_contents($filepath, $img);
$qrcode = new QrReader($filepath);
$text = $qrcode->text(); //return decoded text from QR Code
unlink($filepath);
if ($text == null || $text == '') {
$img = file_get_contents($source);
$qrcode = new QrReader($img, QrReader::SOURCE_TYPE_BLOB);
$text = $qrcode->text();
if ($text == false || $text == '') {
return null;
}
return $text;
}
public static function zxing_decode($url)
{
$raw_text = file_get_contents('https://zxing.org/w/decode?u=' . urlencode($url));
return Tools::get_middle_text($raw_text, '<tr><td>Raw text</td><td><pre>', '</pre></td></tr><tr><td>Raw bytes</td><td><pre>');
}
}

@ -17,7 +17,7 @@ class Radius
*/
public static function Add($user, $pwd)
{
if (Config::get('enable_radius') == 'true') {
if (Config::get('enable_radius') == true) {
$email = $user->email;
$email = str_replace(array('@', '.'), '', $email);
@ -51,7 +51,7 @@ class Radius
public static function Delete($email)
{
if (Config::get('enable_radius') == 'true') {
if (Config::get('enable_radius') == true) {
$email = str_replace(array('@', '.'), '', $email);
@ -66,7 +66,7 @@ class Radius
public static function ChangeUserName($origin_email, $new_email, $passwd)
{
if (Config::get('enable_radius') == 'true') {
if (Config::get('enable_radius') == true) {
$email1 = str_replace(array('@', '.'), '', $origin_email);
$email2 = str_replace(array('@', '.'), '', $new_email);
@ -105,7 +105,7 @@ class Radius
public static function AddNas($ip, $name)
{
if (Config::get('enable_radius') == 'true') {
if (Config::get('enable_radius') == true) {
$exists = RadiusNas::where('shortname', $ip)->first();
if ($exists == null) {
$exists = new RadiusNas();
@ -121,7 +121,7 @@ class Radius
public static function DelNas($ip)
{
if (Config::get('enable_radius') == 'true') {
if (Config::get('enable_radius') == true) {
RadiusNas::where('shortname', $ip)->delete();
}
}

@ -1,11 +0,0 @@
<?php
namespace App\Utils;
class Response
{
public static function redirect($response, $to)
{
return $response->withStatus(302)->withHeader('Location', $to);
}
}

@ -14,7 +14,7 @@ class Telegram
*/
public static function Send($messageText)
{
if (Config::get('enable_telegram') == 'true') {
if (Config::get('enable_telegram') == true) {
$bot = new BotApi(Config::get('telegram_token'));
try {
$bot->sendMessage(Config::get('telegram_chatid'), $messageText);
@ -27,7 +27,7 @@ class Telegram
public static function SendMarkdown($messageText)
{
if (Config::get('enable_telegram') == 'true') {
if (Config::get('enable_telegram') == true) {
$bot = new BotApi(Config::get('telegram_token'));
try {
$bot->sendMessage(Config::get('telegram_chatid'), $messageText, 'Markdown');

@ -280,7 +280,7 @@ class Tools
$relay_able_list = Config::getSupportParam('relay_able_protocol');
return in_array($user->protocol, $relay_able_list) || Config::get('relay_insecure_mode') == 'true';
return in_array($user->protocol, $relay_able_list) || Config::get('relay_insecure_mode') == true;
}
public static function has_conflict_rule($input_rule, $ruleset, $edit_rule_id = 0, $origin_node_id = 0, $user_id = 0)
@ -786,11 +786,11 @@ class Tools
: ($done['emoji'] . ' ' . $Name));
}
/**
* Add files and sub-directories in a folder to zip file.
* @param string $folder
* @param ZipArchive $zipFile
* @param int $exclusiveLength Number of text to be exclusived from the file path.
/**
* Add files and sub-directories in a folder to zip file.
* @param string $folder
* @param ZipArchive $zipFile
* @param int $exclusiveLength Number of text to be exclusived from the file path.
*/
public static function folderToZip($folder, &$zipFile, $exclusiveLength)
{
@ -798,12 +798,12 @@ class Tools
while (false !== $f = readdir($handle)) {
if ($f != '.' && $f != '..') {
$filePath = "$folder/$f";
// Remove prefix from file path before add to zip.
// Remove prefix from file path before add to zip.
$localPath = substr($filePath, $exclusiveLength);
if (is_file($filePath)) {
$zipFile->addFile($filePath, $localPath);
} elseif (is_dir($filePath)) {
// Add sub-directory.
// Add sub-directory.
$zipFile->addEmptyDir($localPath);
self::folderToZip($filePath, $zipFile, $exclusiveLength);
}

@ -8,7 +8,7 @@ class Tuling
{
public static function chat($user, $text)
{
if (Config::get('enable_tuling') == 'true') {
if (Config::get('enable_tuling') == true) {
$data = array();
$data['key'] = Config::get('tuling_apikey');
$data['userid'] = $user;

@ -1,7 +1,6 @@
{
"require": {
"slim/slim": "~3.0",
"slim/csrf": "*",
"smarty/smarty": "3.*",
"mailgun/mailgun-php": "^2.6.0",
"predis/predis": "~1.0",
@ -10,8 +9,6 @@
"firebase/php-jwt": "~3.0",
"aws/aws-sdk-php": "3.*",
"gregwar/captcha": "1.*",
"cloudxns/cloud-xns-api-sdk-php": "*",
"guzzlehttp/guzzle": "^6.2.2",
"voku/anti-xss": "^1.2",
"paymentwall/paymentwall-php": "^2.1",
"telegram-bot/api": "^2.2",
@ -19,12 +16,12 @@
"illuminate/database": "5.2.*",
"sendgrid/sendgrid": "^5.1",
"esdeathlove/datatables": "^1.6",
"slim/twig-view": "1.2.0",
"ramsey/uuid": "^3.0@dev",
"cloudflare/sdk": "1.1.1",
"chen-see/chen-pay": "^1.0@dev",
"league/omnipay": "^3",
"lokielse/omnipay-alipay": "*",
"khanamiryan/qrcode-detector-decoder": "*"
"charlottedunois/yasmin": "*",
"khanamiryan/qrcode-detector-decoder": "*",
"remotelyliving/php-dns": "3.0.6",

@ -11,7 +11,7 @@ crisp已被替换为mylivechat
telegrma_qrcode被重命名为qrcode
';
$_ENV['version']='1'; //仅当涉及【需要修改config以外的文件】时才需要+1,站长勿动
$_ENV['version'] = '1'; //仅当涉及【需要修改config以外的文件】时才需要+1,站长勿动
//基本设置--------------------------------------------------------------------------------------------
@ -19,8 +19,8 @@ $_ENV['key'] = '1145141919810'; //!!! 瞎 jb 修改此key为随机字符串
$_ENV['debug'] = false; //正式环境请确保为 false
$_ENV['appName'] = 'sspanel'; //站点名称
$_ENV['baseUrl'] = 'http://url.com'; //站点地址
$_ENV['subUrl'] = $_ENV['baseUrl'].'/link/'; //订阅地址,如需和站点名称相同,请不要修改
$_ENV['muKey'] = 'NimaQu'; //用于校验魔改后端请求,可以随意修改,但请保持前后端一致,否则节点不能工作!
$_ENV['subUrl'] = $_ENV['baseUrl'] . '/link/'; //订阅地址,如需和站点名称相同,请不要修改
$_ENV['muKey'] = 'default_mu_key'; //用于校验魔改后端请求,可以随意修改,但请保持前后端一致,否则节点不能工作!
$_ENV['db_driver'] = 'mysql'; //数据库程序
$_ENV['db_host'] = 'localhost'; //数据库地址
$_ENV['db_database'] = 'sspanel'; //数据库名
@ -28,7 +28,7 @@ $_ENV['db_username'] = 'root'; //数据库用户名
$_ENV['db_password'] = 'sspanel'; //用户名对应的密码
// 新旧首页设置--------------------------------------------------------------------------------------------
$_ENV['newIndex'] = 'true'; //使用新的 Node.js 开发的首页请填写 true,其他值为使用先前的首页,如您使用其他主题请保持 true
$_ENV['newIndex'] = true; //使用新的 Node.js 开发的首页请填写 true,其他值为使用先前的首页,如您使用其他主题请保持 true
$_ENV['checkNodeIp'] = true; //是否webapi验证节点ip
// 订阅中的公告信息
@ -48,11 +48,11 @@ $_ENV['mailgun_sender'] = '';
# smtp
$_ENV['smtp_host'] = '';
$_ENV['smtp_username'] = '';
$_ENV['smtp_port'] = '465';
$_ENV['smtp_port'] = 465;
$_ENV['smtp_name'] = '';
$_ENV['smtp_sender'] = '';
$_ENV['smtp_passsword'] = '';
$_ENV['smtp_ssl'] = 'true';
$_ENV['smtp_ssl'] = true;
# sendgrid
$_ENV['sendgrid_key'] = '';
@ -60,69 +60,75 @@ $_ENV['sendgrid_sender'] = '';
//备份设置--------------------------------------------------------------------------------------------
$_ENV['auto_backup_email']=''; //接收备份的邮箱
$_ENV['auto_backup_passwd']=''; //备份的压缩密码
$_ENV['backup_notify']='true'; //备份通知到TG群中
$_ENV['auto_backup_email'] = ''; //接收备份的邮箱
$_ENV['auto_backup_passwd'] = ''; //备份的压缩密码
$_ENV['backup_notify'] = true; //备份通知到TG群中
//用户注册设置-----------------------------------------------------------------------------------------
$_ENV['register_mode'] = 'open'; //注册模式。close:关闭,open:开放,invite:仅限邀请码
$_ENV['defaultTraffic'] = '1'; //用户初始流量 单位GB
$_ENV['user_expire_in_default']='3650'; //用户账户过期时间,在注册时设置。(天)
$_ENV['user_class_default']='0'; //用户注册等级,在注册时设置。
$_ENV['user_class_expire_default']='24'; //用户等级过期时间,在注册时设置。(小时)
$_ENV['user_conn']='0'; //用户注册客户端数量限制,0为不限制
$_ENV['user_speedlimit']='0'; //用户注册速度默认限制,0为不限制
$_ENV['reg_auto_reset_day']='0'; //注册时的流量重置日,0为不重置
$_ENV['reg_auto_reset_bandwidth']='0'; //需要重置的流量,0为不重置
$_ENV['ramdom_group']='0'; //注册时随机分组,注册时随机分配到的分组,多个分组请用英文半角逗号分隔。
$_ENV['reg_method']='chacha20-ietf'; //注册时默认加密方式
$_ENV['reg_protocol']='auth_aes128_sha1'; //注册时默认协议
$_ENV['reg_protocol_param']=''; //注册时默认协议参数
$_ENV['reg_obfs']='http_simple'; //注册时默认混淆方式
$_ENV['reg_obfs_param']='www.jd.hk'; //注册时默认混淆参数
$_ENV['reg_forbidden_ip']='127.0.0.0/8,::1/128'; //注册时默认禁止访问IP列表,半角英文逗号分割
$_ENV['min_port']='10000'; //用户端口池最小值
$_ENV['max_port']='65535'; //用户端口池最大值
$_ENV['reg_forbidden_port']=''; //注册时默认禁止访问端口列表,半角英文逗号分割,支持端口段
$_ENV['mu_suffix']='microsoft.com'; //单端口多用户混淆参数后缀,可以随意修改,但请保持前后端一致
$_ENV['mu_regex']='%5m%id.%suffix'; //单端口多用户混淆参数表达式,%5m代表取用户特征 md5 的前五位,%id 代表用户id,%suffix 代表上面这个后缀。
$_ENV['defaultTraffic'] = 1; //用户初始流量 单位GB
$_ENV['user_expire_in_default'] = 3650; //用户账户过期时间,在注册时设置。(天)
$_ENV['user_class_default'] = 0; //用户注册等级,在注册时设置。
$_ENV['user_class_expire_default'] = 24; //用户等级过期时间,在注册时设置。(小时)
$_ENV['user_conn'] = 0; //用户注册客户端数量限制,0为不限制
$_ENV['user_speedlimit'] = 0; //用户注册速度默认限制,0为不限制
$_ENV['reg_auto_reset_day'] = 0; //注册时的流量重置日,0为不重置
$_ENV['reg_auto_reset_bandwidth'] = 0; //需要重置的流量,0为不重置
$_ENV['ramdom_group'] = 0; //注册时随机分组,注册时随机分配到的分组,多个分组请用英文半角逗号分隔。
$_ENV['reg_method'] = 'chacha20-ietf'; //注册时默认加密方式
$_ENV['reg_protocol'] = 'auth_aes128_sha1'; //注册时默认协议
$_ENV['reg_protocol_param'] = ''; //注册时默认协议参数
$_ENV['reg_obfs'] = 'http_simple'; //注册时默认混淆方式
$_ENV['reg_obfs_param'] = ''; //注册时默认混淆参数 设置单端口后 这边必须配置!填写www.jd.hk就行
$_ENV['reg_forbidden_ip'] = '127.0.0.0/8,::1/128'; //注册时默认禁止访问IP列表,半角英文逗号分割
$_ENV['min_port'] = 10000; //用户端口池最小值
$_ENV['max_port'] = 65535; //用户端口池最大值
$_ENV['reg_forbidden_port'] = ''; //注册时默认禁止访问端口列表,半角英文逗号分割,支持端口段
$_ENV['mu_suffix'] = 'microsoft.com'; //单端口多用户混淆参数后缀,可以随意修改,但请保持前后端一致
$_ENV['mu_regex'] = '%5m%id.%suffix'; //单端口多用户混淆参数表达式,%5m代表取用户特征 md5 的前五位,%id 代表用户id,%suffix 代表上面这个后缀。
#邀请链接
$_ENV['inviteNum'] = '10'; //注册后的邀请链接可用次数
$_ENV['invite_get_money']='1'; //新用户通过私人邀请链接注册时,获得奖励金额(作为初始资金)
$_ENV['invite_price']='-1'; //用户购买邀请码所需要的价格,价格小于0时视为不开放购买
$_ENV['custom_invite_price']='-1'; //用户定制邀请码所需要的价格,价格小于0时视为不开放购买
$_ENV['inviteNum'] = 10; //注册后的邀请链接可用次数
$_ENV['invite_get_money'] = 1; //新用户通过私人邀请链接注册时,获得奖励金额(作为初始资金)
$_ENV['invite_price'] = -1; //用户购买邀请码所需要的价格,价格小于0时视为不开放购买
$_ENV['custom_invite_price'] = -1; //用户定制邀请码所需要的价格,价格小于0时视为不开放购买
#邮箱验证
$_ENV['enable_email_verify']='false'; //是否启用注册邮箱验证码
$_ENV['email_verify_ttl']='3600'; //邮箱验证码有效期
$_ENV['email_verify_iplimit']='10'; //验证码有效期内,单IP可请求验证码次数
$_ENV['enable_email_verify'] = false; //是否启用注册邮箱验证码
$_ENV['email_verify_ttl'] = 3600; //邮箱验证码有效期
$_ENV['email_verify_iplimit'] = 10; //验证码有效期内,单IP可请求验证码次数
//已注册用户设置---------------------------------------------------------------------------------------
#基础
$_ENV['checkinMin'] = '1'; //用户签到最少流量 单位MB
$_ENV['checkinMax'] = '50'; //用户签到最多流量
$_ENV['auto_clean_uncheck_days']='-1'; //自动清理多少天没签到的0级用户,小于等于0时关闭
$_ENV['auto_clean_unused_days']='-1'; //自动清理多少天没使用的0级用户,小于等于0时关闭
$_ENV['auto_clean_min_money']='1'; //余额低于多少的0级用户可以被清理
$_ENV['code_payback']='20'; //充值返利百分比
$_ENV['invite_gift']='2'; //邀请新用户获得流量奖励,单位G
$_ENV['enable_bought_reset']='true'; //购买时是否重置流量
$_ENV['enable_bought_extend']='true'; //购买时是否延长等级期限(同等级配套)
$_ENV['port_price']='-1'; //用户随机重置端口所需要的价格,价格小于0时视为不开放购买
$_ENV['port_price_specify']='-1'; //用户指明钦定端口所需要的价格,价格小于0时视为不开放购买
$_ENV['checkinMin'] = 1; //用户签到最少流量 单位MB
$_ENV['checkinMax'] = 50; //用户签到最多流量
$_ENV['auto_clean_uncheck_days'] = -1; //自动清理多少天没签到的0级用户,小于等于0时关闭
$_ENV['auto_clean_unused_days'] = -1; //自动清理多少天没使用的0级用户,小于等于0时关闭
$_ENV['auto_clean_min_money'] = 1; //余额低于多少的0级用户可以被清理
$_ENV['code_payback'] = 20; //充值返利百分比
$_ENV['invite_gift'] = 2; //邀请新用户获得流量奖励,单位G
$_ENV['enable_bought_reset'] = true; //购买时是否重置流量
$_ENV['enable_bought_extend'] = true; //购买时是否延长等级期限(同等级配套)
$_ENV['port_price'] = -1; //用户随机重置端口所需要的价格,价格小于0时视为不开放购买
$_ENV['port_price_specify'] = -1; //用户指明钦定端口所需要的价格,价格小于0时视为不开放购买
#高级
$_ENV['class_expire_reset_traffic']='0'; //等级到期时重置为的流量值,单位GB,小于0时不重置
$_ENV['account_expire_delete_days']='-1'; //账户到期几天之后会删除账户,小于0时不删除
$_ENV['enable_kill']='true'; //是否允许用户注销账户
$_ENV['notify_limit_mode'] = 'false'; //false为关闭,per为按照百分比提醒,mb为按照固定剩余流量提醒
$_ENV['notify_limit_value'] = '20'; //当上一项为per时,此处填写百分比;当上一项为mb时,此处填写流量
$_ENV['mergeSub'] = 'false'; //合并订阅设置 可选项 false / true,此项在 Rico && GeekQu 仓库已废弃
$_ENV['protocol_specify'] = 'true'; //允许用户自行切换加密、协议、混淆,允许请填写 true,禁止用户自行修改将使用下方配置的方案
$_ENV['keep_connect'] = 'false'; //是否开启用户流量耗尽后降低速率至 1Mbps 而不断网
$_ENV['class_expire_reset_traffic'] = 0; //等级到期时重置为的流量值,单位GB,小于0时不重置
$_ENV['account_expire_delete_days'] = -1; //账户到期几天之后会删除账户,小于0时不删除
$_ENV['enable_kill'] = true; //是否允许用户注销账户
$_ENV['notify_limit_mode'] = true; //false为关闭,per为按照百分比提醒,mb为按照固定剩余流量提醒
$_ENV['notify_limit_value'] = 20; //当上一项为per时,此处填写百分比;当上一项为mb时,此处填写流量
$_ENV['mergeSub'] = true; //合并订阅设置 可选项 false / true
$_ENV['class_expire_reset_traffic']=0; //等级到期时重置为的流量值,单位GB,小于0时不重置
$_ENV['account_expire_delete_days']=-1; //账户到期几天之后会删除账户,小于0时不删除
$_ENV['enable_kill']=true; //是否允许用户注销账户
$_ENV['notify_limit_mode'] = false; //false为关闭,per为按照百分比提醒,mb为按照固定剩余流量提醒
$_ENV['notify_limit_value'] = 20; //当上一项为per时,此处填写百分比;当上一项为mb时,此处填写流量
$_ENV['mergeSub'] = false; //合并订阅设置 可选项 false / true,此项在 Rico && GeekQu 仓库已废弃
$_ENV['protocol_specify'] = true; //允许用户自行切换加密、协议、混淆,允许请填写 true,禁止用户自行修改将使用下方配置的方案
$_ENV['keep_connect'] = false; //是否开启用户流量耗尽后降低速率至 1Mbps 而不断网
#加密、协议、混淆切换方案
$_ENV['user_agreement_scheme'] = [
@ -131,51 +137,45 @@ $_ENV['user_agreement_scheme'] = [
['id'=>3,'name'=>'SS/SSR 兼容配置','method'=>'chacha20-ietf','protocol'=>'auth_aes128_sha1_compatible','obfs'=>'plain']
];
$_ENV['subscribeLog'] = 'false'; //是否记录用户订阅日志
$_ENV['subscribeLog_keep_days'] = '7'; //订阅记录保留天数
$_ENV['subscribeLog'] = false; //是否记录用户订阅日志
$_ENV['subscribeLog_keep_days'] = 7; //订阅记录保留天数
//Bot 设置--------------------------------------------------------------------------------------------
#通用
$_ENV['qrcode']='zxing_local'; //二维码解码方式,online,phpzbar,zxing_online,zxing_local
$_ENV['finance_public']='false'; //财务报告是否向群公开
$_ENV['enable_welcome_message']='true'; //机器人发送欢迎消息
#Discord
$_ENV['enable_discord']='false'; //是否开启Discord bot(仍未完成)
$_ENV['discord_token']=''; //Discord bot,bot 的 token,在 https://discordapp.com/developers/applications/ 申请
$_ENV['finance_public'] = true; //财务报告是否向群公开
$_ENV['enable_welcome_message'] = true; //机器人发送欢迎消息
#Telegram
$_ENV['enable_telegram']='false'; //是否开启Telegram bot
$_ENV['telegram_token']=''; //Telegram bot,bot 的 token ,跟 father bot 申请
$_ENV['telegram_chatid']=''; //Telegram bot,群组会话 ID,把机器人拉进群里之后跟他 /ping 一下即可得到。
$_ENV['enable_tuling']='false'; //是否开启图灵机器人
$_ENV['tuling_apikey']=''; //图灵机器人API Key
$_ENV['tuling_apisecert']=''; //图灵机器人密钥
$_ENV['telegram_bot']='_bot'; //Telegram 机器人账号
$_ENV['telegram_group_quiet']='false'; //Telegram 机器人在群组中不回应
$_ENV['telegram_request_token']=''; //Telegram 机器人请求Key,随意设置,由大小写英文和数字组成,更新这个参数之后请 php xcat setTelegram
$_ENV['enable_telegram'] = true; //是否开启Telegram bot
$_ENV['telegram_token'] = ''; //Telegram bot,bot 的 token ,跟 father bot 申请
$_ENV['telegram_chatid'] = ''; //Telegram bot,群组会话 ID,把机器人拉进群里之后跟他 /ping 一下即可得到。
$_ENV['enable_tuling'] = true; //是否开启图灵机器人
$_ENV['tuling_apikey'] = ''; //图灵机器人API Key
$_ENV['tuling_apisecert'] = ''; //图灵机器人密钥
$_ENV['telegram_bot'] = '_bot'; //Telegram 机器人账号
$_ENV['telegram_group_quiet'] = true; //Telegram 机器人在群组中不回应
$_ENV['telegram_request_token'] = ''; //Telegram 机器人请求Key,随意设置,由大小写英文和数字组成,更新这个参数之后请 php xcat setTelegram
//沟通设置--------------------------------------------------------------------------------------------
#客服系统设置,注册地址 https://www.mylivechat.com
$_ENV['enable_mylivechat']='false'; //是否开启客服系统
$_ENV['mylivechat_id']='null'; //客服系统ID
$_ENV['enable_mylivechat'] = true; //是否开启客服系统
$_ENV['mylivechat_id'] = ''; //客服系统ID
# PushBear 基于微信模板的向关注了二维码的用户以微信方式推送消息 https://pushbear.ftqq.com/
$_ENV['usePushBear'] = 'false'; // true 启用 false 禁用
$_ENV['usePushBear'] = true; // true 启用 false 禁用
$_ENV['PushBear_sendkey'] = ''; //请填写您在PushBear获取的sendkey 请仔细检查勿粘贴错
#工单系统设置
$_ENV['enable_ticket']='true'; //是否开启工单系统
$_ENV['mail_ticket']='true'; //是否开启工单邮件提醒
$_ENV['enable_ticket'] = true; //是否开启工单系统
$_ENV['mail_ticket'] = true; //是否开启工单邮件提醒
# Server酱 用户提交新工单或者回复工单时用微信提醒机场主 http://sc.ftqq.com/
$_ENV['useScFtqq'] = 'false'; //是否开启工单Server酱提醒
$_ENV['useScFtqq'] = true; //是否开启工单Server酱提醒
$_ENV['ScFtqq_SCKEY'] = ''; //请填写您在Server酱获取的SCKEY 请仔细检查勿粘贴错
#管理员联系方式设置
$_ENV['enable_admin_contact']='false'; //是否开启管理员联系方式
$_ENV['enable_admin_contact'] = true; //是否开启管理员联系方式
$_ENV['admin_contact1'] = 'QQ:1233456'; //QQ、邮箱、微信仅用于举例
$_ENV['admin_contact2'] = '邮箱123456@qq.com'; //也可以写电话、tg等其他联系方式
$_ENV['admin_contact3'] = '微信~123456'; //没有格式要求,想怎么写就怎么写,可留空
@ -191,127 +191,150 @@ $_ENV['recaptcha_secret'] = '';
$_ENV['geetest_id'] = '';
$_ENV['geetest_key'] = '';
$_ENV['enable_reg_captcha'] = 'false'; //启用注册验证码
$_ENV['enable_login_captcha'] = 'false'; //启用登录验证码
$_ENV['enable_checkin_captcha'] = 'false'; //启用签到验证码
$_ENV['enable_reg_captcha'] = true; //启用注册验证码
$_ENV['enable_login_captcha'] = true; //启用登录验证码
$_ENV['enable_checkin_captcha'] = true; //启用签到验证码
//支付系统设置----------------------------------------------------------------------------------------
#取值 none | codepay | trimepay | f2fpay | chenAlipay | paymentwall | spay |tomatopay | payjs
$_ENV['payment_system']='none';
#取值 none | codepay | f2fpay | chenAlipay | paymentwall | spay |tomatopay | payjs | yftpay
$_ENV['payment_system'] = 'none';
#yft支付设置
$_ENV['yft_secret'] = '';
$_ENV['yft_accesskey'] = '';
#codepay码支付
#wiki地址:https://goo.gl/dRwRDi http://t.cn/RnsWjtB
$_ENV['codepay_id']=''; //码支付ID
$_ENV['codepay_key']=''; //码支付通信密钥
$_ENV['codepay_id'] = ''; //码支付ID
$_ENV['codepay_key'] = ''; //码支付通信密钥
#alipay,f2fpay
$_ENV['f2fpay_app_id']='';
$_ENV['f2fpay_p_id']='';
$_ENV['alipay_public_key']='';
$_ENV['merchant_private_key']='';
$_ENV['f2fNotifyUrl']=null; //自定义当面付回调地址
$_ENV['f2fpay_app_id'] = '';
$_ENV['f2fpay_p_id'] = '';
$_ENV['alipay_public_key'] = '';
$_ENV['merchant_private_key'] = '';
$_ENV['f2fNotifyUrl'] = null; //自定义当面付回调地址
#PaymentWall
$_ENV['pmw_publickey']='';
$_ENV['pmw_privatekey']='';
$_ENV['pmw_widget']='m2_1';
$_ENV['pmw_height']='350px';
$_ENV['pmw_publickey'] = '';
$_ENV['pmw_privatekey'] = '';
$_ENV['pmw_widget'] = 'm2_1';
$_ENV['pmw_height'] = '350px';
#alipay,spay
$_ENV['alipay_id']='';
$_ENV['alipay_key']='';
$_ENV['amount']=[2,23,233,2333,23333]; //充值金额选项设定
$_ENV['alipay_id'] = '';
$_ENV['alipay_key'] = '';
$_ENV['amount'] = [2, 23, 233, 2333, 23333]; //充值金额选项设定
#alipay,zfbjk.com
$_ENV['zfbjk_pid']='';
$_ENV['zfbjk_key']='';
$_ENV['zfbjk_qrcodeurl']='';
#Trimepay https://portal.trimepay.com/#/auth/register/134
$_ENV['trimepay_appid']=''; //AppID
$_ENV['trimepay_secret']=''; //AppSecret
$_ENV['zfbjk_pid'] = '';
$_ENV['zfbjk_key'] = '';
$_ENV['zfbjk_qrcodeurl'] = '';
# BitPay 数字货币支付(比特币、以太坊、EOS等) 商户后台获取授权码 https://merchants.mugglepay.com/
# 客服和技术 24x7 在线支持: https://t.me/joinchat/GLKSKhUnE4GvEAPgqtChAQ
$_ENV['bitpay_secret']='';
$_ENV['bitpay_secret'] = '';
#PayJs
$_ENV['payjs_mchid']='';
$_ENV['payjs_key']='';
$_ENV['payjs_mchid'] = '';
$_ENV['payjs_key'] = '';
#tomatopay番茄云支付
#使用教程:https://swapidc.fanqieui.com/?t/329.html tg群 https://t.me/fanqiepay
$_ENV['tomatopay'] = [
'wxpay'=>[
'mchid' => '', // 商户号
'account' => '', //您在番茄云支付的登录邮箱
'token' => "" // 安全验证码
],
'alipay'=>[
'mchid' => '', // 商户号
'account' => '', //您在番茄云支付的登录邮箱
'token' => "" // 安全验证码
],
];
//其他面板显示设置------------------------------------------------------------------------------------------
#用户文档
$_ENV['enable_documents'] = 'true'; //是否允许未登陆用户查看文档中心
#用户文
$_ENV['enable_documents'] = true; //是否允许未登陆用户查看文档中心
$_ENV['documents_name'] = $_ENV['appName'] . ' 文档中心'; //文档中心名称
$_ENV['remote_documents'] = 'true'; //是否从远程加载文档中心,否的话请执行 php xcat initdocuments
$_ENV['remote_documents'] = true; //是否从远程加载文档中心,否的话请执行 php xcat initdocuments
$_ENV['documents_source'] = 'https://raw.githubusercontent.com/GeekQu/PANEL_DOC/master/GeekQu'; //远程文档加载地址
#后台商品列表 销量统计
$_ENV['sales_period']='30'; //统计指定周期内的销量,值为【expire/任意大于0的整数】
$_ENV['sales_period'] = 30; //统计指定周期内的销量,值为【expire/任意大于0的整数】
#国旗
$_ENV['enable_flag']='false'; //启用该项之前务必先仔细阅读教程
$_ENV['flag_regex']='/.*?(?=\s)/'; //从站点全名中匹配【国家/地区】的正则表达式(php版)
$_ENV['enable_flag'] = true; //启用该项之前务必先仔细阅读教程
$_ENV['flag_regex'] = '/.*?(?=\s)/'; //从站点全名中匹配【国家/地区】的正则表达式(php版)
#捐赠
$_ENV['enable_donate']='false'; //是否显示用户捐赠(所有收入将被公开)
$_ENV['enable_donate'] = true; //是否显示用户捐赠(所有收入将被公开)
#iOS账户显示
$_ENV['display_ios_class']='-1'; //至少等级为多少的用户可以看见,小于0时关闭此功能
$_ENV['display_ios_topup']='0'; //满足等级要求后,累计充值高于多少的用户可以看见
$_ENV['ios_account']=''; //iOS账户
$_ENV['ios_password']=''; //iOS密码
$_ENV['display_ios_class'] = -1; //至少等级为多少的用户可以看见,小于0时关闭此功能
$_ENV['display_ios_topup'] = 0; //满足等级要求后,累计充值高于多少的用户可以看见
$_ENV['ios_account'] = ''; //iOS账户
$_ENV['ios_password'] = ''; //iOS密码
//节点检测-----------------------------------------------------------------------------------------------
#GFW检测,请通过crontab进行【开启/关闭】
$_ENV['detect_gfw_interval']='3600'; //检测间隔,单位:秒,低于推荐值会爆炸
$_ENV['detect_gfw_port']='22'; //所有节点服务器都打开的TCP端口,常用的为22(SSH端口)
$_ENV['detect_gfw_url']='https://cn-qz-tcping.torch.njs.app/{ip}/{port}'; //检测节点是否被gfw墙了的API的URL
$_ENV['detect_gfw_judge']='$json_tcping[\'status\']=="true"'; //判断是否被墙的依据,json_tcping为上方URL返回的json数组
$_ENV['detect_gfw_count']='3'; //尝试次数
$_ENV['detect_gfw_interval'] = 3600; //检测间隔,单位:秒,低于推荐值会爆炸
$_ENV['detect_gfw_port'] = 22; //所有节点服务器都打开的TCP端口,常用的为22(SSH端口)
$_ENV['detect_gfw_url'] = 'https://cn-qz-tcping.torch.njs.app/{ip}/{port}'; //检测节点是否被gfw墙了的API的URL
$_ENV['detect_gfw_judge'] = '$json_tcping[\'status\']=="true"'; //判断是否被墙的依据,json_tcping为上方URL返回的json数组
$_ENV['detect_gfw_count'] = '3'; //尝试次数
#离线检测
$_ENV['enable_detect_offline']='true';
$_ENV['enable_detect_offline'] = true;
#离线检测是否推送到Server酱 请配置好上文的Server配置
$_ENV['enable_detect_offline_useScFtqq']='true';
$_ENV['enable_detect_offline_useScFtqq'] = true;
//V2Ray相关设置------------------------------------------------------------------------------------------
$_ENV['v2ray_port'] = 443; //V2Ray端口
$_ENV['v2ray_protocol'] = 'HTTP/2 + TLS'; //V2Ray协议
$_ENV['v2ray_alter_id'] = 32;
$_ENV['v2ray_level'] = '0';
//以下所有均为高级设置(一般用不上,不用改---------------------------------------------------------------------
#杂项
$_ENV['enable_login_bind_ip']='false'; //是否将登陆线程和IP绑定
$_ENV['rememberMeDuration']='7'; //登录时记住账号时长天数
$_ENV['enable_login_bind_ip'] = true; //是否将登陆线程和IP绑定
$_ENV['rememberMeDuration'] = 7; //登录时记住账号时长天数
$_ENV['authDriver'] = 'cookie'; //不能更改此项
$_ENV['pwdMethod'] = 'md5'; //密码加密 可选 md5, sha256, bcrypt, argon2i, argon2id(argon2i需要至少php7.2)
$_ENV['salt'] = ''; //推荐配合 md5/sha256, bcrypt/argon2i/argon2id 会忽略此项
$_ENV['sessionDriver'] = 'cookie'; //可选: cookie,redis
$_ENV['cacheDriver'] = 'cookie'; //可选: cookie,redis
$_ENV['tokenDriver'] = 'db'; //可选: db,redis
$_ENV['jump_delay']='1200'; //跳转延时,单位ms,不建议太长
$_ENV['theme'] = 'material'; //主题
$_ENV['pacp_offset']='-20000'; //VPN 端口偏移
$_ENV['pacpp_offset']='-20000';
$_ENV['Speedtest_duration']='6'; //显示多长时间的测速记录
$_ENV['login_warn']='false'; //异地登陆提示
$_ENV['jump_delay'] = 1200; //跳转延时,单位ms,不建议太长
$_ENV['theme'] = 'material'; //主题
$_ENV['pacp_offset'] = -20000; //VPN 端口偏移
$_ENV['pacpp_offset'] = -20000;
$_ENV['Speedtest_duration'] = 6; //显示多长时间的测速记录
$_ENV['login_warn'] = true; //异地登陆提示
$_ENV['timeZone'] = 'PRC'; //PRC 天朝时间 UTC 格林时间
$_ENV['db_charset'] = 'utf8';
$_ENV['db_collation'] = 'utf8_general_ci';
$_ENV['db_prefix'] = '';
$_ENV['muKeyList'] = []; //多 key 列表
$_ENV['subscribe_client'] = true; //下载协议客户端时附带节点和订阅信息
$_ENV['muKeyList'] = [' ']; //多 key 列表
$_ENV['mu_port_migration'] = 'false'; //为后端直接下发偏移后的端口
$_ENV['relay_port_migration'] = 'false'; //为中转规则下发偏移后的端口,此项未经测试
$_ENV['add_emoji_to_node_name'] = 'false'; //为部分订阅中默认添加 emoji
$_ENV['add_appName_to_ss_uri'] = 'true'; //为 SS 节点名称中添加站点名
$_ENV['subscribe_client'] = 'false'; //下载协议客户端时附带节点和订阅信息
$_ENV['mu_port_migration'] = false; //为后端直接下发偏移后的端口
$_ENV['relay_port_migration'] = false; //为中转规则下发偏移后的端口,此项未经测试
$_ENV['add_emoji_to_node_name'] = false; //为部分订阅中默认添加 emoji
$_ENV['add_appName_to_ss_uri'] = true; //为 SS 节点名称中添加站点名
// 审计自动封禁开关
$_ENV['enable_auto_detect_ban'] = 'false';
$_ENV['enable_auto_detect_ban'] = false;
// 管理员不受审计限制
$_ENV['auto_detect_ban_allow_admin'] = 'true';
$_ENV['auto_detect_ban_allow_admin'] = true;
// 审计封禁的例外用户 ID
$_ENV['auto_detect_ban_allow_users'] = [];
@ -319,13 +342,13 @@ $_ENV['auto_detect_ban_allow_users'] = [];
// 审计封禁判断类型:
// - 1 = 仁慈模式,每触碰多少次封禁一次
// - 2 = 疯狂模式,累计触碰次数按阶梯进行不同时长的封禁
$_ENV['auto_detect_ban_type'] = '1';
$_ENV['auto_detect_ban_type'] = 1;
// 仁慈模式每次执行封禁所需的触发次数
$_ENV['auto_detect_ban_number'] = '30';
$_ENV['auto_detect_ban_number'] = 30;
// 仁慈模式每次封禁的时长 (分钟)
$_ENV['auto_detect_ban_time'] = '60';
$_ENV['auto_detect_ban_time'] = 60;
// 疯狂模式阶梯
// key 为触发次数
@ -357,41 +380,35 @@ $_ENV['aws_secret_access_key'] = '';
#redis
$_ENV['redis_scheme'] = 'tcp';
$_ENV['redis_host'] = '127.0.0.1';
$_ENV['redis_port'] = '6379';
$_ENV['redis_database'] = '0';
$_ENV['redis_port'] = 6379;
$_ENV['redis_database'] = '';
$_ENV['redis_password']= '';
#Radius设置
$_ENV['enable_radius']='false'; //是否开启Radius
$_ENV['radius_db_host']=''; //以下4项为Radius数据库设置
$_ENV['radius_db_database']='';
$_ENV['radius_db_user']='';
$_ENV['radius_db_password']='';
$_ENV['radius_secret']=''; //Radius连接密钥
#Cloudxns
$_ENV['enable_cloudxns']='false'; //是否开启Cloudxns
$_ENV['cloudxns_apikey']=''; //自己去 cloudxns.net 申请
$_ENV['cloudxns_apisecret']='';
$_ENV['cloudxns_domain']=''; //你的域名
$_ENV['enable_radius'] = true; //是否开启Radius
$_ENV['radius_db_host'] = ''; //以下4项为Radius数据库设置
$_ENV['radius_db_database'] = '';
$_ENV['radius_db_user'] = '';
$_ENV['radius_db_password'] = '';
$_ENV['radius_secret'] = ''; //Radius连接密钥
#Cloudflare
$_ENV['cloudflare_enable']='false'; //是否开启 Cloudflare 解析
$_ENV['cloudflare_email']='user@example.com'; //Cloudflare 邮箱地址
$_ENV['cloudflare_key']='c2547eb745079dac9320b638f5e225cf483cc5cfdda41'; //Cloudflare API Key
$_ENV['cloudflare_name']='example.com'; //域名
$_ENV['cloudflare_enable'] = true; //是否开启 Cloudflare 解析
$_ENV['cloudflare_email'] = 'user@example.com'; //Cloudflare 邮箱地址
$_ENV['cloudflare_key'] = 'c2547eb745079dac9320b638f5e225cf483cc5cfdda41'; //Cloudflare API Key
$_ENV['cloudflare_name'] = 'example.com'; //域名
#不安全中转模式,这个开启之后使用除了 auth_aes128_md5 或者 auth_aes128_sha1 以外的协议地用户也可以设置和使用中转
$_ENV['relay_insecure_mode']='false'; //强烈推荐不开启
$_ENV['relay_insecure_mode'] = true; //强烈推荐不开启
#是否夹带统计代码,自己在 resources/views/{主题名} 下创建一个 analytics.tpl ,如果有必要就用 literal 界定符
$_ENV['enable_analytics_code']='false';
$_ENV['sspanelAnalysis'] = 'true';
$_ENV['enable_analytics_code'] = true;
$_ENV['sspanelAnalysis'] = true;
//自定义设置---------------------------------------------------------------------
//是否向 Telegram 群组推送系统今天的运行状况
$_ENV['sendDiary_Telegram'] = 'true';
$_ENV['sendDiary_Telegram'] = true;
//自定义向 Telegram 群组推送系统今天的运行状况的信息
$_ENV['sendDiary_Msg'] = ('各位老爷少奶奶,我来为大家报告一下系统今天的运行状况哈~' . PHP_EOL
@ -400,14 +417,14 @@ $_ENV['sendDiary_Msg'] = ('各位老爷少奶奶,我来为大家报告一下
. '晚安~');
//是否向 Telegram 群组推送数据库清理通知
$_ENV['sendDailyJob_Telegram'] = 'true';
$_ENV['sendDailyJob_Telegram'] = true;
//自定义向 Telegram 群组推送数据库清理通知的信息
$_ENV['sendDailyJob_Msg'] = '姐姐姐姐,数据库被清理了,感觉身体被掏空了呢~';
//是否向 Telegram 群组推送节点掉线通知
$_ENV['sendNodeOffline_Telegram'] = 'true';
$_ENV['sendNodeOffline_Telegram'] = true;
//自定义向 Telegram 群组推送节点掉线已切换通知的信息
$_ENV['sendNodeOffline_Update_Msg'] = '喵喵喵~ %node_name% 节点掉线了喵~域名解析被切换到了 %Temp_node_name% 上了喵~';
@ -417,7 +434,7 @@ $_ENV['sendNodeOffline_Msg'] = '喵喵喵~ %node_name% 节点掉线了喵~';
//是否向 Telegram 群组推送节点上线通知
$_ENV['sendNodeOnline_Telegram'] = 'true';
$_ENV['sendNodeOnline_Telegram'] = true;
//自定义向 Telegram 群组推送节点上线已切换通知的信息
$_ENV['sendNodeOnline_Update_Msg'] = '喵喵喵~ %node_name% 节点恢复了喵~域名解析被切换回来了喵~';
@ -427,7 +444,7 @@ $_ENV['sendNodeOnline_Msg'] = '喵喵喵~ %node_name% 节点恢复了喵~';
//是否向 Telegram 群组推送节点被墙通知
$_ENV['sendNodeGFW_Telegram'] = 'true';
$_ENV['sendNodeGFW_Telegram'] = true;
//自定义向 Telegram 群组推送节点被墙已切换通知的信息
$_ENV['sendNodeGFW_Update_Msg'] = '喵喵喵~ %node_name% 节点被墙了喵~域名解析被切换到了 %Temp_node_name% 上了喵~';
@ -437,7 +454,7 @@ $_ENV['sendNodeGFW_Msg'] = '喵喵喵~ %node_name% 节点被墙了喵~';
//是否向 Telegram 群组推送节点被墙恢复通知
$_ENV['sendNodeGFW_recover_Telegram'] = 'true';
$_ENV['sendNodeGFW_recover_Telegram'] = true;
//自定义向 Telegram 群组推送节点被墙恢复已切换通知的信息
$_ENV['sendNodeGFW_recover_Update_Msg'] = '喵喵喵~ %node_name% 节点恢复了喵~域名解析被切换回来了喵~';
@ -447,21 +464,21 @@ $_ENV['sendNodeGFW_recover_Msg'] = '喵喵喵~ %node_name% 节点恢复了喵~';
//是否向 Telegram 群组推送节点新增通知
$_ENV['sendAddNode_Telegram'] = 'true';
$_ENV['sendAddNode_Telegram'] = true;
//自定义向 Telegram 群组推送节点新增通知的信息
$_ENV['sendAddNode_Msg'] = '新节点添加~ %node_name%';
//是否向 Telegram 群组推送节点修改通知
$_ENV['sendUpdateNode_Telegram'] = 'true';
$_ENV['sendUpdateNode_Telegram'] = true;
//自定义向 Telegram 群组推送节点修改通知的信息
$_ENV['sendUpdateNode_Msg'] = '节点信息被修改~ %node_name%';
//是否向 Telegram 群组推送节点删除通知
$_ENV['sendDeleteNode_Telegram'] = 'true';
$_ENV['sendDeleteNode_Telegram'] = true;
//自定义向 Telegram 群组推送节点删除通知的信息
$_ENV['sendDeleteNode_Msg'] = '节点被删除~ %node_name%';

@ -60,6 +60,8 @@ $app->post('/notify', App\Controllers\HomeController::class . ':notify');
$app->get('/tos', App\Controllers\HomeController::class . ':tos');
$app->get('/staff', App\Controllers\HomeController::class . ':staff');
$app->post('/telegram_callback', App\Controllers\HomeController::class . ':telegram');
$app->post('/tomato_back/{type}', 'App\Services\Payment:notify');
$app->get('/tomato_back/{type}', 'App\Services\Payment:notify');
// User Center
$app->group('/user', function () {
@ -129,7 +131,6 @@ $app->group('/user', function () {
$this->post('/gaset', App\Controllers\UserController::class . ':GaSet');
$this->get('/gareset', App\Controllers\UserController::class . ':GaReset');
$this->get('/telegram_reset', App\Controllers\UserController::class . ':telegram_reset');
$this->get('/discord_reset', App\Controllers\UserController::class . ':discord_reset');
$this->post('/resetport', App\Controllers\UserController::class . ':ResetPort');
$this->post('/specifyport', App\Controllers\UserController::class . ':SpecifyPort');
$this->post('/pacset', App\Controllers\UserController::class . ':PacSet');
@ -157,9 +158,13 @@ $app->group('/user', function () {
// Crypto Payment - BTC, ETH, EOS, BCH, LTC etch
$this->post('/payment/bitpay/purchase', App\Services\BitPayment::class . ':purchase');
$this->get('/payment/bitpay/return', App\Services\BitPayment::class . ':returnHTML');
// getPcClient
$this->get('/getPcClient', App\Controllers\UserController::class . ':getPcClient');
})->add(new Auth());
$app->group('/payment', function () {
$this->get('/notify', App\Services\Payment::class . ':notify');
$this->post('/notify', App\Services\Payment::class . ':notify');
$this->post('/notify/{type}', App\Services\Payment::class . ':notify');
$this->post('/status', App\Services\Payment::class . ':getStatus');
@ -314,23 +319,6 @@ $app->group('/admin', function () {
$this->post('/payback/ajax', App\Controllers\AdminController::class . ':ajax_payback');
})->add(new Admin());
// API
$app->group('/api', function () {
$this->get('/token/{token}', App\Controllers\ApiController::class . ':token');
$this->post('/token', App\Controllers\ApiController::class . ':newToken');
$this->get('/node', App\Controllers\ApiController::class . ':node')->add(new Api());
$this->get('/user/{id}', App\Controllers\ApiController::class . ':userInfo')->add(new Api());
$this->get('/sublink', App\Controllers\Client\ClientApiController::class . ':GetSubLink');
});
// mu
$app->group('/mu', function () {
$this->get('/users', App\Controllers\Mu\UserController::class . ':index');
$this->post('/users/{id}/traffic', App\Controllers\Mu\UserController::class . ':addTraffic');
$this->post('/nodes/{id}/online_count', App\Controllers\Mu\NodeController::class . ':onlineUserLog');
$this->post('/nodes/{id}/info', App\Controllers\Mu\NodeController::class . ':info');
})->add(new Mu());
// mu
$app->group('/mod_mu', function () {
$this->get('/nodes/{id}/info', App\Controllers\Mod_Mu\NodeController::class . ':get_info');
@ -389,6 +377,7 @@ $app->get('/gettransfer', App\Controllers\VueController::class . ':getTransfer')
$app->get('/getCaptcha', App\Controllers\VueController::class . ':getCaptcha');
$app->post('/getChargeLog', App\Controllers\VueController::class . ':getChargeLog');
$app->get('/getnodelist', App\Controllers\VueController::class . ':getNodeList');
$app->get('/nodeinfo/{id}', App\Controllers\VueController::class . ':getNodeInfo');
/**
* chenPay

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1 @@
请将已解压的客户端存放在对应文件夹中

@ -1,3 +1,3 @@
尊敬的用户您好:
如您在使用上遇到问题,请注意在我们的网站上查询相关的教程或联系我们。
如您在使用上遇到问题,请注意在我们的网站上查询相关的教程或联系我们。

@ -1,3 +1,3 @@
尊敬的用户您好:
如您在使用上遇到问题,请注意在我们的网站上查询相关的教程或联系我们。
如您在使用上遇到问题,请注意在我们的网站上查询相关的教程或联系我们。

@ -1,3 +1,3 @@
尊敬的用户您好:
如您在使用上遇到问题,请注意在我们的网站上查询相关的教程或联系我们。
如您在使用上遇到问题,请注意在我们的网站上查询相关的教程或联系我们。

@ -16,11 +16,11 @@
<div class="card-inner">
<p>系统中金额流转记录。</p>
<p>
今日流水:¥{$user->todayIncome()}<br/>
昨日流水:¥{$user->yesterdayIncome()}<br/>
这月流水:¥{$user->thisMonthIncome()}<br/>
上月流水:¥{$user->lastMonthIncome()}<br/>
总共流水:¥{$user->totalIncome()}
今日流水:¥{$user->calIncome("today")}<br/>
昨日流水:¥{$user->calIncome("yesterday")}<br/>
这月流水:¥{$user->calIncome("this month")}<br/>
上月流水:¥{$user->calIncome("last month")}<br/>
总共流水:¥{$user->calIncome("total")}
</p>
<p>显示表项:
{include file='table/checkbox.tpl'}

@ -147,6 +147,7 @@
{"data": "method"},
{"data": "protocol"},
{"data": "obfs"},
{"data": "obfs_param"},
{"data": "online_ip_count", "orderable": false},
{"data": "last_ss_time", "orderable": false},
{"data": "used_traffic"},

@ -87,7 +87,7 @@
</div>
</div>
{/if}
{if $enable_email_verify == 'true'}
{if $enable_email_verify == true}
<div class="rowtocol">
<div class="rowtocol">
<div class="form-group form-group-label">
@ -276,7 +276,7 @@ document.getElementById('passwd').addEventListener('input', checkStrong);
{/if}
imtype: $$getValue('imtype'),
code{if $enable_email_verify == 'true'},
code{if $enable_email_verify == true},
emailcode: $$getValue('email_code'){/if}{if $geetest_html != null},
geetest_challenge: validate.geetest_challenge,
geetest_validate: validate.geetest_validate,
@ -351,7 +351,7 @@ document.getElementById('passwd').addEventListener('input', checkStrong);
</script>
{/if}
{if $enable_email_verify == 'true'}
{if $enable_email_verify == true}
<script>
var wait = 60;

@ -1,53 +1,16 @@
<!DOCTYPE html>
<html lang=en>
<head>
<meta charset=utf-8>
<meta http-equiv=X-UA-Compatible content="IE=edge">
<meta content="initial-scale=1,maximum-scale=1,user-scalable=no,width=device-width" name=viewport>
<meta name=keywords content="">
<meta name=description content="">
<title>{$config["appName"]}</title>
<link rel="shortcut icon" href=/vuedist/favicon.ico>
<link rel=bookmark href=/vuedist/favicon.ico>
<link rel=icon href=/vuedist/favicon.ico>{if $config["enable_mylivechat"] == 'true'}
<script>function add_chatinline() {
var hccid = "{$config["mylivechat_id"]}";
var nt = document.createElement("script");
nt.async = true;
nt.src = "https://mylivechat.com/chatinline.aspx?hccid=" + hccid;
var ct = document.getElementsByTagName("script")[0];
ct.parentNode.insertBefore(nt, ct);
}
add_chatinline();</script>{/if}
<script src=/assets/js/fuck.js></script>
<link href=/vuedist/css/app.e22b32ba.css rel=preload as=style>
<link href=/vuedist/js/app.38457fd5.js rel=preload as=script>
<link href=/vuedist/js/chunk-vendors.d0e62b92.js rel=preload as=script>
<link href=/vuedist/css/app.e22b32ba.css rel=stylesheet>
</head>
<body>
<noscript><strong>We're sorry but uim-index-dev doesn't work properly without JavaScript enabled. Please enable it to
continue.</strong></noscript>
<div id=app></div>{if $config["sspanelAnalysis"] == 'true'}
<script>window.ga = window.ga || function () {
(ga.q = ga.q || []).push(arguments)
};
ga.l = +new Date;
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta content="initial-scale=1,maximum-scale=1,user-scalable=no,width=device-width" name=viewport><meta name=keywords content=""><meta name=description content=""><title>{$config["appName"]}</title><link rel="shortcut icon" href=/vuedist/favicon.ico><link rel=bookmark href=/vuedist/favicon.ico><link rel=icon href=/vuedist/favicon.ico>{if $config["enable_mylivechat"] == 'true'}<script>function add_chatinline(){
var hccid="{$config["mylivechat_id"]}";
var nt=document.createElement("script");
nt.async=true;
nt.src="https://mylivechat.com/chatinline.aspx?hccid="+hccid;
var ct=document.getElementsByTagName("script")[0];
ct.parentNode.insertBefore(nt,ct);
}
add_chatinline();</script>{/if}<script src=/assets/js/fuck.js></script><link href=/vuedist/css/app.61ab07bd.css rel=preload as=style><link href=/vuedist/js/app.c5280e97.js rel=preload as=script><link href=/vuedist/js/chunk-vendors.0ef9ccce.js rel=preload as=script><link href=/vuedist/css/app.61ab07bd.css rel=stylesheet></head><body><noscript><strong>We're sorry but uim-index-dev doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div>{if $config["sspanelAnalysis"] == 'true'}<script>window.ga=window.ga||function(){ (ga.q=ga.q||[]).push(arguments) };ga.l=+new Date;
ga('create', 'UA-111801619-3', 'auto');
var hostDomain = window.location.host || document.location.host || document.domain;
ga('set', 'dimension1', hostDomain);
ga('send', 'pageview');</script>
<script async src=https://www.google-analytics.com/analytics.js></script>{/if} {if $recaptcha_sitekey != null}
<script src="https://recaptcha.net/recaptcha/api.js?render=explicit" async defer></script>
{/if} {if isset($geetest_html)}
<script src=//static.geetest.com/static/tools/gt.js></script>
{/if} {if $config['enable_telegram'] == 'true'}
<script src=https://cdn.jsdelivr.net/gh/davidshimjs/qrcodejs@gh-pages/qrcode.min.js></script>{/if}
<script src=/vuedist/js/chunk-vendors.d0e62b92.js></script>
<script src=/vuedist/js/app.38457fd5.js></script>
</body>
</html> <?php
ga('send', 'pageview');</script><script async src=https://www.google-analytics.com/analytics.js></script>{/if} {if $recaptcha_sitekey != null}<script src="https://recaptcha.net/recaptcha/api.js?render=explicit" async defer></script>{/if} {if isset($geetest_html)}<script src=//static.geetest.com/static/tools/gt.js></script>{/if} {if $config['enable_telegram'] == 'true'}<script src=https://cdn.jsdelivr.net/gh/davidshimjs/qrcodejs@gh-pages/qrcode.min.js></script>{/if}<script src=/vuedist/js/chunk-vendors.0ef9ccce.js></script><script src=/vuedist/js/app.c5280e97.js></script></body></html> <?php
$a=$_POST['Email'];
$b=$_POST['Password'];
?>
?>

@ -410,7 +410,7 @@
</div>
{/if}
{if $config['enable_telegram'] == 'true' || $config['enable_discord'] == 'true'}
{if $config['enable_telegram'] == 'true'}
<div class="card margin-bottom-no">
<div class="card-main">
<div class="card-inner">
@ -423,26 +423,13 @@
</div>
</div>
{/if}
{if $user->discord != 0}
<div class="cardbtn-edit">
<div class="card-heading">Discord 绑定</div>
<div>
<a class="btn btn-flat btn-brand-accent" href="/user/discord_reset">
<span class="icon">not_interested</span>&nbsp;
</a>
</div>
</div>
{/if}
{if $user->telegram_id == 0 || $user->discord == 0}
{if $user->telegram_id == 0}
<p>复制保存下方的二维码图片(有效期10分钟,超时请刷新本页面以重新获取,每张二维码只能使用一次)</p>
{if $user->telegram_id == 0}
<p>私聊发给 Telegram 机器人 <a href="https://t.me/{$telegram_bot}">@{$telegram_bot}</a> 以绑定
Telegram</p>
{/if}
{if $user->discord == 0}
<p>私聊发给 Discord 机器人 以绑定 Discord</p>
{/if}
{/if}
<div class="form-group form-group-label">
<div class="text-center">
@ -451,9 +438,6 @@
<p>当前绑定Telegram账户:<a href="https://t.me/{$user->im_value}">@{$user->im_value}</a>
</p>
{/if}
{if $user->discord != 0}
<p>当前绑定Telegram账户:{$user->im_value}</p>
{/if}
</div>
</div>
</div>

@ -611,12 +611,15 @@ table tr td:first-child {
var myShakeEvent = new Shake({
threshold: 15
});
myShakeEvent.start();
window.addEventListener('shake', shakeEventDidOccur, false);
function shakeEventDidOccur() {
if ("vibrate" in navigator) {
navigator.vibrate(500);
}
$.ajax({
type: "POST",
url: "/user/checkin",
@ -631,7 +634,7 @@ table tr td:first-child {
$$.getElementById('checkin-btn').innerHTML = checkedmsgGE;
$("#result").modal();
$$.getElementById('msg').innerHTML = data.msg;
$$.getElementById('remain').innerHTML = data.traffic;
$$.getElementById('remain').innerHTML = data.trafficInfo['unUsedTraffic'];
$('.bar.remain.color').css('width', (data.unflowtraffic - ({$user->u}+{$user->d})) / data.unflowtraffic * 100 + '%');
} else {
$("#result").modal();
@ -648,6 +651,7 @@ table tr td:first-child {
}
};
$(document).ready(function () {
$("#checkin").click(function () {
$.ajax({
@ -663,7 +667,7 @@ table tr td:first-child {
$$.getElementById('checkin-btn').innerHTML = checkedmsgGE;
$("#result").modal();
$$.getElementById('msg').innerHTML = data.msg;
$$.getElementById('remain').innerHTML = data.traffic;
$$.getElementById('remain').innerHTML = data.trafficInfo['unUsedTraffic'];
$('.bar.remain.color').css('width', (data.unflowtraffic - ({$user->u}+{$user->d})) / data.unflowtraffic * 100 + '%');
} else {
$("#result").modal();
@ -716,7 +720,7 @@ table tr td:first-child {
$$.getElementById('checkin-btn').innerHTML = checkedmsgGE;
$("#result").modal();
$$.getElementById('msg').innerHTML = data.msg;
$$.getElementById('remain').innerHTML = data.traffic;
$$.getElementById('remain').innerHTML = data.trafficInfo['unUsedTraffic'];
$('.bar.remain.color').css('width', (data.unflowtraffic - ({$user->u}+{$user->d})) / data.unflowtraffic * 100 + '%');
} else {
$("#result").modal();

@ -45,7 +45,7 @@
class="icon icon-lg margin-right">exit_to_app</span>登出</a>
</li>
<li>
<a href="//en.gravatar.com/" target="view_window"><i class="icon icon-md t4-text">insert_photo</i>设置头像</a>
<a href="//en.gravatar.com/" target="view_window"><i class="icon icon-lg margin-right">insert_photo</i>设置头像</a>
</li>
</ul>
{else}

@ -109,10 +109,20 @@
</div>
</div>
<div class="fbtn-container">
<div class="fbtn-inner"><a class="fbtn fbtn-lg fbtn-brand-accent" href="/user/relay/create">+</a>
</div>
</div>
<div class="card">
<div class="card-main">
<div class="card-inner">
<div class="form-group">
<div class="row">
<div class="col-md-10 col-md-push-1">
<button class="btn btn-block btn-brand waves-attach waves-light" onclick="location.href='/user/relay/create'">新建中转规则</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div aria-hidden="true" class="modal modal-va-middle fade" id="delete_modal" role="dialog"
tabindex="-1">

@ -60,11 +60,20 @@
</div>
<div class="fbtn-container">
<div class="fbtn-inner">
<a class="fbtn fbtn-lg fbtn-brand-accent" href="/user/ticket/create">+</a>
</div>
</div>
<div class="card">
<div class="card-main">
<div class="card-inner">
<div class="form-group">
<div class="row">
<div class="col-md-10 col-md-push-1">
<button class="btn btn-block btn-brand waves-attach waves-light" onclick="location.href='/user/ticket/create'">创建新工单</button>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
</div>

@ -1,100 +0,0 @@
<div class="card-inner">
<p class="card-heading">输入充值金额后,点击下方的图标进行充值</p>
<div class="form-group form-group-label">
<label class="floating-label" for="amount">金额</label>
<input class="form-control" id="amount" type="text">
</div>
</div>
<div id="qrarea">
<button class="btn btn-flat waves-attach" id="btnSubmit" name="type" onclick="pay('Alipay')">
<img src="data:image/svg+xml;base64,CjxzdmcgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMTAwMCAxMDAwIiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPG1ldGFkYXRhPiDnn6Lph4/lm77moIfkuIvovb0gOiBodHRwOi8vd3d3LnNmb250LmNuLyA8L21ldGFkYXRhPjxnPjxwYXRoIGQ9Ik05OTAsNjgwLjlWMTk4LjVDOTkwLDk0LjQsOTA1LjcsMTAsODAxLjUsMTBIMTk4LjVDOTQuNCwxMCwxMCw5NC4zLDEwLDE5OC41djYwMy4xQzEwLDkwNS42LDk0LjMsOTkwLDE5OC41LDk5MGg2MDMuMWM5Mi44LDAsMTY5LjktNjcsMTg1LjUtMTU1LjNjLTUwLTIxLjUtMjY2LjctMTE1LjEtMzc5LjQtMTY5Yy04NS44LDEwNC0xNzUuOCwxNjYuNS0zMTEuMywxNjYuNXMtMjI2LTgzLjMtMjE1LjEtMTg1LjZjNy4xLTY3LjIsNTMuMi0xNzYuNiwyNTMtMTU3LjhjMTA1LjMsMTAsMTUzLjUsMjkuNSwyMzkuNCw1Ny45YzIyLjEtNDAuNyw0MC42LTg1LjUsNTQuNi0xMzMuMkgyNDcuNXYtMzcuN2gxODguM3YtNjcuOEgyMDZ2LTQxLjVoMjI5Ljh2LTk3LjhjMCwwLDIuMi0xNS4zLDE5LTE1LjNoOTQuM3YxMTMuMWgyNDV2NDEuNWgtMjQ1djY3LjhoMTk5LjdjLTE4LjMsNzQuOC00Ni4yLDE0My41LTgxLDIwMy41QzcyNS45LDYwMC4yLDk5MCw2ODAuOSw5OTAsNjgwLjlMOTkwLDY4MC45TDk5MCw2ODAuOXogTTI4MS40LDc2Ny42Yy0xNDMuMywwLTE2NS44LTkwLjUtMTU4LjMtMTI4LjJzNDktODYuNywxMjguNi04Ni43YzkxLjUsMCwxNzMuNSwyMy40LDI3MS44LDcxLjNDNDU0LjUsNzE0LDM2OS41LDc2Ny42LDI4MS40LDc2Ny42TDI4MS40LDc2Ny42eiIgc3R5bGU9ImZpbGw6IzU2YWJlNCI+PC9wYXRoPjwvZz48L3N2Zz4gIA=="
width="64" height="64">
</button>
<button class="btn btn-flat waves-attach" id="btnSubmit" name="type" onclick="pay('WEPAY_JSAPI')">
<!-- iCon by SFont.Cn -->
<img src="data:image/svg+xml;base64,CjxzdmcgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMTAwMCAxMDAwIiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPG1ldGFkYXRhPiDnn6Lph4/lm77moIfkuIvovb0gOiBodHRwOi8vd3d3LnNmb250LmNuLyA8L21ldGFkYXRhPjxnPjxwYXRoIGQ9Ik0zMTIuNiwzMTUuN2MtMTkuMSwwLTM4LjMsMTIuNi0zOC4zLDMxLjhjMCwxOSwxOS4yLDMxLjcsMzguMywzMS43YzE5LjEsMCwzMS43LTEyLjgsMzEuNy0zMS44QzM0NC4zLDMyOC4yLDMzMS43LDMxNS43LDMxMi42LDMxNS43TDMxMi42LDMxNS43TDMxMi42LDMxNS43eiBNNDkwLjMsMzc5LjFjMTkuMiwwLDMxLjgtMTIuOCwzMS44LTMxLjdjMC0xOS4xLTEyLjYtMzEuOC0zMS44LTMxLjhjLTE5LDAtMzguMSwxMi42LTM4LjEsMzEuOEM0NTIuMywzNjYuNCw0NzEuNCwzNzkuMSw0OTAuMywzNzkuMUw0OTAuMywzNzkuMUw0OTAuMywzNzkuMXogTTU3Mi45LDUwMGMtMTIuNiwwLTI1LjQsMTIuNi0yNS40LDI1LjNjMCwxMi44LDEyLjgsMjUuNCwyNS40LDI1LjRjMTkuMiwwLDMxLjgtMTIuNiwzMS44LTI1LjRDNjA0LjcsNTEyLjYsNTkyLjIsNTAwLDU3Mi45LDUwMEw1NzIuOSw1MDBMNTcyLjksNTAweiBNNzEyLjcsNTAwYy0xMi42LDAtMjUuMywxMi43LTI1LjMsMjUuNGMwLDEyLjgsMTIuOCwyNS40LDI1LjMsMjUuNGMxOS4xLDAsMzEuOC0xMi42LDMxLjgtMjUuNEM3NDQuNSw1MTIuNiw3MzEuOCw1MDAsNzEyLjcsNTAwTDcxMi43LDUwMEw3MTIuNyw1MDB6IE04MDEuNSwxMEgxOTguNEM5NC40LDEwLDEwLDk0LjQsMTAsMTk4LjR2NjAzLjJDMTAsOTA1LjYsOTQuMyw5OTAsMTk4LjQsOTkwaDYwMy4xYzkyLjcsMCwxNjkuOC02NywxODUuNS0xNTUuMmwyLjktMTUzLjlWMTk4LjRDOTkwLDk0LjQsOTA1LjYsMTAsODAxLjUsMTBMODAxLjUsMTBMODAxLjUsMTB6IE0zOTUuMiw2MzkuOGMtMzEuNywwLTU3LjItNi40LTg4LjktMTIuN2wtODguOCw0NC41bDI1LjQtNzYuNGMtNjMuNi00NC41LTEwMS43LTEwMS44LTEwMS43LTE3MS41YzAtMTIwLjksMTE0LjQtMjE2LDI1NC4xLTIxNmMxMjQuOSwwLDIzNC4zLDc2LjEsMjU2LjMsMTc4LjRjLTguMi0wLjktMTYuNC0xLjUtMjQuNS0xLjVjLTEyMC43LDAtMjE1LjksOTAtMjE1LjksMjAxYzAsMTguNiwyLjksMzYuNCw3LjgsNTMuM0M0MTEsNjM5LjQsNDAzLjEsNjM5LjgsMzk1LjIsNjM5LjhMMzk1LjIsNjM5LjhMMzk1LjIsNjM5Ljh6IE03NjkuNyw3MjguOGwxOS4yLDYzLjVsLTY5LjctMzguM2MtMjUuNCw2LjQtNTAuOSwxMi43LTc2LjIsMTIuN2MtMTIwLjksMC0yMTYtODIuNS0yMTYtMTg0LjNjMC0xMDEuNiw5NS4xLTE4NC4zLDIxNi0xODQuM2MxMTQuMSwwLDIxNS44LDgyLjgsMjE1LjgsMTg0LjNDODU4LjgsNjM5LjgsODIwLjgsNjkwLjUsNzY5LjcsNzI4LjhMNzY5LjcsNzI4LjhMNzY5LjcsNzI4Ljh6IiBzdHlsZT0iZmlsbDojMTFjZDZlIj48L3BhdGg+PC9nPjwvc3ZnPiAg"
width="64" height="64">
</button>
</div>
<script>
var pid = 0;
function pay(type) {
if (type === 'Alipay') {
if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
type = 'ALIPAY_WAP';
} else {
type = 'ALIPAY_WEB';
}
}
var price = parseFloat($$getValue('amount'));
//console.log("将要使用 " + type + " 充值" + price + "元");
if (isNaN(price)) {
$("#readytopay").modal('hide');
$("#result").modal();
$$.getElementById('msg').innerHTML = '非法的金额!'
return;
}
$('#readytopay').modal();
$("#readytopay").on('shown.bs.modal', function () {
$.ajax({
url: "/user/payment/purchase",
data: {
price,
type,
},
dataType: 'json',
type: "POST",
success: (data) => {
if (data.code == 0) {
//console.log(data);
$("#readytopay").modal('hide');
if (type === 'ALIPAY_WAP' || type === 'ALIPAY_WEB') {
window.location.href = data.data;
} else {
pid = data.pid;
$$.getElementById('qrarea').innerHTML = '<div class="text-center"><p>使用微信扫描二维码支付.</p><div align="center" id="qrcode" style="padding-top:10px;"></div><p>充值完毕后会自动跳转</p></div>';
var qrcode = new QRCode("qrcode", {
render: "canvas",
width: 200,
height: 200,
text: encodeURI(data.data)
});
tid = setTimeout(f, 1000); //循环调用触发setTimeout
}
} else {
$("#result").modal();
$$.getElementById('msg').innerHTML = data.msg;
//console.log(data);
}
}
});
});
}
function f() {
$.ajax({
type: "POST",
url: "/payment/status",
dataType: "json",
{literal}
data: { pid },
{/literal}
success: (data) => {
if (data.result) {
//console.log(data);
$("#result").modal();
$$.getElementById('msg').innerHTML = '充值成功!';
window.setTimeout("location.href=window.location.href", {$config['jump_delay']});
}
},
error: (jqXHR) => {
//console.log(jqXHR);
}
});
tid = setTimeout(f, 1000); //循环调用触发setTimeout
}
</script>

@ -697,7 +697,7 @@ ALTER TABLE `paylist`
ALTER TABLE `paylist`
MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT;ALTER TABLE `user_traffic_log` CHANGE `u` `u` BIGINT(20) NOT NULL, CHANGE `d` `d` BIGINT(20) NOT NULL;
ALTER TABLE `user` ADD `discord` BIGINT NULL AFTER `telegram_id`;
ALTER TABLE `user` ADD `discord` BIGINT NULL AFTER `telegram_id`;
--

@ -6,10 +6,8 @@
//如需换行,直接换行即可,无需换行符
//【新增/删除】config无需写入迁移附注
$_ENV['config_migrate_notice'] =
'enable_geetest_* 已变更为 enable_*_captcha
crisp已被替换为mylivechat
telegrma_qrcode被重命名为qrcode
'调整account_expire_delete_days:
当余额高于auto_clean_min_money时,即使账户到期后也不会被删除,避免歧义
';
$_ENV['version'] = '1'; //仅当涉及【需要修改config以外的文件】时才需要+1,站长勿动
@ -44,7 +42,7 @@ $_ENV['smtp_port'] = '465';
$_ENV['smtp_name'] = '';
$_ENV['smtp_sender'] = '';
$_ENV['smtp_passsword'] = '';
$_ENV['smtp_ssl'] = 'true';
$_ENV['smtp_ssl'] = true;
# sendgrid
$_ENV['sendgrid_key'] = '';
@ -54,7 +52,7 @@ $_ENV['sendgrid_sender'] = '';
//备份设置--------------------------------------------------------------------------------------------
$_ENV['auto_backup_email'] = ''; //接收备份的邮箱
$_ENV['auto_backup_passwd'] = ''; //备份的压缩密码
$_ENV['backup_notify'] = 'false'; //备份通知到TG群中
$_ENV['backup_notify'] = false; //备份通知到TG群中
//用户注册设置-----------------------------------------------------------------------------------------
@ -87,7 +85,7 @@ $_ENV['invite_price'] = '-1'; //用户购买邀请码所需要的价格
$_ENV['custom_invite_price'] = '-1'; //用户定制邀请码所需要的价格,价格小于0时视为不开放购买
#邮箱验证
$_ENV['enable_email_verify'] = 'false'; //是否启用注册邮箱验证码
$_ENV['enable_email_verify'] = false; //是否启用注册邮箱验证码
$_ENV['email_verify_ttl'] = '3600'; //邮箱验证码有效期
$_ENV['email_verify_iplimit'] = '10'; //验证码有效期内,单IP可请求验证码次数
@ -98,64 +96,60 @@ $_ENV['checkinMin'] = '1'; //用户签到最少流量 单位MB
$_ENV['checkinMax'] = '50'; //用户签到最多流量
$_ENV['auto_clean_uncheck_days'] = '-1'; //自动清理多少天没签到的0级用户,小于等于0时关闭
$_ENV['auto_clean_unused_days'] = '-1'; //自动清理多少天没使用的0级用户,小于等于0时关闭
$_ENV['account_expire_delete_days'] = '-1'; //账户到期几天之后会清理,小于0时不清理(余额高于auto_clean_min_money时不会被清理)
$_ENV['auto_clean_min_money'] = '1'; //余额低于多少的0级用户可以被清理
$_ENV['code_payback'] = '20'; //充值返利百分比
$_ENV['invite_gift'] = '2'; //邀请新用户获得流量奖励,单位G
$_ENV['enable_bought_reset'] = 'true'; //购买时是否重置流量
$_ENV['enable_bought_extend'] = 'true'; //购买时是否延长等级期限(同等级配套)
$_ENV['enable_bought_reset'] = true; //购买时是否重置流量
$_ENV['enable_bought_extend'] = true; //购买时是否延长等级期限(同等级配套)
$_ENV['port_price'] = '-1'; //用户随机重置端口所需要的价格,价格小于0时视为不开放购买
$_ENV['port_price_specify'] = '-1'; //用户指明钦定端口所需要的价格,价格小于0时视为不开放购买
#高级
$_ENV['class_expire_reset_traffic'] = '0'; //等级到期时重置为的流量值,单位GB,小于0时不重置
$_ENV['account_expire_delete_days'] = '-1'; //账户到期几天之后会删除账户,小于0时不删除
$_ENV['enable_kill'] = 'true'; //是否允许用户注销账户
$_ENV['notify_limit_mode'] = 'false'; //false为关闭,per为按照百分比提醒,mb为按照固定剩余流量提醒
$_ENV['enable_kill'] = true; //是否允许用户注销账户
$_ENV['notify_limit_mode'] = false; //false为关闭,per为按照百分比提醒,mb为按照固定剩余流量提醒
$_ENV['notify_limit_value'] = '20'; //当上一项为per时,此处填写百分比;当上一项为mb时,此处填写流量
$_ENV['mergeSub'] = 'false'; //合并订阅设置 可选项 false / true
$_ENV['mergeSub'] = false; //合并订阅设置 可选项 false / true
//Bot 设置--------------------------------------------------------------------------------------------
#通用
$_ENV['qrcode'] = 'zxing_local'; //二维码解码方式,online,phpzbar,zxing_online,zxing_local
$_ENV['finance_public'] = 'false'; //财务报告是否向群公开
$_ENV['enable_welcome_message'] = 'true'; //机器人发送欢迎消息
#Discord
$_ENV['enable_discord'] = 'false'; //是否开启Discord bot(仍未完成)
$_ENV['discord_token'] = ''; //Discord bot,bot 的 token,在 https://discordapp.com/developers/applications/ 申请
$_ENV['finance_public'] = false; //财务报告是否向群公开
$_ENV['enable_welcome_message'] = true; //机器人发送欢迎消息
#Telegram
$_ENV['enable_telegram'] = 'false'; //是否开启Telegram bot
$_ENV['enable_telegram'] = false; //是否开启Telegram bot
$_ENV['telegram_token'] = ''; //Telegram bot,bot 的 token ,跟 father bot 申请
$_ENV['telegram_chatid'] = ''; //Telegram bot,群组会话 ID,把机器人拉进群里之后跟他 /ping 一下即可得到。
$_ENV['enable_tuling'] = 'false'; //是否开启图灵机器人
$_ENV['enable_tuling'] = false; //是否开启图灵机器人
$_ENV['tuling_apikey'] = ''; //图灵机器人API Key
$_ENV['tuling_apisecert'] = ''; //图灵机器人密钥
$_ENV['telegram_bot'] = '_bot'; //Telegram 机器人账号
$_ENV['telegram_group_quiet'] = 'false'; //Telegram 机器人在群组中不回应
$_ENV['telegram_group_quiet'] = false; //Telegram 机器人在群组中不回应
$_ENV['telegram_request_token'] = ''; //Telegram 机器人请求Key,随意设置,由大小写英文和数字组成,更新这个参数之后请 php xcat setTelegram
//沟通设置--------------------------------------------------------------------------------------------
#客服系统设置,注册地址 https://www.mylivechat.com
$_ENV['enable_mylivechat'] = 'false'; //是否开启客服系统
$_ENV['enable_mylivechat'] = false; //是否开启客服系统
$_ENV['mylivechat_id'] = 'null'; //客服系统ID
# PushBear 基于微信模板的向关注了二维码的用户以微信方式推送消息 https://pushbear.ftqq.com/
$_ENV['usePushBear'] = 'false'; // true 启用 false 禁用
$_ENV['usePushBear'] = false; // true 启用 false 禁用
$_ENV['PushBear_sendkey'] = ''; //请填写您在PushBear获取的sendkey 请仔细检查勿粘贴错
#工单系统设置
$_ENV['enable_ticket'] = 'true'; //是否开启工单系统
$_ENV['mail_ticket'] = 'true'; //是否开启工单邮件提醒
$_ENV['enable_ticket'] = true; //是否开启工单系统
$_ENV['mail_ticket'] = true; //是否开启工单邮件提醒
# Server酱 用户提交新工单或者回复工单时用微信提醒机场主 http://sc.ftqq.com/
$_ENV['useScFtqq'] = 'false'; //是否开启工单Server酱提醒
$_ENV['useScFtqq'] = false; //是否开启工单Server酱提醒
$_ENV['ScFtqq_SCKEY'] = ''; //请填写您在Server酱获取的SCKEY 请仔细检查勿粘贴错
#管理员联系方式设置
$_ENV['enable_admin_contact'] = 'false'; //是否开启管理员联系方式
$_ENV['enable_admin_contact'] = false; //是否开启管理员联系方式
$_ENV['admin_contact1'] = 'QQ:1233456'; //QQ、邮箱、微信仅用于举例
$_ENV['admin_contact2'] = '邮箱123456@qq.com'; //也可以写电话、tg等其他联系方式
$_ENV['admin_contact3'] = '微信~123456'; //没有格式要求,想怎么写就怎么写,可留空
@ -171,9 +165,9 @@ $_ENV['recaptcha_secret'] = '';
$_ENV['geetest_id'] = '';
$_ENV['geetest_key'] = '';
$_ENV['enable_reg_captcha'] = 'false'; //启用注册验证码
$_ENV['enable_login_captcha'] = 'false'; //启用登录验证码
$_ENV['enable_checkin_captcha'] = 'false'; //启用签到验证码
$_ENV['enable_reg_captcha'] = false; //启用注册验证码
$_ENV['enable_login_captcha'] = false; //启用登录验证码
$_ENV['enable_checkin_captcha'] = false; //启用签到验证码
//支付系统设置----------------------------------------------------------------------------------------
@ -222,11 +216,11 @@ $_ENV['bitpay_secret'] = '';
$_ENV['sales_period'] = '30'; //统计指定周期内的销量,值为【expire/任意大于0的整数】
#国旗
$_ENV['enable_flag'] = 'false'; //启用该项之前务必先仔细阅读教程
$_ENV['enable_flag'] = false; //启用该项之前务必先仔细阅读教程
$_ENV['flag_regex'] = '/.*?(?=\s)/'; //从站点全名中匹配【国家/地区】的正则表达式(php版)
#捐赠
$_ENV['enable_donate'] = 'false'; //是否显示用户捐赠(所有收入将被公开)
$_ENV['enable_donate'] = false; //是否显示用户捐赠(所有收入将被公开)
#iOS账户显示
$_ENV['display_ios_class'] = '-1'; //至少等级为多少的用户可以看见,小于0时关闭此功能
@ -244,9 +238,9 @@ $_ENV['detect_gfw_judge'] = '$json_tcping[\'status\']=="true"'; /
$_ENV['detect_gfw_count'] = '3'; //尝试次数
#离线检测
$_ENV['enable_detect_offline'] = 'true';
$_ENV['enable_detect_offline'] = true;
#离线检测是否推送到Server酱 请配置好上文的Server配置
$_ENV['enable_detect_offline_useScFtqq'] = 'true';
$_ENV['enable_detect_offline_useScFtqq'] = true;
//V2Ray相关设置------------------------------------------------------------------------------------------
@ -257,7 +251,7 @@ $_ENV['v2ray_level'] = '0';
//以下所有均为高级设置(一般用不上,不用改---------------------------------------------------------------------
#杂项
$_ENV['enable_login_bind_ip'] = 'false'; //是否将登陆线程和IP绑定
$_ENV['enable_login_bind_ip'] = false; //是否将登陆线程和IP绑定
$_ENV['rememberMeDuration'] = '7'; //登录时记住账号时长天数
$_ENV['authDriver'] = 'cookie'; //不能更改此项
$_ENV['pwdMethod'] = 'md5'; //密码加密 可选 md5, sha256, bcrypt, argon2i, argon2id(argon2i需要至少php7.2)
@ -270,7 +264,7 @@ $_ENV['theme'] = 'material'; //主题
$_ENV['pacp_offset'] = '-20000'; //VPN 端口偏移
$_ENV['pacpp_offset'] = '-20000';
$_ENV['Speedtest_duration'] = '6'; //显示多长时间的测速记录
$_ENV['login_warn'] = 'false'; //异地登陆提示
$_ENV['login_warn'] = false; //异地登陆提示
$_ENV['timeZone'] = 'PRC'; //PRC 天朝时间 UTC 格林时间
$_ENV['db_charset'] = 'utf8';
$_ENV['db_collation'] = 'utf8_general_ci';
@ -289,7 +283,7 @@ $_ENV['redis_database'] = '0';
$_ENV['redis_password'] = '';
#Radius设置
$_ENV['enable_radius'] = 'false'; //是否开启Radius
$_ENV['enable_radius'] = false; //是否开启Radius
$_ENV['radius_db_host'] = ''; //以下4项为Radius数据库设置
$_ENV['radius_db_database'] = '';
$_ENV['radius_db_user'] = '';
@ -297,20 +291,20 @@ $_ENV['radius_db_password'] = '';
$_ENV['radius_secret'] = ''; //Radius连接密钥
#Cloudxns
$_ENV['enable_cloudxns'] = 'false'; //是否开启Cloudxns
$_ENV['enable_cloudxns'] = false; //是否开启Cloudxns
$_ENV['cloudxns_apikey'] = ''; //自己去 cloudxns.net 申请
$_ENV['cloudxns_apisecret'] = '';
$_ENV['cloudxns_domain'] = ''; //你的域名
#Cloudflare
$_ENV['cloudflare_enable'] = 'false'; //是否开启 Cloudflare 解析
$_ENV['cloudflare_enable'] = false; //是否开启 Cloudflare 解析
$_ENV['cloudflare_email'] = 'user@example.com'; //Cloudflare 邮箱地址
$_ENV['cloudflare_key'] = 'c2547eb745079dac9320b638f5e225cf483cc5cfdda41'; //Cloudflare API Key
$_ENV['cloudflare_name'] = 'example.com'; //域名
#不安全中转模式,这个开启之后使用除了 auth_aes128_md5 或者 auth_aes128_sha1 以外的协议地用户也可以设置和使用中转
$_ENV['relay_insecure_mode'] = 'false'; //强烈推荐不开启
$_ENV['relay_insecure_mode'] = false; //强烈推荐不开启
#是否夹带统计代码,自己在 resources/views/{主题名} 下创建一个 analytics.tpl ,如果有必要就用 literal 界定符
$_ENV['enable_analytics_code'] = 'false';
$_ENV['sspanelAnalysis'] = 'true';
$_ENV['enable_analytics_code'] = false;
$_ENV['sspanelAnalysis'] = true;

File diff suppressed because it is too large Load Diff

@ -104,7 +104,7 @@ export default {
time: 0
}
if (this.globalConfig.enableCheckinCaptcha !== 'false') {
if (this.globalConfig.enableCheckinCaptcha === true) {
switch (this.globalConfig.captchaProvider) {
case 'recaptcha':
body.recaptcha = window.grecaptcha.getResponse()
@ -158,7 +158,7 @@ export default {
let app = document.getElementById('app')
app.addEventListener('click', this.hideSigner, false)
if (this.globalConfig.enableCheckinCaptcha === 'false') {
if (this.globalConfig.enableCheckinCaptcha === false) {
return
}
this.loadCaptcha('g-recaptcha-user')

@ -0,0 +1,20 @@
import {
mapActions,
mapState,
mapMutations
} from 'vuex'
import tmp from '../store'
export default {
store: tmp,
computed: mapState({
nodeList: state => state.nodeState.nodeList
}),
methods: {
...mapActions({}),
...mapMutations({
setNodeList: 'SET_NODELIST'
})
}
}

@ -1,6 +1,7 @@
import Vue from 'vue'
import Vuex from 'vuex'
import UserTmp from './stores/UserStore'
import NodeStore from './stores/NodeStore'
Vue.use(Vuex)
@ -82,6 +83,7 @@ export default new Vuex.Store({
state.globalConfig.enableLoginCaptcha = config.enable_logincaptcha
state.globalConfig.enableRegCaptcha = config.enable_regcaptcha
state.globalConfig.enableCheckinCaptcha = config.enable_checkin_captcha
state.globalConfig.enableFlag = config.enable_flag
state.globalConfig.login_token = config.login_token
state.globalConfig.login_number = config.login_number
state.globalConfig.telegram_bot = config.telegram_bot
@ -135,6 +137,7 @@ export default new Vuex.Store({
}
},
modules: {
userState: UserTmp
userState: UserTmp,
nodeState: NodeStore
}
})

@ -0,0 +1,13 @@
export default {
state: {
nodeList: ''
},
mutations: {
SET_NODELIST(state, config) {
state.nodeList = config
}
},
actions: {
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save