managemoney.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. 'use strict';
  2. const _ = require('lodash');
  3. const meta = require('./.managemoney.js');
  4. const Controller = require('egg').Controller;
  5. const { CrudController } = require('naf-framework-mongoose/lib/controller');
  6. // 理财产品
  7. class ManageMoneyController extends Controller {
  8. constructor(ctx) {
  9. super(ctx);
  10. this.service = this.ctx.service.managemoney;
  11. }
  12. //修改前要请求的接口(判断是否是发布过的内容: 如果发布过 不可修改 ; 未发布 可修改)
  13. async orUpdate(){
  14. const res = await this.service.getOrUpdate(this.ctx.request.body);
  15. this.ctx.ok({ data: res });
  16. }
  17. //获取理财产品列表
  18. async mmoneyList(){
  19. const res = await this.service.getMoneyList(this.ctx.request.body);
  20. this.ctx.ok({ ...res });
  21. }
  22. //理财产品发布(0-未发布,1-发布)
  23. async publish(){
  24. const res = await this.service.makePublish(this.ctx.request.body);
  25. this.ctx.ok({ data: res });
  26. }
  27. }
  28. module.exports = CrudController(ManageMoneyController, meta);