noticeQuery.js 309 B

123456789101112
  1. 'use strict';
  2. const _ = require('lodash');
  3. module.exports = options => {
  4. return async function noticequery(ctx, next) {
  5. const user_id = _.get(ctx.query, 'user_id');
  6. if (user_id) {
  7. ctx.query.receive = { $elemMatch: { user_id } };
  8. delete ctx.query.user_id;
  9. }
  10. await next();
  11. };
  12. };