这里不再更新帖子,请移步上方文章。
前言
找到之前的一个要饭程序 看版权上写的 烟雨寒云 但是他的网站打不开了,发动偷偷技能,使用微信的 weui 改了个 css 样式,修复了原版的一些功能。
欢迎搬运,可以不带原文链接,但是请不要改我的名字,也不要拿去售卖,Functions.php 已经加密。并带有版权信息。
演示站
支持功能
- 自定义金额打赏
- 后台功能
- 对接彩虹易支付
- 赞助时输入QQ号 获取昵称以及头像
- 赞赏时留言
- 总赞助金额统计
- 赞助者位置显示(根据用户IP)
V1.4.0
新增固定金额按钮,默认隐藏手动输入。优化支付方式逻辑,新增默认黑白颜色,选中时恢复原色彩,新增默认支付方式选择。默认支付宝支付
V1.3.1
由于没有稳定的获取QQ昵称的接口,调整为手动输入昵称模式。代码无需更改,替换根目录的index.php即可
<?php
include './Core/Common.php';
$data = $_REQUEST;
if (isset($data['type']) && !empty($data['type'])) {
$pay = [
'wxpay',
'alipay',
];
if (!in_array($data['type'], $pay)) ng_json(['code' => -1, 'msg' => '支付方式不合法!']);
$trade_no = date('YmdHis') . mt_rand(1111, 9999);
if (!$data['qq']) ng_json(['code' => -1, 'msg' => 'QQ不可为空!']);
if (!preg_match('/^[1-9][0-9]{4,9}$/', $data['qq'])) ng_json(['code' => -1, 'msg' => 'QQ号格式不正确!']);
if (!$data['msg']) ng_json(['code' => -1, 'msg' => '留言不可为空!']);
if (!$data['money']) ng_json(['code' => -1, 'msg' => '金额不可为空!']);
if ($data['money'] < 0 || !is_numeric($data['money']) || $data['money'] > 5000) ng_json(['code' => -1, 'msg' => '金额不合法!']);
$data['money'] = round($data['money'], 2);
$arr = [
'trade_no' => $trade_no,
'qq' => strip_tags($data['qq']),
'nick' => strip_tags($data['nick']),
'city' => get_ip_city(real_ip()),
'msg' => strip_tags($data['msg']),
'ip' => real_ip(),
'money' => strip_tags($data['money']),
'type' => strip_tags($data['type']),
'addtime' => date('Y-m-d H:i:s')
];
$row = Db(insert('ng_order', $arr), 1);
if (!$row) ng_json(['code' => -1, 'msg' => '订单发起失败!']);
ng_json(['code' => 1, 'msg' => '订单发起成功!', 'trade_no' => $trade_no]);
}
// 查询总金额
$cmoney = Db('select sum(money) from ng_order where status=1');
?>
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php echo config('sitename'); ?> - <?php echo config('title'); ?></title>
<link rel="stylesheet" href="/Static/css/weui.css">
<link rel="stylesheet" href="/Static/css/weui.min.css">
<link rel="icon" href="https://q1.qlogo.cn/g?b=qq&nk=<?php echo config('qq'); ?>&s=640" type="image/x-icon">
<link rel='stylesheet' href='https://chinese-fonts-cdn.deno.dev/packages/hcqyt/dist/ChillRoundFBold/result.css' />
<style>
/* 在大屏幕上应用 */
@media (min-width: 768px) {
.weui-form {
max-width: 600px;
/* 设置最大宽度为600px */
margin: auto;
/* 水平居中 */
padding: 20px;
/* 可选:增加一些内边距 */
}
}
/*字体设置*/
body {
font-family: '寒蝉全圆体 Bold';
font-weight: 400;
}
.weui-btn_disabled {
pointer-events: none;
opacity: 0.5;
}
</style>
</head>
<body>
<div class="page">
<div class="weui-form">
<div class="weui-form__bd">
<!-- 头像&公告开始 -->
<div class="weui-form__text-area">
<img src="https://q1.qlogo.cn/g?b=qq&nk=<?php echo config('qq'); ?>&s=640" class="rounded" style="border-radius: 10px; width: 88px; height: 88px;">
<h2 class="weui-form__title"><?php echo config('sitename'); ?></h2>
<div class="weui-form__desc"><?php echo config('gg');?></div>
</div>
<!-- 金额选择框 -->
<div class="weui-cells__group weui-cells__group_form">
<div class="weui-cells__title">赞赏一下</div>
<div class="weui-cells">
<label for="amount" class="weui-cell weui-cell_active">
<div class="weui-cell__hd"><span class="weui-label">金额</span></div>
<div class="weui-cell__bd">
<input id="amount" class="weui-input" type="number" placeholder="大爷,赞赏多少您说了算。" name="money" required />
</div>
</label>
</div>
</div>
<!-- 选择支付方式 -->
<div class="weui-cells__group weui-cells__group_form">
<div class="weui-cells__title">支付方式</div>
<div class="weui-cells weui-cells_radio">
<!-- 支付宝支付 -->
<label class="weui-cell weui-check__label" for="alipay">
<div class="weui-cell__hd">
<input type="radio" name="payment" value="alipay" id="alipay" class="weui-check">
<i class="weui-icon-checked"></i>
</div>
<svg t="1727871238777" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11760" width="32" height="32">
<path d="M1024.0512 701.0304V196.864A196.9664 196.9664 0 0 0 827.136 0H196.864A196.9664 196.9664 0 0 0 0 196.864v630.272A196.9152 196.9152 0 0 0 196.864 1024h630.272a197.12 197.12 0 0 0 193.8432-162.0992c-52.224-22.6304-278.528-120.32-396.4416-176.64-89.7024 108.6976-183.7056 173.9264-325.3248 173.9264s-236.1856-87.2448-224.8192-194.048c7.4752-70.0416 55.552-184.576 264.2944-164.9664 110.08 10.3424 160.4096 30.8736 250.1632 60.5184 23.1936-42.5984 42.496-89.4464 57.1392-139.264H248.064v-39.424h196.9152V311.1424H204.8V267.776h240.128V165.632s2.1504-15.9744 19.8144-15.9744h98.4576V267.776h256v43.4176h-256V381.952h208.8448a805.9904 805.9904 0 0 1-84.8384 212.6848c60.672 22.016 336.7936 106.3936 336.7936 106.3936zM283.5456 791.6032c-149.6576 0-173.312-94.464-165.376-133.9392 7.8336-39.3216 51.2-90.624 134.4-90.624 95.5904 0 181.248 24.4736 284.0576 74.5472-72.192 94.0032-160.9216 150.016-253.0816 150.016z" fill="#bfbfbf" p-id="11761"></path>
</svg>
</svg>
<div style="margin-left:10px;" class="weui-cell__bd">
<p>支付宝</p>
</div>
</label>
<!-- 支付宝支付 -->
<label class="weui-cell weui-check__label" for="wxpay">
<div class="weui-cell__hd">
<input type="radio" name="payment" value="wxpay" id="wxpay" class="weui-check">
<i class="weui-icon-checked"></i>
</div>
<svg t="1727871211770" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10648" width="32" height="32">
<path d="M236.24 323.769c0 24.005 19.32 43.325 43.325 43.325s43.326-19.32 43.326-43.325c0-24.005-19.321-43.325-43.326-43.325-24.004 0-43.325 19.32-43.325 43.325z m336.064 223.067c0 18.735 15.223 33.958 33.958 33.958s33.958-15.223 33.958-33.958-15.223-33.958-33.958-33.958-33.958 15.223-33.958 33.958zM456.38 323.769c0 24.005 19.32 43.325 43.325 43.325 24.005 0 43.325-19.32 43.325-43.325 0-24.005-19.32-43.325-43.325-43.325-24.005 0-43.325 19.32-43.325 43.325z" p-id="10649" fill="#bfbfbf"></path>
<path d="M858.017 0H165.983C74.648 0 0.293 74.356 0.293 166.276v690.863c0 91.92 74.355 166.276 165.69 166.276h692.034c91.335 0 165.69-74.356 165.69-166.276V166.276C1023.707 74.94 949.352 0 858.017 0zM384.366 686.18c-38.642 0-69.672-8.197-108.899-15.808L167.154 724.82l31.03-93.09C120.316 577.28 74.063 507.022 74.063 422.128c0-147.54 139.929-264.05 310.303-264.05 152.81 0 286.298 93.09 313.23 217.798a255.341 255.341 0 0 0-29.859-1.757c-147.54 0-264.05 110.07-264.05 245.315 0 22.834 3.513 44.496 9.367 64.988-9.367 1.171-18.735 1.757-28.688 1.757z m457.843 108.313l23.42 77.283-84.895-46.838c-31.03 7.61-62.06 15.808-93.09 15.808-147.541 0-264.051-100.703-264.051-225.41 0-124.12 116.51-225.408 264.05-225.408 139.344 0 263.465 101.288 263.465 225.409-0.585 70.843-46.838 132.903-108.899 179.156z" p-id="10650" fill="#bfbfbf"></path>
<path d="M741.507 546.836c0 18.735 15.223 33.958 33.958 33.958s33.958-15.223 33.958-33.958-15.223-33.958-33.958-33.958c-19.32 0-33.958 15.223-33.958 33.958z" p-id="10651" fill="#bfbfbf"></path>
</svg>
<div style="margin-left:10px;" class="weui-cell__bd">
<p>微信</p>
</div>
</label>
<!-- 支付按钮结束 -->
</div>
</div>
<!-- 老板信息输入框 -->
<div class="weui-form__control-area">
<div class="weui-cells__group weui-cells__group_form">
<div class="weui-cells__title">您的信息:</div>
<div class="weui-cells">
<label for="qq" class="weui-cell weui-cell_active">
<div class="weui-cell__hd"><span class="weui-label">QQ号</span></div>
<div class="weui-cell__bd">
<input id="qq" class="weui-input" type="number" placeholder="根据QQ调用您的头像和昵称" name="qq" required />
</div>
</label>
<label for="nickname" class="weui-cell weui-cell_active">
<div class="weui-cell__hd"><span class="weui-label">昵称</span></div>
<div class="weui-cell__bd">
<input id="nick" class="weui-input" type="text" placeholder="请输入您的昵称" name="nick" required />
</div>
</label>
<div class="weui-cell weui-cell_active">
<div class="weui-cell__bd">
<textarea class="weui-textarea" placeholder="您有啥想说的吗?" rows="3" name="msg"></textarea>
</div>
</div>
</div>
</div>
</div>
<!-- 信息输入结束 -->
</div>
</div>
<div class="weui-form">
<div class="weui-form__opr-area">
<a role="button" class="weui-btn weui-btn_primary" href="javascript:pay()">确定</a>
</div>
<!-- 赞助订单 -->
<div class="weui-form__control-area">
<div class="weui-cells__group weui-cells__group_form">
<div class="weui-panel__hd">
赞助记录
<span style="font-size: 0.8em;">总赞助:<?php echo 0 + sum_money($cmoney); ?>元</span>
<a role="button" class="weui-btn weui-btn_primary weui-btn_medium" href="ng_orders.php"style="width:100%; display:block; margin-top:10px;">查看全部赞助名单</a>
</div>
<div class="weui-panel__bd" id="ss_list">
<!-- 初始加载第一页数据 -->
<?php
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
echo ss_list($order, $page);
echo generate_pagination(ceil(count($order) / 5), $page);
?>
</div>
</div>
<!-- 版权与备案号 -->
<div class="weui-form__extra-area">
<div class="weui-footer">
<p class="weui-footer__links">
<a href="https://beian.miit.gov.cn/" class="weui-footer__link"><?php echo config('beian'); ?></a>
</p>
<p class="weui-footer__text">Copyright © 2024 <?php echo config('copy'); ?></p>
</div>
</div>
<!-- 引入 WeUI 的样式和脚本 -->
<script src="https://res.wx.qq.com/t/wx_fed/weui.js/res/1.2.21/weui.min.js"></script>
<script src="./Static/js/jquery.min.js"></script>
<script src="./Static/js/bootstrap.min.js"></script>
<script src="./Static/js/layer.js"></script>
<script>
$(document).ready(function() {
function loadOrders(page) {
$.ajax({
url: 'load_orders.php',
type: 'GET',
data: {
page: page
},
success: function(response) {
$('#ss_list').html(response.html + response.pagination);
},
error: function() {
alert('加载失败,请重试!');
}
});
}
// 初始化加载第一页数据
loadOrders(1);
// 绑定分页按钮点击事件
$(document).on('click', '.weui-btn_mini', function() {
var page = $(this).data('page');
if (!$(this).hasClass('weui-btn_disabled')) {
loadOrders(page);
}
});
});
function pay() {
var payment = $('input[name="payment"]:checked').val();
if (!payment) {
weui.topTips('请选择支付方式!');
return;
}
var amount = $('#amount').val();
if (!amount) {
weui.topTips('请输入赞赏金额!');
return;
}
var qq = $('#qq').val();
if (!qq) {
weui.topTips('请输入QQ号!');
return;
}
var nickname = $('#nick').val();
if (!nickname) {
weui.topTips('请输入昵称!');
return;
}
var msg = $('textarea[name="msg"]').val();
if (!msg) {
weui.topTips('请输入留言!');
return;
}
// 创建加载提示
var loadingToast = weui.loading('订单发起中...');
var cont = $("input,textarea").serialize();
$.ajax({
url: "./index.php?type=" + payment,
data: cont,
type: 'post',
dataType: 'json',
success: function(data) {
// 关闭加载提示
loadingToast.hide(function() {
if (data.code == 1) {
// 直接跳转到支付页面
window.location.href = "./Pay/Submit?trade_no=" + data.trade_no;
} else {
weui.alert(data.msg);
}
});
},
timeout: 10000,
error: function(XMLHttpRequest, textStatus, errorThrown) {
// 关闭加载提示
loadingToast.hide(function() {
if (textStatus == "timeout") {
weui.alert('请求超时!');
} else {
weui.alert('服务器错误!');
}
});
}
});
}
</script>
</body>
</html>
V1.3.0新增功能
- 新增赞助用户全部信息展示(朋友圈UI)
- 优化部分样式
V1.2.1新增功能
- 新增收到赞助后邮箱通知
V1.2 新增功能
- 赞助金额前三位,新增角标提示
- 移除原有弹窗提示,更改为Weui提示样式
- 留言内网站自动识别为外链(需带http/https)
- 删除无用css js 图片文件,占用更小
- 后台弹窗样式优化
V1.1 新增功能
- 更改赞助人员逻辑 按赞助金额从大到小排列
- 赞助列表新增翻页按钮,并优化细节
- 优化暗黑模式的部分问题
V1.0.1 新增功能
- USDT赞赏
- 支付方式小图标
- 更换IP库的API
- 修复底部版权和备案号不显示的BUG
演示图
源码下载
https://www.123865.com/s/uXJuVv-fC1U3