commons.js 1.23 KB
/*
 * @Author: huyue 
 * @Date: 2021-09-02 17:57:28 
 * @Last Modified by: huyue
 * @Last Modified time: 2021-09-10 15:20:28
 */

// app/controller/commons.js
const Controller = require('egg').Controller;

class commonsController extends Controller {
  constructor(ctx) {
    super(ctx);
    this.request = ctx.request;
    this.commonsService = ctx.service.commons;
    this.ServerResponseCode = ctx.response.ServerResponseCode;
    this.ServerResponse = ctx.response.ServerResponse;
  }
  
  async getList() {
    const query = this.ctx.query
    const result = await this.commonsService.findAll(query);
    this.ctx.body = this.ServerResponse.Success(result);
  }
  async create({ request: { body } }){
    const p = body
    const result = await this.commonsService.create(p)
    this.ctx.body = this.ServerResponse.Success(result)
  }
  // async update({ request: { body } }){
  //   const p = body
  //   const result = await this.commonsService.update(p)
  //   this.ctx.body = this.ServerResponse.Success(result)
  // }
  // async delete({ request: { body } }){
  //   const p = body
  //   const result = await this.commonsService.delete(p)
  //   this.ctx.body = this.ServerResponse.Success(result)
  // }

}

module.exports = commonsController;