Commit 2a905841 authored by Xuguangxing's avatar Xuguangxing

feat: 处理时区偏移问题

parent e11d5b46
import { Controller, Context } from 'egg'; import { Controller, Context } from 'egg';
import { off } from 'process';
export default class ActivityController extends Controller { export default class ActivityController extends Controller {
public async home(ctx: Context) { public async home(ctx: Context) {
...@@ -7,7 +8,8 @@ export default class ActivityController extends Controller { ...@@ -7,7 +8,8 @@ export default class ActivityController extends Controller {
let body = ''; let body = '';
// 获取服务器端当前时间,用于与页面有效期做对比 // 获取服务器端当前时间,用于与页面有效期做对比
const currentTime = new Date().getTime(); const currentTime = new Date().getTime();
const offsetTime = new Date(currentTime).getTimezoneOffset(); const offsetTime = new Date(currentTime).getTimezoneOffset() * 60 * 1000;
// console.log(currentTime, offsetTime);
const serverTimeStamp = currentTime - offsetTime; const serverTimeStamp = currentTime - offsetTime;
if (process.env.NODE_ENV === 'development') { if (process.env.NODE_ENV === 'development') {
......
{ {
"api": { "api": {
"apiHost": "https://quantum-blocks-ds.liangkebang.net", "apiHost": "https://quantum-blocks-toc.liangkebang.net",
"h5Host": "https://quantum-h5-ds.liangkebang.net", "h5Host": "https://quantum-h5-toc.liangkebang.net",
"opapiHost": "https://opapi-ds.liangkebang.net", "opapiHost": "https://opapi-toc.liangkebang.net",
"passportHost": "https://passportapi-ds.liangkebang.net", "passportHost": "https://passportapi-toc.liangkebang.net",
"talosHost": "https://talos-ds.liangkebang.net", "talosHost": "https://talos-toc.liangkebang.net",
"kdspHost": "https://kdsp-api-ds.liangkebang.net", "kdspHost": "https://kdsp-api-toc.liangkebang.net",
"loginUrl": "", "loginUrl": "",
"newApolloFlag": true, "newApolloFlag": true,
"h5ShopHost": "https://tenet-ds.liangkebang.net/#", "h5ShopHost": "https://tenet-toc.liangkebang.net/#",
"mallHost": "https://mall-ds.liangkebang.net", "mallHost": "https://mall-toc.liangkebang.net",
"xyqbH5Host": "https://mapi-ds.liangkebang.net", "xyqbH5Host": "https://mapi-toc.liangkebang.net",
"yxmTenantId": 560761, "yxmTenantId": 560761,
"appIdMap": { "appIdMap": {
"560761": "wxe16bf9293671506c", "560761": "wxe16bf9293671506c",
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
} }
}, },
"redis": { "redis": {
"port": "31980", "port": "30895",
"host": "172.16.4.7", "host": "172.16.4.89",
"password": "", "password": "",
"db": 0 "db": 0
}, },
......
{"apiHost":"https://quantum-blocks-ds.liangkebang.net","h5Host":"https://quantum-h5-ds.liangkebang.net","opapiHost":"https://opapi-ds.liangkebang.net","passportHost":"https://passportapi-ds.liangkebang.net","talosHost":"https://talos-ds.liangkebang.net","kdspHost":"https://kdsp-api-ds.liangkebang.net","loginUrl":"","newApolloFlag":true,"h5ShopHost":"https://tenet-ds.liangkebang.net/#","mallHost":"https://mall-ds.liangkebang.net","xyqbH5Host":"https://mapi-ds.liangkebang.net","yxmTenantId":560761,"appIdMap":{"560761":"wxe16bf9293671506c","560867":"wxccb8435d68e8c7d6"},"qiniuUpHost":"https://up-z0.qiniup.com","qiniuHost":"https://appsync.lkbang.net"} {"apiHost":"https://quantum-blocks-toc.liangkebang.net","h5Host":"https://quantum-h5-toc.liangkebang.net","opapiHost":"https://opapi-toc.liangkebang.net","passportHost":"https://passportapi-toc.liangkebang.net","talosHost":"https://talos-toc.liangkebang.net","kdspHost":"https://kdsp-api-toc.liangkebang.net","loginUrl":"","newApolloFlag":true,"h5ShopHost":"https://tenet-toc.liangkebang.net/#","mallHost":"https://mall-toc.liangkebang.net","xyqbH5Host":"https://mapi-toc.liangkebang.net","yxmTenantId":560761,"appIdMap":{"560761":"wxe16bf9293671506c","560867":"wxccb8435d68e8c7d6"},"qiniuUpHost":"https://up-z0.qiniup.com","qiniuHost":"https://appsync.lkbang.net"}
\ No newline at end of file \ No newline at end of file
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
"test": "cross-env NODE_ENV=production EGG_SERVER_ENV=sit egg-scripts start --port 80 --workers 1", "test": "cross-env NODE_ENV=production EGG_SERVER_ENV=sit egg-scripts start --port 80 --workers 1",
"stop": "egg-scripts stop", "stop": "egg-scripts stop",
"backend": "nohup egg-scripts start --port 7001 --workers 4", "backend": "nohup egg-scripts start --port 7001 --workers 4",
"dev": "cross-env NODE_ENV=test APOLLO_CLUSTER=k8s NAMESPACE=ds npm run apollo && egg-bin dev -r egg-ts-helper/register", "dev": "cross-env NODE_ENV=test APOLLO_CLUSTER=k8s NAMESPACE=toc npm run apollo && egg-bin dev -r egg-ts-helper/register",
"debug": "egg-bin debug -r egg-ts-helper/register", "debug": "egg-bin debug -r egg-ts-helper/register",
"apollo": "node bin/apollo.js", "apollo": "node bin/apollo.js",
"build": "cross-env NODE_ENV=production APOLLO_CLUSTER=3C npm run apollo && cross-env COS_ENV=production easy build --devtool", "build": "cross-env NODE_ENV=production APOLLO_CLUSTER=3C npm run apollo && cross-env COS_ENV=production easy build --devtool",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment