1234567891011121314151617181920212223242526272829303132333435363738394041 |
- 'use strict';
- const _ = require('lodash');
- const meta = require('./.group.js');
- const Controller = require('egg').Controller;
- const { CrudController } = require('naf-framework-mongoose/lib/controller');
- // 分组管理
- class GroupController extends Controller {
- constructor(ctx) {
- super(ctx);
- this.service = this.ctx.service.group;
- }
- async insert() {
- const res = await this.service.insert(this.ctx.request.body);
- this.ctx.ok({ msg: 'ok', data: res });
- }
- async exit() {
- const res = await this.service.exit(this.ctx.request.body);
- this.ctx.ok({ msg: 'ok', data: res });
- }
- async sethead() {
- const res = await this.service.sethead(this.ctx.request.body);
- this.ctx.ok({ msg: 'ok', data: res });
- }
- async findbystuid() {
- const res = await this.service.findbystuid(this.ctx.request.body);
- this.ctx.ok({ msg: 'ok', data: res });
- }
- async index() {
- const data = await this.service.query(this.ctx.query);
- this.ctx.ok({ ...data });
- }
- }
- module.exports = CrudController(GroupController, meta);
|