优化html参数

This commit is contained in:
cool 2024-02-01 10:59:40 +08:00
parent 4c9ae93d21
commit ac0b0f2740

View File

@ -49,10 +49,12 @@ export class BaseSysParamService extends BaseService {
* @param key * @param key
*/ */
async htmlByKey(key) { async htmlByKey(key) {
let html = '<html><body>@content</body></html>'; let html = '<html><title>@title</title><body>@content</body></html>';
let result: any = await this.cacheManager.get(`param:${key}`); let result: any = await this.cacheManager.get(`param:${key}`);
if (result) { if (result) {
html = html.replace('@content', result.data); html = html
.replace('@content', result.data)
.replace('@title', result.name);
} else { } else {
html = html.replace('@content', 'key notfound'); html = html.replace('@content', 'key notfound');
} }