技术博客
金店参考价格:珠宝商 / 金价小程序如何集成实时金价

金店参考价格:珠宝商 / 金价小程序如何集成实时金价

作者: 万维易源
2026-09-03
金店参考价格金价查询免费接口ShowAPI指南
# 金店参考价格:珠宝商 / 金价小程序如何集成实时金价 > 接口 2145(金店参考价格)· 免费 · 适用人群:珠宝商、小程序/公众号运营 · 阅读时间约 5 分钟 ## 核心要点 - 柜台报价、金价小程序、公众号每日推文都能用同一份 API 数据源。 - 数据表建议存「品牌 + 当日金价 + 数据日期」,前端读缓存。 - 展示务必标注「参考价」,且每天 13:40 后刷新。 ## Why:这跟我有什么关系 对珠宝商和金价内容运营来说,金店参考价格接口把「每天问供货商要价」变成「调一次 API」。本文给一个可直接落地的集成蓝图。 ## What:前置条件与接口速览 **典型场景** | 场景 | 用法 | |---|---| | 柜台/商城报价 | 按品牌展示当日黄金/铂金参考价 | | 金价小程序 | 首页列表 + 品牌详情页 | | 公众号/视频号 | 每天 13:40 后定时生成「今日金价」图文 | **建议数据表** ``` brand_price(brand_id, brand_name, gold_price, platinum_price, price_date, updated_at) ``` ## How:接入步骤 **小程序端调用(两步合一的云函数)** ```javascript // 云函数:返回某品牌今日金价 export async function getGold(appkey, brandName) { const list = await fetch("https://route.showapi.com/2145-1?appKey=" + appkey, { method: "POST", headers: { "content-type": "application/x-www-form-urlencoded" }, }).then(r => r.json()); const target = list.showapi_res_body.data.find(b => b.brand.includes(brandName)) || list.showapi_res_body.data[0]; const price = await fetch("https://route.showapi.com/2145-2?appKey=" + appkey, { method: "POST", headers: { "content-type": "application/x-www-form-urlencoded" }, body: new URLSearchParams({ id: target._id }), }).then(r => r.json()); return price.showapi_res_body; } ``` ## 返回示例与解析 **返回示例(品牌详情页用)** ```python { "showapi_res_error": "", "showapi_fee_num": 1, "showapi_res_code": 0, "showapi_res_id": "67a5aaf5fb638c27e15696c2", "showapi_res_body": { "ret_code": 0, "platinumPrice": 409, "_id": "5da958ead3fb8b0eefc6a3d2", "remark": "", "auLastDate": "2025-02-07", "showapi_fee_code": 0, "ptLastDate": "2025-02-07", "brand": "周大生", "goldPrice": 869 } } ``` 把 `goldPrice`/`platinumPrice` 与 `auLastDate` 一起展示,并注明「参考价」。 ## 进阶 / 边界 - 公众号推文用定时任务在 13:40 后拉取,避免展示旧价。 - 多品牌列表建议服务端预热(见[缓存策略](https://www.showapi.com/guides/gold-price-cache-cost-2145)),前端只读缓存。 - 价格为参考价,不应作为交易结算唯一依据,界面需有免责说明。 ## FAQ **Q:小程序能直连接口吗?** 建议走自家云函数中转,既保护 AppKey 不暴露在前端,也方便做缓存与限流。 **Q:每天自动发金价推文怎么做?** 用定时任务在 13:40 后调接口拉全品牌价,渲染图文后推送;价格来源统一走本接口。 **Q:展示时要不要标注日期?** 要。auLastDate/ptLastDate 是报价日期,标注后可避免用户误以为是实时行情。 ## 相关能力 / 下一步阅读 - [金店参考价格:两步调用工作流](https://www.showapi.com/guides/gold-price-two-step-2145) - [金店参考价格:金价每日 13:40 更新,如何设计缓存策略](https://www.showapi.com/guides/gold-price-cache-cost-2145) - [金店参考价格:高并发 / 批量集成架构](https://www.showapi.com/guides/gold-price-architecture-2145) - **本系列共 12 篇**:查看[金店参考价格 · 官方指南总目录](https://www.showapi.com/guides/gold-price-guides-2145)