重构后端,改为 node 技术栈
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
const { DataTypes } = require('sequelize');
|
||||
const sequelize = require('../config/database');
|
||||
|
||||
const Brand = sequelize.define('Brand', {
|
||||
id: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
autoIncrement: true,
|
||||
comment: '品牌 ID',
|
||||
},
|
||||
name: {
|
||||
type: DataTypes.STRING(100),
|
||||
unique: true,
|
||||
allowNull: false,
|
||||
comment: '品牌名称',
|
||||
},
|
||||
}, {
|
||||
tableName: 'brand',
|
||||
comment: '耳机品牌',
|
||||
});
|
||||
|
||||
module.exports = Brand;
|
||||
@@ -0,0 +1,52 @@
|
||||
const { DataTypes } = require('sequelize');
|
||||
const sequelize = require('../config/database');
|
||||
|
||||
const Model = sequelize.define('Model', {
|
||||
id: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
autoIncrement: true,
|
||||
comment: '型号 ID',
|
||||
},
|
||||
brand_name: {
|
||||
type: DataTypes.STRING(100),
|
||||
allowNull: false,
|
||||
comment: '品牌名称',
|
||||
},
|
||||
name: {
|
||||
type: DataTypes.STRING(100),
|
||||
allowNull: false,
|
||||
comment: '型号名称',
|
||||
},
|
||||
form: {
|
||||
type: DataTypes.STRING(100),
|
||||
allowNull: true,
|
||||
comment: '形式',
|
||||
},
|
||||
rig: {
|
||||
type: DataTypes.STRING(100),
|
||||
allowNull: true,
|
||||
comment: '阻抗',
|
||||
},
|
||||
source: {
|
||||
type: DataTypes.STRING(100),
|
||||
allowNull: true,
|
||||
comment: '来源',
|
||||
},
|
||||
eq_key: {
|
||||
type: DataTypes.STRING(255),
|
||||
allowNull: true,
|
||||
comment: 'EQ 键',
|
||||
},
|
||||
create_at: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: false,
|
||||
defaultValue: DataTypes.NOW,
|
||||
comment: '创建时间',
|
||||
},
|
||||
}, {
|
||||
tableName: 'model',
|
||||
comment: '耳机型号',
|
||||
});
|
||||
|
||||
module.exports = Model;
|
||||
@@ -0,0 +1,118 @@
|
||||
const { DataTypes } = require('sequelize');
|
||||
const sequelize = require('../config/database');
|
||||
|
||||
const Ota = sequelize.define('Ota', {
|
||||
id: {
|
||||
type: DataTypes.INTEGER,
|
||||
primaryKey: true,
|
||||
autoIncrement: true,
|
||||
comment: 'ID',
|
||||
},
|
||||
verCode: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
field: 'verCode',
|
||||
comment: '版本号(整数)',
|
||||
},
|
||||
verName: {
|
||||
type: DataTypes.STRING(20),
|
||||
allowNull: false,
|
||||
field: 'verName',
|
||||
comment: '版本名称',
|
||||
},
|
||||
url: {
|
||||
type: DataTypes.STRING(255),
|
||||
allowNull: false,
|
||||
comment: '升级包 URL',
|
||||
},
|
||||
md5: {
|
||||
type: DataTypes.STRING(32),
|
||||
allowNull: false,
|
||||
comment: '升级包 MD5',
|
||||
},
|
||||
force: {
|
||||
type: DataTypes.SMALLINT,
|
||||
allowNull: false,
|
||||
defaultValue: 0,
|
||||
comment: '是否强升;0-否',
|
||||
},
|
||||
desc: {
|
||||
type: DataTypes.STRING(255),
|
||||
allowNull: true,
|
||||
comment: '描述',
|
||||
},
|
||||
model: {
|
||||
type: DataTypes.STRING(100),
|
||||
allowNull: true,
|
||||
comment: '对应的设备型号',
|
||||
},
|
||||
hw: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
defaultValue: 0,
|
||||
comment: '硬件版本号',
|
||||
},
|
||||
target: {
|
||||
type: DataTypes.SMALLINT,
|
||||
allowNull: false,
|
||||
defaultValue: 0,
|
||||
comment: '是否定向,1-是,0-否',
|
||||
},
|
||||
beta: {
|
||||
type: DataTypes.SMALLINT,
|
||||
allowNull: false,
|
||||
defaultValue: 0,
|
||||
comment: '是否灰度,1-是,0-否',
|
||||
},
|
||||
pawVerCode: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: false,
|
||||
defaultValue: 0,
|
||||
field: 'pawVerCode',
|
||||
comment: '配对版本号',
|
||||
},
|
||||
pawVerName: {
|
||||
type: DataTypes.STRING(20),
|
||||
allowNull: false,
|
||||
defaultValue: '',
|
||||
field: 'pawVerName',
|
||||
comment: '配对版本名称',
|
||||
},
|
||||
pawUrl: {
|
||||
type: DataTypes.STRING(255),
|
||||
allowNull: false,
|
||||
defaultValue: '',
|
||||
field: 'pawUrl',
|
||||
comment: '配对版本 URL',
|
||||
},
|
||||
pawMd5: {
|
||||
type: DataTypes.STRING(32),
|
||||
allowNull: false,
|
||||
defaultValue: '',
|
||||
field: 'pawMd5',
|
||||
comment: '配对版本 MD5',
|
||||
},
|
||||
startTime: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: true,
|
||||
field: 'startTime',
|
||||
comment: '升级开始时间',
|
||||
},
|
||||
endTime: {
|
||||
type: DataTypes.DATE,
|
||||
allowNull: true,
|
||||
field: 'endTime',
|
||||
comment: '升级结束时间',
|
||||
},
|
||||
status: {
|
||||
type: DataTypes.SMALLINT,
|
||||
allowNull: false,
|
||||
defaultValue: 1,
|
||||
comment: '是否可用',
|
||||
},
|
||||
}, {
|
||||
tableName: 'ota',
|
||||
comment: 'OTA 升级版本',
|
||||
});
|
||||
|
||||
module.exports = Ota;
|
||||
@@ -0,0 +1,5 @@
|
||||
const Brand = require('./Brand');
|
||||
const Model = require('./Model');
|
||||
const Ota = require('./Ota');
|
||||
|
||||
module.exports = { Brand, Model, Ota };
|
||||
Reference in New Issue
Block a user