只整理 api 相关的改动,用于和前端人员对接使用。
ErrorCode 枚举替代字符串错误码ValidationException、AuthorizationException、ResourceNotFoundException所有 API 错误响应现在遵循统一格式:
接口:
POST /withdraw_accounts/unbind: 用于执行提现账户的解绑操作。POST /withdraw_accounts/unbind_check: 新增接口,用于在解绑前预先检查是否满足条件。POST /withdraw_accounts/delete: 此路由已被移除。作用: 允许用户解绑已绑定的提现账户,并提供了预检查功能以提升用户体验。
请求参数 (unbind 和 unbind_check):
| 字段名 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
id | integer | 是 | 要操作的提现账户 ID |
unbind 和 unbind_check):| 错误码 | 名称 | 说明 |
|---|---|---|
| 50001 | UserWithdrawAccountStripeBalanceNotZero | Stripe 账户余额不为零 |
| 50002 | UserWithdrawAccountWalletBalanceNotZero | 钱包余额不为零 |
| 50003 | UserWithdrawAccountHasWorkTaskNotDone | 尚有未完成的工作任务 |
| 50004 | UserWithdrawStripeBalanceNotEnough | Stripe 账户余额不足 |
| 50005 | UserWithdrawAccountNotFound | 提现账户未找到 |
| 50007 | UserWithdrawAccountNotBound | 提现账户未绑定 |
code 和 message 的 JSON 响应。POST /withdraw_accounts/list| 字段名 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
currency_id | integer | 否 | 根据货币 ID 筛选 |
stripe_service_agreement | string | 否 | 根据 Stripe 服务协议类型筛选 (full, recipient) |
wallet 字段,包含了完整的关联钱包信息。POST /stripe/create_connect_account_link| 字段名 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
callback | string | 是 | 用户完成 Stripe 流程后重定向的 URL。 |
country | string | 是 | 用户所在的国家代码 (例如: US)。 |
service_agreement | string | 是 | Stripe 服务协议类型,可选值为 full 或 recipient。 |
callback, country, 和 service_agreement 进行验证。country 和 service_agreement 创建不同能力的 Stripe 账户。GET /stripe/stripe_dashboard_link| 字段名 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
withdraw_account_id | integer | 是 | 用户的提现账户 ID。 |
GET /stripe/create_connect_account_return| 字段名 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
account_id | string | 是 | Stripe Connect 账户的 ID。 |
callback | string | 是 | 用户在发起 create_connect_account_link 时提供的回调 URL。 |
account_id 查找对应的用户提现账户,并将其 bind_status 从 Pending 更新为 Successed。currency_id 和 stripe_email 字段。wallet_id 字段。POST /wallets/listwithdrawAccount 字段,包含了已成功绑定的提现账户信息。POST /wallet_withdraws/create| 字段名 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
amount | integer | 是 | 提现金额(最小单位,例如美分)。 |
withdraw_account_id | integer | 是 | 用户的提现账户 ID。 |
password | string | 是 | 用户密码,用于安全验证。 |
| 错误码 | 名称 | 说明 |
|---|---|---|
| 30003 | SystemUserPasswordError | 用户密码错误 |
| 50004 | UserWithdrawStripeBalanceNotEnough | 钱包余额不足 |
| 50005 | UserWithdrawAccountNotFound | 提现账户未找到 |
| 50009 | UserWithdrawWalletNotFound | 钱包未找到 |
| 50010 | UserWithdrawWalletNotOwned | 钱包不属于用户 |
stripe_connect_payoutPOST /wallet_withdraws/stripe_connect_payout| 字段名 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
withdraw_account_id | integer | 是 | 用户的提现账户 ID。 |
amount | integer | 是 | 提现金额(最小单位,例如美分)。 |
password | string | 是 | 用户密码,用于安全验证。 |
UserWithdrawStripeBalanceNotEnough (50004) 错误。stripe_connect_transferPOST /wallet_withdraws/stripe_connect_transfer| 字段名 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
withdraw_account_id | integer | 是 | 用户的提现账户 ID。 |
amount | integer | 是 | 转账金额(最小单位,例如美分)。 |
password | string | 是 | 用户密码,用于安全验证。 |
| 错误码 | 名称 | 说明 |
|---|---|---|
| 30003 | SystemUserPasswordError | 用户密码错误 |
| 50004 | UserWithdrawStripeBalanceNotEnough | 钱包余额不足 |
| 50005 | UserWithdrawAccountNotFound | 提现账户未找到 |
| 50006 | UserWithdrawAccountTypeInvalid | 提现账户类型必须为Stripe |
| 50007 | UserWithdrawAccountNotBound | 提现账户未绑定成功 |
| 50008 | UserWithdrawAccountServiceAgreementInvalid | Stripe服务协议必须为recipient |
| 50009 | UserWithdrawWalletNotFound | 钱包未找到 |
| 50010 | UserWithdrawWalletNotOwned | 钱包不属于用户 |
已废弃的独立接口:
POST /user/send_sign_up_code - 发送注册验证码 (已移除)POST /user/verify_sign_up_code - 验证注册验证码 (已移除)POST /user/send_forget_psw_code - 发送忘记密码验证码 (已移除)POST /user/verify_forget_psw_code - 验证忘记密码验证码 (已移除)POST /withdraw_accounts/send_email_code - 发送提现账户验证码 (已移除)POST /user/send_change_email_code - 发送修改邮箱验证码 (已移除)统一验证码接口:
POST /user/send_email_verify_code - 统一发送验证码接口POST /user/verify_email_verify_code - 统一验证验证码接口send_email_verify_code)POST /user/send_email_verify_code请求参数:
| 字段名 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
email | string | 是 | 邮箱地址,需符合email格式 |
type | string | 是 | 验证码类型,根据登录状态不同有不同可选值 |
type字段可选值:
sign_up (注册), forget_psw (忘记密码)manage_withdraw_account (管理提现账户), change_email_org (原邮箱验证), change_email_new (新邮箱验证)成功响应:
verify_email_verify_code)POST /user/verify_email_verify_code请求参数:
| 字段名 | 类型 | 是否必须 | 说明 |
|---|---|---|---|
email | string | 是 | 邮箱地址,需符合email格式 |
code | string | 是 | 6位数字验证码 |
type | string | 是 | 验证码类型(与发送时保持一致) |
type字段可选值:(与发送接口相同)
sign_up (注册), forget_psw (忘记密码)manage_withdraw_account (管理提现账户), change_email_org (原邮箱验证), change_email_new (新邮箱验证)成功响应:
注册流程:
POST /user/sign_up 中直接使用 EmailVerifyCodeService::use() 方法标记验证码为已使用密码重置流程:
POST /user/forget_psw_change 中直接使用 EmailVerifyCodeService::use() 方法标记验证码为已使用提现账户管理流程:
POST /withdraw_accounts/create 中先验证再使用:verify() → use()修改邮箱流程:
change_email_org)和新邮箱验证(change_email_new)POST /user/change_email 中直接验证和使用新邮箱验证码:verify() → use()发送验证码时的邮箱状态检查:
sign_up) 和 新邮箱验证码 (change_email_new): 检查邮箱是否已存在,存在则抛出 SystemEmailVerifyEmailExists 错误forget_psw): 检查邮箱是否存在,不存在则抛出 SystemEmailVerifyEmailNotFound 错误change_email_org) 和 提现账户验证码 (manage_withdraw_account): 无需邮箱状态检查修改邮箱接口优化 (POST /user/change_email):
EmailVerifyCodeServiceSENT → VERIFIED → USEDused_at 字段记录验证码使用时间| 错误码 | 名称 | 说明 |
|---|---|---|
| 30001 | SystemCaptchaError | 验证码错误 |
| 30004 | SystemEmailVerifyCodeNotFound | 验证码不存在 |
| 30005 | SystemEmailVerifyCodeExpired | 验证码已过期 |
| 30006 | SystemEmailSendError | 邮件发送失败 |
| 30007 | SystemEmailVerifyCodeAttemptsLimit | 验证尝试次数过多,请稍后再试 |
| 30008 | SystemEmailVerifyEmailExists | 邮箱已存在 |
| 30009 | SystemEmailVerifyEmailNotFound | 邮箱未找到 |
used_at 时间戳字段记录验证码使用时间idx_email_type_status: 复合索引用于查询特定状态的验证码idx_email_type_code: 复合索引用于验证码校验idx_expired_at: 单字段索引用于清理过期数据UserWithdrawAccount (用户提现账户)user_withdraw_accountsid: integer, 主键user_id: integer, 用户 IDtype: enum (UserWithdrawAccountType), 提现账户类型 (例如: Alipay, Stripe)bind_status: enum (UserWithdrawAccountStatus), 绑定状态 (例如: Successed, Pending, Unbound)currency_id: integer, 关联的货币 IDalipay_account: string, 支付宝账号 (如果 type 是 Alipay)alipay_name: string, 支付宝姓名 (如果 type 是 Alipay)stripe_connect_account_id: string, Stripe Connect 账户 ID (如果 type 是 Stripe)stripe_service_agreement: enum (UserWithdrawStripeServiceAgreement), Stripe 服务协议类型 (例如: Full, Recipient)stripe_email: string, Stripe 账户邮箱unbound_at: datetime, 解绑时间 (软删除时记录)deleted_at: datetime, 软删除时间stripe_balance: object, Stripe 账户余额信息 (通过 UserWithdrawAccount 模型中的 stripe_balance 属性获取)user(): 属于 User 模型 (多对一)currency(): 属于 Currency 模型 (多对一)wallet(): 属于 Wallet 模型 (多对一)Wallet (钱包)walletsid: integer, 主键user_id: integer, 用户 IDcurrency_id: integer, 关联的货币 IDbalance: decimal, 余额usage: enum (WalletUsage), 钱包用途deposit_type: enum (WalletDepositType), 存款类型stripe_connect_account_id: string, Stripe Connect 账户 ID (如果关联 Stripe)deleted_at: datetime, 软删除时间user(): 属于 User 模型 (多对一)currency(): 属于 Currency 模型 (多对一)transactions(): 拥有多个 WalletTransaction (一对多)withdrawAccounts(): 拥有多个 UserWithdrawAccount (一对多)withdrawAccount(): 拥有一个 UserWithdrawAccount (一对一,且 bind_status 为 Successed)Currency (货币)currenciesid: integer, 主键code: string, 货币代码 (例如: USD, CNY)symbol: string, 货币符号name: string, 货币名称is_zero_decimal: boolean, 是否是零小数货币 (例如: 日元)is_can_withdraw: boolean, 是否可提现货币is_default_withdraw: boolean, 是否默认提现货币UserWithdrawAccountType (用户提现账户类型)stringalipay: 支付宝stripe: StripeUserWithdrawAccountStatus (用户提现账户状态)stringpending: 待处理successed: 成功failed: 失败unbound: 已解绑UserWithdrawStripeServiceAgreement (用户提现 Stripe 服务协议)stringfull: 完整服务协议recipient: 收款人服务协议WalletUsage (钱包用途)stringdeposit: 艺术家收款钱包,用于提现credit: 用户礼品卡,仅用于支付抵扣plat_fee: 艺术家平台手续费,仅用于抵扣平台手续费WalletDepositType (钱包存款类型)stringalipay: 支付宝stripe_full: Stripe 完整服务协议stripe_recipient: Stripe 收款人服务协议ErrorCode (错误码)int| 错误码 | 名称 | 中文描述 |
|---|---|---|
| 10001 | ChatMessageNeedReceiverReturnMessage | 聊天消息需要接收者回复消息 |
| 10002 | ChatMessageUndoTimeLimit | 聊天消息撤回时间限制 |
| 20001 | WorkTaskHasPayingOrder | 工作任务有正在支付的订单 |
| 20002 | WorkTaskNoUnpaidStage | 工作任务没有未支付的阶段 |
| 30001 | SystemCaptchaError | 验证码错误 |
| 30002 | SystemError | 系统错误 |
| 30003 | SystemUserPasswordError | 用户密码错误 |
| 30004 | SystemEmailVerifyCodeNotFound | 验证码不存在 |
| 30005 | SystemEmailVerifyCodeExpired | 验证码已过期 |
| 30006 | SystemEmailSendError | 邮件发送失败 |
| 30007 | SystemEmailVerifyCodeAttemptsLimit | 验证尝试次数过多,请稍后再试 |
| 30008 | SystemEmailVerifyEmailExists | 邮箱已存在 |
| 30009 | SystemEmailVerifyEmailNotFound | 邮箱未找到 |
| 35001 | BusinessLogicError | 业务逻辑错误 |
| 40002 | GroupMessageUndoTimeLimit | 群组消息撤回时间限制 |
| 40003 | GroupReminderLimit | 群组提醒限制 |
| 40004 | GroupReminderExistInvalidUser | 群组提醒存在无效用户 |
| 50001 | UserWithdrawAccountStripeBalanceNotZero | Stripe账户余额不为零 |
| 50002 | UserWithdrawAccountWalletBalanceNotZero | 钱包余额不为零 |
| 50003 | UserWithdrawAccountHasWorkTaskNotDone | 尚有未完成的工作任务 |
| 50004 | UserWithdrawStripeBalanceNotEnough | 余额不足 |
| 50005 | UserWithdrawAccountNotFound | 提现账户未找到 |
| 50006 | UserWithdrawAccountTypeInvalid | 提现账户类型无效 |
| 50007 | UserWithdrawAccountNotBound | 提现账户未绑定 |
| 50008 | UserWithdrawAccountServiceAgreementInvalid | Stripe服务协议无效 |
| 50009 | UserWithdrawWalletNotFound | 钱包未找到 |
| 50010 | UserWithdrawWalletNotOwned | 钱包不属于用户 |