Browse Source

Add register date.

master
t123yh 7 years ago
parent
commit
6d0472c85e
  1. 7
      models/user.js
  2. 3
      utility.js
  3. 8
      views/user.ejs

7
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)));
}

3
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');

8
views/user.ejs

@ -64,6 +64,14 @@
<div class="ui bottom attached segment" class="font-content"><%- show_user.information %></div>
</div>
</div>
<div class="row">
<div class="column">
<h4 class="ui top attached block header">注册于</h4>
<div class="ui bottom attached segment" class="font-content">
<%= syzoj.utils.formatDate(show_user.register_time) %>
</div>
</div>
</div>
<div class="row">
<div class="column">
<h4 class="ui top attached block header">通过的题目</h4>

Loading…
Cancel
Save