chore(docs): remove outdated backend documentation files
This commit is contained in:
@@ -1,135 +0,0 @@
|
||||
{
|
||||
"code": 200,
|
||||
"message": "success",
|
||||
"success": true,
|
||||
"data": {
|
||||
"isFirstRecharge": true,
|
||||
"firstRechargeOffer": {
|
||||
"enabled": true,
|
||||
"type": "first_recharge_half_price",
|
||||
"discountPercent": 50
|
||||
},
|
||||
"plans": [
|
||||
{
|
||||
"planId": "vip_monthly",
|
||||
"planName": "月度会员",
|
||||
"orderType": "vip_monthly",
|
||||
"vipDays": 30,
|
||||
"dolAmount": null,
|
||||
"creditBalance": 3000,
|
||||
"amountCents": 995,
|
||||
"originalAmountCents": 1990,
|
||||
"dailyPriceCents": 33,
|
||||
"currency": "USD",
|
||||
"isFirstRechargeOffer": true,
|
||||
"firstRechargeDiscountPercent": 50,
|
||||
"promotionType": "first_recharge_half_price"
|
||||
},
|
||||
{
|
||||
"planId": "vip_quarterly",
|
||||
"planName": "季度会员",
|
||||
"orderType": "vip_quarterly",
|
||||
"vipDays": 90,
|
||||
"dolAmount": null,
|
||||
"creditBalance": 9000,
|
||||
"amountCents": 2495,
|
||||
"originalAmountCents": 4990,
|
||||
"dailyPriceCents": 27,
|
||||
"currency": "USD",
|
||||
"isFirstRechargeOffer": true,
|
||||
"firstRechargeDiscountPercent": 50,
|
||||
"promotionType": "first_recharge_half_price"
|
||||
},
|
||||
{
|
||||
"planId": "vip_annual",
|
||||
"planName": "年度会员",
|
||||
"orderType": "vip_annual",
|
||||
"vipDays": 365,
|
||||
"dolAmount": null,
|
||||
"creditBalance": 36000,
|
||||
"amountCents": 8995,
|
||||
"originalAmountCents": 17990,
|
||||
"dailyPriceCents": 24,
|
||||
"currency": "USD",
|
||||
"isFirstRechargeOffer": true,
|
||||
"firstRechargeDiscountPercent": 50,
|
||||
"promotionType": "first_recharge_half_price"
|
||||
},
|
||||
{
|
||||
"planId": "dol_1000",
|
||||
"planName": "1,000 Credits",
|
||||
"orderType": "dol",
|
||||
"vipDays": null,
|
||||
"dolAmount": 1000,
|
||||
"creditBalance": 1000,
|
||||
"amountCents": 495,
|
||||
"originalAmountCents": 990,
|
||||
"dailyPriceCents": null,
|
||||
"currency": "USD",
|
||||
"isFirstRechargeOffer": true,
|
||||
"firstRechargeDiscountPercent": 50,
|
||||
"promotionType": "first_recharge_half_price"
|
||||
},
|
||||
{
|
||||
"planId": "dol_2000",
|
||||
"planName": "2,000 Credits",
|
||||
"orderType": "dol",
|
||||
"vipDays": null,
|
||||
"dolAmount": 2000,
|
||||
"creditBalance": 2000,
|
||||
"amountCents": 845,
|
||||
"originalAmountCents": 1690,
|
||||
"dailyPriceCents": null,
|
||||
"currency": "USD",
|
||||
"isFirstRechargeOffer": true,
|
||||
"firstRechargeDiscountPercent": 50,
|
||||
"promotionType": "first_recharge_half_price"
|
||||
},
|
||||
{
|
||||
"planId": "dol_3000",
|
||||
"planName": "3,000 Credits",
|
||||
"orderType": "dol",
|
||||
"vipDays": null,
|
||||
"dolAmount": 3000,
|
||||
"creditBalance": 3000,
|
||||
"amountCents": 1145,
|
||||
"originalAmountCents": 2290,
|
||||
"dailyPriceCents": null,
|
||||
"currency": "USD",
|
||||
"isFirstRechargeOffer": true,
|
||||
"firstRechargeDiscountPercent": 50,
|
||||
"promotionType": "first_recharge_half_price"
|
||||
},
|
||||
{
|
||||
"planId": "dol_5000",
|
||||
"planName": "5,000 Credits",
|
||||
"orderType": "dol",
|
||||
"vipDays": null,
|
||||
"dolAmount": 5000,
|
||||
"creditBalance": 5000,
|
||||
"amountCents": 1745,
|
||||
"originalAmountCents": 3490,
|
||||
"dailyPriceCents": null,
|
||||
"currency": "USD",
|
||||
"isFirstRechargeOffer": true,
|
||||
"firstRechargeDiscountPercent": 50,
|
||||
"promotionType": "first_recharge_half_price"
|
||||
},
|
||||
{
|
||||
"planId": "dol_10000",
|
||||
"planName": "10,000 Credits",
|
||||
"orderType": "dol",
|
||||
"vipDays": null,
|
||||
"dolAmount": 10000,
|
||||
"creditBalance": 10000,
|
||||
"amountCents": 3245,
|
||||
"originalAmountCents": 6490,
|
||||
"dailyPriceCents": null,
|
||||
"currency": "USD",
|
||||
"isFirstRechargeOffer": true,
|
||||
"firstRechargeDiscountPercent": 50,
|
||||
"promotionType": "first_recharge_half_price"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
有更新,主要是 /api/payment/plans。
|
||||
前端判断方式:
|
||||
调用:
|
||||
GET /api/payment/plans
|
||||
如果用户已登录,请带上:
|
||||
Authorization: Bearer <token>
|
||||
后端会返回:
|
||||
{
|
||||
"isFirstRecharge": true,
|
||||
"firstRechargeOffer": {
|
||||
"enabled": true,
|
||||
"type": "first_recharge_half_price",
|
||||
"discountPercent": 50
|
||||
},
|
||||
"plans": [
|
||||
{
|
||||
"planId": "vip_monthly",
|
||||
"amountCents": 995,
|
||||
"originalAmountCents": 1990,
|
||||
"isFirstRechargeOffer": true,
|
||||
"firstRechargeDiscountPercent": 50,
|
||||
"promotionType": "first_recharge_half_price"
|
||||
}
|
||||
]
|
||||
}
|
||||
前端逻辑很简单:
|
||||
data.isFirstRecharge === true 或 plan.isFirstRechargeOffer === true:展示首充价
|
||||
amountCents:实际支付价,也就是首充半价
|
||||
originalAmountCents:划线原价
|
||||
firstRechargeDiscountPercent:折扣,比如 50
|
||||
不需要前端自己算半价
|
||||
创建订单还是原接口:
|
||||
POST /api/payment/create-order
|
||||
前端只传原来的 planId/payChannel/autoRenew,不用传首充字段。后端会重新判断首充资格,并按半价创建订单,防止前端伪造价格。
|
||||
@@ -1,144 +0,0 @@
|
||||
告诉前端这次只改了 GET /api/user/profile 的响应,新增每日免费额度信息,原有字段不变。
|
||||
接口:GET https://api.cozsweet.com/api/user/profile
|
||||
新增字段:
|
||||
{
|
||||
"dailyFreeChatLimit": 10,
|
||||
"dailyFreeChatUsed": 0,
|
||||
"dailyFreeChatRemaining": 10,
|
||||
"dailyFreePrivateLimit": 0,
|
||||
"dailyFreePrivateUsed": 0,
|
||||
"dailyFreePrivateRemaining": 0,
|
||||
"dailyQuotas": {
|
||||
"chat": {
|
||||
"limit": 10,
|
||||
"used": 0,
|
||||
"remaining": 10
|
||||
},
|
||||
"privateMessage": {
|
||||
"limit": 0,
|
||||
"used": 0,
|
||||
"remaining": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
含义:
|
||||
dailyFreeChatLimit:今天免费聊天总次数
|
||||
dailyFreeChatUsed:今天已用免费聊天次数
|
||||
dailyFreeChatRemaining:今天剩余免费聊天次数
|
||||
dailyFreePrivateLimit:今天免费私密消息总次数
|
||||
dailyFreePrivateUsed:今天已用免费私密消息次数
|
||||
dailyFreePrivateRemaining:今天剩余免费私密消息次数
|
||||
dailyQuotas:同样数据的结构化版本,前端想用对象也可以直接用它
|
||||
当前额度规则:
|
||||
游客/未注册:聊天 10,私密 0
|
||||
注册用户:聊天 30,私密 2
|
||||
注意:
|
||||
聊天优先消耗 dailyFreeChatRemaining
|
||||
私密消息优先消耗 dailyFreePrivateRemaining
|
||||
聊天剩余为 0 时,前端应阻止继续聊天或展示后端返回的额度用完提示
|
||||
私密剩余为 0 时,前端不要展示私密内容,按锁定私密消息处理。
|
||||
16:19
|
||||
profile完整字段发给前端
|
||||
16:20
|
||||
发给前端这版:
|
||||
GET https://api.cozsweet.com/api/user/profile
|
||||
Authorization: Bearer <token>
|
||||
完整响应结构:
|
||||
interface ProfileResponse {
|
||||
code: number;
|
||||
message: string;
|
||||
success: boolean;
|
||||
data: UserProfile;
|
||||
}
|
||||
|
||||
interface UserProfile {
|
||||
id: string;
|
||||
username: string;
|
||||
email: string | null;
|
||||
platform: string;
|
||||
|
||||
intimacy: number;
|
||||
dolBalance: number;
|
||||
creditBalance: number;
|
||||
|
||||
isTestAccount: boolean;
|
||||
|
||||
personalityTraits: Record<string, number> | null;
|
||||
preferredLanguage: string | null;
|
||||
|
||||
createdAt: string | null;
|
||||
lastMessageAt: string | null;
|
||||
|
||||
country: string | null;
|
||||
countryCode: string | null;
|
||||
|
||||
dailyFreeChatLimit: number;
|
||||
dailyFreeChatUsed: number;
|
||||
dailyFreeChatRemaining: number;
|
||||
|
||||
dailyFreePrivateLimit: number;
|
||||
dailyFreePrivateUsed: number;
|
||||
dailyFreePrivateRemaining: number;
|
||||
|
||||
dailyQuotas: {
|
||||
chat: {
|
||||
limit: number;
|
||||
used: number;
|
||||
remaining: number;
|
||||
};
|
||||
privateMessage: {
|
||||
limit: number;
|
||||
used: number;
|
||||
remaining: number;
|
||||
};
|
||||
};
|
||||
}
|
||||
示例:
|
||||
{
|
||||
"code": 200,
|
||||
"message": "success",
|
||||
"success": true,
|
||||
"data": {
|
||||
"id": "user-id",
|
||||
"username": "guest_codex",
|
||||
"email": "device_xxx@guest.local",
|
||||
"platform": "web",
|
||||
"intimacy": 0,
|
||||
"dolBalance": 0,
|
||||
"creditBalance": 0,
|
||||
"isTestAccount": false,
|
||||
"personalityTraits": {
|
||||
"caring": 0.5,
|
||||
"playful": 0.5,
|
||||
"serious": 0.5,
|
||||
"cheerful": 0.5,
|
||||
"romantic": 0.5
|
||||
},
|
||||
"preferredLanguage": "ja",
|
||||
"createdAt": "2026-07-03T16:12:01.591264+08:00",
|
||||
"lastMessageAt": null,
|
||||
"country": "Japan",
|
||||
"countryCode": "JP",
|
||||
"dailyFreeChatLimit": 10,
|
||||
"dailyFreeChatUsed": 0,
|
||||
"dailyFreeChatRemaining": 10,
|
||||
"dailyFreePrivateLimit": 0,
|
||||
"dailyFreePrivateUsed": 0,
|
||||
"dailyFreePrivateRemaining": 0,
|
||||
"dailyQuotas": {
|
||||
"chat": {
|
||||
"limit": 10,
|
||||
"used": 0,
|
||||
"remaining": 10
|
||||
},
|
||||
"privateMessage": {
|
||||
"limit": 0,
|
||||
"used": 0,
|
||||
"remaining": 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
额度规则:
|
||||
游客:dailyFreeChatLimit = 10,dailyFreePrivateLimit = 0
|
||||
注册用户:dailyFreeChatLimit = 30,dailyFreePrivateLimit = 2
|
||||
@@ -1,53 +0,0 @@
|
||||
这次新增/补齐的主要是这些字段,都是给前端判断“能不能继续发、当前内容锁不锁、扣了多少积分”用的。
|
||||
{
|
||||
"canSendMessage": false,
|
||||
"cannotSendReason": "insufficient_credits",
|
||||
"creditBalance": 0,
|
||||
"creditsCharged": 0,
|
||||
"requiredCredits": 2,
|
||||
"shortfallCredits": 2
|
||||
}
|
||||
字段含义
|
||||
canSendMessage
|
||||
用户是否还能继续发普通聊天消息。
|
||||
如果是 false,前端应该禁用输入框/发送按钮,提示充值。
|
||||
cannotSendReason
|
||||
不能继续发送消息的原因。
|
||||
目前主要是:
|
||||
insufficient_credits
|
||||
表示免费聊天次数用完,并且积分也不够继续发消息。
|
||||
creditBalance
|
||||
本次接口处理后的用户积分余额。
|
||||
比如原来 100,发了一条会员普通消息扣 2,这里返回 98。
|
||||
creditsCharged
|
||||
本次实际扣掉的积分。
|
||||
例如:
|
||||
普通聊天扣 2
|
||||
照片扣 40
|
||||
语音消息扣 20
|
||||
私密消息扣 10
|
||||
没有扣费就是 0
|
||||
requiredCredits
|
||||
本次动作理论上需要多少积分。
|
||||
比如用户想看照片,需要 40,就返回 40。
|
||||
如果免费额度内,通常是 0。
|
||||
shortfallCredits
|
||||
用户还差多少积分。
|
||||
比如照片需要 40,用户只有 15,则:
|
||||
{
|
||||
"requiredCredits": 40,
|
||||
"creditBalance": 15,
|
||||
"shortfallCredits": 25
|
||||
}
|
||||
和旧字段的关系
|
||||
blocked
|
||||
当前这条回复/内容是否被锁住。比如照片、语音、私密消息积分不够时是 true。
|
||||
blockReason
|
||||
当前内容被锁的原因,比如:
|
||||
insufficient_credits
|
||||
image_paywall
|
||||
voice_message
|
||||
private_message
|
||||
lockDetail
|
||||
给前端展示锁定卡片/充值提示的详细信息。
|
||||
里面也会带 requiredCredits/currentCredits/shortfallCredits,方便前端直接渲染弹窗。
|
||||
@@ -1,32 +0,0 @@
|
||||
用途:解锁某一条历史里的付费/私密消息。
|
||||
请求体:
|
||||
{
|
||||
"messageId": "消息ID"
|
||||
}
|
||||
需要带登录 token:
|
||||
Authorization: Bearer <token>
|
||||
Content-Type: application/json
|
||||
返回示例:
|
||||
{
|
||||
"code": 200,
|
||||
"message": "success",
|
||||
"success": true,
|
||||
"data": {
|
||||
"unlocked": true,
|
||||
"content": "完整消息内容",
|
||||
"reason": "ok",
|
||||
"creditBalance": 9180,
|
||||
"creditsCharged": 10,
|
||||
"requiredCredits": 10,
|
||||
"shortfallCredits": 0,
|
||||
"lockDetail": {
|
||||
"locked": false,
|
||||
"showContent": true,
|
||||
"showUpgrade": false,
|
||||
"reason": null,
|
||||
"hint": null,
|
||||
"detail": null
|
||||
}
|
||||
}
|
||||
}
|
||||
如果积分不够,会返回 unlocked:false,并带 requiredCredits / shortfallCredits / creditBalance。
|
||||
Reference in New Issue
Block a user