system · 应用配置
import { SystemDomain } from '@hfyidu/api/system'系统领域负责应用全局配置(应用信息、支付渠道配置)、底部导航栏(Tabbar)拉取,以及应用运行错误上报,服务前缀 system。
用例总览
| 用例 | 说明 | 请求方式 |
|---|---|---|
SystemDomain.cases.appSetting | 获取应用设置 | GET system/appSetting |
SystemDomain.cases.appTabbar | 获取应用底部导航栏 | GET system/appTabbar |
SystemDomain.cases.report | 上报应用运行错误 | POST system/reportAppLog |
appSetting · 获取应用设置
const { data } = await SystemDomain.cases.appSetting.run()
console.log(data) // SystemAppSettingDto请求参数 SystemAppSettingQueryParams
该用例的请求参数类型固定为 null,即不需要任何查询参数,调用时可不传参数(或传 null)。
响应 SystemAppSettingDto
SystemAppSettingDto(不可变,@Freeze)
| 字段 | 类型 | 后台原始字段 | 说明 |
|---|---|---|---|
appKey | string | app_key | 应用 Key,默认 '' |
appName | string | app_name | 应用名称,默认 '' |
appPackageName | string | app_package | 应用包名,默认 '' |
appVersionName | string | app_version | 应用版本号,默认 '1.0.0' |
appType | AppType | app_type | 应用类型,默认 AppType.QA |
appId | string | mini_app_id | 小程序 AppId,默认 '' |
appSecret | string | mini_app_secret | 小程序 AppSecret,默认 '' |
config | SystemAppSettingConfigDto | — | 应用扩展配置,默认新建一个 SystemAppSettingConfigDto 实例 |
domains | string | call_domain | 请求域名列表的 JSON 字符串,默认 '' |
requestDomains | any(getter) | — | 对 domains 做 JSON.parse 后的运行时求值属性,非后台原始字段 |
SystemAppSettingConfigDto(不可变,@Freeze)
| 字段 | 类型 | 后台原始字段 | 说明 |
|---|---|---|---|
appName | string | name | 应用展示名称,默认 '' |
customerUrl | string | customer_url | 客服链接,默认 '' |
customerDouyin | string | customer_dy | 抖音客服号,默认 '0' |
customerWechat | string | null | customer_wechat | 微信客服号,默认 null |
customerQQ | string | null | customer_qq | QQ 客服号,默认 null |
customerPhone | string | null | customer_phone | 客服电话,默认 null |
payOriginalType | number | pay_original_type | 原生支付类型标识,默认 1 |
workingTime | string | working_time | 客服工作时间,默认 '' |
workType | string | work_type | 工作类型,默认 '' |
arpu | number | ad_close_arpu | 关闭广告的 ARPU 阈值,默认 0 |
payType | SystemAppSettingConfigPayTypeDto[] | quickappAssignPay | 快应用指定支付渠道列表,默认 [] |
mpPayType | SystemAppSettingConfigMpPayTypeDto[] | wechatMiniAssignPay | 微信小程序指定支付渠道列表,默认 [] |
wechatOaPayType | SystemAppSettingConfigWechatOaPayTypeDto[] | wechatOaAssignPay | 微信公众号指定支付渠道列表,默认 [] |
h5PayList | SystemAppSettingConfigH5PayListDto[] | h5AssignPay | H5 指定支付渠道列表,默认 [] |
servicesImage | string | services_image | 客服图片,默认 '' |
readListAdGaps | number | ad_section_num | 小说滑动翻页时插入广告的段数,默认 10 |
readAdGaps | number | pre_read_ad_gaps | 预留可配置字段:阅读间隔广告段数,默认 3 |
readAdCount | number | pre_read_ad_count | 预留可配置字段:阅读广告次数,默认 0 |
adDwellTime | number | pre_ad_dwell_time | 广告停留时间(秒),默认 3 |
payChannel | string | pay_channel | 支付渠道标识,默认 'mhpay' |
以下 4 个支付渠道子 DTO(payType / mpPayType / wechatOaPayType / h5PayList)字段结构完全一致,仅默认值不同,统一说明如下。其中 payType 字段与 payProvider 字段均引用 @hfyidu/api/order 领域(PayType、PayProvider)导出的枚举类型,非 system 领域自有类型,具体成员定义请查阅 order 领域文档。
SystemAppSettingConfigPayTypeDto(不可变,@Freeze,对应 quickappAssignPay)
| 字段 | 类型 | 后台原始字段 | 说明 |
|---|---|---|---|
type | number | assign_pay | 指定支付类型数值,默认 1 |
payType | PayType | assign_pay | 指定支付类型枚举,默认 PayType.MH_WX |
provider | string | platform | 支付平台代码,默认 'other' |
payProvider | PayProvider | platform | 支付平台枚举,默认 PayProvider.unknown |
status | number | — | 状态标记,默认 0 |
SystemAppSettingConfigMpPayTypeDto(不可变,@Freeze,对应 wechatMiniAssignPay)
| 字段 | 类型 | 后台原始字段 | 说明 |
|---|---|---|---|
type | number | assign_pay | 指定支付类型数值,默认 1 |
payType | PayType | assign_pay | 指定支付类型枚举,默认 PayType.MH_MP |
provider | string | platform | 支付平台代码,默认 'mhpay' |
payProvider | PayProvider | platform | 支付平台枚举,默认 PayProvider.mhpay |
status | number | — | 状态标记,默认 0 |
SystemAppSettingConfigWechatOaPayTypeDto(不可变,@Freeze,对应 wechatOaAssignPay)
| 字段 | 类型 | 后台原始字段 | 说明 |
|---|---|---|---|
type | number | assign_pay | 指定支付类型数值,默认 1 |
payType | PayType | assign_pay | 指定支付类型枚举,默认 PayType.MH_JSAPI |
provider | string | platform | 支付平台代码,默认 'mhpay' |
payProvider | PayProvider | platform | 支付平台枚举,默认 PayProvider.mhpay |
status | number | — | 状态标记,默认 0 |
SystemAppSettingConfigH5PayListDto(不可变,@Freeze,对应 h5AssignPay)
| 字段 | 类型 | 后台原始字段 | 说明 |
|---|---|---|---|
type | number | assign_pay | 指定支付类型数值,默认 1 |
payType | PayType | assign_pay | 指定支付类型枚举,默认 PayType.MH_WX |
provider | string | platform | 支付平台代码,默认 'mhpay' |
payProvider | PayProvider | platform | 支付平台枚举,默认 PayProvider.mhpay |
status | number | — | 状态标记,默认 0 |
appTabbar · 获取应用底部导航栏
const { data } = await SystemDomain.cases.appTabbar.run({
provider_code: 'wxapp',
})
console.log(data) // SystemAppTabbarDto[]请求参数 SystemAppTabbarQueryParams
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
provider_code | string | 否 | 广告/渠道平台代码 |
响应 SystemAppTabbarDto[]
SystemAppTabbarDto(支持 @List,即 SystemAppTabbarDto.toList 批量转换)
| 字段 | 类型 | 后台原始字段 | 说明 |
|---|---|---|---|
name | string | pagePath | 导航项标识(与 pagePath 同源),默认 '' |
title | string | text | 导航项标题(与 text 同源),默认 '' |
icon | string | — | 图标,默认 '' |
iconPath | string | — | 未选中态图标路径,默认 '' |
selectedIconPath | string | — | 选中态图标路径,默认 '' |
pagePath | string | — | 页面路径,默认 '' |
text | string | — | 文案,默认 '' |
pageParams | string | — | 页面参数(JSON 字符串),默认 '{}' |
render | boolean | — | 是否渲染,运行时状态字段,默认 false |
active | boolean | — | 是否激活,运行时状态字段,默认 false |
sort | number | — | 排序值,默认 0 |
value | number | sort | 与 sort 同源的唯一标识值,默认 0 |
report · 上报应用运行错误
await SystemDomain.cases.report.run({
title: '页面渲染异常',
content: { stack: 'Error: xxx' },
level: 'error',
})请求参数 SystemReportBodyParams
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
title | any | 否 | 上报标题 |
content | any | 否 | 上报内容详情 |
level | 'warn' | 'error' | 是 | 上报级别 |
响应
无格式化 DTO,直接透传后台原始返回(any)。
枚举
AppType 应用类型
| 枚举成员 | value | code | 说明 |
|---|---|---|---|
H5 | 0 | H5 | 网页端 |
WXGZH | 1 | WechatOa | 微信公众号网页 |
WXAPP | 2 | WechatApp | 微信小程序 |
QA | 3 | QuickApp | 快应用 |
Android | 4 | Android | 安卓 APP |
IOS | 5 | IOS | 苹果 APP |
DouyinApp | 6 | DouyinApp | 抖音小程序 |
KuaishouApp | 7 | KuaishouApp | 快手小程序 |
TabbarItem 导航项类型
该类型定义在 enum/tabbar_type.ts 中,实际是一个纯 TypeScript 接口(interface),并非继承 BaseEnumeration 的业务枚举,这里为保持目录归属完整性一并收录。它描述了单个 Tabbar 导航项的完整字段形态,与 SystemAppTabbarDto 字段基本一一对应,可用于业务侧自定义 Tabbar 状态管理时的类型标注。
| 字段 | 类型 | 说明 |
|---|---|---|
name | string | 导航项标识 |
value | number | null | 排序/唯一标识值 |
active | boolean | 是否激活 |
title | string | 导航项标题 |
icon | string | 图标 |
pagePath | string | 页面路径 |
iconPath | string | 未选中态图标路径 |
selectedIconPath | string | 选中态图标路径 |
text | string | 文案 |
sort | number | 排序值 |
render | boolean | 是否渲染 |