本文档描述了 H5 页面需要调用的后端接口。
https://t-mapi.colormaprun.com/api/card/https://colormaprun.com/api/card/http://oss-card.colormaprun.com/card/POSTapplication/x-www-form-urlencodedtoken。| 参数名 | 必选 | 说明 | 示例 |
|---|---|---|---|
Content-Type |
是 | 固定值 | application/x-www-form-urlencoded |
token |
是 | 用户身份令牌 | 96ba3c924394934f7d30fa869a94ce0d |
所有接口返回 JSON 格式数据:
{
"code": 0, // 0 表示成功,非 0 表示失败
"message": "成功", // 提示信息
"data": { ... } // 业务数据,下文中的“返回数据”均指此 data 字段的内容
}
window.API 对象)API.getOssUrl()string (OSS 基础 URL)1.1 卡片基本信息查询
API.getCardBase(ecId)ecId (int)json
{
"ecName": "活动名称",
"ecDesc": "活动描述",
"beginSecond": 1700000000, // 开始时间戳
"endSecond": 1700090000, // 结束时间戳
"secondCardName": "跳转页面名称"
}
1.2 卡片通用配置查询
API.getCardConfig(ecId, pageName)ecId (int): 卡片/活动 IDpageName (string): 页面名称 (如 "all", "rankList", "index")json
{
"configJson": "{\"css\": \"string\", \"tabActiveColor\": \"string\", \"popupRuleConfig\": {...}, \"popupRuleList\": [...]}"
}
* configJson 字段说明 (示例):
* css: string,动态注入到页面的 CSS 样式。
* tabActiveColor: string,Tab 栏选中颜色,如 "#FF5733"。
* teamType: int,队伍类型 (0:默认, 1:学生/家长)。
* popupRuleConfig: object,规则弹窗组件的样式配置,如 { "height": "500px", "theme": "light" }。
* popupMessageConfig: object,消息弹窗组件的样式配置。
* popupHelpConfig, popupWarnConfig, popupExchgConfig: object,其他类型弹窗的配置。
* popupRuleList: array<object|string>,规则弹窗的内容列表,元素可以是 { "type": 1, "data": { "title": "标题", "content": "HTML 内容", "logo": {"src": "...", "width": "..."} } },也可以是字符串 "default" 或 "default2" (表示加载预设内容)。
* popupExchgList, popupHelpList: array<object>,其他类型弹窗的内容列表。
* popupDataList: array<object|string>,通用弹窗内容列表,用于显示自定义弹窗信息,支持 default / default2 关键字加载预设内容。
* 注意:configJson 结构灵活,字段是动态的,取决于后台配置,开发者应做好判空处理。1.3 用户个性化配置查询
API.getUserConfig(ecId, pageName)ecId (int), pageName (string)json
{
"configJson": "{\"tplInfo\": {...}, \"mapInfo\": [...], \"popupRuleList\": [...]}"
}
* configJson 字段说明 (示例):
* tplInfo: object,模板信息,如 { "tplTypeId": 1, "ssctId": 1 }。
* mapInfo: array<object>,地图相关信息,如 [{"activityList": [{"showName": "路线名称", "point": {"longitude": 117, "latitude": 36}}]}]。
* popupRuleList: array<object>,用户专属规则弹窗内容。
* 注意:结构灵活,字段是动态的,取决于后台配置,开发者应做好判空处理。2.1 卡片对应活动或赛事详情查询
API.getCardDetail(ecId)ecId (int)json
{
"mcId": 101,
"mcName": "赛事名称",
"mcType": 1, // 1:普通 2:线下 3:线上
"beginSecond": 1700000000,
"endSecond": 1700090000,
"teamNum": 0, // 0:个人, >0:团队
"coiId": 1, // 已报名单位ID
"coiName": "已报名单位名称",
"ocaId": 201 // 关联活动详情ID (用于跳转)
}
2.2 用户是否已报名卡片对应赛事查询
API.getUserJoinStatus(ecId)ecId (int)json
{
"isJoin": true // true: 已报名, false: 未报名
}
2.3 线上赛报名 (重新分组)
API.signUpOnline(mcId, coiId, selectTeam, nickName)mcId (int), coiId (opt), selectTeam (opt), nickName (opt){} (空对象表示成功)2.4 是否允许重新分组(报名)
API.isAllowMcSignUp(ecId)ecId (int)json
{
"allowSignUp": true
}
2.5 线上赛报名页面信息详情
API.getOnlineMcSignUpDetail(ecId, mcId)ecId (int), mcId (int)2.6 卡片对应线上赛多个活动查询 (用户赛事结果详情)
API.getMatchRsDetail(ecId, ocaId)ecId (int), ocaId (int)json
[
{
"mcId": 101,
"mcName": "赛事名称",
"mcType": 1,
"beginSecond": 1700000000,
"endSecond": 1700090000,
"status": 1, // 状态
"nickName": "用户昵称", // 用户在赛事中的昵称
"totalNum": 10, // 总场次/次数
"totalDistanct": 5000, // 总距离 (米)
"totalDistanctRankNum": 5, // 总距离排名
"totalCp": 20, // 总打点数
"totalCpRankNum": 3, // 总打点数排名
"totalSysPoint": 100, // 总积分/百味豆
"totalSysPointRankNum": 10, // 总积分排名
"fastPace": 300, // 最快配速 (秒/公里)
"fastPaceRankNum": 8 // 最快配速排名
}
}
2.7 用户在卡片对应赛事是否新用户
API.isNewUserInCardComp(ecId)ecId (int)json
{
"isNew": true // true: 是新用户, false: 不是
}
3.1 排名查询
API.getRankDetail(mcIdListStr, mcType, ocaId, dispArrStr)mcIdListStr (string), mcType (int), ocaId (int), dispArrStr (string)json
{
"totalRankRs": [ // 总榜
{
"nickName": "张三",
"score": 10000,
"headUrl": "http://...",
"rankNum": 1
}
],
"teamRankRs": [], // 队伍榜
"inTeamRs": [] // 队内榜
}
3.1.1 月挑战排名查询 (月榜)
API.getMonthRankDetail(year, month, dispArrStr)year (int): 年份,如 2025month (int): 月份,1-12dispArrStr (string): 固定传 grad,mapNum(分别返回个人榜、场地榜)示例:
curl -X POST -H "Content-Type: application/x-www-form-urlencoded" \
-d "year=2025&month=11&dispArrStr=grad,mapNum" \
https://colormaprun.com/api/card/MonthRankDetailQuery
json
{
"gradRs": [ { "userName": "张三", "rankNum": 1, "inRankNum": 264, "isSelf": 0, "isInGame": 0 }, ... ],
"mapNumRs": [ { "userName": "Q", "rankNum": 1, "inRankNum": 1, "isSelf": 0, "isInGame": 0 }, ... ]
}
说明: 部分环境允许不带 token 访问月榜;若需鉴权同样在 Header 携带 token。3.2 卡片用户当前排名查询
API.getUserCurrentRank(ecId)ecId (int)json
{
"rankNum": 5 // 当前排名,0表示未上榜
}
3.3 玩家所有月挑战记录查询
API.getMonthlyChallenge()json
[
{
"year": "2023",
"monthRs": [
{
"month": 10,
"realNum": 5, // 实际完成
"targetNum": 10 // 目标
}
]
}
]
3.4 玩家活动成就查询
API.getAchievement()json
[
{
"year": "2023",
"aiRs": [
{
"aiName": "完赛奖牌",
"aiTime": 1700000000,
"iconUrl": "http://..."
}
]
}
]
3.5 赛事总成绩统计查询
API.getCompStatistic(mcId)mcId (int)json
{
"totalDistance": 123.45, // 总里程
"totalPeople": 1000, // 总参与人数
"totalRightAnswerNum": 500, // 总正确答题数
"totalAnswerNum": 800, // 总答题数
"totalCp": 2000, // 总打点数
"totalSysPoint": 5000 // 总积分/百味豆
}
3.6 玩家当前月挑战记录查询
API.getCurrentMonthlyChallenge(year, month)year (int): 可选,默认当年month (int): 可选,默认当月json
{
"month": 11,
"realNum": 10, // 实际完成次数
"targetNum": 20 // 目标次数
}
4.1 卡片内可用积分查询
API.getScore(ecId)ecId (int)json
{
"score": 880,
"extTime": 1700000000 // 过期时间
}
4.2 积分可兑换商品列表查询
API.getGoodsList(ecId)ecId (int)json
[
{
"goodsId": 1,
"goodsName": "商品A",
"goodsPic": "/static/...", // 需拼接 OSS Url
"goodsLeftNum": 99,
"corrScore": 100
}
]
4.3 积分兑换商品
API.exchangeGoods(ecId, goodsId, exchNum)ecId (int), goodsId (int), exchNum (int, 可选, 默认1){} (成功)4.4 玩家兑换记录查询
API.getExchangeList()json
[
{
"exchangeId": 123,
"goodsName": "商品A",
"createTime": 1700000000,
"status": 1 // 1:成功
}
]
4.5 玩家兑换详情查询
API.getExchangeDetail(oarId)oarId (int)json
{
"exchangeId": 1,
"goodsName": "商品名称",
"createTime": 1700000000,
"status": 1,
"address": "收货地址",
"receiver": "收件人",
"phone": "联系电话"
}
4.6 积分可兑换商品详情
API.getGoodsDetail(ecId, goodsId)ecId (int), goodsId (int)json
{
"goodsId": 1,
"goodsName": "商品名称",
"goodsPic": "http://...",
"corrScore": 500, // 所需积分
"goodsLeftNum": 99, // 剩余库存
"goodsUnit": "个", // 单位
"goodsDesc": "HTML描述内容",
"exchDesc": "HTML兑换说明",
"exchLimit": 3 // 个人兑换上限
}
5.1 未读消息列表查询
API.getUnReadMessages(relationId, relationType)relationId (int), relationType (int)json
[
{
"mqId": 1,
"mqType": 1, // 1:成就, 3:系统
"mqTitle": "标题",
"mqMessage": "内容",
"iconUrl": "http://..."
}
]
5.2 警告列表查询
API.getWarnMessage(ecId)ecId (int)json
[
{
"warnType": 1,
"warnTitle": "黄牌警告",
"warnMessage": "您违规了...",
"iconUrl": "http://..."
}
]
5.3 标记消息已读
API.readMessage(mqIdListStr)mqIdListStr (string) - 消息ID列表字符串,如 "1,2,3"{} (成功)API.getGrids(ecId)ecId (int)json
{
"compId": 101,
"compName": "网格赛",
"widthNum": 3,
"heightNum": 3,
"maskImgPic": "http://...",
"actualImgPic": "http://...",
"state": 2, // 1:未开始 2:进行中 3:已结束
"detailRs": [
{
"orderNum": 1, // 格子序号
"isComplete": 1, // 1:点亮 0:未点亮
"showName": "格子1",
"relationType": 1, // 1:活动详情 2:活动列表 3:地图列表
"ocaId": 201, // 关联活动ID (relationType=1时有效)
"mapId": 0, // 关联地图ID (relationType=2时有效)
"description": "描述信息",
"popupImg": "http://...", // 弹窗图片
"longitude": 117.0,
"latitude": 36.0
}
]
}
7.1 查询电子证书样式
API.getCertStyle(certStyleType)certStyleType (int)json
{
"styleId": 1,
"styleName": "默认样式",
"templateUrl": "http://...", // 证书模板图片 URL
"elements": [
{ "type": "text", "field": "userName", "x": 100, "y": 200, "fontSize": 20, "color": "#000" }
// 更多元素配置,如位置、字体、颜色
]
}
7.2 查询电子证书成就对应用户基本信息
API.getUserBaseInCertificate(oarId)oarId (int)json
{
"userName": "用户名称",
"activityName": "活动名称",
"completionTime": 1700000000 // 完成时间戳
}
7.3 根据成就信息确认生成电子证书
API.createCertificate(nickName, oarId)nickName (string): 用户昵称oarId (int): 订单活动记录IDjson
{
"certUrl": "http://example.com/generated_cert.png" // 生成的证书图片 URL
}
API.getUserInfo()json
{
"nickName": "用户昵称",
"headUrl": "http://..."
}
8.2 卡片对应地图列表详情查询
API.getMapList(mcId)mcId (int)json
[
{
"mapId": 1,
"mapName": "奥体中心",
"latitude": 36.666,
"longitude": 117.123,
"activityList": [
{ "ocaId": 101, "showName": "迷你跑" }
]
}
]
8.3 卡片URL查询
API.getCardUrl(actId, matchType)actId (int), matchType (int)json
{
"url": "http://example.com/card/detail.html?id=123" // 卡片对应的H5页面URL
}
8.4 赛事完赛信息查询
API.getMatchFinishInfo(actId, matchType)actId (int), matchType (int){} (待定)8.5 Redis 重建 (管理接口)
API.redisRebuild(compId)compId (int){} (待定)