dev
laurieryayoi 7 years ago
commit d809788106

@ -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,31 @@
---
name: Bug report
about: Create a bug report
title: "[BUG]"
labels: bug
---
- [ ] 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.
- [ ] I certify that I have read project Wiki and other issue may related to this one.
**Environment**
Your PHP/MySQL version and...
**Commit**
The commit you on.
**Bug**
The bug information.
**Reproduce**
Steps to reproduce the bug.
**Expected behavior**
What you expected to happen.
**Logs**
If applicable, add your PHP logs here.
**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>

@ -163,6 +163,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 .

@ -25,7 +25,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;
@ -71,7 +70,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',
@ -97,7 +96,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('备份完毕了喵~今天又是安全祥和的一天呢。');
}
}
@ -433,12 +432,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(
@ -468,60 +467,12 @@ 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 = '喵喵喵~ ' . $node->name . ' 节点掉线了喵~域名解析被切换到了 ' . $Temp_node->name . ' 上了喵~';
}
}
} else {
$notice_text = '喵喵喵~ ' . $node->name . ' 节点掉线了喵~';
}
$notice_text = '喵喵喵~ ' . $node->name . ' 节点掉线了喵~';
}
Telegram::Send($notice_text);
@ -534,7 +485,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(
@ -564,50 +515,12 @@ 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 = '喵喵喵~ ' . $node->name . ' 节点恢复了喵~域名解析被切换回来了喵~';
} else {
$notice_text = '喵喵喵~ ' . $node->name . ' 节点恢复了喵~';
}
$notice_text = '喵喵喵~ ' . $node->name . ' 节点恢复了喵~';
}
Telegram::Send($notice_text);
@ -619,7 +532,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) {
@ -713,7 +626,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';
@ -755,7 +668,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;
@ -921,48 +836,7 @@ 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 = '喵喵喵~ ' . $node->name . ' 节点被墙了喵~域名解析被切换到了 ' . $Temp_node->name . ' 上了喵~';
}
}
} else {
$notice_text = '喵喵喵~ ' . $node->name . ' 节点被墙了喵~';
}
$notice_text = '喵喵喵~ ' . $node->name . ' 节点被墙了喵~';
}
Telegram::Send($notice_text);
$file_node = fopen(BASE_PATH . '/storage/' . $node->id . '.gfw', 'wb+');
@ -987,40 +861,7 @@ 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 = '喵喵喵~ ' . $node->name . ' 节点恢复了喵~域名解析被切换回来了喵~';
} else {
$notice_text = '喵喵喵~ ' . $node->name . ' 节点恢复了喵~';
}
$notice_text = '喵喵喵~ ' . $node->name . ' 节点恢复了喵~';
}
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;
@ -39,8 +38,6 @@ class XCat
return $this->createAdmin();
case ('resetTraffic'):
return $this->resetTraffic();
case ('setDiscord'):
return Discord::set();
case ('setTelegram'):
return $this->setTelegram();
case ('initQQWry'):
@ -111,7 +108,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);

@ -85,7 +85,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,40 +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\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';
@ -114,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) {
@ -175,7 +193,6 @@ class UserController extends AdminController
return $response->getBody()->write(json_encode($result));
}
public function search($request, $response, $args)
{
$pageNum = 1;
@ -187,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();
@ -205,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];
@ -214,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');
}
@ -227,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();
@ -248,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];
@ -257,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'];
@ -284,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();
@ -378,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'] = '切换成功';
@ -511,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);
}
}

@ -1,70 +0,0 @@
<?php
/**
* Created by PhpStorm.
* User: kaguya
* Date: 2018/06/30
* Time: 21:40
*/
namespace App\Controllers\Client;
use App\Controllers\BaseController;
use App\Controllers\LinkController;
use App\Models\Ann;
use App\Models\User;
use App\Services\Auth;
use App\Services\Config;
use App\Services\Factory;
use App\Utils\Helper;
class ClientApiController extends BaseController
{
public function GetAnnouncement($request, $response, $args)
{
$accessToken = Helper::getParam($request, 'access_token');
$storage = Factory::createTokenStorage();
$token = $storage->get($accessToken);
$user = User::find($token->userId);
$Anns = Ann::orderBy('date', 'desc')->first();
$res['ret'] = 1;
$res['msg'] = 'ok';
$res['data'] = $Anns;
return $this->echoJson($response, $res);
}
public function Redirect($request, $response, $args)
{
$user = Auth::getUser();
$url = $request->getQueryParams()['target'];
if (!$user->isLogin) {
$accessToken = Helper::getParam($request, 'access_token');
$storage = Factory::createTokenStorage();
$token = $storage->get($accessToken);
if ($token == null) {
$res['ret'] = 0;
$res['msg'] = 'token is null';
return $this->echoJson($response, $res);
}
$user = User::find($token->userId);
$time = 3600 * 24;
Auth::login($user->id, $time);
}
return $response->withRedirect($url);
}
public function GetSubLink($request, $response, $args)
{
$accessToken = Helper::getParam($request, 'access_token');
$mu = Helper::getParam($request, 'mu');
$storage = Factory::createTokenStorage();
$token = $storage->get($accessToken);
$user = User::find($token->userId);
$ssr_sub_token = LinkController::GenerateSSRSubCode($user->id, 0);
$res['ret'] = 1;
$res['msg'] = 'ok';
$res['data'] = Config::get('subUrl') . $ssr_sub_token;
if ($mu != '') $res['data'] = $res['data'].'?mu=' . $mu;
return $this->echoJson($response, $res);
}
}

@ -37,7 +37,7 @@ class HomeController 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];

@ -10,6 +10,7 @@ use App\Models\Smartline;
use App\Utils\ConfRender;
use App\Utils\Tools;
use App\Utils\URL;
use App\Services\Config;
/**
* HomeController
@ -194,4 +195,274 @@ class LinkController extends BaseController
);
return $render->fetch('clash.tpl');
}
public static function getSSPcConf($user)
{
$proxy = [];
$items = URL::getAllItems($user, 0, 1);
foreach ($items as $item) {
$proxy_plugin = '';
$proxy_plugin_opts = '';
if ($item['obfs'] == 'v2ray' || in_array($item['obfs'], Config::getSupportParam('ss_obfs'))) {
if ($item['obfs'] == 'v2ray') {
$proxy_plugin .= 'v2ray';
} else {
$proxy_plugin .= 'obfs-local';
}
if (strpos($item['obfs'], 'http') !== false) {
$proxy_plugin_opts .= 'obfs=http';
} elseif (strpos($item['obfs'], 'tls') !== false) {
$proxy_plugin_opts .= 'obfs=tls';
} else {
$proxy_plugin_opts .= 'v2ray;' . $item['obfs_param'];
}
if ($item['obfs_param'] != '' && $item['obfs'] != 'v2ray') {
$proxy_plugin_opts .= ';obfs-host=' . $item['obfs_param'];
}
}
$proxy[] = [
'remarks' => $item['remark'],
'server' => $item['address'],
'server_port' => $item['port'],
'method' => $item['method'],
'password' => $item['passwd'],
'timeout' => 5,
'plugin' => $proxy_plugin,
'plugin_opts' => $proxy_plugin_opts
];
}
$config = [
'configs' => $proxy,
'strategy' => null,
'index' => 0,
'global' => false,
'enabled' => true,
'shareOverLan' => false,
'isDefault' => false,
'localPort' => 1080,
'portableMode' => true,
'pacUrl' => null,
'useOnlinePac' => false,
'secureLocalPac' => true,
'availabilityStatistics' => false,
'autoCheckUpdate' => true,
'checkPreRelease' => false,
'isVerboseLogging' => false,
'logViewer' => [
'topMost' => false,
'wrapText' => false,
'toolbarShown' => false,
'Font' => 'Consolas, 8pt',
'BackgroundColor' => 'Black',
'TextColor' => 'White'
],
'proxy' => [
'useProxy' => false,
'proxyType' => 0,
'proxyServer' => '',
'proxyPort' => 0,
'proxyTimeout' => 3
],
'hotkey' => [
'SwitchSystemProxy' => '',
'SwitchSystemProxyMode' => '',
'SwitchAllowLan' => '',
'ShowLogs' => '',
'ServerMoveUp' => '',
'ServerMoveDown' => '',
'RegHotkeysAtStartup' => false
]
];
return json_encode($config, JSON_PRETTY_PRINT);
}
public static function getSSRPcConf($user)
{
$proxy = [];
$items = URL::getAllItems($user, 0, 0);
foreach ($items as $item) {
$proxy[] = [
'remarks' => $item['remark'],
'server' => $item['address'],
'server_port' => $item['port'],
'method' => $item['method'],
'obfs' => $item['obfs'],
'obfsparam' => $item['obfs_param'],
'remarks_base64' => base64_encode($item['remark']),
'password' => $item['passwd'],
'tcp_over_udp' => false,
'udp_over_tcp' => false,
'group' => Config::get('appName'),
'protocol' => $item['protocol'],
'protocolparam' => $item['protocol_param'],
'obfs_udp' => false,
'enable' => true
];
}
$config = [
'configs' => $proxy,
'index' => 0,
'random' => true,
'sysProxyMode' => 1,
'shareOverLan' => false,
'localPort' => 1080,
'localAuthPassword' => Tools::genRandomChar(26),
'dnsServer' => '',
'reconnectTimes' => 2,
'balanceAlgorithm' => 'LowException',
'randomInGroup' => false,
'TTL' => 0,
'connectTimeout' => 5,
'proxyRuleMode' => 2,
'proxyEnable' => false,
'pacDirectGoProxy' => false,
'proxyType' => 0,
'proxyHost' => '',
'proxyPort' => 0,
'proxyAuthUser' => '',
'proxyAuthPass' => '',
'proxyUserAgent' => '',
'authUser' => '',
'authPass' => '',
'autoBan' => false,
'sameHostForSameTarget' => false,
'keepVisitTime' => 180,
'isHideTips' => false,
'nodeFeedAutoUpdate' => true,
'serverSubscribes' => [
[
'URL' => (Config::get('subUrl') . self::GenerateSSRSubCode($user->id, 0) . '?mu=0'),
'Group' => Config::get('appName'),
'LastUpdateTime' => 0
]
],
'token' => [],
'portMap' => []
];
return json_encode($config, JSON_PRETTY_PRINT);
}
public static function getSSDPcConf($user)
{
$id = 1;
$proxy = [];
$items = URL::getAllItems($user, 0, 1);
foreach ($items as $item) {
$proxy_plugin = '';
$proxy_plugin_opts = '';
if ($item['obfs'] == 'v2ray' || in_array($item['obfs'], Config::getSupportParam('ss_obfs'))) {
if ($item['obfs'] == 'v2ray') {
$proxy_plugin .= 'v2ray';
} else {
$proxy_plugin .= 'simple-obfs';
}
if (strpos($item['obfs'], 'http') !== false) {
$proxy_plugin_opts .= 'obfs=http';
} elseif (strpos($item['obfs'], 'tls') !== false) {
$proxy_plugin_opts .= 'obfs=tls';
} else {
$proxy_plugin_opts .= 'v2ray;' . $item['obfs_param'];
}
if ($item['obfs_param'] != '' && $item['obfs'] != 'v2ray') {
$proxy_plugin_opts .= ';obfs-host=' . $item['obfs_param'];
}
}
$proxy[] = [
'remarks' => $item['remark'],
'server' => $item['address'],
'server_port' => $item['port'],
'password' => $item['passwd'],
'method' => $item['method'],
'plugin' => $proxy_plugin,
'plugin_opts' => $proxy_plugin_opts,
'plugin_args' => '',
'timeout' => 5,
'id' => $id,
'ratio' => $item['ratio'],
'subscription_url' => (Config::get('subUrl') . self::GenerateSSRSubCode($user->id, 0) . '?mu=3')
];
$id++;
}
$plugin = '';
$plugin_opts = '';
if ($user->obfs == 'v2ray' || in_array($user->obfs, Config::getSupportParam('ss_obfs'))) {
if ($user->obfs == 'v2ray') {
$plugin .= 'v2ray';
} else {
$plugin .= 'simple-obfs';
}
if (strpos($user->obfs, 'http') !== false) {
$plugin_opts .= 'obfs=http';
} elseif (strpos($user->obfs, 'tls') !== false) {
$plugin_opts .= 'obfs=tls';
} else {
$plugin_opts .= 'v2ray;' . $user->obfs_param;
}
if ($user->obfs_param != '' && $user->obfs != 'v2ray') {
$plugin_opts .= ';obfs-host=' . $user->obfs_param;
}
}
$config = [
'configs' => $proxy,
'strategy' => null,
'index' => 0,
'global' => false,
'enabled' => true,
'shareOverLan' => false,
'isDefault' => false,
'localPort' => 1080,
'portableMode' => true,
'pacUrl' => null,
'useOnlinePac' => false,
'secureLocalPac' => true,
'availabilityStatistics' => false,
'autoCheckUpdate' => true,
'checkPreRelease' => false,
'isVerboseLogging' => false,
'logViewer' => [
'topMost' => false,
'wrapText' => false,
'toolbarShown' => false,
'Font' => 'Consolas, 8pt',
'BackgroundColor' => 'Black',
'TextColor' => 'White'
],
'proxy' => [
'useProxy' => false,
'proxyType' => 0,
'proxyServer' => '',
'proxyPort' => 0,
'proxyTimeout' => 3
],
'hotkey' => [
'SwitchSystemProxy' => '',
'SwitchSystemProxyMode' => '',
'SwitchAllowLan' => '',
'ShowLogs' => '',
'ServerMoveUp' => '',
'ServerMoveDown' => '',
'RegHotkeysAtStartup' => false
],
'subscriptions' => [
[
'airport' => Config::get('appName'),
'encryption' => $user->method,
'password' => $user->passwd,
'port' => $user->port,
'expiry' => $user->class_expire,
'traffic_used' => Tools::flowToGB($user->u + $user->d),
'traffic_total' => Tools::flowToGB($user->transfer_enable),
'url' => (Config::get('subUrl') . self::GenerateSSRSubCode($user->id, 0) . '?mu=3'),
'plugin' => $plugin,
'plugin_options' => $plugin_opts,
'plugin_arguments' => '',
'use_proxy' => false
]
]
];
return json_encode($config, JSON_PRETTY_PRINT);
}
}

@ -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);
}
}

@ -58,7 +58,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');
@ -112,7 +112,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);
}
@ -268,7 +268,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 {
@ -648,7 +648,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);
@ -1176,7 +1176,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;
@ -1219,7 +1219,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') . '-新工单被开启';
@ -1236,7 +1236,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(
@ -1286,7 +1286,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') . '-工单被重新开启';
@ -1302,7 +1302,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(
@ -1321,7 +1321,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') . '-工单被回复';
@ -1337,7 +1337,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(
@ -1409,12 +1409,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'] = '非法输入';
@ -1655,7 +1649,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');
@ -1724,7 +1718,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;
@ -1764,14 +1758,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;
@ -1833,4 +1819,62 @@ class UserController extends BaseController
], $expire_in);
return $response->withStatus(302)->withHeader('Location', $local);
}
/**
* 获取包含订阅信息的客户端压缩档
*
* @param Request $request
* @param Response $response
* @param array $args
*/
public function getPcClient($request, $response, $args)
{
$zipArc = new \ZipArchive();
$user_token = LinkController::GenerateSSRSubCode($this->user->id, 0);
$type = trim($request->getQueryParams()['type']);
// 临时文件存放路径
$temp_file_path = '../storage/';
// 客户端文件存放路径
$client_path = '../resources/clients/';
switch ($type) {
case 'ss-win':
$temp_file_path .= $type . '_' . $user_token . '.zip';
$user_config_file_name = 'gui-config.json';
$content = LinkController::getSSPcConf($this->user);
$client_path .= $type . '/';
break;
case 'ssd-win':
$temp_file_path .= $type . '_' . $user_token . '.zip';
$user_config_file_name = 'gui-config.json';
$content = LinkController::getSSDPcConf($this->user);
$client_path .= $type . '/';
break;
case 'ssr-win':
$temp_file_path .= $type . '_' . $user_token . '.zip';
$user_config_file_name = 'gui-config.json';
$content = LinkController::getSSRPcConf($this->user);
$client_path .= $type . '/';
break;
default:
return 'gg';
}
// 文件存在则先删除
if (is_file($temp_file_path)) {
unlink($temp_file_path);
}
// 超链接文件内容
$site_url_content = '[InternetShortcut]' . PHP_EOL . 'URL=' . Config::get('baseUrl');
// 创建 zip 并添加内容
$zipArc->open($temp_file_path, \ZipArchive::CREATE);
$zipArc->addFromString($user_config_file_name, $content);
$zipArc->addFromString('点击访问_' . Config::get('appName') . '.url', $site_url_content);
Tools::folderToZip($client_path, $zipArc, strlen($client_path));
$zipArc->close();
$newResponse = $response->withHeader('Content-type', ' application/octet-stream')->withHeader('Content-Disposition', ' attachment; filename=' . $type . '.zip');
$newResponse->write(file_get_contents($temp_file_path));
unlink($temp_file_path);
return $newResponse;
}
}

@ -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];

@ -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,51 +1,42 @@
<?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);
$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'] = 'token or source is invalid, Your ip address is ' . $_SERVER['REMOTE_ADDR'];
$response->getBody()->write(json_encode($res));
return $response;
}
if ($auth == false) {
$res['ret'] = 0;
$res['data'] = 'token or source is invalid';
$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']
]);
}
$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 {

@ -38,7 +38,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()
@ -349,6 +349,7 @@ class User extends Model
$this->attributes['method'],
$this->attributes['protocol'],
$this->attributes['obfs'],
$this->attributes['obfs_param'],
$this->online_ip_count(),
$this->lastSsTime(),
$used_traffic,
@ -381,31 +382,29 @@ class User extends Model
return round($top_up, 2);
}
public function yesterdayIncome()
{
return Code::where('usedatetime', 'like', date('Y-m-d%', strtotime('-1 days')))->sum(number);
}
public function todayIncome()
{
return Code::where('usedatetime', 'like', date('Y-m-d%'))->sum(number);
}
public function thisMonthIncome()
{
return Code::where('usedatetime', 'like', date('Y-m%'))->sum(number);
}
public function lastMonthIncome()
{
return Code::where('usedatetime', 'like', date('Y-m%', strtotime('-1 months')))->sum(number);
}
public function totalIncome()
{
return Code::where('usedatetime', 'like', date('%'))->sum(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()
{
return self::where('class', '!=', '0')->count();

@ -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'),
@ -45,7 +44,8 @@ class Config
'enable_kill' => self::get('enable_kill'),
'custom_invite_price' => self::get('custom_invite_price'),
'captcha_provider' => self::get('captcha_provider'),
'enable_email_verify' => self::get('enable_email_verify')
'enable_email_verify' => self::get('enable_email_verify'),
'subscribe_client' => self::get('subscribe_client')
];
}

@ -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,139 @@
<?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>
';
}
}

@ -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.Trimepay.com/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
AopF2F, Codepay, PaymentWall, ChenPay, SPay, PAYJS, YftPay
};
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,10 +28,10 @@ class Payment
return new AopF2F();
case ('chenAlipay'):
return new ChenPay();
case ('trimepay'):
return new TrimePay(Config::get('trimepay_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');

@ -221,7 +221,7 @@ class TelegramProcess
}
} else {
//群组
if (Config::get('telegram_group_quiet') == 'true') {
if (Config::get('telegram_group_quiet') == true) {
return;
}
$bot->sendChatAction($message->getChat()->getId(), 'typing');
@ -257,7 +257,7 @@ class TelegramProcess
$reply['message'] = '不约,叔叔我们不约';
}
}
if ($message->getNewChatMember() != null && Config::get('enable_welcome_message') == 'true') {
if ($message->getNewChatMember() != null && Config::get('enable_welcome_message') == true) {
$reply['message'] = '欢迎 ' . $message->getNewChatMember()->getFirstName() . ' ' . $message->getNewChatMember()->getLastName();
} else {
$reply['message'] = null;

@ -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)
@ -531,4 +531,31 @@ class Tools
}
return $item;
}
/**
* 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)
{
$handle = opendir($folder);
while (false !== $f = readdir($handle)) {
if ($f != '.' && $f != '..') {
$filePath = "$folder/$f";
// 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.
$zipFile->addEmptyDir($localPath);
self::folderToZip($filePath, $zipFile, $exclusiveLength);
}
}
}
closedir($handle);
}
}

@ -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;

@ -243,7 +243,7 @@ class URL
if (strtotime($user->expire_in) < time()) {
return $return_url;
}
if (Config::get('mergeSub') == 'true') {
if (Config::get('mergeSub') == true) {
$items = array_merge(self::getAllItems($user, 1, $is_ss), self::getAllItems($user, 0, $is_ss));
} else {
$items = self::getAllItems($user, $is_mu, $is_ss);
@ -531,7 +531,7 @@ class URL
$mu_user->obfs_param = $user->getMuMd5();
$mu_user->protocol_param = $user->id . ':' . $user->passwd;
$user = $mu_user;
if (Config::get('mergeSub') != 'true') {
if (Config::get('mergeSub') != true) {
$node_name .= ' - ' . $mu_port . ' 单端口';
}
}
@ -571,9 +571,12 @@ class URL
$return_array['method'] = $user->method;
$return_array['remark'] = $node_name;
$return_array['group'] = Config::get('appName');
if ($mu_port != 0 && Config::get('mergeSub') != 'true') {
if ($mu_port != 0 && Config::get('mergeSub') != true) {
$return_array['group'] .= ' - 单端口';
}
$return_array['ratio'] = ($relay_rule != null
? $node->traffic_rate + $relay_rule->dist_node()->traffic_rate
: $node->traffic_rate);
return $return_array;
}
@ -585,7 +588,7 @@ class URL
public static function getUserTraffic($user, $is_mu = 0)
{
$group_name = Config::get('appName');
if ($is_mu == 1 && Config::get('mergeSub') != 'true') {
if ($is_mu == 1 && Config::get('mergeSub') != true) {
$group_name .= ' - 单端口';
}
if (strtotime($user->expire_in) > time()) {
@ -604,7 +607,7 @@ class URL
public static function getUserClassExpiration($user, $is_mu = 0)
{
$group_name = Config::get('appName');
if ($is_mu == 1 && Config::get('mergeSub') != 'true') {
if ($is_mu == 1 && Config::get('mergeSub') != true) {
$group_name .= ' - 单端口';
}
if (strtotime($user->expire_in) > time()) {

@ -9,10 +9,10 @@
"firebase/php-jwt": "~3.0",
"aws/aws-sdk-php": "3.*",
"gregwar/captcha": "1.*",
"cloudxns/cloud-xns-api-sdk-php": "*",
"voku/anti-xss": "^1.2",
"paymentwall/paymentwall-php": "^2.1",
"telegram-bot/api": "^2.2",
"illuminate/pagination": "5.2.*",
"illuminate/database": "5.2.*",
"sendgrid/sendgrid": "^5.1",
"esdeathlove/datatables": "^1.6",
@ -21,7 +21,6 @@
"chen-see/chen-pay": "^1.0@dev",
"league/omnipay": "^3",
"lokielse/omnipay-alipay": "*",
"charlottedunois/yasmin": "*",
"khanamiryan/qrcode-detector-decoder": "*"
},
"autoload": {

@ -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'; //数据库名
@ -40,11 +40,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'] = '';
@ -52,110 +52,104 @@ $_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
$_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
//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'; //没有格式要求,想怎么写就怎么写,可留空
@ -171,115 +165,131 @@ $_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['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['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['muKeyList'] = []; //多 key 列表
$_ENV['subscribe_client'] = true; //下载协议客户端时附带节点和订阅信息
#aws
$_ENV['aws_access_key_id'] = '';
@ -288,36 +298,30 @@ $_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;
#在套了CDN之后获取用户真实ip,如果您不知道这是什么,请不要乱动
if ( isset($_SERVER['HTTP_X_FORWARDED_FOR']) ) {

@ -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 () {
@ -126,7 +128,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');
@ -145,9 +146,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');
@ -294,23 +299,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');

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

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

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

@ -0,0 +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;

@ -356,7 +356,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">
@ -369,26 +369,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">
@ -397,9 +384,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>

@ -467,7 +467,7 @@ table tr td:first-child {
<div class="card-inner">
<div class="tab-content">
<div class="tab-pane fade {if $ssr_prefer}active in{/if}" id="all_ssr_client">
<p><i class="icon icon-lg">laptop_windows</i> Windows:下载 <a href="/ssr-download/ssr-win.7z" target="_blank">ShadowsocksRR Windows</a> 或 <a href="/ssr-download/SSTap.7z" target="_blank">SSTap</a></p>
<p><i class="icon icon-lg">laptop_windows</i> Windows:下载 <a href="{if $config['subscribe_client']!='true'}/ssr-download/ssr-win.7z{else}/user/getPcClient?type=ssr-win{/if}" target="_blank">ShadowsocksRR Windows</a> 或 <a href="/ssr-download/SSTap.7z" target="_blank">SSTap</a></p>
<p><i class="icon icon-lg">laptop_mac</i> macOS:<a href="/ssr-download/ssr-mac.dmg" target="_blank">下载 ShadowsocksX-NG-R8</a></p>
<p><i class="icon icon-lg">laptop_windows</i> Linux(GUI):<a href="/ssr-download/ssr-linux.AppImage" target="_blank">下载 Electron SSR</a></p>
<p><i class="icon icon-lg">android</i> Android:下载 <a href="/ssr-download/ssrr-android.apk">SSRR</a> 或 <a href="/ssr-download/ssr-android.apk">SSR</a></p>
@ -475,7 +475,7 @@ table tr td:first-child {
<p><i class="icon icon-lg">router</i> Koolshare 固件路由器/软路由:前往 <a href="https://github.com/hq450/fancyss_history_package" target="_blank">FancySS 下载页面</a></p>
</div>
<div class="tab-pane fade {if !$ssr_prefer}active in{/if}" id="all_ss_client">
<p><i class="icon icon-lg">laptop_windows</i> Windows:下载 <a href="/ssr-download/ssd-win.7z" target="_blank">SSD Windows</a>,<a href="/ssr-download/ss-win.zip" target="_blank">Shadowsocks Windows</a> 或 <a href="/ssr-download/SSTap.7z" target="_blank">SSTap</a></p>
<p><i class="icon icon-lg">laptop_windows</i> Windows:下载 <a href="{if $config['subscribe_client']!='true'}/ssr-download/ssd-win.7z{else}/user/getPcClient?type=ssd-win{/if}" target="_blank">SSD Windows</a>,<a href="{if $config['subscribe_client']!='true'}/ssr-download/ss-win.zip{else}/user/getPcClient?type=ss-win{/if}" target="_blank">Shadowsocks Windows</a> 或 <a href="/ssr-download/SSTap.7z" target="_blank">SSTap</a></p>
<p><i class="icon icon-lg">laptop_mac</i> macOS:<a href="/ssr-download/ss-mac.zip" target="_blank">下载 ShadowsocksX-NG</a></p>
<p><i class="icon icon-lg">laptop_windows</i> Linux(GUI):<a href="/ssr-download/ssr-linux.AppImage" target="_blank">下载 Electron SSR</a></p>
<p><i class="icon icon-lg">android</i> Android:下载 <a href="/ssr-download/ss-android.apk">Shadowsocks Android</a> 或 <a href="/ssr-download/ssd-android.apk">SSD Android</a>。如果需要启用混淆还需要下载 <a href="/ssr-download/ss-android-obfs.apk">Simple-Obfs 混淆插件</a>。</p>
@ -638,7 +638,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();
@ -671,7 +671,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();
@ -731,7 +731,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>

@ -696,5 +696,3 @@ 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`;

@ -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
Loading…
Cancel
Save