client_framework/docs/new_app_config_template.md
2026-03-26 10:39:39 +08:00

187 lines
6.3 KiB
Markdown
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.

# 新应用配置模板
创建新应用时,请填写以下配置信息。
***
## 一、应用基本信息
| 配置项 | 值 | 说明 |
| ------------- | ------------------ | ------------------- |
| 应用名称 | `填写应用名称` | 如FunyMee AI |
| Android 包名 | `填写 Android 包名` | 如com.funymeeai.app |
| iOS Bundle ID | `填写 iOS Bundle ID` | 如com.funymeeai.app |
| 应用 IDappId | `填写 appId` | 后台接口参数用 |
***
## 二、服务器配置
| 配置项 | 值 | 说明 |
| --------- | ------------- | ------------------------------- |
| 预发布环境 URL | `填写预发布环境 URL` | 如:<https://pre-api.example.com> |
| 生产环境 URL | `填写生产环境 URL` | 如:<https://api.example.com> |
| 代理接口路径 | `填写代理接口路径` | 如:/v1/proxy |
***
## 三、代理请求体字段配置
| 配置项 | 值 | 说明 |
| ------------------- | --------- | ----------------------------------------------------- |
| appId 明文 | `填写字段名` | 如hero\_class |
| 原始path | `填写字段名` | 如pet\_species |
| "POST"或"GET" | `填写字段名` | 如power\_level |
| 映射后的Header字段名构造JSON | `填写字段名` | 如quest\_rank |
| 映射后的URL参数字段名构造JSON | `填写字段名` | 如battle\_score |
| V2包装后的业务数据 | `填写字段名` | 如loyalty\_index |
| 噪音字段名列表 | `填写字段名列表` | 如:\['billing\_addr', 'utm\_term', 'cluster\_id', ...] |
***
## 四、V2 包装配置
| 配置项 | 值 | 说明 |
| ----------- | --------- | ---------------------------------------------------------- |
| V2 层级 | `填写字段名` | 如arsenal |
| V2 层级值 | `填写值` | 如4 |
| V2 层级路径 | `填写路径` | 如:\['vault', 'tome', 'codex', 'grimoire', 'sanctum'] |
| 噪音字段名列表 | `填写字段名列表` | 如:\['roar', 'clash', 'thunder', 'rumble', 'howl', 'growl'] |
***
## 五、安全配置
| 配置项 | 值 | 说明 |
| ------ | ---------------- | --------------- |
| AES 密钥 | `填写 16 字节 AES 密钥` | 用于请求加密AES-128 需要 16 字符 |
> **密钥长度说明**
> - AES-12816 字节16 个字符)
> - AES-25632 字节32 个字符)
>
> 当前框架使用 AES-128-ECB 模式,密钥固定为 16 字符。
***
## 六、Adjust SDK 配置
| 配置项 | 值 | 说明 |
| ----------- | ------------------------ | -------------------------- |
| App Token | `填写 Adjust App Token` | Adjust Dashboard 获取 |
| Environment | `sandbox` / `production` | 测试用 sandbox正式用 production |
### Adjust 事件 Token如有自定义
| 事件名称 | 事件 Token |
| --------- | ---------- |
| 首充 | `填写 token` |
| 购买 | `填写 token` |
| 注册 | `填写 token` |
| $5.99 档位 | `填写 token` |
| $9.99 档位 | `填写 token` |
| $19.99 档位 | `填写 token` |
| $49.99 档位 | `填写 token` |
| $99.99 档位 | `填写 token` |
***
## 七、Facebook SDK 配置
| 配置项 | 值 | 说明 |
| ------------ | -------------------- | ----------------------------- |
| App ID | `填写 Facebook App ID` | Facebook Developer Console 获取 |
| Client Token | `填写 Client Token` | Facebook Developer Console 获取 |
> MethodChannel 名称:框架自动使用 `{packageName}/facebook_sdk`,无需配置
***
## 八、字段映射配置(可选)
如有特殊字段映射需求请填写,默认使用框架默认映射。
| 原始字段名 | 映射后字段名 | 说明 |
| ------ | ------ | ------ |
| <br /> | <br /> | <br /> |
***
## 九、其他配置(如有)
| 配置项 | 值 | 说明 |
| ----------- | ----------- | ---------- |
| 调试基础 URL 覆盖 | `填写调试用 URL` | 仅调试时使用,可留空 |
| <br /> | <br /> | <br /> |
***
## 十、填写完成后的配置示例
```dart
// app_config.dart
class NewAppConfig extends AppConfig {
@override
String get appId => 'your_app_id';
@override
String get packageName => 'com.example.app';
@override
String get aesKey => 'your_16_char_key'; // AES-128 需要 16 字符
@override
String get preBaseUrl => 'https://pre-api.example.com';
@override
String get prodBaseUrl => 'https://api.example.com';
@override
String get proxyPath => '/v1/proxy';
@override
ProxyKeysConfig get proxyKeys => const ProxyKeysConfig(
appIdField: 'hero_class',
pathField: 'pet_species',
methodField: 'power_level',
headerField: 'quest_rank',
paramsField: 'battle_score',
bodyField: 'loyalty_index',
noiseKeys: ['billing_addr', 'utm_term', 'cluster_id', 'lsn_value', 'accuracy_val', 'dir_path'],
);
@override
String get v2LevelField => 'arsenal';
@override
int get v2LevelFixedValue => 4;
@override
List<String> get v2SanctumPath =>
const ['vault', 'tome', 'codex', 'grimoire', 'sanctum'];
@override
List<String> get v2NoiseKeys =>
const ['roar', 'clash', 'thunder', 'rumble', 'howl', 'growl'];
}
// main.dart
await AnalyticsService.init(
AnalyticsConfig(
packageName: 'com.example.app',
adjustConfig: AdjustConfig(
appToken: 'your_adjust_app_token',
environment: AdjustEnv.sandbox,
),
facebookConfig: FacebookConfig(
appId: 'your_facebook_app_id',
clientToken: 'your_facebook_client_token',
),
),
);
```
***
**填写完成后发送给我,我将根据此配置创建完整的应用代码。**