welcomeMessageController.js 588 B

1234567891011121314151617181920212223242526
  1. 'use strict';
  2. const Controller = require('../extend/baseController');
  3. class WelcomeMessageController extends Controller {
  4. tag() {
  5. return this.ctx.service.welcomeMessageService;
  6. }
  7. async listForPage() {
  8. const { ctx } = this;
  9. ctx.query.sort = { createTime: -1 };
  10. if (!ctx.query.searchtitle) {
  11. delete ctx.query.searchtitle;
  12. }else{
  13. ctx.query.title = ctx.query.searchtitle;
  14. delete ctx.query.searchtitle;
  15. }
  16. const result = await this.tag().listForPage(ctx.query);
  17. ctx.success(result);
  18. }
  19. }
  20. module.exports = WelcomeMessageController;