live-forum/server/webapi/LiveForum/LiveForum.Code/Base/ResponseCode.cs
2026-03-24 11:27:37 +08:00

73 lines
2.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Net.WebRequestMethods;
namespace LiveForum.Code.Base
{
/// <summary>
/// 0 - 成功
///1xx - 业务验证错误(如 101 签名错误)
///4xx - HTTP 标准客户端错误(400, 401, 403, 404)
///5xx - HTTP 标准服务器错误(500)
///1000-1099 - 用户认证相关错误 ✅
///1100-1199 - 帖子相关业务错误(可扩展)
///1200-1299 - 评论相关业务错误(可扩展)
///1300-1399 - 支付相关业务错误(可扩展)
/// </summary>
public enum ResponseCode
{
Success = 0,
/// <summary>
/// 验证错误
/// </summary>
SignError = 101,
/// <summary>
/// 参数错误
/// </summary>
ParamError = 400,
/// <summary>
/// 未提供 Token、Token 无效、Token 过期、签名错误、用户未认证等 ​​认证失败​​ 的情况
/// </summary>
Unauthorized = 401,
/// <summary>
/// 用户认证成功了Token 有效),但 ​​没有权限访问该资源​​(例如角色不对、权限不足)
/// </summary>
Forbidden = 403,
/// <summary>
/// 数据不存在
/// </summary>
NotFound = 404,
/// <summary>
/// 异常
/// </summary>
Error = 500,
// ========== 用户认证相关错误码 (1000-1099) ==========
/// <summary>
/// 用户未实名认证(需要完成实名认证才能操作)
/// </summary>
UserNotCertified = 1001,
/// <summary>
/// 用户认证审核中(认证申请正在审核,暂时无法操作)
/// </summary>
UserCertificationPending = 1002,
/// <summary>
/// 用户未激活CDK需要激活CDK才能进行互动操作
/// </summary>
CdkNotActivated = 1003,
// ========== 帖子相关业务错误码 (1100-1199) ==========
/// <summary>
/// 帖子已删除
/// </summary>
PostDeleted = 1101,
}
}