3
This commit is contained in:
@@ -18,6 +18,8 @@
|
||||
|
||||
// 兼容旧命名(如有使用 API_APPLE_LOGIN 的位置,映射到统一命名)
|
||||
#define API_APPLE_LOGIN @"/user/appleLogin" // Apple 登录
|
||||
#define API_LOGOUT @"/user/logout" // 退出登录
|
||||
|
||||
|
||||
// 应用配置
|
||||
#ifndef KB_API_APP_CONFIG
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user