You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
vue-shop-admin-work/models/OrderModel.js

27 lines
2.1 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

// 导出一个函数这个函数接受数据库对象db和一个回调函数callback作为参数
module.exports = function(db, callback) {
// 用户模型
// 使用db.define方法定义一个模型模型名为OrderModel
db.define("OrderModel", {
// 定义模型的属性
order_id: {type: 'serial', key: true}, // 订单ID自增主键用于唯一标识每一个订单
user_id: Number, // 用户ID类型为数字表示下单用户的唯一标识
order_number: String, // 订单编号,类型为字符串,用于内部跟踪或用户查询
order_price: Number, // 订单总价,类型为数字,表示订单的总金额
order_pay: [1,2,3], // 订单支付方式类型为数字数组具体值可能代表不同的支付方式如1代表支付宝2代表微信支付等
is_send: ["是","否"], // 是否发货,类型为字符串数组,表示订单是否已经发货
trade_no: String, // 交易编号,类型为字符串,用于第三方支付平台的交易记录
order_fapiao_title: ["个人","公司"], // 发票抬头,类型为字符串数组,表示发票的抬头信息
order_fapiao_company: String, // 发票公司名称,类型为字符串,当发票抬头为公司时需要填写
order_fapiao_content: String, // 发票内容,类型为字符串,表示发票的具体内容
consignee_addr: String, // 收货人地址,类型为字符串,表示订单的收货地址
pay_status: ['0','1'], // 支付状态类型为字符串数组表示订单的支付状态如0代表未支付1代表已支付
create_time: Number, // 创建时间,类型为数字,表示订单创建的时间戳
update_time: Number // 更新时间,类型为数字,表示订单最后一次更新的时间戳
}, {
// 定义模型的选项
table: "sp_order" // 指定模型对应的数据库表名为sp_order用于在数据库中存储订单信息
});
// 调用回调函数,传入无参数,表示模型定义完成
return callback();
}