本文整理汇总了Java中com.xnx3.DateUtil.timeForUnix10方法的典型用法代码示例。如果您正苦于以下问题:Java DateUtil.timeForUnix10方法的具体用法?Java DateUtil.timeForUnix10怎么用?Java DateUtil.timeForUnix10使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.xnx3.DateUtil
的用法示例。
在下文中一共展示了DateUtil.timeForUnix10方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TemplateCMS
import com.xnx3.DateUtil; //导入方法依赖的package包/类
/**
* 默认editMode为生成模式
* @param site
*/
public TemplateCMS(Site site) {
linuxTime = DateUtil.timeForUnix10();
this.site = site;
if(Global.get("MASTER_SITE_URL") != null && Global.get("MASTER_SITE_URL").equals("http://wang.market/")){
if(site.getId() - 255 > 0){
//site.id < 255 的站点,是code模式
generateUrlRule = "code";
}
if(site.getId() - 218 == 0){
//site.id 218 是qiye1,作为调试使用
generateUrlRule = "code";
}
}else{
//后台主域名不是wang.market,那可能就是别人在使用这个程序,直接使用code模式生成html文件
generateUrlRule = "code";
}
}
示例2: previewByToken
import com.xnx3.DateUtil; //导入方法依赖的package包/类
@RequestMapping("previewByToken")
public String previewByToken(HttpServletRequest request,Model model,
@RequestParam(value = "token", required = false , defaultValue="") String token){
//进行安全过滤
token = token.replaceAll("\\s*", "");
token = filter(token);
if(token.length() != 64){
return error(model, "授权码错误");
}else{
int currentTime = DateUtil.timeForUnix10();
int startTime = currentTime - 86400*30; //30天内有效
try {
AliyunLogPageUtil log = new AliyunLogPageUtil(Global.aliyunLogUtil);
JSONArray jsonArray = log.listForJSONArray("receiveSocketUuid="+token, "", false, startTime, currentTime, 100, request);
model.addAttribute("list", jsonArray);
} catch (LogException e) {
e.printStackTrace();
}
}
return "im/perviewByToken";
}
示例3: hostoryChatList
import com.xnx3.DateUtil; //导入方法依赖的package包/类
/**
* 历史聊天人列表,会话列表,每一项都是一个人
*/
@RequestMapping("hostoryChatList")
public String hostoryChatList(HttpServletRequest request,Model model){
if(Global.aliyunLogUtil == null){
return error(model, "您未开启IM客服访问相关的日志服务!");
}
User user = getUser();
int currentTime = DateUtil.timeForUnix10();
int startTime = currentTime - 86400*30; //30天内有效
try {
AliyunLogPageUtil log = new AliyunLogPageUtil(Global.aliyunLogUtil);
JSONArray jsonArray = log.listForJSONArray("receiveId = "+user.getId()+" | select max(sendId) , map_agg('array',sendUserName) as sendUserName,max(sendId) as sendIds, count(*) as count, max(__time__) as time group by sendId order by time desc limit 100", "", false, startTime, currentTime, 100, request);
model.addAttribute("list", jsonArray);
} catch (LogException e) {
e.printStackTrace();
}
return "im/hostoryChatList";
}
示例4: chatRecord
import com.xnx3.DateUtil; //导入方法依赖的package包/类
/**
* 聊天记录,跟某个人之间,一个会话的聊天记录,两个人之间的聊天记录
* @param id 跟自己会话的那个人的id,对方的id
*/
@RequestMapping("chatRecord")
public String chatRecord(HttpServletRequest request,Model model,
@RequestParam(value = "id", required = false , defaultValue="0") long id){
if(id == 0){
return error(model, "请输入要查看得对方得id编号");
}
User user = getUser();
int currentTime = DateUtil.timeForUnix10();
int startTime = currentTime - 86400*30; //30天内有效
try {
AliyunLogPageUtil log = new AliyunLogPageUtil(Global.aliyunLogUtil);
JSONArray jsonArray = log.listForJSONArray("(receiveId = "+user.getId()+" and sendId = "+id+" ) or (receiveId = "+id+" and sendId = "+user.getId()+" )", "", false, startTime, currentTime, 100, request);
JSONArray ja = new JSONArray(); //将其倒序
for (int i = jsonArray.size()-1; i >-1 ; --i) {
ja.add(jsonArray.get(i));
}
model.addAttribute("list", ja);
} catch (LogException e) {
e.printStackTrace();
}
model.addAttribute("user", user);
return "im/chatRecord";
}
示例5: cacheCommit
import com.xnx3.DateUtil; //导入方法依赖的package包/类
/**
* 手动将 {@link #cacheLog(LogItem)} 缓存中的数据提交到阿里云日志服务中去。若提交成功,便清空缓存。
* <br/>此方法会在 {@link #cacheLog(LogItem)} 向缓存中添加日志时,当达到 {@link #setCacheLogMaxNumber(int)} 设置的缓存最大条数后会自动触发。
* <br/>当然,比如Tomcat停止时,或者其他意外情况,也可以手动调用此处方法触发提交到阿里云日志服务中的命令
* @return {@link PutLogsResponse} 提交返回的结果
* @throws LogException
*/
public PutLogsResponse cacheCommit() throws LogException{
PutLogsResponse r = saveByGroup("", "", logGroupCache);
if(r != null && r.GetRequestId() != null && r.GetRequestId().length() > 0){
//数据提交成功
//清空日志缓存及条数
logGroupCache.clear();
//同步最后提交时间
int currentTime = DateUtil.timeForUnix10(); //当前时间
if(lastSubmitTime < currentTime){
lastSubmitTime = currentTime;
}
}
return r;
}
示例6: simpleList
import com.xnx3.DateUtil; //导入方法依赖的package包/类
/**
* 获取当前7天内,最新的100条日志列表
* @throws LogException
*/
public static void simpleList() throws LogException{
int endTime = DateUtil.timeForUnix10(); //结束时间为当前时间
ArrayList<QueriedLog> qList = actionLog.queryList("", "", endTime - (7*24*60*60), endTime, 0, 100, true);
for (int i = 0; i < qList.size(); i++) {
System.out.println(qList.get(i).GetLogItem().ToJsonString());
}
}
示例7: dayLineForCurrentMonth
import com.xnx3.DateUtil; //导入方法依赖的package包/类
/**
* 折线图,当月(最近30天),每天的访问情况
*/
@RequiresPermissions("adminRequestLogFangWen")
@RequestMapping("dayLineForCurrentMonth")
@ResponseBody
public RequestLogDayLineVO dayLineForCurrentMonth(HttpServletRequest request) throws LogException{
RequestLogDayLineVO vo = new RequestLogDayLineVO();
//当前10位时间戳
int currentTime = DateUtil.timeForUnix10();
String query = "Mozilla | timeslice 24h | count as c";
//当月访问量统计
ArrayList<QueriedLog> jinriQlList = G.aliyunLogUtil.queryList(query, "", DateUtil.getDateZeroTime(currentTime - 2592000), currentTime, 0, 100, true);
JSONArray jsonArrayDate = new JSONArray(); //天数
JSONArray jsonArrayFangWen = new JSONArray(); //某天访问量,pv
for (int i = 0; i < jinriQlList.size(); i++) {
LogItem li = jinriQlList.get(i).GetLogItem();
JSONObject json = JSONObject.fromObject(li.ToJsonString());
try {
jsonArrayDate.add(DateUtil.dateFormat(json.getInt("logtime"), "MM-dd"));
} catch (NotReturnValueException e) {
e.printStackTrace();
}
jsonArrayFangWen.add(json.getInt("c"));
}
vo.setJsonArrayFangWen(jsonArrayFangWen);
vo.setJsonArrayDate(jsonArrayDate);
AliyunLog.addActionLog(0, "总管理后台,获取最近30天的访问数据统计记录");
return vo;
}
示例8: dayLineForCurrentMonth
import com.xnx3.DateUtil; //导入方法依赖的package包/类
/**
* 折线图,当月(最近30天),每天的访问情况
*/
@RequestMapping("dayLineForCurrentMonth")
@ResponseBody
public RequestLogDayLineVO dayLineForCurrentMonth(HttpServletRequest request) throws LogException{
RequestLogDayLineVO vo = new RequestLogDayLineVO();
//当前10位时间戳
int currentTime = DateUtil.timeForUnix10();
String query = "siteid="+getSiteId()+" | timeslice 24h | count as c";
//当月访问量统计
ArrayList<QueriedLog> jinriQlList = G.aliyunLogUtil.queryList(query, "", DateUtil.getDateZeroTime(currentTime - 2592000), currentTime, 0, 100, true);
JSONArray jsonArrayDate = new JSONArray(); //天数
JSONArray jsonArrayFangWen = new JSONArray(); //某天访问量,pv
for (int i = 0; i < jinriQlList.size(); i++) {
LogItem li = jinriQlList.get(i).GetLogItem();
JSONObject json = JSONObject.fromObject(li.ToJsonString());
try {
jsonArrayDate.add(DateUtil.dateFormat(json.getInt("logtime"), "MM-dd"));
} catch (NotReturnValueException e) {
e.printStackTrace();
}
jsonArrayFangWen.add(json.getInt("c"));
}
vo.setJsonArrayFangWen(jsonArrayFangWen);
vo.setJsonArrayDate(jsonArrayDate);
AliyunLog.addActionLog(getSiteId(), "获取最近30天的访问数据统计记录");
return vo;
}
示例9: spiderList
import com.xnx3.DateUtil; //导入方法依赖的package包/类
/**
* 爬虫访问列表,列出最近7天内,最近的100条爬虫记录
*/
@RequestMapping("spiderList")
@ResponseBody
public RequestLogItemListVO spiderList(HttpServletRequest request) throws LogException{
RequestLogItemListVO vo = new RequestLogItemListVO();
//当前10位时间戳
int currentTime = DateUtil.timeForUnix10();
String query = "siteid="+getSiteId();
String spider = null;
for (int i = 0; i < spiderNameArray.length; i++) {
if(spider == null){
spider = spiderNameArray[i];
}else{
spider = spider + " or " + spiderNameArray[i];
}
}
query = query + " and ("+spider+")";
//当月访问量统计
ArrayList<QueriedLog> jinriQlList = G.aliyunLogUtil.queryList(query, "", DateUtil.getDateZeroTime(currentTime - 604800), currentTime, 0, 100, true);
JSONArray jsonArray = new JSONArray(); //某天访问量,pv
for (int i = 0; i < jinriQlList.size(); i++) {
LogItem li = jinriQlList.get(i).GetLogItem();
JSONObject json = JSONObject.fromObject(li.ToJsonString());
try {
json.put("logtimeString", DateUtil.dateFormat(json.getInt("logtime"), "MM-dd HH:mm"));
} catch (NotReturnValueException e) {
e.printStackTrace();
}
UserAgent ua = UserAgent.parseUserAgentString(json.getString("userAgent"));
json.put("os", ua.getOperatingSystem());
json.put("browser", ua.getBrowser());
if(ua.getOperatingSystem().getName().equals("Unknown")){
String userAgent = json.getString("userAgent");
//没有发现是哪个浏览器,那可能是爬虫
for (int j = 0; j < spiderNameArray.length; j++) {
if(userAgent.indexOf(spiderNameArray[j]) > -1){
json.put("os", spiderExplainArray[j]);
}
}
if(json.get("os") == null){
if(userAgent.equals("Mozilla")){
//忽略
}else{
System.out.println("未发现的useragent : "+json.toString());
}
}
}
jsonArray.add(json);
}
vo.setList(jsonArray);
AliyunLog.addActionLog(getSiteId(), "获取最近7天内,最近的100条访问记录");
return vo;
}
示例10: spiderCount
import com.xnx3.DateUtil; //导入方法依赖的package包/类
/**
* 获取当前搜索引擎爬虫的爬取情况
*/
@RequestMapping("spiderCount")
@ResponseBody
public BaseVO spiderCount(HttpServletRequest request) throws LogException{
BaseVO vo = new BaseVO();
//当前10位时间戳
int currentTime = DateUtil.timeForUnix10();
//爬虫的具体访问统计
long[] spiderRequestCountArray = new long[spiderNameArray.length];
//最近7天的爬虫统计
for (int i = 0; i < spiderNameArray.length; i++) {
spiderRequestCountArray[i] = G.aliyunLogUtil.queryCount("siteid="+getSiteId()+" AND "+spiderNameArray[i], "", DateUtil.getDateZeroTime(currentTime - 604800), currentTime);
}
JSONArray jsonArray = new JSONArray();
for (int i = 0; i < spiderNameArray.length; i++) {
if(spiderRequestCountArray[i] > 0){
JSONObject json = new JSONObject();
json.put("name", spiderExplainArray[i]);
json.put("value", spiderRequestCountArray[i]);
jsonArray.add(json);
}
}
vo.setInfo(jsonArray.toString());
AliyunLog.addActionLog(getSiteId(), "获取7天爬虫抓取记录");
return vo;
}
示例11: getSiteRemainHint
import com.xnx3.DateUtil; //导入方法依赖的package包/类
public SiteRemainHintVO getSiteRemainHint(Site site, Agency agency) {
SiteRemainHintVO vo = new SiteRemainHintVO();
//v2.25 有时候会出现agency为null的情况,如果这样,默认讲result 设为正常模式未到期,不会出现什么提示
if(agency == null){
vo.setResult(SiteRemainHintVO.SUCCESS);
return vo;
}
vo.setCompanyName(agency.getName());
vo.setPhone(agency.getPhone());
vo.setQq(agency.getQq());
//计算当前网站的过期时间,当网站过期时间低于两个月时,会出现即将到期的提示
if(site.getExpiretime() != null && site.getExpiretime() > 0){
//获取当前网站还有多久过期,获取剩余时间的秒数
int remain = site.getExpiretime() - DateUtil.timeForUnix10();
//当前时间 + 两个月以后的时间,于过期时间比较 //1 * 60 * 60 * 24 * 30 * 2 两个月
if(remain < 5184000){
//如果剩余时间不到连个月了,那么会有提示
//计算还剩多久了
if(remain < 1){
vo.setResult(3);
vo.setRemainTimeString("已到期");
}else{
vo.setResult(SiteRemainHintVO.FAILURE);
vo.setRemainTimeString("还剩<span style=\"font-size: 38px; font-style: oblique; padding: 5px; color:red; padding-right: 12px;\">" + (int)Math.ceil(remain/86400) + "</span>天到期");
}
}
}
return vo;
}
示例12: generateCacheFile
import com.xnx3.DateUtil; //导入方法依赖的package包/类
/**
* 生成js缓存文件保存
* @param siteid 站点id
* @param fileName 生成的js文件名字,只写文件名,不传入".js"后缀
*/
public void generateCacheFile(com.xnx3.admin.entity.Site site){
try {
content = content + " var xnx3_r"+DateUtil.timeForUnix10()+" = '"+getRandomValue()+"';";
AttachmentFile.put("site/"+site.getId()+"/data/"+objName+".js", new ByteArrayInputStream(content.getBytes("UTF-8")));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
示例13: GenerateHTML
import com.xnx3.DateUtil; //导入方法依赖的package包/类
public GenerateHTML(Site site) {
linuxTime = DateUtil.timeForUnix10();
if(site.getTemplateId() != null){
this.templateId = site.getTemplateId();
}else{
this.templateId = 0;
}
this.site = site;
this.editMode = false;
}
示例14: cacheLog
import com.xnx3.DateUtil; //导入方法依赖的package包/类
/**
* 缓存日志。缓存的并不会立即联网提交到阿里云日志服务,而是达到一定条数 {@link #setCacheLogMaxNumber(int)} 达到这里设置的条数后才会触发 {@link #cacheCommit()} 提交到阿里云日志服务
* <br/>这里缓存的日志,没提供设置topic、source,可以将其记录到日志本身中去
* @param logItem 要缓存的日志,可用 {@link AliyunLogUtil#newLogItem()} 获取创建 {@link LogItem} 对象,然后将要记录的日志类似JSON, {@link LogItem#PushBack(String, String)} 加入
* @throws LogException
*/
public void cacheLog(LogItem logItem) throws LogException{
if(logItem == null){
return;
}
/*使用的类的信息,来源位置*/
if(stack_trace_deep > 0){
StackTraceElement st = Thread.currentThread().getStackTrace()[stack_trace_deep];
logItem.PushBack("className", st.getClassName());
logItem.PushBack("methodName", st.getMethodName());
logItem.PushBack("fileName", st.getFileName());
}
logGroupCache.add(logItem);
boolean submit = false; //提交日志
if(logGroupCache.size() > cacheLogMaxNumber){
//超过定义的缓存最大值,那么将缓存中的日志数据提交到阿里日志服务中去
submit = true;
}else{
int currentTime = DateUtil.timeForUnix10(); //当前时间
if(lastSubmitTime + cacheLogMaxTime < currentTime){
submit = true;
lastSubmitTime = currentTime;
}
}
if(submit){
cacheCommit();
}
}
示例15: list
import com.xnx3.DateUtil; //导入方法依赖的package包/类
/**
* 列出日志服务的列表记录
* <br/>获取当前生成得分页信息可用 {@link #getPage()} 得到
* @param query 查询条件。若divQuery为true,开启用户自定义检索,这里会先将query的查询条件作为首要查询。总之查询时无论是用户传入什么条件,都会加上此指定的查询条件一并 and 查询。(<a href="https://help.aliyun.com/document_detail/29060.html">查询语法参考</a>)
* @param topic topic主题,若不指定查询主题,可为空字符串""
* @param divQuery 是否开启用户自定义检索。若是开启,则用户可以通过<a href="https://help.aliyun.com/document_detail/29060.html">查询语法</a>进行自定义查询。GET或者POST传入queryString=查询条件
* @param startTime 筛选日志的开始时间,10位时间戳,若为0,则为结束时间以前1000天的时刻
* @param endTime 筛选日志的结束时间,10位时间戳,若为0,则为当前时间
* @param everyPageNumber 分页列表每页显示的条数
* @param request 主要用于获取当前url中的get传递的参数。分页数都是通过get传递的。同样,分页的参数也是自动根据这个计算出来的
* @return 返回查询的结果。
* @throws LogException
*/
public ArrayList<QueriedLog> list(String query, String topic, boolean divQuery, int startTime, int endTime, int everyPageNumber, HttpServletRequest request) throws LogException{
if(endTime == 0){
endTime = DateUtil.timeForUnix10();
}
if(startTime == 0){
startTime = DateUtil.getDateZeroTime(endTime - 86400000);
}
if(divQuery){
String queryStringRequest = request.getParameter("queryString"); //查询的关键词,可模糊查询
if(queryStringRequest == null || queryStringRequest.length() == 0){
}else{
if(query != null && query.length() > 0){
query = query + " and "+queryStringRequest;
}else{
query = queryStringRequest;
}
}
}
//统计1000天内的符合条件的总数量
int count = (int) aliyunLogUtil.queryCount(query, "", startTime, endTime);
page = new Page(count, everyPageNumber, request);
//最近三个月访问量统计
ArrayList<QueriedLog> logList = aliyunLogUtil.queryList(query, "", startTime, endTime, page.getLimitStart(), page.getEveryNumber(), true);
return logList;
}