🔐 卡密API 接口文档

提供卡密生成、验证、使用和管理的完整接口

📝 注册账号 🧪 测试页面
📖 API 简介
🔑 API 密钥说明
所有接口都需要 API 密钥才能调用!
请先在注册页面注册账号,注册成功后会自动获得一个 48 位的 API 密钥。
📝 如何获取 API 密钥:
  1. 访问 注册页面 注册账号
  2. 注册成功后,系统会自动生成一个 48 位的 API 密钥
  3. 复制并保存您的 API 密钥
  4. 在调用所有接口时,携带 api_key 参数
通用请求参数
参数名类型必填说明
api_keystringAPI密钥,注册后获得
📦 卡密类型说明

⏰ 小时卡

按时长计算,如24小时、48小时等

card_type=time

📅 天数卡

按时长计算,如7天、30天等

card_type=time

🔢 次数卡

按使用次数计算,可重复使用

card_type=count

💎 点数卡

按点数计算,每次扣除设定点数

card_type=point
POST /?action=generate
生成卡密
⚠️ 参数说明:
  • 时间卡:card_type=time, duration=30, duration_unit=day(30天)
  • 次数卡:card_type=count, duration=5(可使用5次)
  • 点数卡:card_type=point, duration=100, total_uses=10(100点,每次扣10点)
请求参数
参数名类型必填默认值说明
api_keystring-API密钥
countint1生成数量
card_typestringtimetime/count/point
durationint30时长/次数/点数
duration_unitstringdayhour/day(仅时间卡)
total_usesint1每次扣点数(点数卡)
remarkstring-备注
请求示例
// 生成30天卡密
curl -X POST "https://yhs.ihuahui.win/?action=generate" \
  -d "api_key=您的密钥&count=5&card_type=time&duration=30&duration_unit=day"

// 生成24小时卡密
curl -X POST "https://yhs.ihuahui.win/?action=generate" \
  -d "api_key=您的密钥&count=10&card_type=time&duration=24&duration_unit=hour"

// 生成次数卡(可使用5次)
curl -X POST "https://yhs.ihuahui.win/?action=generate" \
  -d "api_key=您的密钥&card_type=count&duration=5"

// 生成点数卡(100点,每次扣10点)
curl -X POST "https://yhs.ihuahui.win/?action=generate" \
  -d "api_key=您的密钥&card_type=point&duration=100&total_uses=10"
成功响应
{
  "code": 200,
  "message": "生成成功",
  "data": {
    "codes": ["A1B2C3D4E5F6G7H8", "I9J8K7L6M5N4O3P2"]
  }
}
200 生成成功 400 参数错误 401 密钥无效
GET/POST /?action=verify
验证卡密

验证卡密的有效性和剩余使用次数/点数

请求参数
参数名类型必填说明
api_keystringAPI密钥
codestring要验证的卡密
请求示例
curl "https://yhs.ihuahui.win/?action=verify&api_key=密钥&code=A1B2C3D4"
成功响应(天数卡)
{
  "code": 200,
  "message": "卡密有效",
  "data": {
    "code": "A1B2C3D4E5F6G7H8",
    "card_type": "time",
    "card_type_name": "时间卡",
    "duration": 30,
    "duration_unit": "day",
    "duration_unit_name": "天",
    "expire_at": "2026-06-15 10:30:00",
    "status": "未使用"
  }
}
成功响应(小时卡)
{
  "code": 200,
  "message": "卡密有效",
  "data": {
    "code": "I9J8K7L6M5N4O3P2",
    "card_type": "time",
    "card_type_name": "时间卡",
    "duration": 24,
    "duration_unit": "hour",
    "duration_unit_name": "小时",
    "expire_at": "2026-05-17 10:30:00",
    "status": "已使用",
    "remaining_time": "18小时30分"
  }
}
成功响应(次数卡)
{
  "code": 200,
  "message": "卡密有效",
  "data": {
    "code": "Y7Z8A9B0C1D2E3F4",
    "card_type": "count",
    "card_type_name": "次数卡",
    "total_uses": 10,
    "used_count": 3,
    "remaining_count": 7
  }
}
成功响应(点数卡)
{
  "code": 200,
  "message": "卡密有效",
  "data": {
    "code": "Q1R2S3T4U5V6W7X8",
    "card_type": "point",
    "card_type_name": "点数卡",
    "total_points": 100,
    "points_per_use": 10,
    "used_points": 20,
    "remaining_points": 80
  }
}
200 验证成功 404 卡密不存在 400 卡密已过期
GET/POST /?action=use
使用卡密

验证并使用卡密,扣除相应的时间/次数/点数

请求参数
参数名类型必填说明
api_keystringAPI密钥
codestring要使用的卡密
请求示例
curl "https://yhs.ihuahui.win/?action=use&api_key=密钥&code=A1B2C3D4"
成功响应(天数卡)
{
  "code": 200,
  "message": "卡密使用成功",
  "data": {
    "code": "A1B2C3D4E5F6G7H8",
    "card_type": "time",
    "card_type_name": "时间卡",
    "duration": 30,
    "duration_unit": "day",
    "duration_unit_name": "天",
    "expire_at": "2026-06-15 10:30:00",
    "status": "已使用"
  }
}
成功响应(小时卡)
{
  "code": 200,
  "message": "卡密使用成功",
  "data": {
    "code": "I9J8K7L6M5N4O3P2",
    "card_type": "time",
    "card_type_name": "时间卡",
    "duration": 24,
    "duration_unit": "hour",
    "duration_unit_name": "小时",
    "expire_at": "2026-05-17 10:30:00",
    "status": "已使用",
    "remaining_time": "23小时59分"
  }
}
成功响应(次数卡)
{
  "code": 200,
  "message": "卡密使用成功",
  "data": {
    "code": "Y7Z8A9B0C1D2E3F4",
    "card_type": "count",
    "card_type_name": "次数卡",
    "total_uses": 10,
    "used_count": 4,
    "remaining_count": 6
  }
}
成功响应(点数卡)
{
  "code": 200,
  "message": "卡密使用成功",
  "data": {
    "code": "Q1R2S3T4U5V6W7X8",
    "card_type": "point",
    "card_type_name": "点数卡",
    "total_points": 100,
    "points_per_use": 10,
    "used_points": 10,
    "remaining_points": 90
  }
}
200 使用成功 404 卡密不存在 400 点数/次数已用完
GET /?action=query
查询卡密列表

查询卡密列表,支持按状态和类型筛选

请求参数
参数名类型必填说明
api_keystringAPI密钥
codestring模糊搜索卡密
statusint0-未使用,1-已使用
card_typestringtime/count/point
请求示例
// 查询所有卡密
curl "https://yhs.ihuahui.win/?action=query&api_key=密钥"

// 查询未使用的卡密
curl "https://yhs.ihuahui.win/?action=query&api_key=密钥&status=0&card_type=point"
200 查询成功 401 密钥无效
GET/POST /?action=delete
删除卡密
⚠️ 注意:删除操作是不可逆的,请谨慎操作!
请求参数
参数名类型必填说明
api_keystringAPI密钥
codestring要删除的卡密
请求示例
curl "https://yhs.ihuahui.win/?action=delete&api_key=密钥&code=A1B2C3D4"
200 删除成功 404 卡密不存在
GET/POST /?action=recharge
充值卡密

为已有的卡密增加时长、次数或点数

💡 充值说明:
  • 时间卡:增加时长(已使用的卡密会延长过期时间)
  • 次数卡:增加使用次数(status 会自动重置为 0)
  • 点数卡:增加点数(status 会自动重置为 0)
请求参数
参数名类型必填说明
api_keystringAPI密钥
codestring要充值的卡密
amountint充值数量(天数/次数/点数)
请求示例
// 充值天数卡(增加 30 天)
curl "https://yhs.ihuahui.win/?action=recharge&api_key=密钥&code=A1B2C3D4&amount=30"

// 充值小时卡(增加 24 小时)
curl "https://yhs.ihuahui.win/?action=recharge&api_key=密钥&code=A1B2C3D4&amount=24"

// 充值次数卡(增加 10 次)
curl "https://yhs.ihuahui.win/?action=recharge&api_key=密钥&code=A1B2C3D4&amount=10"

// 充值点数卡(增加 50 点)
curl "https://yhs.ihuahui.win/?action=recharge&api_key=密钥&code=A1B2C3D4&amount=50"
成功响应(天数卡)
{
  "code": 200,
  "message": "充值成功",
  "data": {
    "code": "A1B2C3D4E5F6G7H8",
    "card_type": "time",
    "card_type_name": "时间卡",
    "added_duration": 30,
    "duration_unit": "day",
    "duration_unit_name": "天",
    "expire_at": "2026-07-15 10:30:00",
    "status": "已使用"
  }
}
成功响应(小时卡)
{
  "code": 200,
  "message": "充值成功",
  "data": {
    "code": "I9J8K7L6M5N4O3P2",
    "card_type": "time",
    "card_type_name": "时间卡",
    "added_duration": 24,
    "duration_unit": "hour",
    "duration_unit_name": "小时",
    "expire_at": "2026-05-18 10:30:00",
    "status": "已使用",
    "remaining_time": "47小时59分"
  }
}
成功响应(次数卡)
{
  "code": 200,
  "message": "充值成功",
  "data": {
    "code": "Q1R2S3T4U5V6W7X8",
    "card_type": "count",
    "card_type_name": "次数卡",
    "added_uses": 10,
    "new_total_uses": 20,
    "used_count": 5,
    "remaining_count": 15
  }
}
成功响应(点数卡)
{
  "code": 200,
  "message": "充值成功",
  "data": {
    "code": "Z1Y2X3W4V5U6T7S8",
    "card_type": "point",
    "card_type_name": "点数卡",
    "added_points": 50,
    "new_total_points": 150,
    "points_per_use": 10,
    "used_points": 30,
    "remaining_points": 120
  }
}
200 充值成功 404 卡密不存在 400 参数错误