塔罗牌占卜源码(塔罗牌源码)占卜+爱情+预测+事业
塔罗牌占卜可以追溯到 15 世纪,当时这些装饰牌只不过是一种派对把戏。随着岁月的流逝,人们意识到隐藏在这个华丽甲板中的潜力。几个世纪后,在线塔罗牌占卜业务迅速占领了神秘市场。新一代已经着迷于洗牌的奥秘、耳语的预测以及魔法觉醒的可能性。
这个源码是一个用Python编写的简单应用程序,可以从包含78个描述和图像参考的字典中随机抽取一张或三张塔罗牌。此应用程序的源代码在这里-请随意分叉或重复使用,没有许可证限制。
塔罗牌源码及演示:m.appwin.top
部分源码展示:app.js
const express = require("express");
const bodyParser = require("body-parser");
const fs = require("fs");
const path = require("path");
const cloneDeep = require("lodash.clonedeep");
const remove = require("lodash.remove");const app = express();
const router = express.Router();const root =process.env.NODE_ENV === "production"? path.join(__dirname, ".."): __dirname;app.use(bodyParser.json());
app.use("/static", express.static(path.join(root, "static")));app.get("/", (_req, res) => {return res.sendFile("static/index.html", { root });
});app.get("/documentation.yaml", (_req, res) => {return res.sendFile("static/RWS-card-api.yaml", { root });
});app.use("/api/v1/", router);router.use((_req, res, next) => {res.locals.rawData = JSON.parse(fs.readFileSync("static/card_data.json", "utf8"));return next();
});router.use(function (_req, res, next) {res.header("Access-Control-Allow-Origin", "*");res.header("Access-Control-Allow-Credentials", true);res.header("Access-Control-Allow-Methods", "GET,PUT,POST,DELETE,OPTIONS");res.header("Access-Control-Allow-Headers","Origin,X-Requested-With,Content-Type,Accept,content-type,application/json");return next();
});router.get("/", (_req, res) => {return res.redirect("/api/v1/cards");
});router.get("/cards", (_req, res) => {const { cards } = res.locals.rawData;return res.json({ nhits: cards.length, cards }).status(200);
});router.get("/cards/search", (req, res) => {const { cards } = res.locals.rawData;console.log(`req.query:`, req.query);if (!req.query || Object.keys(req.query).length === 0)return res.redirect("/api/v1/cards");let filteredCards = [];for (let k in req.query) {if (k !== "q") {if (k === "meaning") {filteredCards = cards.filter((c) =>[c.meaning_up, c.meaning_rev].join().toLowerCase().includes(req.query[k].toLowerCase()));} else {filteredCards = cards.filter((c) => c[k] && c[k].toLowerCase().includes(req.query[k].toLowerCase()));}} else if (k === "q") {filteredCards = cards.filter((c) =>Object.values(c).join().toLowerCase().includes(req.query[k].toLowerCase()));}}return res.json({ nhits: filteredCards.length, cards: filteredCards }).status(200);
});router.get("/cards/random", function (req, res) {const { cards } = res.locals.rawData;const n = req.query.n > 0 && req.query.n < 79 ? req.query.n : 78;let cardPool = cloneDeep(cards);let returnCards = [];for (let i = 0; i < n; i++) {let id = Math.floor(Math.random() * (78 - i));let card = cardPool[id];returnCards.push(card);remove(cardPool, (c) => c.name_short === card.name_short);}return res.json({ nhits: returnCards.length, cards: returnCards });
});router.get("/cards/:id", (req, res, next) => {const { cards } = res.locals.rawData;const card = cards.find((c) => c.name_short === req.params.id);if (typeof card === "undefined") return next();return res.json({ nhits: 1, card }).status(200);
});router.get("/cards/suits/:suit", (req, res, next) => {const { cards } = res.locals.rawData;const cardsOfSuit = cards.filter((c) => c.suit === req.params.suit);if (!cardsOfSuit.length) return next();return res.json({ nhits: cardsOfSuit.length, cards: cardsOfSuit }).status(200);
});router.get("/cards/courts", (_req, res) => {const { cards } = res.locals.rawData;const courtCards = cards.filter((c) =>["queen", "king", "page", "knight"].includes(c.value));return res.json({ nhits: courtCards.length, cards: courtCards }).status(200);
});router.get("/cards/courts/:court", (req, res, next) => {const { cards } = res.locals.rawData;const { court } = req.params;const len = court.length;if (len < 4) return next();const courtSg = court[len - 1] === "s" ? court.slice(0, len - 1) : court;const cardsOfCourt = cards.filter((c) => c.value === courtSg);if (!cardsOfCourt.length) return next();return res.json({ nhits: cardsOfCourt.length, cards: cardsOfCourt }).status(200);
});router.use(function (_req, _res, next) {var err = new Error("Not Found");err.status = 404;next(err);
});router.use(function (err, _req, res) {res.status(err.status || 500);res.json({ error: { status: err.status, message: err.message } });
});const port = process.env.PORT || 8000;app.listen(port, function () {console.log("RWS API Server now running on port", port);
});
Footer
描述:
这是使用 Flutter 进行开发的移动应用算命。
克隆此存储库
在项目终端运行以下代码:
flutter pub getflutter runPI
满足您所有的网络神秘主义需求。
提供从 AE Waite 的 The Pictorial Key to the Tarot 解析的信息,符合 OpenAPI 3 规范。这是作为对使用 ExpressJS 的 REST API 的友好介绍而创建的。
API 使用
查看完整文档 + 使用 SwaggerHub 上的 API
快速开始
JS:
fetch("https://rws herokuapp/api/v1/cards/random?n=10").then(function (response) {return response.json()}).then(function (response) {// handle ten random cards}).catch(function (error) {// handle what went wrong});
欢迎您获取用作数据源的 JSON 文件并将其用于您自己的项目。
克隆或分叉此存储库并在本地安装依赖项。需要 Node 10.0.0 或更高版本,以及 npm 6.0.0 或更高版本。
git clone ekelen/tarot-api.git# or git@ekelen/tarot-api.git# -OR- click fork on this project's page, then:git clone /YOUR-USERNAME/tarot-api.git
然后:
cd tarot-apinpm installnpm run dev
当谈到在线占卜塔罗牌时,您可能会感到孤立无援。通过虚拟空间交换故事和深入占卜会感觉不如面对面占卜那么亲密。紫园通过营造更加风度翩翩、平易近人的举止来解决这个问题。
一旦找到与您相关的从业者,您就可以与同一位顾问预订每日在线塔罗牌占卜。该网站通过允许用户随时联系顾问来弥补虚拟差距。灵活的时间表和持续的联系使这些服务更具吸引力和意义。
此外,您可以在咨询期间提出每个主题和主题。这些包括关系建议、精神支持、财务预测和与职业相关的星座。注册从业者在这些谈话中采取非评判的立场。然后他们使用他们固有的力量和占卜工具来分享关于你下一步应该做什么的公正建议。这种方法使这些读数高度可靠。