open_profit.ts 980 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { CoolController, BaseController } from '@cool-midway/core';
  2. import {
  3. ALL,
  4. Body,
  5. Get,
  6. Inject,
  7. Param,
  8. Post,
  9. Provide,
  10. Query,
  11. } from '@midwayjs/decorator';
  12. import { Context } from '@midwayjs/koa';
  13. import {OpenPayeeService} from "../../service/admin/OpenPayee";
  14. import {OpenProfitEntity} from "../../entity/open_profit";
  15. import {openProfitService} from "../../service/admin/OpenProfit";
  16. /**
  17. * 收款人
  18. */
  19. @Provide()
  20. @CoolController({
  21. api: ['add', 'delete', 'update', 'info', 'page', 'list'],
  22. entity: OpenProfitEntity,
  23. service: openProfitService,
  24. pageQueryOp: {
  25. where: async (ctx: Context) => {
  26. const { merchant, roleIds } = ctx.admin;
  27. if (roleIds.includes(1) || roleIds.includes(3)) {
  28. return [['mch_id=:mch_id', { mch_id: merchant.mch_id }]];
  29. }
  30. return [];
  31. },
  32. },
  33. })
  34. export class openProfitController extends BaseController {
  35. @Inject()
  36. openProfitService: openProfitService;
  37. @Inject()
  38. ctx: Context;
  39. }