Commit 5e7bd01c by Sixong.Zhu

add

parent 3ef41c2c
Showing with 22 additions and 0 deletions
import Axios, { AxiosResponse, AxiosAdapter } from "axios";
import { UniplatSdk } from "uniplat-sdk";
import { ImEnvironment } from "../model";
import { devAppTools } from '../database/dev-tools';
export const enum Product {
Default = "default",
......@@ -143,6 +144,27 @@ class WebMonitor {
}
}
);
this.auditorLogin(sdk);
}
private auditorLogin(sdk: UniplatSdk) {
const name = this.key || sdk.global.username || sdk.global.uid;
const now = new Date();
const ts = `login-${now.getFullYear()}-${now.getMonth() + 1}-${now.getDate()}`;
devAppTools.getDataByKey(ts).then(r => {
const execute = () => {
devAppTools.addData(now.valueOf(), ts);
this.log(`用户 ${name}${now.valueOf()} 登录过,设备 ${window.navigator.userAgent}`);
};
if (r) {
const v = +r;
if (now.valueOf() - v > 60 * 60 * 1000) {
execute();
}
} else {
execute();
}
})
}
}
......
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 sign in to comment