wangzhibo
6 天以前 7dcc2997614f849258091f5d66e648317a40d323
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { Get, Inject, Provide, Query } from '@midwayjs/core';
import { CoolController, BaseController } from '@cool-midway/core';
import { BaseSysParamEntity } from '../../../entity/sys/param';
import { BaseSysParamService } from '../../../service/sys/param';
import { Context } from '@midwayjs/koa';
 
/**
 * 参数配置
 */
@Provide()
@CoolController({
  api: ['add', 'delete', 'update', 'info', 'page'],
  entity: BaseSysParamEntity,
  service: BaseSysParamService,
  pageQueryOp: {
    keyWordLikeFields: ['name', 'keyName'],
    fieldEq: ['dataType'],
  },
})
export class BaseSysParamController extends BaseController {
  @Inject()
  baseSysParamService: BaseSysParamService;
 
  @Inject()
  ctx: Context;
 
  /**
   * 根据配置参数key获得网页内容(富文本)
   */
  @Get('/html', { summary: '获得网页内容的参数值' })
  async htmlByKey(@Query('key') key: string) {
    this.ctx.body = await this.baseSysParamService.htmlByKey(key);
  }
 
   @Get('/stringbykey', { summary: '获得网页内容的参数值' })
  async stringByKey(@Query('key') key: string) {
    this.ctx.body = await this.baseSysParamService.getByKey(key);
  }
}