@@ -2,6 +2,7 @@ const express = require('express')
2
2
const router = express . Router ( )
3
3
const mysql = require ( './../mysql/db' )
4
4
const md5 = require ( "blueimp-md5" )
5
+ const moment = require ( 'moment' )
5
6
6
7
router . post ( '/' , addUser )
7
8
@@ -27,11 +28,11 @@ async function addUser(req, res, next) {
27
28
} ) ;
28
29
}
29
30
30
- insertData = await mysql . query ( 'INSERT INTO vue_blog_author (authorName, authorPassword, authorEmail, admin, authority, token) VALUES (?, ?, ?, 0, 2, ?)' ,
31
- [ req . body . name , req . body . password , req . body . email , token ] )
31
+ insertData = await mysql . query ( 'INSERT INTO vue_blog_author (authorName, authorPassword, authorEmail, admin, authority, token, createTime ) VALUES (?, ?, ?, 0, 2, ? , ?)' ,
32
+ [ req . body . name , req . body . password , req . body . email , token , moment ( ) . format ( 'YYYY-MM-DD HH:mm:ss' ) ] )
32
33
} else {
33
- insertData = await mysql . query ( 'INSERT INTO vue_blog_author (authorName, authorPassword, authorEmail, admin, authority, token) VALUES (?, ?, ?, 1, 0, ?)' ,
34
- [ req . body . name , req . body . password , req . body . email , token ] )
34
+ insertData = await mysql . query ( 'INSERT INTO vue_blog_author (authorName, authorPassword, authorEmail, admin, authority, token, createTime ) VALUES (?, ?, ?, 1, 0, ? , ?)' ,
35
+ [ req . body . name , req . body . password , req . body . email , token , moment ( ) . format ( 'YYYY-MM-DD HH:mm:ss' ) ] )
35
36
}
36
37
return res . json ( {
37
38
isok : true ,
0 commit comments