123456789101112131415161718192021222324252627282930313233 |
- 'use strict';
- const { CrudService } = require('naf-framework-mongoose/lib/service');
- const { BusinessError, ErrorCode } = require('naf-core').Error;
- const { ObjectId } = require('mongoose').Types;
- const _ = require('lodash');
- const assert = require('assert');
- // 专利资讯服务聊天表
- class PatentchatService extends CrudService {
- constructor(ctx) {
- super(ctx, 'patentchat');
- this.model = this.ctx.model.Patent.Patentchat;
- }
- async query({ id }) {
- assert(id, '缺少用户信息');
- const data = await this.model.find({ $or: [{ sender_id: id }, { receiver_id: id }] }).sort({ 'meta.createdAt': -1 });
- return data;
- }
- async count({ id }) {
- assert(id, '缺少用户信息');
- const data = await this.model.count({ $or: [{ sender_id: id }, { receiver_id: id }] });
- return data;
- }
- async getChatList({ id }) {
- }
- }
- module.exports = PatentchatService;
|