统一api

This commit is contained in:
2025-11-13 18:03:26 +08:00
parent a61b5fa2fd
commit 5ec950cc61
10 changed files with 30 additions and 2 deletions

View File

@@ -17,6 +17,7 @@
// 公共配置
#import "KBConfig.h"
#import "KBAPI.h" // 接口路径宏(统一管理)
#import "Masonry.h"
#import "KBHUD.h" // 复用 App 内的 HUD 封装
#import "KBLocalizationManager.h" // 复用多语言封装(可在扩展内使用)

21
Shared/KBAPI.h Normal file
View File

@@ -0,0 +1,21 @@
//
// KBAPI.h
// 统一管理所有接口路径的宏,避免在代码中散落硬编码字符串。
// 注意:这里的路径为相对 KB_BASE_URL 的“相对路径”,可带或不带开头的斜杠。
//
#ifndef KBAPI_h
#define KBAPI_h
// 用户与认证
#ifndef KB_API_USER_APPLE_LOGIN
#define API_APPLE_LOGIN @"/user/appleLogin" // Apple 登录
#endif
// 应用配置
#ifndef KB_API_APP_CONFIG
#define KB_API_APP_CONFIG @"app/config" // 获取 App 配置
#endif
#endif /* KBAPI_h */

View File

@@ -176,6 +176,7 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
04122F592EC5D40000EF7AB3 /* KBAPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBAPI.h; sourceTree = "<group>"; };
0459D1B22EBA284C00F2D189 /* KBSkinCenterVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBSkinCenterVC.h; sourceTree = "<group>"; };
0459D1B32EBA284C00F2D189 /* KBSkinCenterVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KBSkinCenterVC.m; sourceTree = "<group>"; };
0459D1B52EBA287900F2D189 /* KBSkinManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KBSkinManager.h; sourceTree = "<group>"; };
@@ -1146,6 +1147,7 @@
children = (
04A9FE1F2EB893F10020DB6D /* Localization */,
04FC98012EB36AAB007BD342 /* KBConfig.h */,
04122F592EC5D40000EF7AB3 /* KBAPI.h */,
A1B2C4002EB4A0A100000001 /* KBAuthManager.h */,
A1B2C4002EB4A0A100000002 /* KBAuthManager.m */,
A1B2C4232EB4B7A100000001 /* KBKeyboardPermissionManager.h */,

View File

@@ -176,7 +176,7 @@ static NSString * const kKBKeyboardExtensionBundleId = @"com.loveKey.nyx.CustomK
NSDictionary *params = @{
@"code": tokenString ?: @"",
};
[[KBNetworkManager shared] POST:@"/user/appleLogin" jsonBody:params headers:nil completion:^(id _Nullable jsonOrData, NSURLResponse * _Nullable response, NSError * _Nullable error) {
[[KBNetworkManager shared] POST:API_APPLE_LOGIN jsonBody:params headers:nil completion:^(id _Nullable jsonOrData, NSURLResponse * _Nullable response, NSError * _Nullable error) {
NSLog(@"=====");
}];

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 KiB

View File

@@ -1,6 +1,7 @@
{
"images" : [
{
"filename" : "AppIcon60x60@2x.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
@@ -12,6 +13,7 @@
"value" : "dark"
}
],
"filename" : "AppIcon60x60@2x 1.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
@@ -23,6 +25,7 @@
"value" : "tinted"
}
],
"filename" : "AppIcon60x60@2x 2.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"

View File

@@ -42,7 +42,7 @@
dispatch_async(dispatch_get_main_queue(), ^{ [self.textView becomeFirstResponder]; });
[[KBNetworkManager shared] GET:@"app/config" parameters:nil headers:nil completion:^(id _Nullable jsonOrData, NSURLResponse * _Nullable response, NSError * _Nullable error) {
[[KBNetworkManager shared] GET:KB_API_APP_CONFIG parameters:nil headers:nil completion:^(id _Nullable jsonOrData, NSURLResponse * _Nullable response, NSError * _Nullable error) {
NSLog(@"====");
}];
}

View File

@@ -17,6 +17,7 @@
#import <Masonry/Masonry.h>
// 公共配置
#import "KBConfig.h"
#import "KBAPI.h" // 接口路径宏(统一管理)
/// 系统
#import <UIKit/UIKit.h>