初始化

This commit is contained in:
2026-03-02 13:44:38 +08:00
commit 05b785083c
677 changed files with 58662 additions and 0 deletions

260
app/external/ExternalApiController.php vendored Normal file
View File

@@ -0,0 +1,260 @@
<?php
namespace app\external;
use addons\webman\model\Broadcast;
use addons\webman\model\Notice;
use addons\webman\model\PlayerGamePlatform;
use addons\webman\model\PlayerRechargeRecord;
use addons\webman\model\Player;
use addons\webman\model\PlayerDeliveryRecord;
use addons\webman\model\PlayerWithdrawRecord;
use app\service\game\MeGa888ServiceInterface;
use app\service\OnePayServices;
use app\service\SePayServices;
use app\service\SklPayServices;
use Respect\Validation\Exceptions\AllOfException;
use Respect\Validation\Validator as v;
use support\Db;
use support\Request;
use support\Log;
use support\Response;
use Webman\Push\PushException;
use Webman\RedisQueue\Redis;
class ExternalApiController
{
/** 排除 */
protected $noNeedSign = [];
/**
* 网页注册
* @return Response
*/
public function login(): Response
{
return view('login/index');
}
/**
* app下载
* @return Response
*/
public function download(): Response
{
return view('login/download');
}
/**
* SKL支付回调
* @param Request $request
* @return string
* @throws PushException
*/
public function sklRechargeNotify(Request $request): string
{
$data = $request->all();
if ($data['status'] && $data['invoice_no']) {
/** @var PlayerRechargeRecord $playerRechargeRecord */
$playerRechargeRecord = PlayerRechargeRecord::query()->where('tradeno', $data['invoice_no'])->where('status', 0)->first();
if(empty($playerRechargeRecord) || $playerRechargeRecord->money != $data['amount']){
return 'FAIL';
}
if ($data['status'] == 'SUCCESS') {
if ($playerRechargeRecord->gift_coins > 0) {
$firstRecharge = PlayerRechargeRecord::query()
->where('player_id', $playerRechargeRecord->player_id)
->where('status', 2)
->where('setting_id', $playerRechargeRecord->setting_id)
->first();
if ($firstRecharge) {
$playerRechargeRecord->gift_coins = 0;
}
}
$addMoney = bcadd($playerRechargeRecord->coins, $playerRechargeRecord->gift_coins, 2);
DB::beginTransaction();
try {
/** @var Player $player */
$player = Player::query()->find($playerRechargeRecord->player_id);
$playerRechargeRecord->status = PlayerRechargeRecord::STATUS_RECHARGED_SUCCESS;
$playerRechargeRecord->finish_time = date("Y-m-d H:i:s");
$playerRechargeRecord->notify_result = json_encode($data);
$playerRechargeRecord->save();
$beforeGameAmount = $player->wallet->money;
// 更新钱包
$player->wallet->money = bcadd($player->wallet->money, $addMoney, 2);
$player->player_extend->recharge_amount = bcadd($player->player_extend->recharge_amount, $addMoney, 2);
$player->push();
//寫入金流明細
$playerDeliveryRecord = new PlayerDeliveryRecord;
$playerDeliveryRecord->player_id = $player->id;
$playerDeliveryRecord->department_id = $player->department_id;
$playerDeliveryRecord->target = $playerRechargeRecord->getTable();
$playerDeliveryRecord->target_id = $playerRechargeRecord->id;
$playerDeliveryRecord->type = PlayerDeliveryRecord::TYPE_RECHARGE;
$playerDeliveryRecord->source = 'self_recharge';
$playerDeliveryRecord->amount = $addMoney;
$playerDeliveryRecord->amount_before = $beforeGameAmount;
$playerDeliveryRecord->amount_after = $player->wallet->money;
$playerDeliveryRecord->tradeno = '';
$playerDeliveryRecord->remark = '';
$playerDeliveryRecord->save();
DB::commit();
sendSocketMessage('private-recharge_withdrawal', [
'msg_type' => 'recharge',
'player_id' => $player->id,
'amount' => $player->wallet->money,
]);
} catch (\Exception $e) {
DB::rollBack();
Log::info('sklRecharge', (array)$data);
return json_encode(['status' => 'RECEIVED']);
}
return json_encode(['status' => 'RECEIVED']);
} else {
$playerRechargeRecord->status = PlayerRechargeRecord::STATUS_RECHARGED_FAIL;
$playerRechargeRecord->cancel_time = date('Y-m-d H:i:s');
$playerRechargeRecord->notify_result = json_encode($data);
$playerRechargeRecord->save();
return json_encode(['status' => 'RECEIVED']);
}
} else {
return json_encode(['status' => 'RECEIVED']);
}
}
/**
* SKL代付回调
* @param Request $request
* @return string
*/
public function sklWithdrawalNotify(Request $request): string
{
$data = $request->all();
if ($data['status'] && $data['invoice_no']) {
//查询订单是否存在
/** @var PlayerWithdrawRecord $playerWithdrawRecord */
$playerWithdrawRecord = PlayerWithdrawRecord::query()->where('tradeno', $data['invoice_no'])->where('status', 1)->first();
if(empty($playerWithdrawRecord) || $playerWithdrawRecord->money != $data['amount']){
return 'FAIL';
}
if ($data['status'] == 'SUCCESS') {
$playerWithdrawRecord->status = PlayerWithdrawRecord::STATUS_SUCCESS;
$playerWithdrawRecord->finish_time = date('Y-m-d H:i:s');
$playerWithdrawRecord->notify_result = json_encode($data);
$playerWithdrawRecord->talk_tradeno = $data['transferOut_id'];
$playerWithdrawRecord->save();
$broadcast = Broadcast::query()
->where('type', 2)
->where('status', 1)
->where('min_money', '<=', $data['amount'])
->first();
if (isset($broadcast)){
$queue = 'broadcast_tasks';
$broadcast_data = [
'user_id' => substr($playerWithdrawRecord->player->phone, 2),
'money' => $data['amount']
];
for ($i = 0; $i < $broadcast->copy_num; $i++) {
Redis::send($queue, $broadcast_data);
}
}
$notice = new Notice();
$notice->department_id = $playerWithdrawRecord->player->department_id;
$notice->player_id = $playerWithdrawRecord->player_id;
$notice->source_id = $playerWithdrawRecord->id;
$notice->type = Notice::TYPE_WITHDRAW;
$notice->receiver = Notice::RECEIVER_PLAYER;
$notice->is_private = 1;
$notice->title = '下分成功';
$notice->content = '本次申请已成功处理,下分 ' . $playerWithdrawRecord->money . ' ,请查收。 ';
$notice->save();
return json_encode(['status' => 'RECEIVED']);
} else {
DB::beginTransaction();
try {
/** @var Player $player */
$player = Player::query()->find($playerWithdrawRecord->player_id);
$playerWithdrawRecord->status = PlayerWithdrawRecord::STATUS_FAIL;
$playerWithdrawRecord->cancel_time = date('Y-m-d H:i:s');
$playerWithdrawRecord->notify_result = json_encode($data);
$playerWithdrawRecord->talk_tradeno = $data['transferOut_id'];
$playerWithdrawRecord->save();
$beforeGameAmount = $player->wallet->money;
// 更新钱包
$player->wallet->money = bcadd($player->wallet->money, $playerWithdrawRecord->coins, 2);
$player->push();
//寫入金流明細
$playerDeliveryRecord = new PlayerDeliveryRecord;
$playerDeliveryRecord->player_id = $player->id;
$playerDeliveryRecord->department_id = $player->department_id;
$playerDeliveryRecord->target = $playerWithdrawRecord->getTable();
$playerDeliveryRecord->target_id = $playerWithdrawRecord->id;
$playerDeliveryRecord->type = PlayerDeliveryRecord::TYPE_WITHDRAWAL_BACK;
$playerDeliveryRecord->source = 'channel_withdrawal';
$playerDeliveryRecord->amount = $playerWithdrawRecord->coins;
$playerDeliveryRecord->amount_before = $beforeGameAmount;
$playerDeliveryRecord->amount_after = $player->wallet->money;
$playerDeliveryRecord->tradeno = '';
$playerDeliveryRecord->remark = '提现失败返还金额';
$playerDeliveryRecord->save();
$notice = new Notice();
$notice->department_id = $player->department_id;
$notice->player_id = $player->id;
$notice->source_id = $playerWithdrawRecord->id;
$notice->type = Notice::TYPE_WITHDRAW;
$notice->receiver = Notice::RECEIVER_PLAYER;
$notice->is_private = 1;
$notice->title = '下分失败';
$notice->content = '本次申请下分 ' . $playerWithdrawRecord->money . ' 已退回,请查收。 ';
$notice->save();
DB::commit();
sendSocketMessage('private-recharge_withdrawal', [
'msg_type' => 'withdrawal',
'player_id' => $player->id,
'amount' => $player->wallet->money,
]);
} catch (\Exception $e) {
DB::rollBack();
Log::info('sklWithdrawal', (array)$data);
return json_encode(['status' => 'RECEIVED']);
}
return json_encode(['status' => 'RECEIVED']);
}
} else {
return json_encode(['status' => 'RECEIVED']);
}
}
/**
* SKL订单查询
* @param Request $request
* @return Response
*/
public function sklQuery(Request $request): Response
{
$validator = v::key('transactionId', v::stringType()->notEmpty()->setName(trans('certificate', [], 'message')));
$data = $request->get();
try {
$validator->assert($data);
} catch (AllOfException $e) {
return jsonFailResponse(getValidationMessages($e));
}
$params = [
'orderNo' => $data['transactionId'],
];
$res = (new SklPayServices())->query($params);
if ($res['status'] == 'SUCCESS') {
return view('skl/detail_success');
} elseif ($res['status'] == 'FAILED') {
return view('skl/detail_fail');
} elseif ($res['status'] == 'PENDING_QR') {
return view('skl/detail_paying');
} elseif ($res['status'] == 'VERIFIED') {
return view('skl/detail_paying');
} else {
return view('sepay/detail_fail');
}
}
}

14
app/external/view/login/download.html vendored Normal file
View File

@@ -0,0 +1,14 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<!-- <link rel="icon" type="image/svg+xml" href="/vite.svg" />-->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>SamSung88</title>
<script type="module" crossorigin src="/external/assets/index-DrUgyNgB.js"></script>
<link rel="stylesheet" crossorigin href="/external/assets/index-DB4XlpIQ.css">
</head>
<body>
<div id="root"></div>
</body>
</html>

14
app/external/view/login/index.html vendored Normal file
View File

@@ -0,0 +1,14 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<!-- <link rel="icon" type="image/svg+xml" href="/vite.svg" />-->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>SamSung88</title>
<script type="module" crossorigin src="/external/assets/index-BZ3xB-zH.js"></script>
<link rel="stylesheet" crossorigin href="/external/assets/index-DB4XlpIQ.css">
</head>
<body>
<div id="root"></div>
</body>
</html>

126
app/external/view/sepay/detail.html vendored Normal file
View File

@@ -0,0 +1,126 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>页面</title>
<style>
/* 页面整体居中 */
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
flex-direction: column;
text-align: center;
}
/* 按钮样式 */
button {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 10px 20px;
margin: 10px;
font-size: 16px;
cursor: pointer;
border: none;
background-color: #4CAF50;
color: white;
border-radius: 5px;
}
/* 按钮图标样式 */
img {
margin-right: 8px;
width: 20px;
height: 20px;
}
/* 隐藏按钮 */
.hidden {
display: none;
}
</style>
<script>
// 获取 URL 中的参数
function getUrlParameter(name) {
const urlParams = new URLSearchParams(window.location.search);
return urlParams.get(name);
}
// 页面加载后根据 URL 参数决定显示的按钮
window.onload = function () {
const status = getUrlParameter('status');
const orderNo = getUrlParameter('orderNo');
// 填充订单号
if (orderNo) {
document.getElementById('orderNoField').innerHTML = `订单号: ${orderNo}`;
document.getElementById('orderNoField1').innerHTML = `订单号: ${orderNo}`;
document.getElementById('orderNoField2').innerHTML = `订单号: ${orderNo}`;
} else {
document.getElementById('orderNoField').innerHTML = '订单号: 未找到';
}
// 根据 type 参数设置按钮
const closeButton = document.getElementById('closeButton');
const refreshButton = document.getElementById('refreshButton');
const loadButton = document.getElementById('loadButton');
closeButton.classList.add('hidden');
refreshButton.classList.add('hidden');
loadButton.classList.add('hidden');
if (status == '1') {
closeButton.classList.remove('hidden');
} else if (status == '2') {
refreshButton.classList.remove('hidden');
} else if (status == '3') {
loadButton.classList.remove('hidden');
}
};
// 关闭页面
function closePage() {
window.close();
}
// 刷新页面
function refreshPage() {
window.location.reload();
}
// 加载页面内容
function loadContent() {
alert('加载内容');
}
</script>
</head>
<body>
<!-- <h1>按钮操作</h1> -->
<div id="closeButton" class="hidden">
<img src="./img/icon01.png" alt="关闭" style="width: 200px;height: 200px;">
<div style="font-size: 18px;margin-top: 30px;">支付成功</div>
<div style="font-size: 18px;margin-top: 30px;"><strong id="orderNoField"></strong></div>
<button style="background-color: #1ab56a;margin-top: 30px;" onclick="closePage()">返回游戏</button>
</div>
<div id="refreshButton" class="hidden">
<img src="./img/icon02.png" alt="关闭" style="width: 200px;height: 200px;">
<div style="font-size: 18px;margin-top: 30px;">支付失败</div>
<div style="font-size: 18px;margin-top: 30px;"><strong id="orderNoField1"></strong></div>
<button style="background-color: #ca2f11;margin-top: 30px;" onclick="closePage()">返回游戏</button>
</div>
<div id="loadButton" class="hidden">
<img src="./img/icon03.png" alt="刷新" style="width: 200px;height: 200px;">
<div style="font-size: 18px;margin-top: 30px;">获取支付状态中...</div>
<div style="font-size: 18px;margin-top: 30px;"><strong id="orderNoField2"></strong></div>
<button style="background-color: #d78e0e;margin-top: 30px;" onclick="refreshPage()">刷新状态</button>
</div>
</body>
</html>

View File

@@ -0,0 +1,91 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>页面</title>
<style>
/* 页面整体居中 */
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
flex-direction: column;
text-align: center;
}
/* 按钮样式 */
button {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 10px 20px;
margin: 10px;
font-size: 16px;
cursor: pointer;
border: none;
background-color: #4CAF50;
color: white;
border-radius: 5px;
}
/* 按钮图标样式 */
img {
margin-right: 8px;
width: 20px;
height: 20px;
}
</style>
<script>
// 获取 URL 中的参数
function getUrlParameter(name) {
const urlParams = new URLSearchParams(window.location.search);
return urlParams.get(name);
}
// 页面加载后根据 URL 参数决定显示的按钮
window.onload = function () {
const orderNo = getUrlParameter('orderNo');
// 填充订单号
if (orderNo) {
document.getElementById('orderNoField').innerHTML = `订单号: ${orderNo}`;
} else {
document.getElementById('orderNoField').innerHTML = '订单号: 未找到';
}
};
// 关闭页面
function closePage() {
window.close();
}
// 刷新页面
function refreshPage() {
window.location.reload();
}
// 加载页面内容
function loadContent() {
alert('加载内容');
}
</script>
</head>
<body>
<!-- <h1>按钮操作</h1> -->
<div id="refreshButton" class="hidden">
<img src="./img/icon02.png" alt="关闭" style="width: 200px;height: 200px;">
<div style="font-size: 18px;margin-top: 30px;">支付失败</div>
<div style="font-size: 18px;margin-top: 30px;"><strong id="orderNoField"></strong></div>
<button style="background-color: #ca2f11;margin-top: 30px;" onclick="closePage()">返回游戏</button>
</div>
</body>
</html>

View File

@@ -0,0 +1,90 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>页面</title>
<style>
/* 页面整体居中 */
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
flex-direction: column;
text-align: center;
}
/* 按钮样式 */
button {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 10px 20px;
margin: 10px;
font-size: 16px;
cursor: pointer;
border: none;
background-color: #4CAF50;
color: white;
border-radius: 5px;
}
/* 按钮图标样式 */
img {
margin-right: 8px;
width: 20px;
height: 20px;
}
</style>
<script>
// 获取 URL 中的参数
function getUrlParameter(name) {
const urlParams = new URLSearchParams(window.location.search);
return urlParams.get(name);
}
// 页面加载后根据 URL 参数决定显示的按钮
window.onload = function () {
const orderNo = getUrlParameter('orderNo');
// 填充订单号
if (orderNo) {
document.getElementById('orderNoField').innerHTML = `订单号: ${orderNo}`;
} else {
document.getElementById('orderNoField').innerHTML = '订单号: 未找到';
}
};
// 关闭页面
function closePage() {
window.close();
}
// 刷新页面
function refreshPage() {
window.location.reload();
}
// 加载页面内容
function loadContent() {
alert('加载内容');
}
</script>
</head>
<body>
<!-- <h1>按钮操作</h1> -->
<div id="loadButton" class="hidden">
<img src="./img/icon03.png" alt="刷新" style="width: 200px;height: 200px;">
<div style="font-size: 18px;margin-top: 30px;">获取支付状态中...</div>
<div style="font-size: 18px;margin-top: 30px;"><strong id="orderNoField"></strong></div>
<button style="background-color: #d78e0e;margin-top: 30px;" onclick="refreshPage()">刷新状态</button>
</div>
</body>
</html>

View File

@@ -0,0 +1,91 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>页面</title>
<style>
/* 页面整体居中 */
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
flex-direction: column;
text-align: center;
}
/* 按钮样式 */
button {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 10px 20px;
margin: 10px;
font-size: 16px;
cursor: pointer;
border: none;
background-color: #4CAF50;
color: white;
border-radius: 5px;
}
/* 按钮图标样式 */
img {
margin-right: 8px;
width: 20px;
height: 20px;
}
</style>
<script>
// 获取 URL 中的参数
function getUrlParameter(name) {
const urlParams = new URLSearchParams(window.location.search);
return urlParams.get(name);
}
// 页面加载后根据 URL 参数决定显示的按钮
window.onload = function () {
const orderNo = getUrlParameter('orderNo');
// 填充订单号
if (orderNo) {
document.getElementById('orderNoField').innerHTML = `订单号: ${orderNo}`;
} else {
document.getElementById('orderNoField').innerHTML = '订单号: 未找到';
}
};
// 关闭页面
function closePage() {
window.close();
}
// 刷新页面
function refreshPage() {
window.location.reload();
}
// 加载页面内容
function loadContent() {
alert('加载内容');
}
</script>
</head>
<body>
<!-- <h1>按钮操作</h1> -->
<div id="closeButton">
<img src="./img/icon01.png" alt="关闭" style="width: 200px;height: 200px;">
<div style="font-size: 18px;margin-top: 30px;">支付成功</div>
<div style="font-size: 18px;margin-top: 30px;"><strong id="orderNoField"></strong></div>
<button style="background-color: #1ab56a;margin-top: 30px;" onclick="closePage()">返回游戏</button>
</div>
</body>
</html>

126
app/external/view/skl/detail.html vendored Normal file
View File

@@ -0,0 +1,126 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>页面</title>
<style>
/* 页面整体居中 */
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
flex-direction: column;
text-align: center;
}
/* 按钮样式 */
button {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 10px 20px;
margin: 10px;
font-size: 16px;
cursor: pointer;
border: none;
background-color: #4CAF50;
color: white;
border-radius: 5px;
}
/* 按钮图标样式 */
img {
margin-right: 8px;
width: 20px;
height: 20px;
}
/* 隐藏按钮 */
.hidden {
display: none;
}
</style>
<script>
// 获取 URL 中的参数
function getUrlParameter(name) {
const urlParams = new URLSearchParams(window.location.search);
return urlParams.get(name);
}
// 页面加载后根据 URL 参数决定显示的按钮
window.onload = function () {
const status = getUrlParameter('status');
const orderNo = getUrlParameter('orderNo');
// 填充订单号
if (orderNo) {
document.getElementById('transactionId').innerHTML = `订单号: ${orderNo}`;
document.getElementById('orderNoField1').innerHTML = `订单号: ${orderNo}`;
document.getElementById('orderNoField2').innerHTML = `订单号: ${orderNo}`;
} else {
document.getElementById('orderNoField').innerHTML = '订单号: 未找到';
}
// 根据 type 参数设置按钮
const closeButton = document.getElementById('closeButton');
const refreshButton = document.getElementById('refreshButton');
const loadButton = document.getElementById('loadButton');
closeButton.classList.add('hidden');
refreshButton.classList.add('hidden');
loadButton.classList.add('hidden');
if (status == '1') {
closeButton.classList.remove('hidden');
} else if (status == '2') {
refreshButton.classList.remove('hidden');
} else if (status == '3') {
loadButton.classList.remove('hidden');
}
};
// 关闭页面
function closePage() {
window.close();
}
// 刷新页面
function refreshPage() {
window.location.reload();
}
// 加载页面内容
function loadContent() {
alert('加载内容');
}
</script>
</head>
<body>
<!-- <h1>按钮操作</h1> -->
<div id="closeButton" class="hidden">
<img src="./img/icon01.png" alt="关闭" style="width: 200px;height: 200px;">
<div style="font-size: 18px;margin-top: 30px;">支付成功</div>
<div style="font-size: 18px;margin-top: 30px;"><strong id="orderNoField"></strong></div>
<button style="background-color: #1ab56a;margin-top: 30px;" onclick="closePage()">返回游戏</button>
</div>
<div id="refreshButton" class="hidden">
<img src="./img/icon02.png" alt="关闭" style="width: 200px;height: 200px;">
<div style="font-size: 18px;margin-top: 30px;">支付失败</div>
<div style="font-size: 18px;margin-top: 30px;"><strong id="orderNoField1"></strong></div>
<button style="background-color: #ca2f11;margin-top: 30px;" onclick="closePage()">返回游戏</button>
</div>
<div id="loadButton" class="hidden">
<img src="./img/icon03.png" alt="刷新" style="width: 200px;height: 200px;">
<div style="font-size: 18px;margin-top: 30px;">获取支付状态中...</div>
<div style="font-size: 18px;margin-top: 30px;"><strong id="orderNoField2"></strong></div>
<button style="background-color: #d78e0e;margin-top: 30px;" onclick="refreshPage()">刷新状态</button>
</div>
</body>
</html>

97
app/external/view/skl/detail_fail.html vendored Normal file
View File

@@ -0,0 +1,97 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>页面</title>
<style>
/* 页面整体居中 */
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
flex-direction: column;
text-align: center;
}
/* 按钮样式 */
button {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 10px 20px;
margin: 10px;
font-size: 16px;
cursor: pointer;
border: none;
background-color: #4CAF50;
color: white;
border-radius: 5px;
}
/* 按钮图标样式 */
img {
margin-right: 8px;
width: 20px;
height: 20px;
}
</style>
<script>
// 获取 URL 中的参数
function getInvoiceNoFromUrl(name) {
try {
const fullUrl = window.location.href;
const params = new URL(fullUrl).searchParams;
const rawValue = params.get(name);
if (!rawValue) return "";
return rawValue.split("?")[0];
} catch (err) {
return "";
}
}
// 页面加载后根据 URL 参数决定显示的按钮
window.onload = function () {
const orderNo = getInvoiceNoFromUrl('invoiceNo');
// 填充订单号
if (orderNo) {
document.getElementById('orderNoField').innerHTML = `订单号: ${orderNo}`;
} else {
document.getElementById('orderNoField').innerHTML = '订单号: 未找到';
}
};
// 关闭页面
function closePage() {
window.close();
}
// 刷新页面
function refreshPage() {
window.location.reload();
}
// 加载页面内容
function loadContent() {
alert('加载内容');
}
</script>
</head>
<body>
<!-- <h1>按钮操作</h1> -->
<div id="refreshButton" class="hidden">
<img src="../img/icon02.png" alt="关闭" style="width: 200px;height: 200px;">
<div style="font-size: 18px;margin-top: 30px;">支付失败</div>
<div style="font-size: 18px;margin-top: 30px;"><strong id="orderNoField"></strong></div>
<button style="background-color: #ca2f11;margin-top: 30px;" onclick="closePage()">返回游戏</button>
</div>
</body>
</html>

View File

@@ -0,0 +1,97 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>页面</title>
<style>
/* 页面整体居中 */
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
flex-direction: column;
text-align: center;
}
/* 按钮样式 */
button {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 10px 20px;
margin: 10px;
font-size: 16px;
cursor: pointer;
border: none;
background-color: #4CAF50;
color: white;
border-radius: 5px;
}
/* 按钮图标样式 */
img {
margin-right: 8px;
width: 20px;
height: 20px;
}
</style>
<script>
// 获取 URL 中的参数
function getInvoiceNoFromUrl(name) {
try {
const fullUrl = window.location.href;
const params = new URL(fullUrl).searchParams;
const rawValue = params.get(name);
if (!rawValue) return "";
return rawValue.split("?")[0];
} catch (err) {
return "";
}
}
// 页面加载后根据 URL 参数决定显示的按钮
window.onload = function () {
const orderNo = getInvoiceNoFromUrl('invoiceNo');
// 填充订单号
if (orderNo) {
document.getElementById('orderNoField').innerHTML = `订单号: ${orderNo}`;
} else {
document.getElementById('orderNoField').innerHTML = '订单号: 未找到';
}
};
// 关闭页面
function closePage() {
window.close();
}
// 刷新页面
function refreshPage() {
window.location.reload();
}
// 加载页面内容
function loadContent() {
alert('加载内容');
}
</script>
</head>
<body>
<!-- <h1>按钮操作</h1> -->
<div id="loadButton" class="hidden">
<img src="../img/icon03.png" alt="刷新" style="width: 200px;height: 200px;">
<div style="font-size: 18px;margin-top: 30px;">获取支付状态中...</div>
<div style="font-size: 18px;margin-top: 30px;"><strong id="orderNoField"></strong></div>
<button style="background-color: #d78e0e;margin-top: 30px;" onclick="refreshPage()">刷新状态</button>
</div>
</body>
</html>

View File

@@ -0,0 +1,97 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>页面</title>
<style>
/* 页面整体居中 */
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
flex-direction: column;
text-align: center;
}
/* 按钮样式 */
button {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 10px 20px;
margin: 10px;
font-size: 16px;
cursor: pointer;
border: none;
background-color: #4CAF50;
color: white;
border-radius: 5px;
}
/* 按钮图标样式 */
img {
margin-right: 8px;
width: 20px;
height: 20px;
}
</style>
<script>
// 获取 URL 中的参数
function getInvoiceNoFromUrl(name) {
try {
const fullUrl = window.location.href;
const params = new URL(fullUrl).searchParams;
const rawValue = params.get(name);
if (!rawValue) return "";
return rawValue.split("?")[0];
} catch (err) {
return "";
}
}
// 页面加载后根据 URL 参数决定显示的按钮
window.onload = function () {
const orderNo = getInvoiceNoFromUrl('invoiceNo');
// 填充订单号
if (orderNo) {
document.getElementById('orderNoField').innerHTML = `订单号: ${orderNo}`;
} else {
document.getElementById('orderNoField').innerHTML = '订单号: 未找到';
}
};
// 关闭页面
function closePage() {
window.close();
}
// 刷新页面
function refreshPage() {
window.location.reload();
}
// 加载页面内容
function loadContent() {
alert('加载内容');
}
</script>
</head>
<body>
<!-- <h1>按钮操作</h1> -->
<div id="closeButton">
<img src="../img/icon01.png" alt="关闭" style="width: 200px;height: 200px;">
<div style="font-size: 18px;margin-top: 30px;">支付成功</div>
<div style="font-size: 18px;margin-top: 30px;"><strong id="orderNoField"></strong></div>
<button style="background-color: #1ab56a;margin-top: 30px;" onclick="closePage()">返回游戏</button>
</div>
</body>
</html>