基于微信小程序二手物品调剂系统设计与实现-核心代码


import { Sequelize, DataTypes } from 'sequelize'
import moment from 'moment'
import sequelize from './sequelize'

const UsersModel = sequelize.define('UsersModel', {
	id: {
		type: DataTypes.BIGINT,
		primaryKey: true,
		autoIncrement: true,
		allowNull: false,
		comment: '主键id'
	},
	username: {
		type: DataTypes.STRING,
		allowNull: false,
		comment: '用户名'
	},
	password: {
		type: DataTypes.STRING,
		allowNull: false,
		comment: '用户密码'
	},
	role: {
		type: DataTypes.STRING,
		allowNull: true,
		comment: '用户角色'
	},
	image: {
		type: DataTypes.STRING,
		allowNull: true,
		comment: '头像'
	},
	addtime: {
  		type: DataTypes.DATE,
  		defaultValue: DataTypes.NOW,
    	allowNull: false,
    	get() {
            return moment(this.getDataValue('addtime')).format('YYYY-MM-DD HH:mm:ss')
        },
		comment: '添加时间'
	}
}, {
	timestamps: false,
	freezeTableName: true,
	tableName: 'users'
})

export default UsersModel

数据库参考


--
-- Current Database: `nodejsdcsf4pm1`
--

/*!40000 DROP DATABASE IF EXISTS `nodejsdcsf4pm1`*/;

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `nodejsdcsf4pm1` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;

USE `nodejsdcsf4pm1`;

--
-- Table structure for table `aboutus`
--

DROP TABLE IF EXISTS `aboutus`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `aboutus` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `title` varchar(200) NOT NULL COMMENT '标题',
  `subtitle` varchar(200) DEFAULT NULL COMMENT '副标题',
  `content` longtext NOT NULL COMMENT '内容',
  `picture1` longtext COMMENT '图片1',
  `picture2` longtext COMMENT '图片2',
  `picture3` longtext COMMENT '图片3',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='关于我们';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `aboutus`
--

LOCK TABLES `aboutus` WRITE;
/*!40000 ALTER TABLE `aboutus` DISABLE KEYS */;
INSERT INTO `aboutus` VALUES (1,'2024-03-06 23:42:52','关于我们','ABOUT US','当你设想门外是寒冷可怕的世界时,你还应该开门出去看看,是否真的如此。如果你有信心,你对前途就不犹豫了。如果你有勇气,你就不怕前途是否有困难或危险了每个人心中都应有两盏灯,一盏是希望的灯,一盏是勇气的灯。有了这两盏灯,我们就不怕海上的黑暗和风涛的险恶了。人的一生很像是在雾中行走。远远望去,只是迷蒙一片,辨不出方向和吉凶。可是,当你鼓起勇气,放下恐惧和怀疑,一步一步向前走去的时候,你就会发现,每走一步,你都能把下一步路看得清楚一点。“往前走,别站在远远的地方观望!”你就可以找到你的方向。','upload/aboutus_picture1.jpg','upload/aboutus_picture2.jpg','upload/aboutus_picture3.jpg');
/*!40000 ALTER TABLE `aboutus` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `config`
--

DROP TABLE IF EXISTS `config`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `config` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `name` varchar(100) NOT NULL COMMENT '配置参数名称',
  `value` varchar(100) DEFAULT NULL COMMENT '配置参数值',
  `url` varchar(500) DEFAULT NULL COMMENT 'url',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='配置文件';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `config`
--

LOCK TABLES `config` WRITE;
/*!40000 ALTER TABLE `config` DISABLE KEYS */;
INSERT INTO `config` VALUES (1,'picture1','upload/picture1.jpg',NULL),(2,'picture2','upload/picture2.jpg',NULL),(3,'picture3','upload/picture3.jpg',NULL);
/*!40000 ALTER TABLE `config` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `diaojidingdan`
--

DROP TABLE IF EXISTS `diaojidingdan`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `diaojidingdan` (
  `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
  `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `diaojibianhao` varchar(200) DEFAULT NULL COMMENT '调剂编号',
  `wupinmingcheng` varchar(200) DEFAULT NULL COMMENT '物品名称',
  `wupinleixing` varchar(200) DEFAULT NULL COMMENT '物品类型',
  `tupian` longtext COMMENT '图片',
  `jiage` varchar(200) DEFAULT NULL COMMENT '价格',
  `diaojididian` varchar(200) DEFAULT NULL COMMENT '调剂地点',
  `diaojizhuangtai` varchar(200) DEFAULT NULL COMMENT '调剂状态',
  `wanchengshijian` date DEFAULT NULL COMMENT '完成时间',
  `yonghuzhanghao` varchar(200) DEFAULT NULL COMMENT '用户账号',
  `yonghuxingming` varchar(200) DEFAULT NULL COMMENT '用户姓名',
  `zhanghao` varchar(200) DEFAULT NULL COMMENT '用户账号',
  `xingming` varchar(200) DEFAULT NULL COMMENT '用户姓名',
  `ispay` varchar(200) DEFAULT '未支付' COMMENT '是否支付',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=70 DEFAULT CHARSET=utf8 COMMENT='调剂订单';
/*!40101 SET character_set_client = @saved_cs_client */;

--


上一篇:入门!Linux 常见指令及权限管理全面指南


下一篇:android黑屏问题记录