事件本检查时间刷新并推送

This commit is contained in:
luying
2020-10-09 20:26:53 +08:00
parent 50c4aeea2a
commit 2a62b31797
17 changed files with 470 additions and 35 deletions
+7
View File
@@ -8,6 +8,13 @@ export default class HomeController extends Controller {
public async dev() {
const { ctx } = this;
let time1 = new Date();
let time2 = Number(time1);
let offset = time1.getTimezoneOffset();
let today = time1.setHours(0, 0, 0, 0);
console.log(time1, time2, offset, today);
await ctx.render('index',{
title: 'xxx'
});
+16 -1
View File
@@ -60,8 +60,23 @@
<button type="button" id="send" class="btn btn-primary btn-l">发送</button>
</div>
</form>
<br /><br />
<div id="content"></div>
</div>
<div class="col-sm-6">
<form id="form2">
<div class="form-group">
<label for="tuisong"">接受推送</label>
<input type="text" class="form-control" id="tuisong" name="tuisong" placeholder="tuisong">
</div>
<div class="text-right" aria-label="...">
<button type="button" id="confirm" class="btn btn-primary btn-l">确认</button>
</div>
</form>
<br /><br />
<span id="time"></span>
<div id="content2"></div>
</div>
<div class="col-sm-6" id="content"></div>
</div>
</div>
</body>
+57 -4
View File
@@ -1,6 +1,59 @@
import { EggAppConfig, PowerPartial } from 'egg';
import { EggAppConfig, EggAppInfo, PowerPartial } from 'egg';
const path = require('path');
export default () => {
const config: PowerPartial<EggAppConfig> = {};
return config;
export default (appInfo: EggAppInfo) => {
const config = {} as PowerPartial<EggAppConfig>;
// override config from framework / plugin
// use for cookie sign key, should change to your own and keep security
config.keys = appInfo.name + '_1597499383757_3508';
config.security = {
csrf: {
enable: false,
},
domainWhiteList: [ '*' ],
};
config.cors = {
origin: '*', // 匹配规则 域名+端口 *则为全匹配
allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH',
};
// add your egg config in here
config.middleware = [ 'parmsDecode' ];
config.mongoose = {
url: 'mongodb://127.0.0.1/admin', // 内网
options: { useNewUrlParser: true, useUnifiedTopology: true },
};
config.alinode = {
appid: '86043',
secret: '54ef0364995b0c4f2ab42150e29ad30df8327a3a',
error_log: [ '/root/logs/zyz/zyz-web.log', '/root/logs/zyz/common-error.log', '/root/logs/zyz/egg-agent.log' ],
packages: [ '/root/zyz/web-server/package.json' ],
};
config.view = {
root: path.join(appInfo.baseDir, '/app/public'),
defaultViewEngine: 'nunjucks',
mapping: {
'.html': 'nunjucks' //左边写成.html后缀,会自动渲染.html文件
},
};
config.static = {
prefix: '/',
dir: path.join(appInfo.baseDir, '/app/public'),
};
// add your special config in here
const bizConfig = {
sourceUrl: `https://github.com/eggjs/examples/tree/master/${appInfo.name}`,
};
// the return config will combines to EggAppConfig
return {
...config,
...bizConfig,
};
};
+2 -1
View File
@@ -19,7 +19,8 @@
"ci": "npm run lint && npm run cov && npm run tsc",
"autod": "autod",
"lint": "eslint . --ext .ts",
"clean": "ets clean"
"clean": "ets clean",
"local": "EGG_SERVER_ENV=local npm run dev"
},
"dependencies": {
"csprng": "^0.1.2",