pikachu-be/src/models/admin/GameGift.js
2019-08-22 11:45:10 +08:00

69 lines
1.5 KiB
JavaScript

'use strict'
import mongoose from 'mongoose'
/**
* 奖品库
*/
const GameGiftSchema = new mongoose.Schema(
{
gift_id: {type: String},
gift_name: {type: String},
gift_url: {type: String},
codes: [{type: String}], // 兑换码
used_codes: [{type: String}], // 已使用兑换码
status: {type: Number, default: 0}, // 0-正常, 1-停用
deleted: {type: Boolean, default: false},
},
{
collection: 'game_gift',
timestamps: true,
}
)
/**
* 游戏礼品列表
*/
const GiftListSchema = new mongoose.Schema(
{
game_id: {type: String},
platform_id: {type: String, default: '6001'},
title: {type: String},
cond_name: {type: String}, // 兑换条件名称
condition: {type: Number}, // 兑换条件
list: [{type: String, ref: 'GameGift'}],
deleted: {type: Boolean, default: false},
},
{
collection: 'gift_list',
timestamps: true,
}
)
/**
* 兑换记录
*/
const GiftRecordSchema = new mongoose.Schema(
{
user_id: {type: String},
game_id: {type: String},
platform_id: {type: String},
gift_id: {type: String},
gift_info: {
gift_id: {type: String},
gift_name: {type: String},
gift_url: {type: String},
},
code: {type: String},
},
{
collection: 'gift_record',
timestamps: true,
}
)
const GameGift = mongoose.model('GameGift', GameGiftSchema)
const GiftList = mongoose.model('GiftList', GiftListSchema)
const GiftRecord = mongoose.model('GiftRecord', GiftRecordSchema)
export {GameGift, GiftList, GiftRecord}