📖
API 简介
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_key | string | 是 | - | API密钥 |
count | int | 否 | 1 | 生成数量 |
card_type | string | 否 | time | time/count/point |
duration | int | 否 | 30 | 时长/次数/点数 |
duration_unit | string | 否 | day | hour/day(仅时间卡) |
total_uses | int | 否 | 1 | 每次扣点数(点数卡) |
remark | string | 否 | - | 备注 |
请求示例
// 生成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_key | string | 是 | API密钥 |
code | string | 是 | 要验证的卡密 |
请求示例
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_key | string | 是 | API密钥 |
code | string | 是 | 要使用的卡密 |
请求示例
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_key | string | 是 | API密钥 |
code | string | 否 | 模糊搜索卡密 |
status | int | 否 | 0-未使用,1-已使用 |
card_type | string | 否 | time/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_key | string | 是 | API密钥 |
code | string | 是 | 要删除的卡密 |
请求示例
curl "https://yhs.ihuahui.win/?action=delete&api_key=密钥&code=A1B2C3D4"
200 删除成功
404 卡密不存在
GET/POST
/?action=recharge
充值卡密
为已有的卡密增加时长、次数或点数
💡 充值说明:
- 时间卡:增加时长(已使用的卡密会延长过期时间)
- 次数卡:增加使用次数(status 会自动重置为 0)
- 点数卡:增加点数(status 会自动重置为 0)
请求参数
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
api_key | string | 是 | API密钥 |
code | string | 是 | 要充值的卡密 |
amount | int | 是 | 充值数量(天数/次数/点数) |
请求示例
// 充值天数卡(增加 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 参数错误