吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 4523|回复: 67
上一主题 下一主题
收起左侧

[其他原创] 自用挪车二维码,免服务器,可免费5G短信通知,可打电话

    [复制链接]
跳转到指定楼层
楼主
niustark 发表于 2026-10-28 16:26 回帖奖励
本帖最后由 niustark 于 2026-10-29 09:11 编辑

最近发现pushplus支持免费5G短信通知了(中国移动用户),想起来之前论坛里有过几个版本的挪车二维码页面,
加上我自己用vibe coding加上了自己的一些想法,感觉挺好用的,就把代码分享出来供大家参考.
这是部署完的页面预览


利用Cloudflare Workers部署挪车页面
代码粘贴到workers里就行了,在设置里面增加这3个变量,填自己的
手机号
车牌号
pushplus的token就行了

代码打包了.
move-car-worker.zip (4.06 KB, 下载次数: 197)

收到短信提醒是这样的

[JavaScript] 纯文本查看 复制代码
// ===== 使用 ES Module 语法(Cloudflare Workers 当前标准写法)=====
// 环境变量通过 fetch 的第二个参数 env 传入,确保能读到配置
export default {
  async fetch(request, env, ctx) {
    return handleRequest(request, env)
  }
}

async function handleRequest(request, env) {
  // 防御:个别部署环境不传 env 时,退化为空对象,避免报 undefined 错误
  env = env || globalThis.env || {}

  // ===== 敏感信息全部从环境变量读取(在 Cloudflare 控制台或 wrangler 中配置)=====
  // 必须配置的环境变量:
  //   PHONE          车主手机号,如 15888888888
  //   PUSHPLUS_TOKEN pushplus 的 token
  //   PLATE          车牌号,如 豫C99999
  const phone = env.PHONE
  const pushplusToken = env.PUSHPLUS_TOKEN
  const plate = env.PLATE

  // 校验环境变量是否已配置
  if (!phone || !pushplusToken || !plate) {
    return new Response(
      '缺少环境变量:请在 Cloudflare 中配置 PHONE、PUSHPLUS_TOKEN、PLATE(Settings → Variables → Environment Variables / Secrets)',
      { status: 500, headers: { 'Content-Type': 'text/plain;charset=UTF-8' } }
    )
  }

  // 从车牌号中拆出省份简称、发牌机关字母、序号(如 豫C99999 -> 豫 / C / 99999)
  const plateProvince = plate.slice(0, 1)
  const plateLetter = plate.slice(1, 2)
  const plateNumbers = plate.slice(2)

  const htmlContent = `
    <!DOCTYPE html>
    <html lang="zh-CN">
      <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>通知车主挪车</title>
        <link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>&#128663;</text></svg>">
        <style>
          * { box-sizing: border-box; margin: 0; padding: 0; }
          :root {
            --primary-color: #4776E6;
            --secondary-color: #8E54E9;
            --text-color: #2c3e50;
            --shadow-color: rgba(0, 0, 0, 0.1);
          }
          body { 
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            display: flex; 
            align-items: center; 
            justify-content: center; 
            min-height: 100vh; 
            background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
            color: var(--text-color);
            padding: 20px;
            line-height: 1.6;
          }
          .container { 
            text-align: center; 
            padding: 30px; 
            width: 100%; 
            max-width: 450px; 
            border-radius: 24px; 
            box-shadow: 0 10px 40px var(--shadow-color);
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            transform: translateY(0);
            transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
          }
          .container:hover {
            transform: translateY(-8px);
            box-shadow: 0 15px 50px rgba(0, 0, 0, 0.15);
          }
          h1 { 
            font-size: 32px; 
            margin-bottom: 25px; 
            background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            font-weight: 700;
          }
          .car-icon {
            font-size: 64px;
            margin-bottom: 20px;
            display: inline-block;
            animation: float 6s ease-in-out infinite;
          }
          p { 
            margin-bottom: 20px; 
            font-size: 12px; 
            color: #546e7a;
            line-height: 1.3;
          }
          .button-group {
            display: flex;
            flex-direction: column;
            gap: 15px;
          }
          button { 
            width: 100%; 
            padding: 16px 24px; 
            font-size: 18px; 
            font-weight: 600; 
            color: #fff; 
            border: none; 
            border-radius: 16px; 
            cursor: pointer; 
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
          }
          button:active {
            transform: scale(0.98);
          }
          .notify-btn { 
            background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
            box-shadow: 0 4px 15px rgba(71, 118, 230, 0.2);
          }
          .notify-btn:hover { 
            box-shadow: 0 6px 20px rgba(71, 118, 230, 0.3);
            transform: translateY(-2px);
          }
          .call-btn { 
            background: linear-gradient(45deg, #00b09b, #96c93d);
            box-shadow: 0 4px 15px rgba(0, 176, 155, 0.2);
          }
          .call-btn:hover { 
            box-shadow: 0 6px 20px rgba(0, 176, 155, 0.3);
            transform: translateY(-2px);
          }
          @keyframes float {
            0% { transform: translateY(0px) rotate(0deg); }
            50% { transform: translateY(-20px) rotate(5deg); }
            100% { transform: translateY(0px) rotate(0deg); }
          }
          .loading {
            position: relative;
            pointer-events: none;
          }
          .loading::after {
            content: "";
            position: absolute;
            width: 20px;
            height: 20px;
            border: 3px solid #ffffff;
            border-radius: 50%;
            border-top-color: transparent;
            animation: spin 0.8s linear infinite;
            margin-left: 10px;
          }
          @keyframes spin {
            to { transform: rotate(360deg); }
          }
          .toast {
            position: fixed;
            top: 30%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: rgba(0, 0, 0, 0.8);
            color: white;
            padding: 10px 24px;
            border-radius: 20px;
            font-size: 14px;
            opacity: 0;
            transition: opacity 0.3s;
            z-index: 1000;
          }
          .toast.show {
            opacity: 1;
          }
          
          /* 中国标准蓝牌样式 */
          .license-plate-blue {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-family: 'Arial', sans-serif;
            background: linear-gradient(to bottom, #0c44c5, #1a65ff, #0c44c5);
            border: 3px solid #fff;
            border-radius: 8px;
            padding: 10px 20px;
            margin: 25px 0;
            box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
            position: relative;
            overflow: hidden;
          }
          .license-plate-blue::before {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 5px;
            background: rgba(255, 255, 255, 0.2);
          }
          .license-plate-blue::after {
            content: "&#8226; 豫 &#8226;";
            position: absolute;
            bottom: 5px;
            left: 0;
            right: 0;
            font-size: 8px;
            color: rgba(255, 255, 255, 0.7);
            letter-spacing: 2px;
          }
          .province {
            font-size: 36px;
            font-weight: bold;
            color: #fff;
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
            margin-right: 4px;
          }
          .letter {
            font-size: 36px;
            font-weight: bold;
            color: #fff;
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
            margin: 0 3px;
          }
          .numbers {
            font-size: 36px;
            font-weight: bold;
            color: #FFDE59;
            letter-spacing: 3px;
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
          }
          
          /* 按钮图标动画 */
          button span {
            transition: transform 0.3s ease;
          }
          button:hover span {
            transform: scale(1.05);
          }
          
          .plate-title {
            color: #2c3e50;
            font-size: 14px;
            margin-bottom: 8px;
            opacity: 0.8;
          }
        </style>
      </head>
      <body>
        <div class="container">
            <div class="license-plate-blue">
            <span class="province">${plateProvince}</span>
            <span class="letter">${plateLetter}</span>
            <span class="numbers">${plateNumbers}</span>
          </div>
          <p>请通过以下方式联系车主,我会立即前来处理</p>
          <div class="button-group">
            <button class="notify-btn">
            &#128664;&#65039;<span>通知挪车</span>
            </button>
            <button class="notify-btn">
            &#128656;<span>提醒未关车窗</span>
            </button>
            <button class="notify-btn">
            &#128161;<span>提醒未关车灯</span>
            </button>
            <button class="call-btn">
              &#128222;<span>电话联系</span>
            </button>
          </div>
        </div>
        <div id="toast" class="toast"></div>

        <script>
          // 敏感信息不写死在前端代码中,由服务端渲染时注入
          const PLATE = '${plate}';

          function showToast(message, duration = 3000) {
            const toast = document.getElementById('toast');
            toast.textContent = message;
            toast.classList.add('show');
            setTimeout(() => toast.classList.remove('show'), duration);
          }

          function notifyOwner(type) {
            const buttons = document.querySelectorAll('.notify-btn');
            buttons.forEach(btn => {
              btn.classList.add('loading');
              btn.disabled = true;
            });
            
            const messages = {
              moveCar: {
                title: '挪车通知',
                content: '您好,您的车牌号' + PLATE + '阻碍了他人通行,请尽快前往挪车',
                toast: "通知已发送,车主很快就来!"
              },
              remindWindows: {
                title: '车窗提醒',
                content: '温馨提醒:您的车牌号' + PLATE + '车窗未关,请及时检查以防物品丢失',
                toast: "车窗提醒已发送!"
              },
              remindLights: {
                title: '车灯提醒',
                content: '温馨提醒:您的车牌号' + PLATE + '车灯未关闭,请及时检查以防电瓶亏电',
                toast: "车灯提醒已发送!"
              }
            };
            
            const { title, content, toast: toastMessage } = messages[type];
            
            // 使用pushplus发送通知(5G消息/新消息ClawBot渠道)
            // token 由服务端渲染注入,不在源代码中明文出现
            fetch('https://www.pushplus.plus/send', {
              method: 'POST',
              headers: {
                'Content-Type': 'application/json'
              },
              body: JSON.stringify({
                token: '${pushplusToken}',
                title: title,
                content: content,
                channel: 'cmcc', // 5G消息(中国移动「新消息ClawBot」应用号)渠道
                template: 'txt'  // 5G消息渠道建议使用txt模板,正文完整展示
              })
            })
            .then(response => response.json())
            .then(data => {
              buttons.forEach(btn => {
                btn.classList.remove('loading');
                btn.disabled = false;
              });
              // pushplus成功响应code为200
              data.code === 200 
                ? showToast(toastMessage) 
                : showToast("发送失败: " + (data.msg || '请电话联系'));
            })
            .catch(error => {
              console.error("Error:", error);
              buttons.forEach(btn => {
                btn.classList.remove('loading');
                btn.disabled = false;
              });
              showToast("网络错误,请电话联系");
            });
          }

          function callOwner() {
            window.location.href = "tel:${phone}";
          }
        </script>
      </body>
    </html>
  `;

  return new Response(htmlContent, {
    headers: { 'Content-Type': 'text/html;charset=UTF-8' },
  });
}

免费评分

参与人数 13吾爱币 +16 热心值 +10 收起 理由
斌斌斌哥哥 + 1 + 1 用心讨论,共获提升!
zyai530 + 1 + 1 我很赞同!
WJF12321 + 1 谢谢@Thanks!
gtf68081551 + 1 我很赞同!
陪初雪去看雪 + 1 我很赞同!
kaimenzzz + 1 + 1 谢谢@Thanks!
苏紫方璇 + 7 + 1 欢迎分析讨论交流,吾爱破解论坛有你更精彩!
zxc147258369 + 1 谢谢@Thanks!
tzxinqing + 1 + 1 用心讨论,共获提升!
循环水 + 1 + 1 用心讨论,共获提升!
and11 + 1 + 1 我很赞同!
繁花似锦丿遇见 + 1 我很赞同!
cux666 + 1 谢谢@Thanks!

查看全部评分

发帖前要善用【论坛搜索】功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

来自 30#
 楼主| niustark 发表于 2026-10-29 09:28 |楼主
本帖最后由 niustark 于 2026-10-30 10:36 编辑

Cloudflare 网页控制台部署
  • 登录 Cloudflare 后台 → 左侧【计算】→【Workers 和 Pages】
  • 点【创建应用程序】→【创建 Worker】
  • 填写 Worker 名称(比如 move-car),点【部署】,等待初始化完成
  • 点【快速编辑】进入代码编辑器
  • 清空编辑器里面默认全部代码,把上面整段代码完整粘贴进去
  • 点右上角【保存并部署】
配置环境变量(最重要!不配置直接 500 报错)
  • 退出编辑页,找到这个 Worker →【设置】→【变量】
  • 添加 3 个变量
PHONE = 车主手机号,例:15888888888
PLATE = 完整车牌,例:豫C99999
PUSHPLUS_TOKEN = pushplus 的token 变量类型选【密钥】,保存

返回 Worker 概览,复制 *.workers.dev 链接,打开就能用!

注意:pushplus channel:cmcc 5G 消息渠道,必须你的手机号支持移动 5G 消息
倘若你的 CloudFlare 中已经有域名,那么可以直接填写一个二级域名,CF 会自动帮你做好 DNS 解析。
这里我用了 nuoche 开头做二级域名,其实在你创建 Worker 时候就有分配了一个项目地址,但是由于国内网络环境复杂的原因,该链接往往是打不开的,所以最好弄一个自己的域名。
然后把这个网址制作成二维码.
制作美化二维码
草料二维码 - 这玩意已经很多年了,应该是在线二维码里最好用的了,直接进入美化二维码界面,
这里选择的是一个叫编号:B342的模板,大家可以根据自己的喜好进行选择,然后编辑字段将内容替换替换为自己需求的文字即可。

设计好之后可以导出图片,去淘宝找印刷店做个静电贴啥的往车前挡上一贴就好了。

免费评分

参与人数 1吾爱币 +1 热心值 +1 收起 理由
繁花似锦丿遇见 + 1 + 1 我很赞同!

查看全部评分

推荐
dork 发表于 2026-10-29 09:00
看了一下pushplus.plus的收费功能:大致能用几次
短信渠道请求        10积分/条        10积分/条
语音渠道请求        30积分/条        30积分/条
可创建群组数        5个        50个
单群组内用户数        100人        500人
可添加好友总数        1,000人        2万人
好友消息群发人数        10人        100人
可绑定公众号        0个        5个
可创建webhook数        10个        50个
推荐
frankcc 发表于 2026-10-29 00:04
沙发
gaoxiaoao 发表于 2026-10-28 21:37
大佬,不会玩,不明觉厉
3#
cux666 发表于 2026-10-28 21:55
是不是得用上微信扫描
4#
and11 发表于 2026-10-28 23:03
不是APP的吗?
5#
pojie521008 发表于 2026-10-28 23:46
先收藏,坐等使用说明
6#
wuy009 发表于 2026-10-28 23:51
这就厉害了,虽然看不太懂。
8#
hebeijianke 发表于 2026-10-29 00:10
最后一张截图中的链接能打开,可以看到你的车牌哦
9#
循环水 发表于 2026-10-29 00:41
坐等哈 哈哈哈
10#
熊猫咖啡 发表于 2026-10-29 02:29
后期其他运营商手机号可以吗?
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - 52pojie.cn ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2026-11-12 17:51

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表