版本: v1.0.0
为了保证API安全,所有请求都需要提供有效的API密钥。请联系管理员获取API密钥。
配置文件位置:app/controller/ApiCardVerifyController.php
默认密钥:your-api-key-here-change-this(请务必修改)
支持两种方式传递API密钥:
X-API-Key: your-api-key?api_key=your-api-key基础URL:正在获取...
响应格式:JSON
字符编码:UTF-8
验证指定卡密的有效性,不会消费卡密。
| 参数名 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
| card_secret | string | 必填 | 要验证的卡密 |
| openid | string | 可选 | 用户标识 |
curl -X POST "" \ -H "X-API-Key: your-api-key" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "card_secret=ABC123&openid=user123"
{
"code": 0,
"msg": "卡密有效",
"data": {
"card_secret": "ABC123",
"exists": true,
"valid": true,
"claimed": false,
"used": false,
"trigger_keyword": "测试",
"card_type": "VIP",
"prefix": "VIP",
"create_time": "2023-10-01 12:00:00",
"claim_info": null
}
}
使用指定卡密,会将卡密标记为已使用状态,无法再次使用。
| 参数名 | 类型 | 是否必填 | 说明 |
|---|---|---|---|
| card_secret | string | 必填 | 要使用的卡密 |
| openid | string | 可选 | 用户标识 |
curl -X POST "" \ -H "X-API-Key: your-api-key" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "card_secret=ABC123&openid=user123"
{
"code": 0,
"msg": "卡密使用成功",
"data": {
"card_secret": "ABC123",
"trigger_keyword": "测试",
"card_type": "VIP",
"used_time": "2023-10-01 12:30:00",
"openid": "user123"
}
}
获取API文档的JSON格式数据。
curl -X GET ""
| 错误码 | 说明 |
|---|---|
| 0 | 成功 |
| 400 | 请求参数错误 |
| 401 | API密钥不能为空 |
| 403 | API密钥无效 |
| 404 | 卡密不存在 |
| 500 | 服务器内部错误 |
/verify 接口只验证不消费,/use 接口会消费卡密