爱意满满的作品展示区。
iPocket

[送码] 维护了快一年的会员订阅管理工具 — 口袋订阅,最近大幅优化了一版本

  •  
  •   iPocket · 6h 47m ago · 352 views
    一个苹果 iOS 原生制作的会员订阅管理工具 —— 口袋订阅,维护了快一年了,总体很稳定了,非常感谢国内外的朋友反馈,特别是一个老外叫 Jimmy ,好像非常喜欢我这款产品,他发现 bug 总是发邮件给我,邮件里有和他对话的几十封邮件了,真的非常感谢,也很开心。
    产品主打简约,可以快速添加会员订阅,快速查找会员订阅,其他功能,订阅 APP 里该有的应该都有。然后可以通过长按别的 APP 分享到 口袋订阅 快速添加,也可以通过搜索 APP/网站 名称来快速添加,其他功能我倒觉得没那么重要,主要看个大概的费用。
    APP 不搜集你的任何数据,这里其实有个缺点,就是你想改善你的产品的时候,没有数据,就会发现无从下手,你根本不知道用户在哪个页面体验不好😂,全靠用户从其他渠道反馈,邮件、小红书等。如有苹果开发者也可以一起交流下这方面的经验。
    App Store 地址: https://apps.apple.com/cn/app/%E5%8F%A3%E8%A2%8B%E8%AE%A2%E9%98%85-%E8%AE%A2%E9%98%85%E7%AE%A1%E7%90%86%E4%B8%8E%E8%B4%A6%E5%8D%95%E6%8F%90%E9%86%92/id6752631319


    留言抽 20 个永久会员,明天收市后按上证指数抽出,因为我发现我送的很多兑换码感觉被机器人秒了
    抽奖程序由 GPT 提供,代码如下
    ```javascript
    (async function lottery() {
    const drawTime = "2026-05-27 18:00:00"; // 开奖时间
    const postUrl = "https://example.com/post/123"; // 帖子链接
    const shIndex = "3123.45"; // 上证指数,建议用字符串,避免小数精度问题
    const replyTotal = 1000; // 回复总数
    const winnerCount = 20; // 抽奖个数

    if (!drawTime || !postUrl || !shIndex) {
    console.error("开奖时间、帖子链接、上证指数不能为空");
    return;
    }

    if (!Number.isSafeInteger(replyTotal) || replyTotal <= 0) {
    console.error("回复总数必须是大于 0 的安全整数");
    return;
    }

    if (!Number.isSafeInteger(winnerCount) || winnerCount <= 0) {
    console.error("抽奖个数必须是大于 0 的安全整数");
    return;
    }

    if (winnerCount > replyTotal) {
    console.error("抽奖个数不能大于回复总数");
    return;
    }

    async function sha256Hex(text) {
    const data = new TextEncoder().encode(text);
    const hashBuffer = await crypto.subtle.digest("SHA-256", data);

    return Array.from(new Uint8Array(hashBuffer))
    .map(b => b.toString(16).padStart(2, "0"))
    .join("");
    }

    function hexToBigInt(hex) {
    return BigInt("0x" + hex);
    }

    async function randomInt(seed, counter, maxExclusive) {
    const max = BigInt(maxExclusive);
    const space = 1n << 256n;
    const limit = space - (space % max);

    while (true) {
    const hash = await sha256Hex(seed + ":" + counter.value);
    counter.value++;

    const num = hexToBigInt(hash);

    // 拒绝采样,避免简单取模产生偏差
    if (num < limit) {
    return Number(num % max);
    }
    }
    }

    async function drawWinners(seed, replyTotal, winnerCount) {
    const winners = [];
    const swapped = new Map();
    const counter = { value: 0 };

    for (let i = 0; i < winnerCount; i++) {
    const remaining = replyTotal - i;
    const r = await randomInt(seed, counter, remaining);

    const selectedIndex = i + r;

    const selectedValue = swapped.has(selectedIndex)
    ? swapped.get(selectedIndex)
    : selectedIndex + 1;

    const currentValue = swapped.has(i)
    ? swapped.get(i)
    : i + 1;

    swapped.set(selectedIndex, currentValue);
    winners.push(selectedValue);
    }

    return winners;
    }

    const rawSeed = [
    `开奖时间=${drawTime}`,
    `帖子链接=${postUrl}`,
    `上证指数=${shIndex}`,
    `回复总数=${replyTotal}`,
    `抽奖个数=${winnerCount}`
    ].join("|");

    const seedHash = await sha256Hex(rawSeed);
    const winners = await drawWinners(seedHash, replyTotal, winnerCount);
    const sortedWinners = [...winners].sort((a, b) => a - b);

    console.log("========== 抽奖结果 ==========");
    console.log("原始种子:");
    console.log(rawSeed);
    console.log("");
    console.log("种子 SHA-256:");
    console.log(seedHash);
    console.log("");
    console.log("中奖楼层:");
    console.log(winners.join(", "));
    console.log("");
    console.log("中奖楼层,升序:");
    console.log(sortedWinners.join(", "));
    console.log("============================");
    })();
    ```
    8 replies    2026-05-27 02:41:54 +08:00
    TaoTao
        1
    TaoTao  
       4h 18m ago via iPhone
    支持下
    vpromise
        2
    vpromise  
       4h 6m ago
    前来支持
    xspoco
        3
    xspoco  
       3h 33m ago
    支持一下
    huoma
        4
    huoma  
       2h 50m ago via iPhone
    kk
    samli12
        5
    samli12  
       2h 45m ago
    支持
    Crazy9527
        6
    Crazy9527  
       1h 58m ago via Android
    支持
    azhezzz
        7
    azhezzz  
       1h 30m ago
    支持
    outofbound
        8
    outofbound  
       1h 16m ago
    支持!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   948 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 43ms · UTC 19:58 · PVG 03:58 · LAX 12:58 · JFK 15:58
    ♥ Do have faith in what you're doing.