mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 09:39:10 +08:00
format
This commit is contained in:
parent
35f954cd84
commit
f7fdfadfb0
@ -60,12 +60,14 @@ class CheckOrder extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function orderHandle ($order) {
|
private function orderHandle($order)
|
||||||
|
{
|
||||||
$user = User::find($order->user_id);
|
$user = User::find($order->user_id);
|
||||||
return $this->buy($order, $user);
|
return $this->buy($order, $user);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function buy ($order, $user) {
|
private function buy($order, $user)
|
||||||
|
{
|
||||||
$plan = Plan::find($order->plan_id);
|
$plan = Plan::find($order->plan_id);
|
||||||
// change plan process
|
// change plan process
|
||||||
if ($order->type === 3) {
|
if ($order->type === 3) {
|
||||||
@ -83,15 +85,20 @@ class CheckOrder extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getTime ($str, $timestamp) {
|
private function getTime($str, $timestamp)
|
||||||
|
{
|
||||||
if ($timestamp < time()) {
|
if ($timestamp < time()) {
|
||||||
$timestamp = time();
|
$timestamp = time();
|
||||||
}
|
}
|
||||||
switch ($str) {
|
switch ($str) {
|
||||||
case 'month_price': return strtotime('+1 month', $timestamp);
|
case 'month_price':
|
||||||
case 'quarter_price': return strtotime('+3 month', $timestamp);
|
return strtotime('+1 month', $timestamp);
|
||||||
case 'half_year_price': return strtotime('+6 month', $timestamp);
|
case 'quarter_price':
|
||||||
case 'year_price': return strtotime('+12 month', $timestamp);
|
return strtotime('+3 month', $timestamp);
|
||||||
|
case 'half_year_price':
|
||||||
|
return strtotime('+6 month', $timestamp);
|
||||||
|
case 'year_price':
|
||||||
|
return strtotime('+12 month', $timestamp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,8 @@ class SendRemindMail extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function remindExpire ($user) {
|
private function remindExpire($user)
|
||||||
|
{
|
||||||
if (($user->expired_at - 86400) < time() && $user->expired_at > time()) {
|
if (($user->expired_at - 86400) < time() && $user->expired_at > time()) {
|
||||||
SendEmail::dispatch([
|
SendEmail::dispatch([
|
||||||
'email' => $user->email,
|
'email' => $user->email,
|
||||||
@ -61,7 +62,8 @@ class SendRemindMail extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function remindTraffic ($user) {
|
private function remindTraffic($user)
|
||||||
|
{
|
||||||
if ($this->remindTrafficIsWarnValue(($user->u + $user->d), $user->transfer_enable)) {
|
if ($this->remindTrafficIsWarnValue(($user->u + $user->d), $user->transfer_enable)) {
|
||||||
$sendCount = MailLog::where('created_at', '>=', strtotime(date('Y-m-1')))
|
$sendCount = MailLog::where('created_at', '>=', strtotime(date('Y-m-1')))
|
||||||
->where('template_name', 'mail.sendRemindTraffic')
|
->where('template_name', 'mail.sendRemindTraffic')
|
||||||
@ -79,7 +81,8 @@ class SendRemindMail extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function remindTrafficIsWarnValue ($ud, $transfer_enable) {
|
private function remindTrafficIsWarnValue($ud, $transfer_enable)
|
||||||
|
{
|
||||||
if ($ud <= 0) return false;
|
if ($ud <= 0) return false;
|
||||||
if (($ud / $transfer_enable * 100) < 80) return false;
|
if (($ud / $transfer_enable * 100) < 80) return false;
|
||||||
return true;
|
return true;
|
||||||
|
@ -47,7 +47,8 @@ class V2boardCache extends Command
|
|||||||
$this->setMonthRegisterTotal();
|
$this->setMonthRegisterTotal();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function setMonthIncome() {
|
private function setMonthIncome()
|
||||||
|
{
|
||||||
Cache::put(
|
Cache::put(
|
||||||
'month_income',
|
'month_income',
|
||||||
Order::where('created_at', '>=', strtotime(date('Y-m-1')))
|
Order::where('created_at', '>=', strtotime(date('Y-m-1')))
|
||||||
@ -57,7 +58,8 @@ class V2boardCache extends Command
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function setMonthRegisterTotal() {
|
private function setMonthRegisterTotal()
|
||||||
|
{
|
||||||
Cache::put(
|
Cache::put(
|
||||||
'month_register_total',
|
'month_register_total',
|
||||||
User::where('created_at', '>=', strtotime(date('Y-m-1')))
|
User::where('created_at', '>=', strtotime(date('Y-m-1')))
|
||||||
|
@ -60,7 +60,8 @@ class V2boardInstall extends Command
|
|||||||
foreach ($sql as $item) {
|
foreach ($sql as $item) {
|
||||||
try {
|
try {
|
||||||
DB::select(DB::raw($item));
|
DB::select(DB::raw($item));
|
||||||
} catch (\Exception $e) {}
|
} catch (\Exception $e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$email = '';
|
$email = '';
|
||||||
while (!$email) {
|
while (!$email) {
|
||||||
@ -78,7 +79,8 @@ class V2boardInstall extends Command
|
|||||||
\File::put(base_path() . '/.lock', time());
|
\File::put(base_path() . '/.lock', time());
|
||||||
}
|
}
|
||||||
|
|
||||||
private function registerAdmin ($email, $password) {
|
private function registerAdmin($email, $password)
|
||||||
|
{
|
||||||
$user = new User();
|
$user = new User();
|
||||||
$user->email = $email;
|
$user->email = $email;
|
||||||
$user->password = password_hash($password, PASSWORD_DEFAULT);
|
$user->password = password_hash($password, PASSWORD_DEFAULT);
|
||||||
|
@ -53,7 +53,8 @@ class V2boardUpdate extends Command
|
|||||||
foreach ($sql as $item) {
|
foreach ($sql as $item) {
|
||||||
try {
|
try {
|
||||||
DB::select(DB::raw($item));
|
DB::select(DB::raw($item));
|
||||||
} catch (\Exception $e) {}
|
} catch (\Exception $e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$this->info('更新完毕');
|
$this->info('更新完毕');
|
||||||
}
|
}
|
||||||
|
@ -11,11 +11,13 @@ use App\Models\User;
|
|||||||
|
|
||||||
class ConfigController extends Controller
|
class ConfigController extends Controller
|
||||||
{
|
{
|
||||||
public function init () {
|
public function init()
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function fetch () {
|
public function fetch()
|
||||||
|
{
|
||||||
return response([
|
return response([
|
||||||
'data' => [
|
'data' => [
|
||||||
'invite' => [
|
'invite' => [
|
||||||
@ -62,7 +64,8 @@ class ConfigController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function save (ConfigSave $request) {
|
public function save(ConfigSave $request)
|
||||||
|
{
|
||||||
$data = $request->input();
|
$data = $request->input();
|
||||||
$array = \Config::get('v2board');
|
$array = \Config::get('v2board');
|
||||||
foreach ($data as $k => $v) {
|
foreach ($data as $k => $v) {
|
||||||
|
@ -10,13 +10,15 @@ use App\Utils\Helper;
|
|||||||
|
|
||||||
class CouponController extends Controller
|
class CouponController extends Controller
|
||||||
{
|
{
|
||||||
public function fetch (Request $request) {
|
public function fetch(Request $request)
|
||||||
|
{
|
||||||
return response([
|
return response([
|
||||||
'data' => Coupon::all()
|
'data' => Coupon::all()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function save (CouponSave $request) {
|
public function save(CouponSave $request)
|
||||||
|
{
|
||||||
$params = $request->only([
|
$params = $request->only([
|
||||||
'name',
|
'name',
|
||||||
'type',
|
'type',
|
||||||
@ -42,7 +44,8 @@ class CouponController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function drop (Request $request) {
|
public function drop(Request $request)
|
||||||
|
{
|
||||||
if (empty($request->input('id'))) {
|
if (empty($request->input('id'))) {
|
||||||
abort(500, '参数有误');
|
abort(500, '参数有误');
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,8 @@ use App\Jobs\SendEmail;
|
|||||||
|
|
||||||
class MailController extends Controller
|
class MailController extends Controller
|
||||||
{
|
{
|
||||||
public function send (MailSend $request) {
|
public function send(MailSend $request)
|
||||||
|
{
|
||||||
if ($request->input('type') == 2 && empty($request->input('receiver'))) {
|
if ($request->input('type') == 2 && empty($request->input('receiver'))) {
|
||||||
abort(500, '收件人不能为空');
|
abort(500, '收件人不能为空');
|
||||||
}
|
}
|
||||||
|
@ -10,13 +10,15 @@ use Cache;
|
|||||||
|
|
||||||
class NoticeController extends Controller
|
class NoticeController extends Controller
|
||||||
{
|
{
|
||||||
public function fetch (Request $request) {
|
public function fetch(Request $request)
|
||||||
|
{
|
||||||
return response([
|
return response([
|
||||||
'data' => Notice::orderBy('id', 'DESC')->get()
|
'data' => Notice::orderBy('id', 'DESC')->get()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function save (NoticeSave $request) {
|
public function save(NoticeSave $request)
|
||||||
|
{
|
||||||
$data = $request->only([
|
$data = $request->only([
|
||||||
'title',
|
'title',
|
||||||
'content',
|
'content',
|
||||||
@ -36,7 +38,8 @@ class NoticeController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function drop (Request $request) {
|
public function drop(Request $request)
|
||||||
|
{
|
||||||
if (empty($request->input('id'))) {
|
if (empty($request->input('id'))) {
|
||||||
abort(500, '参数错误');
|
abort(500, '参数错误');
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,8 @@ use App\Models\Plan;
|
|||||||
|
|
||||||
class OrderController extends Controller
|
class OrderController extends Controller
|
||||||
{
|
{
|
||||||
public function fetch (Request $request) {
|
public function fetch(Request $request)
|
||||||
|
{
|
||||||
$current = $request->input('current') ? $request->input('current') : 1;
|
$current = $request->input('current') ? $request->input('current') : 1;
|
||||||
$pageSize = $request->input('pageSize') >= 10 ? $request->input('pageSize') : 10;
|
$pageSize = $request->input('pageSize') >= 10 ? $request->input('pageSize') : 10;
|
||||||
$orderModel = Order::orderBy('created_at', 'DESC');
|
$orderModel = Order::orderBy('created_at', 'DESC');
|
||||||
@ -42,7 +43,8 @@ class OrderController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update (OrderUpdate $request) {
|
public function update(OrderUpdate $request)
|
||||||
|
{
|
||||||
$updateData = $request->only([
|
$updateData = $request->only([
|
||||||
'status',
|
'status',
|
||||||
'commission_status'
|
'commission_status'
|
||||||
@ -63,7 +65,8 @@ class OrderController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function repair (Request $request) {
|
public function repair(Request $request)
|
||||||
|
{
|
||||||
if (empty($request->input('trade_no'))) {
|
if (empty($request->input('trade_no'))) {
|
||||||
abort(500, '参数错误');
|
abort(500, '参数错误');
|
||||||
}
|
}
|
||||||
|
@ -12,13 +12,15 @@ use App\Models\User;
|
|||||||
|
|
||||||
class PlanController extends Controller
|
class PlanController extends Controller
|
||||||
{
|
{
|
||||||
public function fetch (Request $request) {
|
public function fetch(Request $request)
|
||||||
|
{
|
||||||
return response([
|
return response([
|
||||||
'data' => Plan::get()
|
'data' => Plan::get()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function save (PlanSave $request) {
|
public function save(PlanSave $request)
|
||||||
|
{
|
||||||
if ($request->input('id')) {
|
if ($request->input('id')) {
|
||||||
$plan = Plan::find($request->input('id'));
|
$plan = Plan::find($request->input('id'));
|
||||||
if (!$plan) {
|
if (!$plan) {
|
||||||
@ -41,7 +43,8 @@ class PlanController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function drop (Request $request) {
|
public function drop(Request $request)
|
||||||
|
{
|
||||||
if (Order::where('plan_id', $request->input('id'))->first()) {
|
if (Order::where('plan_id', $request->input('id'))->first()) {
|
||||||
abort(500, '该订阅下存在订单无法删除');
|
abort(500, '该订阅下存在订单无法删除');
|
||||||
}
|
}
|
||||||
@ -59,7 +62,8 @@ class PlanController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update (PlanUpdate $request) {
|
public function update(PlanUpdate $request)
|
||||||
|
{
|
||||||
$updateData = $request->only([
|
$updateData = $request->only([
|
||||||
'show',
|
'show',
|
||||||
'renew'
|
'renew'
|
||||||
|
@ -14,7 +14,8 @@ use Cache;
|
|||||||
|
|
||||||
class ServerController extends Controller
|
class ServerController extends Controller
|
||||||
{
|
{
|
||||||
public function fetch (Request $request) {
|
public function fetch(Request $request)
|
||||||
|
{
|
||||||
$server = Server::get();
|
$server = Server::get();
|
||||||
for ($i = 0; $i < count($server); $i++) {
|
for ($i = 0; $i < count($server); $i++) {
|
||||||
if (!empty($server[$i]['tags'])) {
|
if (!empty($server[$i]['tags'])) {
|
||||||
@ -32,7 +33,8 @@ class ServerController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function save (ServerSave $request) {
|
public function save(ServerSave $request)
|
||||||
|
{
|
||||||
$params = $request->only([
|
$params = $request->only([
|
||||||
'show',
|
'show',
|
||||||
'group_id',
|
'group_id',
|
||||||
@ -80,7 +82,8 @@ class ServerController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function groupFetch (Request $request) {
|
public function groupFetch(Request $request)
|
||||||
|
{
|
||||||
if ($request->input('group_id')) {
|
if ($request->input('group_id')) {
|
||||||
return response([
|
return response([
|
||||||
'data' => [ServerGroup::find($request->input('group_id'))]
|
'data' => [ServerGroup::find($request->input('group_id'))]
|
||||||
@ -91,7 +94,8 @@ class ServerController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function groupSave (Request $request) {
|
public function groupSave(Request $request)
|
||||||
|
{
|
||||||
if (empty($request->input('name'))) {
|
if (empty($request->input('name'))) {
|
||||||
abort(500, '组名不能为空');
|
abort(500, '组名不能为空');
|
||||||
}
|
}
|
||||||
@ -108,7 +112,8 @@ class ServerController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function groupDrop (Request $request) {
|
public function groupDrop(Request $request)
|
||||||
|
{
|
||||||
if ($request->input('id')) {
|
if ($request->input('id')) {
|
||||||
$serverGroup = ServerGroup::find($request->input('id'));
|
$serverGroup = ServerGroup::find($request->input('id'));
|
||||||
if (!$serverGroup) {
|
if (!$serverGroup) {
|
||||||
@ -135,7 +140,8 @@ class ServerController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function drop (Request $request) {
|
public function drop(Request $request)
|
||||||
|
{
|
||||||
if ($request->input('id')) {
|
if ($request->input('id')) {
|
||||||
$server = Server::find($request->input('id'));
|
$server = Server::find($request->input('id'));
|
||||||
if (!$server) {
|
if (!$server) {
|
||||||
@ -147,7 +153,8 @@ class ServerController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update (ServerUpdate $request) {
|
public function update(ServerUpdate $request)
|
||||||
|
{
|
||||||
$params = $request->only([
|
$params = $request->only([
|
||||||
'show',
|
'show',
|
||||||
]);
|
]);
|
||||||
|
@ -14,7 +14,8 @@ use Cache;
|
|||||||
|
|
||||||
class StatController extends Controller
|
class StatController extends Controller
|
||||||
{
|
{
|
||||||
public function getOverride (Request $request) {
|
public function getOverride(Request $request)
|
||||||
|
{
|
||||||
return response([
|
return response([
|
||||||
'data' => [
|
'data' => [
|
||||||
'month_income' => Cache::get('month_income'),
|
'month_income' => Cache::get('month_income'),
|
||||||
|
@ -10,7 +10,8 @@ use Illuminate\Support\Facades\DB;
|
|||||||
|
|
||||||
class TicketController extends Controller
|
class TicketController extends Controller
|
||||||
{
|
{
|
||||||
public function fetch (Request $request) {
|
public function fetch(Request $request)
|
||||||
|
{
|
||||||
if ($request->input('id')) {
|
if ($request->input('id')) {
|
||||||
$ticket = Ticket::where('id', $request->input('id'))
|
$ticket = Ticket::where('id', $request->input('id'))
|
||||||
->first();
|
->first();
|
||||||
@ -43,7 +44,8 @@ class TicketController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function reply (Request $request) {
|
public function reply(Request $request)
|
||||||
|
{
|
||||||
if (empty($request->input('id'))) {
|
if (empty($request->input('id'))) {
|
||||||
abort(500, '参数错误');
|
abort(500, '参数错误');
|
||||||
}
|
}
|
||||||
@ -75,7 +77,8 @@ class TicketController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function close (Request $request) {
|
public function close(Request $request)
|
||||||
|
{
|
||||||
if (empty($request->input('id'))) {
|
if (empty($request->input('id'))) {
|
||||||
abort(500, '参数错误');
|
abort(500, '参数错误');
|
||||||
}
|
}
|
||||||
|
@ -9,13 +9,15 @@ use App\Models\Tutorial;
|
|||||||
|
|
||||||
class TutorialController extends Controller
|
class TutorialController extends Controller
|
||||||
{
|
{
|
||||||
public function fetch (Request $request) {
|
public function fetch(Request $request)
|
||||||
|
{
|
||||||
return response([
|
return response([
|
||||||
'data' => Tutorial::all()
|
'data' => Tutorial::all()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function save (TutorialSave $request) {
|
public function save(TutorialSave $request)
|
||||||
|
{
|
||||||
$params = $request->only([
|
$params = $request->only([
|
||||||
'title',
|
'title',
|
||||||
'description',
|
'description',
|
||||||
@ -38,7 +40,8 @@ class TutorialController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show (Request $request) {
|
public function show(Request $request)
|
||||||
|
{
|
||||||
if (empty($request->input('id'))) {
|
if (empty($request->input('id'))) {
|
||||||
abort(500, '参数有误');
|
abort(500, '参数有误');
|
||||||
}
|
}
|
||||||
@ -56,7 +59,8 @@ class TutorialController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function drop (Request $request) {
|
public function drop(Request $request)
|
||||||
|
{
|
||||||
if (empty($request->input('id'))) {
|
if (empty($request->input('id'))) {
|
||||||
abort(500, '参数有误');
|
abort(500, '参数有误');
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,8 @@ use App\Models\Plan;
|
|||||||
|
|
||||||
class UserController extends Controller
|
class UserController extends Controller
|
||||||
{
|
{
|
||||||
public function fetch (Request $request) {
|
public function fetch(Request $request)
|
||||||
|
{
|
||||||
$current = $request->input('current') ? $request->input('current') : 1;
|
$current = $request->input('current') ? $request->input('current') : 1;
|
||||||
$pageSize = $request->input('pageSize') >= 10 ? $request->input('pageSize') : 10;
|
$pageSize = $request->input('pageSize') >= 10 ? $request->input('pageSize') : 10;
|
||||||
$userModel = User::orderBy('created_at', 'DESC');
|
$userModel = User::orderBy('created_at', 'DESC');
|
||||||
@ -35,7 +36,8 @@ class UserController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function id2UserInfo ($id) {
|
public function id2UserInfo($id)
|
||||||
|
{
|
||||||
if (empty($id)) {
|
if (empty($id)) {
|
||||||
abort(500, '参数错误');
|
abort(500, '参数错误');
|
||||||
}
|
}
|
||||||
@ -50,7 +52,8 @@ class UserController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update (UserUpdate $request) {
|
public function update(UserUpdate $request)
|
||||||
|
{
|
||||||
$updateData = $request->only([
|
$updateData = $request->only([
|
||||||
'email',
|
'email',
|
||||||
'password',
|
'password',
|
||||||
|
@ -16,7 +16,8 @@ class AppController extends Controller
|
|||||||
CONST SOCKS_PORT = 10010;
|
CONST SOCKS_PORT = 10010;
|
||||||
CONST HTTP_PORT = 10011;
|
CONST HTTP_PORT = 10011;
|
||||||
|
|
||||||
public function data (Request $request) {
|
public function data(Request $request)
|
||||||
|
{
|
||||||
$user = $request->user;
|
$user = $request->user;
|
||||||
$nodes = [];
|
$nodes = [];
|
||||||
if ($user->plan_id) {
|
if ($user->plan_id) {
|
||||||
@ -49,7 +50,8 @@ class AppController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function config (Request $request) {
|
public function config(Request $request)
|
||||||
|
{
|
||||||
if (empty($request->input('server_id'))) {
|
if (empty($request->input('server_id'))) {
|
||||||
abort(500, '参数错误');
|
abort(500, '参数错误');
|
||||||
}
|
}
|
||||||
@ -77,17 +79,23 @@ class AppController extends Controller
|
|||||||
$json->outbound->streamSettings->network = $server->network;
|
$json->outbound->streamSettings->network = $server->network;
|
||||||
if ($server->settings) {
|
if ($server->settings) {
|
||||||
switch ($server->network) {
|
switch ($server->network) {
|
||||||
case 'tcp': $json->outbound->streamSettings->tcpSettings = json_decode($server->settings);
|
case 'tcp':
|
||||||
|
$json->outbound->streamSettings->tcpSettings = json_decode($server->settings);
|
||||||
break;
|
break;
|
||||||
case 'kcp': $json->outbound->streamSettings->kcpSettings = json_decode($server->settings);
|
case 'kcp':
|
||||||
|
$json->outbound->streamSettings->kcpSettings = json_decode($server->settings);
|
||||||
break;
|
break;
|
||||||
case 'ws': $json->outbound->streamSettings->wsSettings = json_decode($server->settings);
|
case 'ws':
|
||||||
|
$json->outbound->streamSettings->wsSettings = json_decode($server->settings);
|
||||||
break;
|
break;
|
||||||
case 'http': $json->outbound->streamSettings->httpSettings = json_decode($server->settings);
|
case 'http':
|
||||||
|
$json->outbound->streamSettings->httpSettings = json_decode($server->settings);
|
||||||
break;
|
break;
|
||||||
case 'domainsocket': $json->outbound->streamSettings->dsSettings = json_decode($server->settings);
|
case 'domainsocket':
|
||||||
|
$json->outbound->streamSettings->dsSettings = json_decode($server->settings);
|
||||||
break;
|
break;
|
||||||
case 'quic': $json->outbound->streamSettings->quicSettings = json_decode($server->settings);
|
case 'quic':
|
||||||
|
$json->outbound->streamSettings->quicSettings = json_decode($server->settings);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,8 @@ use Symfony\Component\Yaml\Yaml;
|
|||||||
|
|
||||||
class ClientController extends Controller
|
class ClientController extends Controller
|
||||||
{
|
{
|
||||||
public function subscribe (Request $request) {
|
public function subscribe(Request $request)
|
||||||
|
{
|
||||||
$user = $request->user;
|
$user = $request->user;
|
||||||
$server = [];
|
$server = [];
|
||||||
if ($user->expired_at > time()) {
|
if ($user->expired_at > time()) {
|
||||||
@ -40,7 +41,8 @@ class ClientController extends Controller
|
|||||||
die($this->origin($user, $server));
|
die($this->origin($user, $server));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function quantumultX ($user, $server) {
|
private function quantumultX($user, $server)
|
||||||
|
{
|
||||||
$uri = '';
|
$uri = '';
|
||||||
foreach ($server as $item) {
|
foreach ($server as $item) {
|
||||||
$uri .= "vmess=" . $item->host . ":" . $item->port . ", method=none, password=" . $user->v2ray_uuid . ", fast-open=false, udp-relay=false, tag=" . $item->name;
|
$uri .= "vmess=" . $item->host . ":" . $item->port . ", method=none, password=" . $user->v2ray_uuid . ", fast-open=false, udp-relay=false, tag=" . $item->name;
|
||||||
@ -57,7 +59,8 @@ class ClientController extends Controller
|
|||||||
return base64_encode($uri);
|
return base64_encode($uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function quantumult ($user, $server) {
|
private function quantumult($user, $server)
|
||||||
|
{
|
||||||
$uri = '';
|
$uri = '';
|
||||||
header('subscription-userinfo: upload=' . $user->u . '; download=' . $user->d . ';total=' . $user->transfer_enable);
|
header('subscription-userinfo: upload=' . $user->u . '; download=' . $user->d . ';total=' . $user->transfer_enable);
|
||||||
foreach ($server as $item) {
|
foreach ($server as $item) {
|
||||||
@ -76,7 +79,8 @@ class ClientController extends Controller
|
|||||||
return base64_encode($uri);
|
return base64_encode($uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function origin ($user, $server) {
|
private function origin($user, $server)
|
||||||
|
{
|
||||||
$uri = '';
|
$uri = '';
|
||||||
foreach ($server as $item) {
|
foreach ($server as $item) {
|
||||||
$uri .= Helper::buildVmessLink($item, $user);
|
$uri .= Helper::buildVmessLink($item, $user);
|
||||||
@ -84,7 +88,8 @@ class ClientController extends Controller
|
|||||||
return base64_encode($uri);
|
return base64_encode($uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function clash ($user, $server) {
|
private function clash($user, $server)
|
||||||
|
{
|
||||||
$proxy = [];
|
$proxy = [];
|
||||||
$proxyGroup = [];
|
$proxyGroup = [];
|
||||||
$proxies = [];
|
$proxies = [];
|
||||||
|
@ -7,7 +7,8 @@ use App\Models\Coupon;
|
|||||||
|
|
||||||
class CouponController extends Controller
|
class CouponController extends Controller
|
||||||
{
|
{
|
||||||
public function check (Request $request) {
|
public function check(Request $request)
|
||||||
|
{
|
||||||
if (empty($request->input('code'))) {
|
if (empty($request->input('code'))) {
|
||||||
abort(500, '优惠券码不能为空');
|
abort(500, '优惠券码不能为空');
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,8 @@ use Library\BitpayX;
|
|||||||
|
|
||||||
class OrderController extends Controller
|
class OrderController extends Controller
|
||||||
{
|
{
|
||||||
public function alipayNotify (Request $request) {
|
public function alipayNotify(Request $request)
|
||||||
|
{
|
||||||
Log::info('alipayNotifyData: ' . json_encode($_POST));
|
Log::info('alipayNotifyData: ' . json_encode($_POST));
|
||||||
$gateway = Omnipay::create('Alipay_AopF2F');
|
$gateway = Omnipay::create('Alipay_AopF2F');
|
||||||
$gateway->setSignType('RSA2'); //RSA/RSA2
|
$gateway->setSignType('RSA2'); //RSA/RSA2
|
||||||
@ -48,7 +49,8 @@ class OrderController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function stripeNotify (Request $request) {
|
public function stripeNotify(Request $request)
|
||||||
|
{
|
||||||
Log::info('stripeNotifyData: ' . json_encode($request->input()));
|
Log::info('stripeNotifyData: ' . json_encode($request->input()));
|
||||||
|
|
||||||
\Stripe\Stripe::setApiKey(config('v2board.stripe_sk_live'));
|
\Stripe\Stripe::setApiKey(config('v2board.stripe_sk_live'));
|
||||||
@ -86,7 +88,8 @@ class OrderController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function bitpayXNotify (Request $request) {
|
public function bitpayXNotify(Request $request)
|
||||||
|
{
|
||||||
$inputString = file_get_contents('php://input', 'r');
|
$inputString = file_get_contents('php://input', 'r');
|
||||||
Log::info('bitpayXNotifyData: ' . $inputString);
|
Log::info('bitpayXNotifyData: ' . $inputString);
|
||||||
$inputStripped = str_replace(array("\r", "\n", "\t", "\v"), '', $inputString);
|
$inputStripped = str_replace(array("\r", "\n", "\t", "\v"), '', $inputString);
|
||||||
@ -127,7 +130,8 @@ class OrderController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function handle ($tradeNo, $callbackNo) {
|
private function handle($tradeNo, $callbackNo)
|
||||||
|
{
|
||||||
$order = Order::where('trade_no', $tradeNo)->first();
|
$order = Order::where('trade_no', $tradeNo)->first();
|
||||||
if (!$order) {
|
if (!$order) {
|
||||||
abort(500, 'order is not found');
|
abort(500, 'order is not found');
|
||||||
|
@ -8,7 +8,8 @@ use App\Models\Plan;
|
|||||||
|
|
||||||
class PlanController extends Controller
|
class PlanController extends Controller
|
||||||
{
|
{
|
||||||
public function fetch (Request $request) {
|
public function fetch(Request $request)
|
||||||
|
{
|
||||||
$plan = Plan::where('show', 1)->get();
|
$plan = Plan::where('show', 1)->get();
|
||||||
return response([
|
return response([
|
||||||
'data' => $plan
|
'data' => $plan
|
||||||
|
@ -11,7 +11,8 @@ use App\Utils\Helper;
|
|||||||
|
|
||||||
class InviteController extends Controller
|
class InviteController extends Controller
|
||||||
{
|
{
|
||||||
public function save (Request $request) {
|
public function save(Request $request)
|
||||||
|
{
|
||||||
if (InviteCode::where('user_id', $request->session()->get('id'))->where('status', 0)->count() >= config('v2board.invite_gen_limit', 5)) {
|
if (InviteCode::where('user_id', $request->session()->get('id'))->where('status', 0)->count() >= config('v2board.invite_gen_limit', 5)) {
|
||||||
abort(500, '已达到创建数量上限');
|
abort(500, '已达到创建数量上限');
|
||||||
}
|
}
|
||||||
@ -23,7 +24,8 @@ class InviteController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function details (Request $request) {
|
public function details(Request $request)
|
||||||
|
{
|
||||||
return response([
|
return response([
|
||||||
'data' => Order::where('invite_user_id', $request->session()->get('id'))
|
'data' => Order::where('invite_user_id', $request->session()->get('id'))
|
||||||
->where('status', 3)
|
->where('status', 3)
|
||||||
@ -38,7 +40,8 @@ class InviteController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function fetch (Request $request) {
|
public function fetch(Request $request)
|
||||||
|
{
|
||||||
$codes = InviteCode::where('user_id', $request->session()->get('id'))
|
$codes = InviteCode::where('user_id', $request->session()->get('id'))
|
||||||
->where('status', 0)
|
->where('status', 0)
|
||||||
->get();
|
->get();
|
||||||
|
@ -9,7 +9,8 @@ use App\Utils\Helper;
|
|||||||
|
|
||||||
class NoticeController extends Controller
|
class NoticeController extends Controller
|
||||||
{
|
{
|
||||||
public function fetch (Request $request) {
|
public function fetch(Request $request)
|
||||||
|
{
|
||||||
return response([
|
return response([
|
||||||
'data' => Notice::orderBy('created_at', 'DESC')->first()
|
'data' => Notice::orderBy('created_at', 'DESC')->first()
|
||||||
]);
|
]);
|
||||||
|
@ -20,7 +20,8 @@ use Library\BitpayX;
|
|||||||
|
|
||||||
class OrderController extends Controller
|
class OrderController extends Controller
|
||||||
{
|
{
|
||||||
public function fetch (Request $request) {
|
public function fetch(Request $request)
|
||||||
|
{
|
||||||
$order = Order::where('user_id', $request->session()->get('id'))
|
$order = Order::where('user_id', $request->session()->get('id'))
|
||||||
->orderBy('created_at', 'DESC')
|
->orderBy('created_at', 'DESC')
|
||||||
->get();
|
->get();
|
||||||
@ -37,7 +38,8 @@ class OrderController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function details (Request $request) {
|
public function details(Request $request)
|
||||||
|
{
|
||||||
$order = Order::where('user_id', $request->session()->get('id'))
|
$order = Order::where('user_id', $request->session()->get('id'))
|
||||||
->where('trade_no', $request->input('trade_no'))
|
->where('trade_no', $request->input('trade_no'))
|
||||||
->first();
|
->first();
|
||||||
@ -54,7 +56,8 @@ class OrderController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function isExistNotPayOrderByUserId ($userId) {
|
private function isExistNotPayOrderByUserId($userId)
|
||||||
|
{
|
||||||
$order = Order::where('status', 0)
|
$order = Order::where('status', 0)
|
||||||
->where('user_id', $userId)
|
->where('user_id', $userId)
|
||||||
->first();
|
->first();
|
||||||
@ -64,7 +67,8 @@ class OrderController extends Controller
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function save (OrderSave $request) {
|
public function save(OrderSave $request)
|
||||||
|
{
|
||||||
if ($this->isExistNotPayOrderByUserId($request->session()->get('id'))) {
|
if ($this->isExistNotPayOrderByUserId($request->session()->get('id'))) {
|
||||||
abort(500, '存在未付款订单,请取消后再试');
|
abort(500, '存在未付款订单,请取消后再试');
|
||||||
}
|
}
|
||||||
@ -133,9 +137,11 @@ class OrderController extends Controller
|
|||||||
// coupon process
|
// coupon process
|
||||||
if (isset($coupon)) {
|
if (isset($coupon)) {
|
||||||
switch ($coupon->type) {
|
switch ($coupon->type) {
|
||||||
case 1: $order->discount_amount = $coupon->value;
|
case 1:
|
||||||
|
$order->discount_amount = $coupon->value;
|
||||||
break;
|
break;
|
||||||
case 2: $order->discount_amount = $order->total_amount * ($coupon->value / 100);
|
case 2:
|
||||||
|
$order->discount_amount = $order->total_amount * ($coupon->value / 100);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$order->total_amount = $order->total_amount - $order->discount_amount;
|
$order->total_amount = $order->total_amount - $order->discount_amount;
|
||||||
@ -165,7 +171,8 @@ class OrderController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkout (Request $request) {
|
public function checkout(Request $request)
|
||||||
|
{
|
||||||
$tradeNo = $request->input('trade_no');
|
$tradeNo = $request->input('trade_no');
|
||||||
$method = $request->input('method');
|
$method = $request->input('method');
|
||||||
$order = Order::where('trade_no', $tradeNo)
|
$order = Order::where('trade_no', $tradeNo)
|
||||||
@ -218,7 +225,8 @@ class OrderController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function check (Request $request) {
|
public function check(Request $request)
|
||||||
|
{
|
||||||
$tradeNo = $request->input('trade_no');
|
$tradeNo = $request->input('trade_no');
|
||||||
$order = Order::where('trade_no', $tradeNo)
|
$order = Order::where('trade_no', $tradeNo)
|
||||||
->where('user_id', $request->session()->get('id'))
|
->where('user_id', $request->session()->get('id'))
|
||||||
@ -231,7 +239,8 @@ class OrderController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPaymentMethod () {
|
public function getPaymentMethod()
|
||||||
|
{
|
||||||
$data = [];
|
$data = [];
|
||||||
if ((int)config('v2board.alipay_enable')) {
|
if ((int)config('v2board.alipay_enable')) {
|
||||||
$alipayF2F = new \StdClass();
|
$alipayF2F = new \StdClass();
|
||||||
@ -270,7 +279,8 @@ class OrderController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function cancel (Request $request) {
|
public function cancel(Request $request)
|
||||||
|
{
|
||||||
if (empty($request->input('trade_no'))) {
|
if (empty($request->input('trade_no'))) {
|
||||||
abort(500, '参数有误');
|
abort(500, '参数有误');
|
||||||
}
|
}
|
||||||
@ -292,7 +302,8 @@ class OrderController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function alipayF2F ($tradeNo, $totalAmount) {
|
private function alipayF2F($tradeNo, $totalAmount)
|
||||||
|
{
|
||||||
$gateway = Omnipay::create('Alipay_AopF2F');
|
$gateway = Omnipay::create('Alipay_AopF2F');
|
||||||
$gateway->setSignType('RSA2'); //RSA/RSA2
|
$gateway->setSignType('RSA2'); //RSA/RSA2
|
||||||
$gateway->setAppId(config('v2board.alipay_appid'));
|
$gateway->setAppId(config('v2board.alipay_appid'));
|
||||||
@ -315,7 +326,8 @@ class OrderController extends Controller
|
|||||||
return $response->getQrCode();
|
return $response->getQrCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function stripeAlipay ($order) {
|
private function stripeAlipay($order)
|
||||||
|
{
|
||||||
$exchange = Helper::exchange('CNY', 'HKD');
|
$exchange = Helper::exchange('CNY', 'HKD');
|
||||||
if (!$exchange) {
|
if (!$exchange) {
|
||||||
abort(500, '货币转换超时,请稍后再试');
|
abort(500, '货币转换超时,请稍后再试');
|
||||||
@ -340,7 +352,8 @@ class OrderController extends Controller
|
|||||||
return $source['redirect']['url'];
|
return $source['redirect']['url'];
|
||||||
}
|
}
|
||||||
|
|
||||||
private function stripeWepay ($order) {
|
private function stripeWepay($order)
|
||||||
|
{
|
||||||
$exchange = Helper::exchange('CNY', 'HKD');
|
$exchange = Helper::exchange('CNY', 'HKD');
|
||||||
if (!$exchange) {
|
if (!$exchange) {
|
||||||
abort(500, '货币转换超时,请稍后再试');
|
abort(500, '货币转换超时,请稍后再试');
|
||||||
@ -364,7 +377,8 @@ class OrderController extends Controller
|
|||||||
return $source['wechat']['qr_code_url'];
|
return $source['wechat']['qr_code_url'];
|
||||||
}
|
}
|
||||||
|
|
||||||
private function bitpayX ($order) {
|
private function bitpayX($order)
|
||||||
|
{
|
||||||
$bitpayX = new BitpayX(config('v2board.bitpayx_appsecret'));
|
$bitpayX = new BitpayX(config('v2board.bitpayx_appsecret'));
|
||||||
$params = [
|
$params = [
|
||||||
'merchant_order_id' => 'V2Board_' . $order->trade_no,
|
'merchant_order_id' => 'V2Board_' . $order->trade_no,
|
||||||
|
@ -11,7 +11,8 @@ use Cache;
|
|||||||
|
|
||||||
class CommController extends Controller
|
class CommController extends Controller
|
||||||
{
|
{
|
||||||
public function config () {
|
public function config()
|
||||||
|
{
|
||||||
return response([
|
return response([
|
||||||
'data' => [
|
'data' => [
|
||||||
'isEmailVerify' => (int)config('v2board.email_verify', 0) ? 1 : 0,
|
'isEmailVerify' => (int)config('v2board.email_verify', 0) ? 1 : 0,
|
||||||
@ -20,13 +21,15 @@ class CommController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function isEmailVerify () {
|
private function isEmailVerify()
|
||||||
|
{
|
||||||
return response([
|
return response([
|
||||||
'data' => (int)config('v2board.email_verify', 0) ? 1 : 0
|
'data' => (int)config('v2board.email_verify', 0) ? 1 : 0
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sendEmailVerify (CommSendEmailVerify $request) {
|
public function sendEmailVerify(CommSendEmailVerify $request)
|
||||||
|
{
|
||||||
$email = $request->input('email');
|
$email = $request->input('email');
|
||||||
$cacheKey = 'sendEmailVerify:' . $email;
|
$cacheKey = 'sendEmailVerify:' . $email;
|
||||||
if (Cache::get($cacheKey)) {
|
if (Cache::get($cacheKey)) {
|
||||||
|
@ -11,7 +11,8 @@ use Cache;
|
|||||||
|
|
||||||
class ForgetController extends Controller
|
class ForgetController extends Controller
|
||||||
{
|
{
|
||||||
public function index (ForgetIndex $request) {
|
public function index(ForgetIndex $request)
|
||||||
|
{
|
||||||
$redisKey = 'sendEmailVerify:' . $request->input('email');
|
$redisKey = 'sendEmailVerify:' . $request->input('email');
|
||||||
if (Cache::get($redisKey) !== $request->input('email_code')) {
|
if (Cache::get($redisKey) !== $request->input('email_code')) {
|
||||||
abort(500, '邮箱验证码有误');
|
abort(500, '邮箱验证码有误');
|
||||||
|
@ -11,7 +11,8 @@ use App\Utils\Helper;
|
|||||||
|
|
||||||
class LoginController extends Controller
|
class LoginController extends Controller
|
||||||
{
|
{
|
||||||
public function index (LoginIndex $request) {
|
public function index(LoginIndex $request)
|
||||||
|
{
|
||||||
$email = $request->input('email');
|
$email = $request->input('email');
|
||||||
$password = $request->input('password');
|
$password = $request->input('password');
|
||||||
|
|
||||||
@ -36,7 +37,8 @@ class LoginController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function token2Login (Request $request) {
|
public function token2Login(Request $request)
|
||||||
|
{
|
||||||
if ($request->input('token')) {
|
if ($request->input('token')) {
|
||||||
$user = User::where('token', $request->input('token'))->first();
|
$user = User::where('token', $request->input('token'))->first();
|
||||||
if (!$user) {
|
if (!$user) {
|
||||||
@ -77,7 +79,8 @@ class LoginController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function check (Request $request) {
|
public function check(Request $request)
|
||||||
|
{
|
||||||
return response([
|
return response([
|
||||||
'data' => $request->session()->get('id') ? true : false
|
'data' => $request->session()->get('id') ? true : false
|
||||||
]);
|
]);
|
||||||
|
@ -15,11 +15,13 @@ use App\Models\InviteCode;
|
|||||||
|
|
||||||
class RegisterController extends Controller
|
class RegisterController extends Controller
|
||||||
{
|
{
|
||||||
private function setTryOut () {
|
private function setTryOut()
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function index (RegisterIndex $request) {
|
public function index(RegisterIndex $request)
|
||||||
|
{
|
||||||
if ((int)config('v2board.stop_register', 0)) {
|
if ((int)config('v2board.stop_register', 0)) {
|
||||||
abort(500, '本站已关闭注册');
|
abort(500, '本站已关闭注册');
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,8 @@ use App\Models\Plan;
|
|||||||
|
|
||||||
class PlanController extends Controller
|
class PlanController extends Controller
|
||||||
{
|
{
|
||||||
public function fetch (Request $request) {
|
public function fetch(Request $request)
|
||||||
|
{
|
||||||
if ($request->input('id')) {
|
if ($request->input('id')) {
|
||||||
$plan = Plan::where('id', $request->input('id'))
|
$plan = Plan::where('id', $request->input('id'))
|
||||||
->first();
|
->first();
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Http\Controllers\Server;
|
namespace App\Http\Controllers\Server;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use App\Http\Controllers\Controller as BaseController;
|
use App\Http\Controllers\Controller as BaseController;
|
||||||
|
|
||||||
class Controller extends BaseController
|
class Controller extends BaseController
|
||||||
{
|
{
|
||||||
public function __construct(Request $request) {
|
public function __construct(Request $request)
|
||||||
|
{
|
||||||
$token = $request->input('token');
|
$token = $request->input('token');
|
||||||
if (empty($token)) {
|
if (empty($token)) {
|
||||||
abort(500, 'token is null');
|
abort(500, 'token is null');
|
||||||
|
@ -14,8 +14,10 @@ use Cache;
|
|||||||
class DeepbworkController extends Controller
|
class DeepbworkController extends Controller
|
||||||
{
|
{
|
||||||
CONST SERVER_CONFIG = '{"api":{"services":["HandlerService","StatsService"],"tag":"api"},"stats":{},"inbound":{"port":443,"protocol":"vmess","settings":{"clients":[]},"streamSettings":{"network":"tcp"},"tag":"proxy"},"inboundDetour":[{"listen":"0.0.0.0","port":23333,"protocol":"dokodemo-door","settings":{"address":"0.0.0.0"},"tag":"api"}],"log":{"loglevel":"debug","access":"access.log","error":"error.log"},"outbound":{"protocol":"freedom","settings":{}},"routing":{"settings":{"rules":[{"inboundTag":["api"],"outboundTag":"api","type":"field"}]},"strategy":"rules"},"policy":{"levels":{"0":{"handshake":4,"connIdle":300,"uplinkOnly":5,"downlinkOnly":30,"statsUserUplink":true,"statsUserDownlink":true}}}}';
|
CONST SERVER_CONFIG = '{"api":{"services":["HandlerService","StatsService"],"tag":"api"},"stats":{},"inbound":{"port":443,"protocol":"vmess","settings":{"clients":[]},"streamSettings":{"network":"tcp"},"tag":"proxy"},"inboundDetour":[{"listen":"0.0.0.0","port":23333,"protocol":"dokodemo-door","settings":{"address":"0.0.0.0"},"tag":"api"}],"log":{"loglevel":"debug","access":"access.log","error":"error.log"},"outbound":{"protocol":"freedom","settings":{}},"routing":{"settings":{"rules":[{"inboundTag":["api"],"outboundTag":"api","type":"field"}]},"strategy":"rules"},"policy":{"levels":{"0":{"handshake":4,"connIdle":300,"uplinkOnly":5,"downlinkOnly":30,"statsUserUplink":true,"statsUserDownlink":true}}}}';
|
||||||
|
|
||||||
// 后端获取用户
|
// 后端获取用户
|
||||||
public function user (Request $request) {
|
public function user(Request $request)
|
||||||
|
{
|
||||||
$nodeId = $request->input('node_id');
|
$nodeId = $request->input('node_id');
|
||||||
$server = Server::find($nodeId);
|
$server = Server::find($nodeId);
|
||||||
if (!$server) {
|
if (!$server) {
|
||||||
@ -56,7 +58,8 @@ class DeepbworkController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 后端提交数据
|
// 后端提交数据
|
||||||
public function submit (Request $request) {
|
public function submit(Request $request)
|
||||||
|
{
|
||||||
Log::info('serverSubmitData:' . $request->input('node_id') . ':' . file_get_contents('php://input'));
|
Log::info('serverSubmitData:' . $request->input('node_id') . ':' . file_get_contents('php://input'));
|
||||||
$server = Server::find($request->input('node_id'));
|
$server = Server::find($request->input('node_id'));
|
||||||
if (!$server) {
|
if (!$server) {
|
||||||
@ -92,7 +95,8 @@ class DeepbworkController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 后端获取配置
|
// 后端获取配置
|
||||||
public function config (Request $request) {
|
public function config(Request $request)
|
||||||
|
{
|
||||||
$nodeId = $request->input('node_id');
|
$nodeId = $request->input('node_id');
|
||||||
$localPort = $request->input('local_port');
|
$localPort = $request->input('local_port');
|
||||||
if (empty($nodeId) || empty($localPort)) {
|
if (empty($nodeId) || empty($localPort)) {
|
||||||
@ -108,17 +112,23 @@ class DeepbworkController extends Controller
|
|||||||
$json->inbound->streamSettings->network = $server->network;
|
$json->inbound->streamSettings->network = $server->network;
|
||||||
if ($server->settings) {
|
if ($server->settings) {
|
||||||
switch ($server->network) {
|
switch ($server->network) {
|
||||||
case 'tcp': $json->inbound->streamSettings->tcpSettings = json_decode($server->settings);
|
case 'tcp':
|
||||||
|
$json->inbound->streamSettings->tcpSettings = json_decode($server->settings);
|
||||||
break;
|
break;
|
||||||
case 'kcp': $json->inbound->streamSettings->kcpSettings = json_decode($server->settings);
|
case 'kcp':
|
||||||
|
$json->inbound->streamSettings->kcpSettings = json_decode($server->settings);
|
||||||
break;
|
break;
|
||||||
case 'ws': $json->inbound->streamSettings->wsSettings = json_decode($server->settings);
|
case 'ws':
|
||||||
|
$json->inbound->streamSettings->wsSettings = json_decode($server->settings);
|
||||||
break;
|
break;
|
||||||
case 'http': $json->inbound->streamSettings->httpSettings = json_decode($server->settings);
|
case 'http':
|
||||||
|
$json->inbound->streamSettings->httpSettings = json_decode($server->settings);
|
||||||
break;
|
break;
|
||||||
case 'domainsocket': $json->inbound->streamSettings->dsSettings = json_decode($server->settings);
|
case 'domainsocket':
|
||||||
|
$json->inbound->streamSettings->dsSettings = json_decode($server->settings);
|
||||||
break;
|
break;
|
||||||
case 'quic': $json->inbound->streamSettings->quicSettings = json_decode($server->settings);
|
case 'quic':
|
||||||
|
$json->inbound->streamSettings->quicSettings = json_decode($server->settings);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,10 @@ use App\Models\User;
|
|||||||
|
|
||||||
use App\Utils\Helper;
|
use App\Utils\Helper;
|
||||||
|
|
||||||
class ServerController extends Controller {
|
class ServerController extends Controller
|
||||||
public function fetch (Request $request) {
|
{
|
||||||
|
public function fetch(Request $request)
|
||||||
|
{
|
||||||
$user = User::find($request->session()->get('id'));
|
$user = User::find($request->session()->get('id'));
|
||||||
$server = [];
|
$server = [];
|
||||||
if ($user->expired_at > time()) {
|
if ($user->expired_at > time()) {
|
||||||
@ -39,18 +41,22 @@ class ServerController extends Controller {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function logFetch (Request $request) {
|
public function logFetch(Request $request)
|
||||||
|
{
|
||||||
$type = $request->input('type') ? $request->input('type') : 0;
|
$type = $request->input('type') ? $request->input('type') : 0;
|
||||||
$current = $request->input('current') ? $request->input('current') : 1;
|
$current = $request->input('current') ? $request->input('current') : 1;
|
||||||
$pageSize = $request->input('pageSize') >= 10 ? $request->input('pageSize') : 10;
|
$pageSize = $request->input('pageSize') >= 10 ? $request->input('pageSize') : 10;
|
||||||
$serverLogModel = ServerLog::where('user_id', $request->session()->get('id'))
|
$serverLogModel = ServerLog::where('user_id', $request->session()->get('id'))
|
||||||
->orderBy('created_at', 'DESC');
|
->orderBy('created_at', 'DESC');
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 0: $serverLogModel->where('created_at', '>=', strtotime(date('Y-m-d')));
|
case 0:
|
||||||
|
$serverLogModel->where('created_at', '>=', strtotime(date('Y-m-d')));
|
||||||
break;
|
break;
|
||||||
case 1: $serverLogModel->where('created_at', '>=', strtotime(date('Y-m-d')) - 604800);
|
case 1:
|
||||||
|
$serverLogModel->where('created_at', '>=', strtotime(date('Y-m-d')) - 604800);
|
||||||
break;
|
break;
|
||||||
case 2: $serverLogModel->where('created_at', '>=', strtotime(date('Y-m-1')));
|
case 2:
|
||||||
|
$serverLogModel->where('created_at', '>=', strtotime(date('Y-m-1')));
|
||||||
}
|
}
|
||||||
$sum = [
|
$sum = [
|
||||||
'u' => $serverLogModel->sum('u'),
|
'u' => $serverLogModel->sum('u'),
|
||||||
|
@ -12,7 +12,8 @@ use Illuminate\Support\Facades\DB;
|
|||||||
|
|
||||||
class TicketController extends Controller
|
class TicketController extends Controller
|
||||||
{
|
{
|
||||||
public function fetch (Request $request) {
|
public function fetch(Request $request)
|
||||||
|
{
|
||||||
if ($request->input('id')) {
|
if ($request->input('id')) {
|
||||||
$ticket = Ticket::where('id', $request->input('id'))
|
$ticket = Ticket::where('id', $request->input('id'))
|
||||||
->where('user_id', $request->session()->get('id'))
|
->where('user_id', $request->session()->get('id'))
|
||||||
@ -47,7 +48,8 @@ class TicketController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function save (TicketSave $request) {
|
public function save(TicketSave $request)
|
||||||
|
{
|
||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
$ticket = Ticket::create(array_merge($request->only([
|
$ticket = Ticket::create(array_merge($request->only([
|
||||||
'subject',
|
'subject',
|
||||||
@ -75,7 +77,8 @@ class TicketController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function reply (Request $request) {
|
public function reply(Request $request)
|
||||||
|
{
|
||||||
if (empty($request->input('id'))) {
|
if (empty($request->input('id'))) {
|
||||||
abort(500, '参数错误');
|
abort(500, '参数错误');
|
||||||
}
|
}
|
||||||
@ -112,7 +115,8 @@ class TicketController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function close (Request $request) {
|
public function close(Request $request)
|
||||||
|
{
|
||||||
if (empty($request->input('id'))) {
|
if (empty($request->input('id'))) {
|
||||||
abort(500, '参数错误');
|
abort(500, '参数错误');
|
||||||
}
|
}
|
||||||
@ -131,7 +135,8 @@ class TicketController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getLastMessage ($ticketId) {
|
private function getLastMessage($ticketId)
|
||||||
|
{
|
||||||
return TicketMessage::where('ticket_id', $ticketId)
|
return TicketMessage::where('ticket_id', $ticketId)
|
||||||
->orderBy('id', 'DESC')
|
->orderBy('id', 'DESC')
|
||||||
->first();
|
->first();
|
||||||
|
@ -9,7 +9,8 @@ use App\Models\Tutorial;
|
|||||||
|
|
||||||
class TutorialController extends Controller
|
class TutorialController extends Controller
|
||||||
{
|
{
|
||||||
public function getSubscribeUrl (Request $request) {
|
public function getSubscribeUrl(Request $request)
|
||||||
|
{
|
||||||
$user = User::find($request->session()->get('id'));
|
$user = User::find($request->session()->get('id'));
|
||||||
return response([
|
return response([
|
||||||
'data' => [
|
'data' => [
|
||||||
@ -18,7 +19,8 @@ class TutorialController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAppleID (Request $request) {
|
public function getAppleID(Request $request)
|
||||||
|
{
|
||||||
$user = User::find($request->session()->get('id'));
|
$user = User::find($request->session()->get('id'));
|
||||||
if ($user->expired_at < time()) {
|
if ($user->expired_at < time()) {
|
||||||
return response([
|
return response([
|
||||||
@ -34,7 +36,8 @@ class TutorialController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function fetch (Request $request) {
|
public function fetch(Request $request)
|
||||||
|
{
|
||||||
if ($request->input('id')) {
|
if ($request->input('id')) {
|
||||||
$tutorial = Tutorial::where('show', 1)
|
$tutorial = Tutorial::where('show', 1)
|
||||||
->where('id', $request->input('id'))
|
->where('id', $request->input('id'))
|
||||||
|
@ -15,13 +15,15 @@ use App\Models\ServerLog;
|
|||||||
|
|
||||||
class UserController extends Controller
|
class UserController extends Controller
|
||||||
{
|
{
|
||||||
public function logout (Request $request) {
|
public function logout(Request $request)
|
||||||
|
{
|
||||||
return response([
|
return response([
|
||||||
'data' => $request->session()->flush()
|
'data' => $request->session()->flush()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function changePassword (Request $request) {
|
public function changePassword(Request $request)
|
||||||
|
{
|
||||||
if (empty($request->input('old_password'))) {
|
if (empty($request->input('old_password'))) {
|
||||||
abort(500, '旧密码不能为空');
|
abort(500, '旧密码不能为空');
|
||||||
}
|
}
|
||||||
@ -42,7 +44,8 @@ class UserController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function info (Request $request) {
|
public function info(Request $request)
|
||||||
|
{
|
||||||
$user = User::where('id', $request->session()->get('id'))
|
$user = User::where('id', $request->session()->get('id'))
|
||||||
->select([
|
->select([
|
||||||
'email',
|
'email',
|
||||||
@ -65,7 +68,8 @@ class UserController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getStat (Request $request) {
|
public function getStat(Request $request)
|
||||||
|
{
|
||||||
$stat = [
|
$stat = [
|
||||||
Order::where('status', 0)
|
Order::where('status', 0)
|
||||||
->where('user_id', $request->session()->get('id'))
|
->where('user_id', $request->session()->get('id'))
|
||||||
@ -81,7 +85,8 @@ class UserController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getSubscribe (Request $request) {
|
public function getSubscribe(Request $request)
|
||||||
|
{
|
||||||
$user = User::find($request->session()->get('id'));
|
$user = User::find($request->session()->get('id'));
|
||||||
if ($user->plan_id) {
|
if ($user->plan_id) {
|
||||||
$user['plan'] = Plan::find($user->plan_id);
|
$user['plan'] = Plan::find($user->plan_id);
|
||||||
@ -95,7 +100,8 @@ class UserController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function resetSecurity (Request $request) {
|
public function resetSecurity(Request $request)
|
||||||
|
{
|
||||||
$user = User::find($request->session()->get('id'));
|
$user = User::find($request->session()->get('id'));
|
||||||
$user->v2ray_uuid = Helper::guid(true);
|
$user->v2ray_uuid = Helper::guid(true);
|
||||||
$user->token = Helper::guid();
|
$user->token = Helper::guid();
|
||||||
@ -107,7 +113,8 @@ class UserController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function update (UserUpdate $request) {
|
public function update(UserUpdate $request)
|
||||||
|
{
|
||||||
$updateData = $request->only([
|
$updateData = $request->only([
|
||||||
'remind_expire',
|
'remind_expire',
|
||||||
'remind_traffic'
|
'remind_traffic'
|
||||||
|
@ -42,10 +42,12 @@ class ConfigSave extends FormRequest
|
|||||||
'apple_id_password' => ''
|
'apple_id_password' => ''
|
||||||
];
|
];
|
||||||
|
|
||||||
public static function filter() {
|
public static function filter()
|
||||||
|
{
|
||||||
// abort(500, json_encode(array_keys(self::RULES)));
|
// abort(500, json_encode(array_keys(self::RULES)));
|
||||||
return array_keys(self::RULES);
|
return array_keys(self::RULES);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the validation rules that apply to the request.
|
* Get the validation rules that apply to the request.
|
||||||
*
|
*
|
||||||
|
@ -14,6 +14,7 @@ class SendEmail implements ShouldQueue
|
|||||||
{
|
{
|
||||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||||
protected $params;
|
protected $params;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new job instance.
|
* Create a new job instance.
|
||||||
*
|
*
|
||||||
|
8
app/Utils/CacheKey.php
Normal file
8
app/Utils/CacheKey.php
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Utils;
|
||||||
|
|
||||||
|
class CacheKey
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
@ -4,7 +4,8 @@ namespace App\Utils;
|
|||||||
|
|
||||||
class Helper
|
class Helper
|
||||||
{
|
{
|
||||||
public static function guid ($format = false) {
|
public static function guid($format = false)
|
||||||
|
{
|
||||||
if (function_exists('com_create_guid') === true) {
|
if (function_exists('com_create_guid') === true) {
|
||||||
return md5(trim(com_create_guid(), '{}'));
|
return md5(trim(com_create_guid(), '{}'));
|
||||||
}
|
}
|
||||||
@ -17,13 +18,15 @@ class Helper
|
|||||||
return md5(vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)) . '-' . time());
|
return md5(vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)) . '-' . time());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function exchange ($from, $to) {
|
public static function exchange($from, $to)
|
||||||
|
{
|
||||||
$result = file_get_contents('https://api.exchangeratesapi.io/latest?symbols=' . $to . '&base=' . $from);
|
$result = file_get_contents('https://api.exchangeratesapi.io/latest?symbols=' . $to . '&base=' . $from);
|
||||||
$result = json_decode($result, true);
|
$result = json_decode($result, true);
|
||||||
return $result['rates'][$to];
|
return $result['rates'][$to];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function randomChar($len, $special=false){
|
public static function randomChar($len, $special = false)
|
||||||
|
{
|
||||||
$chars = array(
|
$chars = array(
|
||||||
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
|
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
|
||||||
"l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v",
|
"l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v",
|
||||||
@ -50,7 +53,8 @@ class Helper
|
|||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function buildVmessLink($item, $user) {
|
public static function buildVmessLink($item, $user)
|
||||||
|
{
|
||||||
$config = [
|
$config = [
|
||||||
"v" => "2",
|
"v" => "2",
|
||||||
"ps" => $item->name,
|
"ps" => $item->name,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
||||||
|
|
||||||
use App\User;
|
use App\User;
|
||||||
use Faker\Generator as Faker;
|
use Faker\Generator as Faker;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
|
@ -1,14 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Library;
|
namespace Library;
|
||||||
|
|
||||||
class BitpayX {
|
class BitpayX
|
||||||
|
{
|
||||||
private $bitpayxAppSecret;
|
private $bitpayxAppSecret;
|
||||||
private $bitpayxGatewayUri;
|
private $bitpayxGatewayUri;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 签名初始化
|
* 签名初始化
|
||||||
* @param merKey 签名密钥
|
* @param merKey 签名密钥
|
||||||
*/
|
*/
|
||||||
public function __construct($bitpayxAppSecret) {
|
public function __construct($bitpayxAppSecret)
|
||||||
|
{
|
||||||
$this->bitpayxAppSecret = $bitpayxAppSecret;
|
$this->bitpayxAppSecret = $bitpayxAppSecret;
|
||||||
$this->bitpayxGatewayUri = 'https://api.mugglepay.com/v1/';
|
$this->bitpayxGatewayUri = 'https://api.mugglepay.com/v1/';
|
||||||
}
|
}
|
||||||
@ -22,15 +26,18 @@ class BitpayX {
|
|||||||
ksort($data_sign);
|
ksort($data_sign);
|
||||||
return http_build_query($data_sign);
|
return http_build_query($data_sign);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sign($data)
|
public function sign($data)
|
||||||
{
|
{
|
||||||
return strtolower(md5(md5($data) . $this->bitpayxAppSecret));
|
return strtolower(md5(md5($data) . $this->bitpayxAppSecret));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function verify($data, $signature)
|
public function verify($data, $signature)
|
||||||
{
|
{
|
||||||
$mySign = $this->sign($data);
|
$mySign = $this->sign($data);
|
||||||
return $mySign === $signature;
|
return $mySign === $signature;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function mprequest($data)
|
public function mprequest($data)
|
||||||
{
|
{
|
||||||
$headers = array('content-type: application/json', 'token: ' . $this->bitpayxAppSecret);
|
$headers = array('content-type: application/json', 'token: ' . $this->bitpayxAppSecret);
|
||||||
@ -48,6 +55,7 @@ class BitpayX {
|
|||||||
curl_close($curl);
|
curl_close($curl);
|
||||||
return json_decode($data, true);
|
return json_decode($data, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function mpcheckout($orderId, $data)
|
public function mpcheckout($orderId, $data)
|
||||||
{
|
{
|
||||||
$headers = array('content-type: application/json', 'token: ' . $this->bitpayxAppSecret);
|
$headers = array('content-type: application/json', 'token: ' . $this->bitpayxAppSecret);
|
||||||
@ -65,11 +73,15 @@ class BitpayX {
|
|||||||
curl_close($curl);
|
curl_close($curl);
|
||||||
return json_decode($data, true);
|
return json_decode($data, true);
|
||||||
}
|
}
|
||||||
public function refund($merchantTradeNo) {
|
|
||||||
|
public function refund($merchantTradeNo)
|
||||||
|
{
|
||||||
// TODO
|
// TODO
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public function buildHtml($params, $method = 'post', $target = '_self'){
|
|
||||||
|
public function buildHtml($params, $method = 'post', $target = '_self')
|
||||||
|
{
|
||||||
// var_dump($params);exit;
|
// var_dump($params);exit;
|
||||||
$html = "<form id='submit' name='submit' action='" . $this->gatewayUri . "' method='$method' target='$target'>";
|
$html = "<form id='submit' name='submit' action='" . $this->gatewayUri . "' method='$method' target='$target'>";
|
||||||
foreach ($params as $key => $value) {
|
foreach ($params as $key => $value) {
|
||||||
|
@ -1,18 +1,22 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Library;
|
namespace Library;
|
||||||
|
|
||||||
class TomatoPay {
|
class TomatoPay
|
||||||
|
{
|
||||||
private $mchid;
|
private $mchid;
|
||||||
private $account;
|
private $account;
|
||||||
private $key;
|
private $key;
|
||||||
|
|
||||||
public function __construct($mchid, $account, $key) {
|
public function __construct($mchid, $account, $key)
|
||||||
|
{
|
||||||
$this->mchid = $mchid;
|
$this->mchid = $mchid;
|
||||||
$this->account = $account;
|
$this->account = $account;
|
||||||
$this->key = $key;
|
$this->key = $key;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function alipay ($cny, $trade) {
|
public function alipay($cny, $trade)
|
||||||
|
{
|
||||||
$params = [
|
$params = [
|
||||||
'mchid' => $this->mchid,
|
'mchid' => $this->mchid,
|
||||||
'account' => $this->account,
|
'account' => $this->account,
|
||||||
@ -24,7 +28,8 @@ class TomatoPay {
|
|||||||
return $this->buildHtml('https://b.fanqieui.com/gateways/alipay.php', $params);
|
return $this->buildHtml('https://b.fanqieui.com/gateways/alipay.php', $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function wxpay ($cny, $trade) {
|
public function wxpay($cny, $trade)
|
||||||
|
{
|
||||||
$params = [
|
$params = [
|
||||||
'mchid' => $this->mchid,
|
'mchid' => $this->mchid,
|
||||||
'account' => $this->account,
|
'account' => $this->account,
|
||||||
@ -36,7 +41,8 @@ class TomatoPay {
|
|||||||
return $this->buildHtml('https://b.fanqieui.com/gateways/wxpay.php', $params);
|
return $this->buildHtml('https://b.fanqieui.com/gateways/wxpay.php', $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sign ($params) {
|
public function sign($params)
|
||||||
|
{
|
||||||
$o = '';
|
$o = '';
|
||||||
foreach ($params as $k => $v) {
|
foreach ($params as $k => $v) {
|
||||||
$o .= "$k=" . ($v) . "&";
|
$o .= "$k=" . ($v) . "&";
|
||||||
@ -44,7 +50,8 @@ class TomatoPay {
|
|||||||
return md5(substr($o, 0, -1) . $this->key);
|
return md5(substr($o, 0, -1) . $this->key);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildHtml($url, $params, $method = 'post', $target = '_self'){
|
public function buildHtml($url, $params, $method = 'post', $target = '_self')
|
||||||
|
{
|
||||||
// return var_dump($params);
|
// return var_dump($params);
|
||||||
$html = "<form id='submit' name='submit' action='" . $url . "' method='$method' target='$target'>";
|
$html = "<form id='submit' name='submit' action='" . $url . "' method='$method' target='$target'>";
|
||||||
foreach ($params as $key => $value) {
|
foreach ($params as $key => $value) {
|
||||||
|
@ -28,7 +28,11 @@
|
|||||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-P1E9Z5LRRK"></script>
|
<script async src="https://www.googletagmanager.com/gtag/js?id=G-P1E9Z5LRRK"></script>
|
||||||
<script>
|
<script>
|
||||||
window.dataLayer = window.dataLayer || [];
|
window.dataLayer = window.dataLayer || [];
|
||||||
function gtag(){dataLayer.push(arguments);}
|
|
||||||
|
function gtag() {
|
||||||
|
dataLayer.push(arguments);
|
||||||
|
}
|
||||||
|
|
||||||
gtag('js', new Date());
|
gtag('js', new Date());
|
||||||
|
|
||||||
gtag('config', 'G-P1E9Z5LRRK');
|
gtag('config', 'G-P1E9Z5LRRK');
|
||||||
|
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
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Web Routes
|
| Web Routes
|
||||||
|
Loading…
Reference in New Issue
Block a user