12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- 'use strict';
- const Controller = require('egg').Controller;
- // 用户基础信息统计分析管理
- class UserInfoController extends Controller {
- constructor(ctx) {
- super(ctx);
- // 特殊的入参校验可以重写在这,默认可以使用commonRule
- this.createRule = {
- user_id: { type: 'string' },
- };
- this.createListRule = {
- pageNumber: { type: 'number', min: 0, required: false },
- pageSize: { type: 'number', min: 0, required: false },
- };
- }
- // 用户基础信息查询
- async list() {
- const { ctx, service } = this;
- const payload = ctx.validate(this.createListRule);
- const data = await service.userInfoService.list(payload);
- // // 设置响应内容和响应状态码
- ctx.success({ data });
- }
- // 单查用户信息
- async index() {
- const { ctx, service } = this;
- const payload = ctx.validate(this.createRule);
- const data = await service.userInfoService.index(payload);
- // // 设置响应内容和响应状态码
- ctx.success({ data });
- }
- }
- module.exports = UserInfoController;
|