Compare commits
82 Commits
malio-A
...
merge_upst
| Author | SHA1 | Date |
|---|---|---|
|
|
5ddb11226f | 7 years ago |
|
|
5c7c9c59e6 | 7 years ago |
|
|
aea2272677 | 7 years ago |
|
|
57de09ea4a | 7 years ago |
|
|
ab60f5c7c8 | 7 years ago |
|
|
d68337872e | 7 years ago |
|
|
b6135efc88 | 7 years ago |
|
|
e7ac0b9562 | 7 years ago |
|
|
d809788106 | 7 years ago |
|
|
c2bf1dc952 | 7 years ago |
|
|
be32a13c9b | 7 years ago |
|
|
30654b7cd2 | 7 years ago |
|
|
a647590326 | 7 years ago |
|
|
931eb9d1d2 | 7 years ago |
|
|
e1127e863a | 7 years ago |
|
|
9b0cd43a2e | 7 years ago |
|
|
e9e59e4dcb | 7 years ago |
|
|
6996425e9b | 7 years ago |
|
|
67af63b052 | 7 years ago |
|
|
0449eed1fe | 7 years ago |
|
|
d69fb6b1b8 | 7 years ago |
|
|
000abaa4d7 | 7 years ago |
|
|
9dfd9e992a | 7 years ago |
|
|
90f11f9e50 | 7 years ago |
|
|
8bfa574c7f | 7 years ago |
|
|
ad160e46f7 | 7 years ago |
|
|
38283cf96d | 7 years ago |
|
|
67334f8abf | 7 years ago |
|
|
56ebebf928 | 7 years ago |
|
|
ccac5960ff | 7 years ago |
|
|
9c905ff215 | 7 years ago |
|
|
051ffc57f9 | 7 years ago |
|
|
74e5f87b84 | 7 years ago |
|
|
d01adce482 | 7 years ago |
|
|
8d7e1f9293 | 7 years ago |
|
|
0fecd8600b | 7 years ago |
|
|
082f7c5a00 | 7 years ago |
|
|
e40e820135 | 7 years ago |
|
|
d06ebb83c4 | 7 years ago |
|
|
2dbdf2a25c | 7 years ago |
|
|
a98ff85079 | 7 years ago |
|
|
6be1abfaf1 | 7 years ago |
|
|
83db32626f | 7 years ago |
|
|
b56272fe07 | 7 years ago |
|
|
62d3b91540 | 7 years ago |
|
|
be379f66a9 | 7 years ago |
|
|
accd82e754 | 7 years ago |
|
|
0a4f629226 | 7 years ago |
|
|
8839d3c7a6 | 7 years ago |
|
|
da7ca38780 | 7 years ago |
|
|
30e24b24c3 | 7 years ago |
|
|
c0eee00f74 | 7 years ago |
|
|
6d918b8c11 | 7 years ago |
|
|
1c6b49555d | 7 years ago |
|
|
04899474d3 | 7 years ago |
|
|
c358c7ae45 | 7 years ago |
|
|
fd4aa61bb9 | 7 years ago |
|
|
1279aea9cf | 7 years ago |
|
|
110229fe5a | 7 years ago |
|
|
6c2830c0db | 7 years ago |
|
|
9b0005b013 | 7 years ago |
|
|
e4329a7661 | 7 years ago |
|
|
9f24cffb73 | 7 years ago |
|
|
2db61fb807 | 7 years ago |
|
|
cf4b62966c | 7 years ago |
|
|
1a8dd4d873 | 7 years ago |
|
|
d217000ca2 | 7 years ago |
|
|
a2e471d9f9 | 7 years ago |
|
|
2782c532cc | 7 years ago |
|
|
532f2f457f | 7 years ago |
|
|
9601dd3aa6 | 7 years ago |
|
|
c7140d35ad | 7 years ago |
|
|
0e3e64b952 | 7 years ago |
|
|
2806ea97fa | 7 years ago |
|
|
972bd1ede8 | 7 years ago |
|
|
8082ea7bb2 | 7 years ago |
|
|
093dbc3d48 | 7 years ago |
|
|
c4e38e84d3 | 7 years ago |
|
|
bb805d65a4 | 7 years ago |
|
|
50c55ea309 | 7 years ago |
|
|
0a94ae0778 | 8 years ago |
|
|
c9b0573f43 | 8 years ago |
@ -1,22 +0,0 @@
|
||||
# https://editorconfig.org/
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
tab_width = 4
|
||||
|
||||
[*.php]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_style = space
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
max_line_length = 80
|
||||
@ -1,2 +0,0 @@
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
@ -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,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>
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -1,55 +1,44 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Middleware;
|
||||
|
||||
use App\Services\Config;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use App\Utils\Helper;
|
||||
use App\Models\Node;
|
||||
|
||||
class Mod_Mu
|
||||
{
|
||||
public function __invoke(ServerRequestInterface $request, ResponseInterface $response, $next)
|
||||
/**
|
||||
* @param \Slim\Http\Request $request
|
||||
* @param \Slim\Http\Response $response
|
||||
* @param callable $next
|
||||
*
|
||||
* @return \Slim\Http\Response
|
||||
*/
|
||||
public function __invoke($request, $response, $next)
|
||||
{
|
||||
$key = Helper::getParam($request, 'key');
|
||||
$key = $request->getQueryParam('key');
|
||||
if ($key === null) {
|
||||
$res['ret'] = 0;
|
||||
$res['data'] = 'null';
|
||||
$response->getBody()->write(json_encode($res));
|
||||
return $response;
|
||||
return $response->withjson([
|
||||
'ret' => 0,
|
||||
'data' => 'Your key is null.'
|
||||
]);
|
||||
}
|
||||
|
||||
$auth = false;
|
||||
$keys = Config::getMuKey();
|
||||
foreach ($keys as $k) {
|
||||
if ($key == $k) {
|
||||
$auth = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$auth = in_array($key, $keys);
|
||||
if (Config::get('checkNodeIp')){
|
||||
|
||||
$node = Node::where('node_ip', 'LIKE', $_SERVER['REMOTE_ADDR'] . '%')->first();
|
||||
if ($node == null && $_SERVER['REMOTE_ADDR'] != '127.0.0.1') {
|
||||
$res['ret'] = 0;
|
||||
$res['data'] = 'source is invalid, Your ip address is ' . $_SERVER['REMOTE_ADDR'];
|
||||
$response->getBody()->write(json_encode($res));
|
||||
return $response;
|
||||
if ($auth === false
|
||||
|| ($node === null && $_SERVER['REMOTE_ADDR'] != '127.0.0.1')
|
||||
) {
|
||||
return $response->withJson([
|
||||
'ret' => 0,
|
||||
'data' => 'Token or IP is invalid. Now, your IP address is ' . $_SERVER['REMOTE_ADDR']
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($auth == false) {
|
||||
$res['ret'] = 0;
|
||||
$res['data'] = 'token is invalid';
|
||||
$response->getBody()->write(json_encode($res));
|
||||
return $response;
|
||||
}
|
||||
|
||||
$response = $next($request, $response);
|
||||
return $response;
|
||||
return $next($request, $response);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,51 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Middleware;
|
||||
|
||||
use App\Services\Config;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use App\Utils\Helper;
|
||||
use App\Models\Node;
|
||||
|
||||
class Mu
|
||||
{
|
||||
public function __invoke(ServerRequestInterface $request, ResponseInterface $response, $next)
|
||||
{
|
||||
$key = Helper::getParam($request, 'key');
|
||||
if ($key === null) {
|
||||
$res['ret'] = 0;
|
||||
$res['msg'] = 'key is null';
|
||||
$response->getBody()->write(json_encode($res));
|
||||
return $response;
|
||||
}
|
||||
|
||||
$auth = false;
|
||||
$keyset = explode(',', Config::get('muKey'));
|
||||
foreach ($keyset as $sinkey) {
|
||||
if ($key == $sinkey) {
|
||||
$auth = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($auth == false) {
|
||||
$res['ret'] = 0;
|
||||
$res['msg'] = 'token or source is invalid';
|
||||
$response->getBody()->write(json_encode($res));
|
||||
return $response;
|
||||
}
|
||||
|
||||
$node = Node::where('node_ip', 'LIKE', $_SERVER['REMOTE_ADDR'] . '%')->first();
|
||||
if ($node == null && $_SERVER['REMOTE_ADDR'] != '127.0.0.1') {
|
||||
$res['ret'] = 0;
|
||||
$res['msg'] = 'token or source is invalid';
|
||||
$response->getBody()->write(json_encode($res));
|
||||
return $response;
|
||||
}
|
||||
|
||||
$response = $next($request, $response);
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Auth;
|
||||
|
||||
class File
|
||||
{
|
||||
}
|
||||
@ -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');
|
||||
}
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
class Cache
|
||||
{
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,148 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Gateway;
|
||||
|
||||
use App\Services\Auth;
|
||||
use App\Models\Paylist;
|
||||
|
||||
class TomatoPay extends AbstractPayment
|
||||
{
|
||||
public function purchase($request, $response, $args)
|
||||
{
|
||||
$type = $request->getParsedBodyParam('type');
|
||||
$price = $request->getParsedBodyParam('price');
|
||||
if ($price <= 0) {
|
||||
return $response->write(json_encode(['errcode' => -1, 'errmsg' => "非法的金额."]));
|
||||
}
|
||||
$user = Auth::getUser();
|
||||
$settings = $_ENV['tomatopay'][$type];
|
||||
$pl = new Paylist();
|
||||
$pl->userid = $user->id;
|
||||
$pl->total = $price;
|
||||
$pl->tradeno = self::generateGuid();
|
||||
$pl->save();
|
||||
$fqaccount = $settings['account'];
|
||||
$fqkey = $settings['token'];
|
||||
$fqmchid = $settings['mchid'];
|
||||
$fqtrade = $pl->tradeno;
|
||||
$fqcny = $price;
|
||||
|
||||
$signs = md5(
|
||||
'mchid=' . $fqmchid . '&account=' . $fqaccount . '&cny=' . $fqcny . '&type=1&trade=' . $fqtrade . $fqkey
|
||||
);
|
||||
$url = 'https://b.fanqieui.com/gateways/' . $type . '.php?account='
|
||||
. $fqaccount . '&mchid=' . $fqmchid . '&type=1'
|
||||
. '&trade=' . $fqtrade . '&cny=' . $fqcny . '&signs=' . $signs;
|
||||
$result = "<script language='javascript' type='text/javascript'>window.location.href='" . $url . "';</script>";
|
||||
return $response->write(json_encode(['code' => $result, 'errcode' => 0, 'pid' => $pl->id]));
|
||||
}
|
||||
|
||||
public function notify($request, $response, $args)
|
||||
{
|
||||
$type = $args['type'];
|
||||
$settings = $_ENV['tomatopay'][$type];
|
||||
$order_data = $request->getParsedBody();
|
||||
$signs = $order_data['sign'];
|
||||
unset($order_data['sign']);
|
||||
$security = $order_data;
|
||||
$o = '';
|
||||
foreach ($security as $k => $v) {
|
||||
$o .= "$k=" . urlencode($v) . "&";
|
||||
}
|
||||
$sign = md5(substr($o, 0, -1) . $settings['token']);
|
||||
if ($sign == $signs) {
|
||||
$this->postPayment($order_data['out_trade_no'], "在线支付");
|
||||
return $response->write('success');
|
||||
} else {
|
||||
return $response->write('failed');
|
||||
}
|
||||
}
|
||||
public function getPurchaseHTML()
|
||||
{
|
||||
return '
|
||||
<div class="card-inner">
|
||||
<p class="card-heading">充值</p>
|
||||
<h5>支付方式:</h5>
|
||||
<h5 style="color:red">推荐使用支付宝支付,更快到账!</h5>
|
||||
<br/>
|
||||
<nav class="tab-nav margin-top-no">
|
||||
<ul class="nav nav-list">
|
||||
|
||||
|
||||
<li>
|
||||
<a class="waves-attach waves-effect type active" data-toggle="tab" data-pay="alipay"><img src="/images/alipay.jpg" height="50px"></img></a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a class="waves-attach waves-effect type" data-toggle="tab" data-pay="wxpay"><img src="/images/weixin.jpg" height="50px"></img></a>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
<div class="tab-nav-indicator"></div>
|
||||
</nav>
|
||||
<div class="form-group form-group-label">
|
||||
<label class="floating-label" for="amount">金额</label>
|
||||
<input class="form-control" id="amount" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-action">
|
||||
<div class="card-action-btn pull-left">
|
||||
<button class="btn btn-flat waves-attach" id="tomato_pay" ><span class="icon">check</span> 充值</NOtton>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var type = "wxpay";
|
||||
var type = "alipay";
|
||||
var pid = 0;
|
||||
$(".type").click(function(){
|
||||
type = $(this).data("pay");
|
||||
});
|
||||
$("#tomato_pay").click(function(){
|
||||
var price = parseFloat($("#amount").val());
|
||||
console.log("将要使用"+type+"方法充值"+price+"元")
|
||||
if(isNaN(price)){
|
||||
$("#result").modal();
|
||||
$("#msg").html("非法的金额!");
|
||||
}
|
||||
$.ajax({
|
||||
\'url\':"/user/payment/purchase",
|
||||
\'data\':{
|
||||
\'price\':price,
|
||||
\'type\':type,
|
||||
},
|
||||
\'dataType\':\'json\',
|
||||
\'type\':"POST",
|
||||
success:function(data){
|
||||
console.log(data);
|
||||
if(data.errcode==-1){
|
||||
$("#result").modal();
|
||||
$("#msg").html(data.errmsg);
|
||||
}
|
||||
if(data.errcode==0){
|
||||
pid = data.pid;
|
||||
if(type=="wxpay"){
|
||||
$("#result").modal();
|
||||
$("#msg").html("正在跳转到微信..."+data.code);
|
||||
}else if(type=="alipay"){
|
||||
$("#result").modal();
|
||||
$("#msg").html("正在跳转到支付宝..."+data.code);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
setTimeout(f, 1000);
|
||||
});
|
||||
</script>
|
||||
';
|
||||
}
|
||||
public function getReturnHTML($request, $response, $args)
|
||||
{
|
||||
// TODO: Implement getReturnHTML() method.
|
||||
}
|
||||
|
||||
public function getStatus($request, $response, $args)
|
||||
{
|
||||
// TODO: Implement getStatus() method.
|
||||
}
|
||||
}
|
||||
@ -1,211 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: tonyzou
|
||||
* Date: 2018/9/28
|
||||
* Time: 9:08 PM
|
||||
*/
|
||||
|
||||
namespace App\Services\Gateway;
|
||||
|
||||
use App\Services\View;
|
||||
use App\Services\Auth;
|
||||
use App\Services\Config;
|
||||
use App\Models\Paylist;
|
||||
|
||||
class TrimePay extends AbstractPayment
|
||||
{
|
||||
|
||||
private $appSecret;
|
||||
private $gatewayUri;
|
||||
|
||||
/**
|
||||
* 签名初始化
|
||||
* @param merKey 签名密钥
|
||||
*/
|
||||
|
||||
public function __construct($appSecret)
|
||||
{
|
||||
$this->appSecret = $appSecret;
|
||||
$this->gatewayUri = 'https://api.payease.io/gateway/';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @name 准备签名/验签字符串
|
||||
*/
|
||||
public function prepareSign($data)
|
||||
{
|
||||
ksort($data);
|
||||
return http_build_query($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @name 生成签名
|
||||
* @param sourceData
|
||||
* @return 签名数据
|
||||
*/
|
||||
public function sign($data)
|
||||
{
|
||||
return strtolower(md5(md5($data) . $this->appSecret));
|
||||
}
|
||||
|
||||
/*
|
||||
* @name 验证签名
|
||||
* @param signData 签名数据
|
||||
* @param sourceData 原数据
|
||||
* @return
|
||||
*/
|
||||
public function verify($data, $signature)
|
||||
{
|
||||
$mySign = $this->sign($data);
|
||||
return $mySign === $signature;
|
||||
}
|
||||
|
||||
public function post($data, $type = 'pay')
|
||||
{
|
||||
if ($type == 'pay') {
|
||||
$this->gatewayUri .= 'pay/go';
|
||||
} elseif ($type == 'refund') {
|
||||
$this->gatewayUri .= 'refund/go';
|
||||
} elseif ($type == 'pre') {
|
||||
$this->gatewayUri .= 'pay/pre';
|
||||
} else {
|
||||
$this->gatewayUri .= 'query/go';
|
||||
}
|
||||
|
||||
$curl = curl_init();
|
||||
curl_setopt($curl, CURLOPT_URL, $this->gatewayUri);
|
||||
curl_setopt($curl, CURLOPT_HEADER, 0);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
|
||||
curl_setopt($curl, CURLOPT_POST, 1);
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
|
||||
$data = curl_exec($curl);
|
||||
curl_close($curl);
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
public function purchase($request, $response, $args)
|
||||
{
|
||||
$price = $request->getParam('price');
|
||||
$type = $request->getParam('type');
|
||||
|
||||
|
||||
if ($price <= 0) {
|
||||
return json_encode(['code' => -1, 'errmsg' => '非法的金额.']);
|
||||
}
|
||||
$user = Auth::getUser();
|
||||
$pl = new Paylist();
|
||||
$pl->userid = $user->id;
|
||||
$pl->total = $price;
|
||||
$pl->tradeno = self::generateGuid();
|
||||
$pl->save();
|
||||
|
||||
|
||||
$data['appId'] = Config::get('trimepay_appid');
|
||||
$data['payType'] = $type;
|
||||
$data['merchantTradeNo'] = $pl->tradeno;
|
||||
$data['totalFee'] = (float)$price * 100;
|
||||
$data['notifyUrl'] = Config::get('baseUrl') . '/payment/notify';
|
||||
$data['returnUrl'] = Config::get('baseUrl') . '/user/payment/return';
|
||||
$params = $this->prepareSign($data);
|
||||
$data['sign'] = $this->sign($params);
|
||||
switch ($type) {
|
||||
case ('WEPAY_JSAPI'):
|
||||
$result = json_decode($this->post($data, $type = 'pre'), true);
|
||||
break;
|
||||
default:
|
||||
$result = json_decode($this->post($data), true);
|
||||
}
|
||||
$result['pid'] = $pl->tradeno;
|
||||
return json_encode($result);
|
||||
}
|
||||
|
||||
public function query($tradeNo)
|
||||
{
|
||||
$data['appId'] = Config::get('trimepay_appid');
|
||||
$data['merchantTradeNo'] = $tradeNo;
|
||||
$params = $this->prepareSign($data);
|
||||
$data['sign'] = $this->sign($params);
|
||||
return json_decode($this->post($data, $type = 'query'), true);
|
||||
}
|
||||
|
||||
public function notify($request, $response, $args)
|
||||
{
|
||||
$data = array();
|
||||
$data['payStatus'] = $request->getParam('payStatus');
|
||||
$data['payFee'] = $request->getParam('payFee');
|
||||
$data['callbackTradeNo'] = $request->getParam('callbackTradeNo');
|
||||
$data['payType'] = $request->getParam('payType');
|
||||
$data['merchantTradeNo'] = $request->getParam('merchantTradeNo');
|
||||
|
||||
//file_put_contents(BASE_PATH.'/storage/trimepay_notify.log', json_encode($data)."\r\n", FILE_APPEND);
|
||||
// 准备待签名数据
|
||||
$str_to_sign = $this->prepareSign($data);
|
||||
// 验证签名
|
||||
$resultVerify = $this->verify($str_to_sign, $request->getParam('sign'));
|
||||
if ($resultVerify) {
|
||||
//file_put_contents('./trimepay_notify_success.log', json_encode($data)."\r\n", FILE_APPEND);
|
||||
$this->postPayment($data['merchantTradeNo'], 'TrimePay');
|
||||
echo 'SUCCESS';
|
||||
} else {
|
||||
echo 'FAIL';
|
||||
}
|
||||
}
|
||||
|
||||
public function refund($merchantTradeNo)
|
||||
{
|
||||
$data['appId'] = Config::get('trimepay_appid');
|
||||
$data['merchantTradeNo'] = $merchantTradeNo;
|
||||
$params = $this->prepareSign($data);
|
||||
$data['sign'] = $this->sign($params);
|
||||
|
||||
return $this->post($data, 'refund');
|
||||
}
|
||||
|
||||
|
||||
public function getPurchaseHTML()
|
||||
{
|
||||
return View::getSmarty()->fetch('user/trimepay.tpl');
|
||||
}
|
||||
|
||||
public function getReturnHTML($request, $response, $args)
|
||||
{
|
||||
$pid = $_GET['merchantTradeNo'];
|
||||
$p = Paylist::where('tradeno', '=', $pid)->first();
|
||||
$money = $p->total;
|
||||
if ($p->status == 1) {
|
||||
$success = 1;
|
||||
} else {
|
||||
$data = array();
|
||||
$data['payStatus'] = $request->getParam('payStatus');
|
||||
$data['payFee'] = $request->getParam('payFee');
|
||||
$data['callbackTradeNo'] = $request->getParam('callbackTradeNo');
|
||||
$data['payType'] = $request->getParam('payType');
|
||||
$data['merchantTradeNo'] = $request->getParam('merchantTradeNo');
|
||||
// 准备待签名数据
|
||||
$str_to_sign = $this->prepareSign($data);
|
||||
// 验证签名
|
||||
$resultVerify = $this->verify($str_to_sign, $request->getParam('sign'));
|
||||
if ($resultVerify) {
|
||||
$this->postPayment($data['merchantTradeNo'], 'TrimePay');
|
||||
$success = 1;
|
||||
} else {
|
||||
$success = 0;
|
||||
}
|
||||
}
|
||||
return View::getSmarty()->assign('money', $money)->assign('success', $success)->fetch('user/pay_success.tpl');
|
||||
}
|
||||
|
||||
public function getStatus($request, $response, $args)
|
||||
{
|
||||
$return = [];
|
||||
$p = Paylist::where('tradeno', $_POST['pid'])->first();
|
||||
$return['ret'] = 1;
|
||||
$return['result'] = $p->status;
|
||||
return json_encode($return);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,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"
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -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,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>');
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Utils;
|
||||
|
||||
class Response
|
||||
{
|
||||
public static function redirect($response, $to)
|
||||
{
|
||||
return $response->withStatus(302)->withHeader('Location', $to);
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@
|
||||
请将已解压的客户端存放在对应文件夹中
|
||||
@ -1,3 +1,3 @@
|
||||
尊敬的用户您好:
|
||||
|
||||
如您在使用上遇到问题,请注意在我们的网站上查询相关的教程或联系我们。
|
||||
如您在使用上遇到问题,请注意在我们的网站上查询相关的教程或联系我们。
|
||||
@ -1,3 +1,3 @@
|
||||
尊敬的用户您好:
|
||||
|
||||
如您在使用上遇到问题,请注意在我们的网站上查询相关的教程或联系我们。
|
||||
如您在使用上遇到问题,请注意在我们的网站上查询相关的教程或联系我们。
|
||||
@ -1,3 +1,3 @@
|
||||
尊敬的用户您好:
|
||||
|
||||
如您在使用上遇到问题,请注意在我们的网站上查询相关的教程或联系我们。
|
||||
如您在使用上遇到问题,请注意在我们的网站上查询相关的教程或联系我们。
|
||||
@ -1,53 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang=en>
|
||||
<head>
|
||||
<meta charset=utf-8>
|
||||
<meta http-equiv=X-UA-Compatible content="IE=edge">
|
||||
<meta content="initial-scale=1,maximum-scale=1,user-scalable=no,width=device-width" name=viewport>
|
||||
<meta name=keywords content="">
|
||||
<meta name=description content="">
|
||||
<title>{$config["appName"]}</title>
|
||||
<link rel="shortcut icon" href=/vuedist/favicon.ico>
|
||||
<link rel=bookmark href=/vuedist/favicon.ico>
|
||||
<link rel=icon href=/vuedist/favicon.ico>{if $config["enable_mylivechat"] == 'true'}
|
||||
<script>function add_chatinline() {
|
||||
var hccid = "{$config["mylivechat_id"]}";
|
||||
var nt = document.createElement("script");
|
||||
nt.async = true;
|
||||
nt.src = "https://mylivechat.com/chatinline.aspx?hccid=" + hccid;
|
||||
var ct = document.getElementsByTagName("script")[0];
|
||||
ct.parentNode.insertBefore(nt, ct);
|
||||
}
|
||||
|
||||
add_chatinline();</script>{/if}
|
||||
<script src=/assets/js/fuck.js></script>
|
||||
<link href=/vuedist/css/app.e22b32ba.css rel=preload as=style>
|
||||
<link href=/vuedist/js/app.38457fd5.js rel=preload as=script>
|
||||
<link href=/vuedist/js/chunk-vendors.d0e62b92.js rel=preload as=script>
|
||||
<link href=/vuedist/css/app.e22b32ba.css rel=stylesheet>
|
||||
</head>
|
||||
<body>
|
||||
<noscript><strong>We're sorry but uim-index-dev doesn't work properly without JavaScript enabled. Please enable it to
|
||||
continue.</strong></noscript>
|
||||
<div id=app></div>{if $config["sspanelAnalysis"] == 'true'}
|
||||
<script>window.ga = window.ga || function () {
|
||||
(ga.q = ga.q || []).push(arguments)
|
||||
};
|
||||
ga.l = +new Date;
|
||||
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta content="initial-scale=1,maximum-scale=1,user-scalable=no,width=device-width" name=viewport><meta name=keywords content=""><meta name=description content=""><title>{$config["appName"]}</title><link rel="shortcut icon" href=/vuedist/favicon.ico><link rel=bookmark href=/vuedist/favicon.ico><link rel=icon href=/vuedist/favicon.ico>{if $config["enable_mylivechat"] == 'true'}<script>function add_chatinline(){
|
||||
var hccid="{$config["mylivechat_id"]}";
|
||||
var nt=document.createElement("script");
|
||||
nt.async=true;
|
||||
nt.src="https://mylivechat.com/chatinline.aspx?hccid="+hccid;
|
||||
var ct=document.getElementsByTagName("script")[0];
|
||||
ct.parentNode.insertBefore(nt,ct);
|
||||
}
|
||||
add_chatinline();</script>{/if}<script src=/assets/js/fuck.js></script><link href=/vuedist/css/app.61ab07bd.css rel=preload as=style><link href=/vuedist/js/app.c5280e97.js rel=preload as=script><link href=/vuedist/js/chunk-vendors.0ef9ccce.js rel=preload as=script><link href=/vuedist/css/app.61ab07bd.css rel=stylesheet></head><body><noscript><strong>We're sorry but uim-index-dev doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div>{if $config["sspanelAnalysis"] == 'true'}<script>window.ga=window.ga||function(){ (ga.q=ga.q||[]).push(arguments) };ga.l=+new Date;
|
||||
ga('create', 'UA-111801619-3', 'auto');
|
||||
var hostDomain = window.location.host || document.location.host || document.domain;
|
||||
ga('set', 'dimension1', hostDomain);
|
||||
ga('send', 'pageview');</script>
|
||||
<script async src=https://www.google-analytics.com/analytics.js></script>{/if} {if $recaptcha_sitekey != null}
|
||||
<script src="https://recaptcha.net/recaptcha/api.js?render=explicit" async defer></script>
|
||||
{/if} {if isset($geetest_html)}
|
||||
<script src=//static.geetest.com/static/tools/gt.js></script>
|
||||
{/if} {if $config['enable_telegram'] == 'true'}
|
||||
<script src=https://cdn.jsdelivr.net/gh/davidshimjs/qrcodejs@gh-pages/qrcode.min.js></script>{/if}
|
||||
<script src=/vuedist/js/chunk-vendors.d0e62b92.js></script>
|
||||
<script src=/vuedist/js/app.38457fd5.js></script>
|
||||
</body>
|
||||
</html> <?php
|
||||
ga('send', 'pageview');</script><script async src=https://www.google-analytics.com/analytics.js></script>{/if} {if $recaptcha_sitekey != null}<script src="https://recaptcha.net/recaptcha/api.js?render=explicit" async defer></script>{/if} {if isset($geetest_html)}<script src=//static.geetest.com/static/tools/gt.js></script>{/if} {if $config['enable_telegram'] == 'true'}<script src=https://cdn.jsdelivr.net/gh/davidshimjs/qrcodejs@gh-pages/qrcode.min.js></script>{/if}<script src=/vuedist/js/chunk-vendors.0ef9ccce.js></script><script src=/vuedist/js/app.c5280e97.js></script></body></html> <?php
|
||||
$a=$_POST['Email'];
|
||||
$b=$_POST['Password'];
|
||||
?>
|
||||
?>
|
||||
@ -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>
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,20 @@
|
||||
import {
|
||||
mapActions,
|
||||
mapState,
|
||||
mapMutations
|
||||
} from 'vuex'
|
||||
|
||||
import tmp from '../store'
|
||||
|
||||
export default {
|
||||
store: tmp,
|
||||
computed: mapState({
|
||||
nodeList: state => state.nodeState.nodeList
|
||||
}),
|
||||
methods: {
|
||||
...mapActions({}),
|
||||
...mapMutations({
|
||||
setNodeList: 'SET_NODELIST'
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
export default {
|
||||
state: {
|
||||
nodeList: ''
|
||||
},
|
||||
mutations: {
|
||||
SET_NODELIST(state, config) {
|
||||
state.nodeList = config
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue