fix: 退款三修复——coins按金额×100兜底旧订单、调微信xpay/refund_order真实退钱、AdminLog枚举补refund/adjust
This commit is contained in:
@@ -1,54 +1,54 @@
|
||||
const mongoose = require('mongoose')
|
||||
const { Schema } = mongoose
|
||||
|
||||
/**
|
||||
* 管理员操作日志模型
|
||||
*/
|
||||
const AdminLogSchema = new Schema({
|
||||
// 管理员信息
|
||||
adminId: {
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: 'Admin',
|
||||
required: true,
|
||||
index: true
|
||||
},
|
||||
adminName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
|
||||
// 操作信息
|
||||
action: {
|
||||
type: String,
|
||||
required: true,
|
||||
enum: ['login', 'create', 'read', 'update', 'delete', 'review', 'export']
|
||||
},
|
||||
resource: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
resourceId: String,
|
||||
|
||||
// 详细信息
|
||||
details: Schema.Types.Mixed,
|
||||
|
||||
// IP 地址
|
||||
ip: String,
|
||||
userAgent: String,
|
||||
|
||||
// 时间戳
|
||||
timestamp: {
|
||||
type: Date,
|
||||
default: Date.now,
|
||||
index: true
|
||||
}
|
||||
}, {
|
||||
timestamps: false
|
||||
})
|
||||
|
||||
// 索引
|
||||
AdminLogSchema.index({ adminId: 1, timestamp: -1 })
|
||||
AdminLogSchema.index({ resource: 1, timestamp: -1 })
|
||||
AdminLogSchema.index({ action: 1 })
|
||||
|
||||
module.exports = mongoose.model('AdminLog', AdminLogSchema)
|
||||
const mongoose = require('mongoose')
|
||||
const { Schema } = mongoose
|
||||
|
||||
/**
|
||||
* 管理员操作日志模型
|
||||
*/
|
||||
const AdminLogSchema = new Schema({
|
||||
// 管理员信息
|
||||
adminId: {
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: 'Admin',
|
||||
required: true,
|
||||
index: true
|
||||
},
|
||||
adminName: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
|
||||
// 操作信息
|
||||
action: {
|
||||
type: String,
|
||||
required: true,
|
||||
enum: ['login', 'create', 'read', 'update', 'delete', 'review', 'export', 'refund', 'adjust']
|
||||
},
|
||||
resource: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
resourceId: String,
|
||||
|
||||
// 详细信息
|
||||
details: Schema.Types.Mixed,
|
||||
|
||||
// IP 地址
|
||||
ip: String,
|
||||
userAgent: String,
|
||||
|
||||
// 时间戳
|
||||
timestamp: {
|
||||
type: Date,
|
||||
default: Date.now,
|
||||
index: true
|
||||
}
|
||||
}, {
|
||||
timestamps: false
|
||||
})
|
||||
|
||||
// 索引
|
||||
AdminLogSchema.index({ adminId: 1, timestamp: -1 })
|
||||
AdminLogSchema.index({ resource: 1, timestamp: -1 })
|
||||
AdminLogSchema.index({ action: 1 })
|
||||
|
||||
module.exports = mongoose.model('AdminLog', AdminLogSchema)
|
||||
|
||||
Reference in New Issue
Block a user