动态算随机数

2018-09-10  本文已影响0人  _嘿嘿_

function commentServerTimestamp() {
// call from server or local time. But must return promise with UNIX Epoch timestamp resolved (like 1507617041)
return new Promise((resolve, reject) => {
let currentTimestamp = Math.round((new Date()).getTime() / 1000);
resolve(currentTimestamp);
});
}

options.commentTimestamp().then(utcSeconds => {
data.commentId = 'ql-comment-'+options.commentAuthorId+'-'+utcSeconds;
data.comment = comment;
// UNIX epoch like 1234567890
});

上一篇下一篇

猜你喜欢

热点阅读