From 6d0472c85e825da7022a918d364a431ff4170e08 Mon Sep 17 00:00:00 2001 From: t123yh Date: Sat, 2 Sep 2017 18:19:28 +0800 Subject: [PATCH] Add register date. --- models/user.js | 7 +++++-- utility.js | 3 +++ views/user.ejs | 8 ++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/models/user.js b/models/user.js index 985604f..eaea68b 100644 --- a/models/user.js +++ b/models/user.js @@ -40,7 +40,9 @@ let model = db.define('user', { public_email: { type: Sequelize.BOOLEAN }, sex: { type: Sequelize.INTEGER }, - rating: { type: Sequelize.INTEGER } + rating: { type: Sequelize.INTEGER }, + + register_time: { type: Sequelize.INTEGER } }, { timestamps: false, tableName: 'user', @@ -72,7 +74,8 @@ class User extends Model { submit_num: 0, sex: 0, is_show: syzoj.config.default.user.show, - rating: syzoj.config.default.user.rating + rating: syzoj.config.default.user.rating, + register_time: parseInt((new Date()).getTime() / 1000) }, val))); } diff --git a/utility.js b/utility.js index aff9a34..3555903 100644 --- a/utility.js +++ b/utility.js @@ -149,6 +149,9 @@ module.exports = { }); }, formatDate(ts, format) { + if (ts == null) { + return "Unknown"; + } let m = moment(ts * 1000); m.locale('eu'); return m.format(format || 'L H:mm:ss'); diff --git a/views/user.ejs b/views/user.ejs index f5bc718..164de2e 100644 --- a/views/user.ejs +++ b/views/user.ejs @@ -64,6 +64,14 @@
<%- show_user.information %>
+
+
+

注册于

+
+ <%= syzoj.utils.formatDate(show_user.register_time) %> +
+
+

通过的题目