bfdz49 发表于 2026-2-11 15:41:25

征途网站角色出售系统

这个网站我做简单点。。功能网站自动化查找玩家FLServerDB   账号数据库
ZtGameDB   角色数据库   优化自己会去优化 功能支持支付宝微信扫码支付 例如:玩家卖个角色了可以去网站提微信或者支付宝 不过平台要收手术费 这个你们这个去修改
<?php
require_once 'config.php';
checkLogin();

$sellId = intval($_GET['id'] ?? 0);
if (!$sellId) exit('参数错误');

$db = getGameDB();
$sell = $db->query("SELECT s.*, w.acc_name as seller_name
                  FROM RoleSell s
                  LEFT JOIN SellerWallet w ON s.acc_id = w.acc_id
                  WHERE s.sell_id = $sellId AND s.status = 1")->fetch_assoc();

if (!$sell) exit('该角色已下架');

$price = $sell['price'];
$priceYuan = number_format($price / 100, 2);

// 创建订单
$orderSn = 'SE' . date('YmdHis') . rand(1000, 9999);
$fee = intval($price * 0.1);
$income = $price - $fee;

$stmt = $db->prepare("INSERT INTO SellOrder (order_sn, sell_id, char_id, seller_acc_id,
                  buyer_acc_id, price, final_price, platform_fee, seller_income,
                  order_status, pay_deadline)
                  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, 0, DATE_ADD(NOW(), INTERVAL 15 MINUTE))");
$stmt->bind_param("siiiiiiii",
    $orderSn, $sellId, $sell['char_id'], $sell['acc_id'],
    $_SESSION['acc_id'], $price, $price, $fee, $income
);
$stmt->execute();
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="gbk">
    <title>支付订单 - ¥<?php echo $priceYuan; ?></title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js"></script>
    <style>
      body { font-family: "Microsoft YaHei", sans-serif; background: #f5f5f5;
               display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; }
      .pay-box { background: white; padding: 40px; border-radius: 12px; text-align: center; width: 450px; }
      .amount { font-size: 36px; color: #f44336; font-weight: bold; margin: 20px 0; }
      .tabs { display: flex; margin: 30px 0; border-bottom: 2px solid #eee; }
      .tab { flex: 1; padding: 15px; cursor: pointer; }
      .tab.active { color: #07c160; border-bottom: 3px solid #07c160; font-weight: bold; }
      #qrcode { margin: 20px auto; }
      .countdown { color: #f44336; margin-top: 15px; }
    </style>
</head>
<body>
    <div class="pay-box">
      <h2>确认支付</h2>
      <p>角色:<?php echo htmlspecialchars($sell['char_name']); ?>(<?php echo $sell['char_level']; ?>级)</p>
      <div class="amount">¥<?php echo $priceYuan; ?></div>
      <p style="color: #999; font-size: 12px;">含平台服务费(10%)</p>
      
      <div class="tabs">
            <div class="tab active" onclick="switchTab(1)">微信支付</div>
            <div class="tab" onclick="switchTab(2)">支付宝</div>
      </div>
      
      <div id="qrcode"></div>
      <div class="countdown">支付剩余时间:<span id="timer">15:00</span></div>
    </div>
   
    <script>
      let currentType = 1;
      let orderSn = '<?php echo $orderSn; ?>';
      
      function switchTab(type) {
            currentType = type;
            document.querySelectorAll('.tab').forEach(t => t.classList.remove('active'));
            event.target.classList.add('active');
            generateQR(type);
      }
      
      function generateQR(type) {
            fetch('api/create_pay.php', {
                method: 'POST',
                headers: {'Content-Type': 'application/json'},
                body: JSON.stringify({
                  order_sn: orderSn,
                  pay_type: type,
                  amount: <?php echo $price; ?>,
                  body: '征途角色-<?php echo $sell['char_name']; ?>'
                })
            })
            .then(r => r.json())
            .then(data => {
                if (data.code === 0) {
                  document.getElementById('qrcode').innerHTML = '';
                  new QRCode(document.getElementById('qrcode'), {
                        text: data.data.qr_url,
                        width: 200,
                        height: 200
                  });
                }
            });
      }
      
      // 倒计时
      let seconds = 900;
      setInterval(() => {
            seconds--;
            if (seconds <= 0) { alert('订单已过期'); location.href = 'market.php'; }
            const m = Math.floor(seconds/60), s = seconds%60;
            document.getElementById('timer').textContent = (m<10?'0':'')+m+':'+(s<10?'0':'');
      }, 1000);
      
      generateQR(1);
    </script>
</body>
</html>
你们需要服务端跟客户端有显示
<?xml version="1.0" encoding="GB2312"?>
<event id="8052500" name="角色交易管理员">
    <quest id="1000">
      <embranchment id="1">
            <actions>
                <flexmenu content="欢迎来到角色交易平台!我可以帮您出售或购买角色。"/>
                <notify2 content="安全提示:请通过官方平台交易,谨防诈骗!"/>
                <menu>
                  function MainMenu()
                        this:AddTalk("\n<c:ff0000>★ 角色交易平台 ★<:c>\n\n")
                        this:AddTalk("我是交易管理员,请选择服务:\n\n")
                        this:AddTalk("<c:00ff00>?<:c> 出售角色 - 将角色上架出售\n")
                        this:AddTalk("<c:00ff00>?<:c> 购买角色 - 浏览市场购买\n")
                        this:AddTalk("<c:00ff00>?<:c> 我的交易 - 查看交易记录\n\n")
                        this:AddTalk("<c:ffff00>注意:出售后角色将被冻结!<:c>\n\n")
                        this:AddTaskCmdItem("出售角色(&v)", "v8052501", 8052501, 10)
                        this:AddTaskCmdItem("购买角色(&v)", "v8052502", 8052502, 20)
                        this:AddTaskCmdItem("我的交易(&v)", "v8052503", 8052503, 30)
                        this:AddCloseItem("离开")
                  end
                  MainMenu()
                </menu>
            </actions>
      </embranchment>
    </quest>
</event>
<?xml version="1.0" encoding="GB2312"?>
<event id="8052502" name="购买角色">
    <quest id="1000">
      <embranchment id="1">
            <actions>
                <flexmenu content="正在加载交易市场..."/>
                <notify1 content="请稍候..."/>
                <menu>
                  function BuyMenu()
                        this:AddTalk("\n<c:ff0000>角色交易市场<:c>\n\n")
                        this:AddTalk("当前热门角色:\n")
                        this:AddTalk("<c:00ff00>?<:c> - 500元\n")
                        this:AddTalk("<c:00ff00>?<:c> - 800元\n")
                        this:AddTalk("<c:00ff00>?<:c> - 1200元\n\n")
                        this:AddTalk("更多角色请访问网站:\n")
                        this:AddTalk("<c:00ffff>http://服务器IP/market.php<:c>\n\n")
                        this:AddTalk("支付后角色自动转入您的账号!\n\n")
                        this:AddCloseItem("返回")
                  end
                  BuyMenu()
                </menu>
            </actions>
      </embranchment>
    </quest>
</event>
其他自己去修改 里面有数据库全部

liyicheng556 发表于 2026-2-11 16:49:26

多谢分享哦

chu_jian 发表于 2026-5-14 16:12:55

谢谢楼主分享
页: [1]
查看完整版本: 征途网站角色出售系统

本站内容如若侵犯到您的权益,请来电来函告知,我们会尽快处理!
联系QQ:1953150286,2251387361,123784736,免责申明