This commit is contained in:
2025-12-03 13:31:02 +08:00
parent 27aa723e7d
commit b87998549c
11 changed files with 104 additions and 12 deletions

View File

@@ -18,6 +18,8 @@
// 兼容旧命名(如有使用 API_APPLE_LOGIN 的位置,映射到统一命名)
#define API_APPLE_LOGIN @"/user/appleLogin" // Apple 登录
#define API_LOGOUT @"/user/logout" // 退出登录
// 应用配置
#ifndef KB_API_APP_CONFIG

View File

@@ -14,6 +14,10 @@
#import <Foundation/Foundation.h>
#import "KBAPI.h" // 引入 SUCCESS_CODE/ERROR_CODE 等基础定义
#define KBMessage @"message"
#define KBCode @"code"
#define KBData @"data"
/// 服务端业务状态码(按项目实际调整)
typedef NS_ENUM(NSInteger, KBBizCode) {
/// 业务成功SUCCESS(0, "ok")
@@ -93,7 +97,7 @@ static inline NSInteger KBBizCodeFromJSONObject(id obj) {
static inline NSString *KBBizMessageFromJSONObject(id obj) {
if (![obj isKindOfClass:NSDictionary.class]) return nil;
NSDictionary *d = (NSDictionary *)obj;
NSString *msg = d[@"message"] ?: d[@"msg"] ?: d[@"error"];
NSString *msg = d[KBMessage] ?: d[@"msg"] ?: d[@"error"];
if (![msg isKindOfClass:NSString.class]) return nil;
return msg;
}