소스 검색

feat: add getServerTime api to fetch server timestamp

add new api endpoint /getServerTime that returns current server timestamp in json format
lsc 5 일 전
부모
커밋
d778b85e3d
1개의 변경된 파일4개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      pbl.js

+ 4 - 0
pbl.js

@@ -10657,6 +10657,10 @@ router.route('/setEduid').all((req, res, next) => {
     getmysql2(req, res, "setEduid", json['userid'], json['eduid']);
 });
 
+// 获取服务器时间
+router.route('/getServerTime').all((req, res, next) => {
+    res.end(JSON.stringify({time: new Date().getTime()}));
+});
 
 
 function generateAPIKey(username) {