compatible with v2

master
DIYgod 6 years ago
parent 40e172ce12
commit 802c24dde5
No known key found for this signature in database
GPG Key ID: EC0B76A252D3EF67
  1. 2
      routes/get.js
  2. 2
      routes/post.js
  3. 2
      utils/mongodb.js

@ -18,7 +18,7 @@ module.exports = async (ctx) => {
}
ctx.response.set('X-Koa-Redis', 'true');
} else {
data = await ctx.mongodb.find({ id }) || [];
data = await ctx.mongodb.find({ player: id }) || [];
ctx.redis.set(`danmaku${id}`, JSON.stringify(data));
if (limit) {
data = data.slice(-1 * parseInt(limit));

@ -4,7 +4,7 @@ module.exports = async (ctx) => {
const body = ctx.request.body;
const dan = new ctx.mongodb({
id: body.id,
player: body.id,
author: body.author,
time: body.time,
text: body.text,

@ -13,7 +13,7 @@ db.once('open', () => {
});
const danmakuSchema = new mongoose.Schema({
id: {
player: {
type: String,
index: true,
},

Loading…
Cancel
Save