1234567891011121314151617181920 |
- 'use strict';
- const { CrudService } = require('naf-framework-mongoose-free/lib/service');
- const { BusinessError, ErrorCode } = require('naf-core').Error;
- const _ = require('lodash');
- const assert = require('assert');
- // 我的喜欢
- class LikesService extends CrudService {
- constructor(ctx) {
- super(ctx, 'likes');
- this.model = this.ctx.model.Likes;
- }
- async selikes({ user_id, video_id }) {
- const data = await this.model.findOne({ user_id, video_id });
- if (data) return { id: data._id, is: true };
- return { is: false };
- }
- }
- module.exports = LikesService;
|