1c4b986924
Co-authored-by: Cursor <cursoragent@cursor.com>
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import { Controller, Get } from '@nestjs/common';
|
|
import { parseMiniHomeBanners } from '@dukang/shared-types';
|
|
import { SystemConfigService } from '../../common/system-config/system-config.service';
|
|
|
|
@Controller('common')
|
|
export class ClientConfigController {
|
|
constructor(private readonly systemConfig: SystemConfigService) {}
|
|
|
|
@Get('client-config')
|
|
clientConfig() {
|
|
const cfg = this.systemConfig.getAppConfig();
|
|
const env = this.systemConfig.getMergedEnv();
|
|
const footer = (env.MINI_HOME_FOOTER_URL ?? '').trim();
|
|
const minClientVersion = (env.MINI_USER_MIN_VERSION ?? '').trim() || null;
|
|
return {
|
|
mockPay: cfg.mockPay,
|
|
wechatPayEnabled: cfg.wechatPayEnabled,
|
|
mockSms: cfg.mockSms,
|
|
mockWechat: cfg.mockWechat,
|
|
wxAuthorize: cfg.wxAuthorize,
|
|
/** 可选暴露;选点已改为服务端 /common/lbs,前端可不依赖此字段 */
|
|
tencentLbsKey: cfg.tencentLbsKey || undefined,
|
|
minClientVersion,
|
|
miniHome: {
|
|
banners: parseMiniHomeBanners(env.MINI_HOME_BANNERS),
|
|
footerUrl: footer || null,
|
|
},
|
|
};
|
|
}
|
|
}
|