⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 todayposts_daily.jsp

📁 论坛软件系统亦称电子公告板(BBS)系统
💻 JSP
字号:
<%@ page language="java" import="java.util.*,cn.jsprun.utils.BeanFactory" pageEncoding="UTF-8"%>
<%@page import="cn.jsprun.dao.CronsDao"%>
<%@page import="java.sql.Connection"%>
<%@page import="java.sql.SQLException"%>
<%! 
	private final String tablepre = "jrun_";
	private CronsDao cronsDao = ((CronsDao)BeanFactory.getBean("cronsSetDao"));
	
	private String getValue(String sql,String field,Connection connection) throws SQLException{
		List<Map<String,String>> tempList = cronsDao.executeQuery(connection,sql);
		if(tempList!=null&&tempList.size()>0){
			return tempList.get(0).get(field);
		}
		return null;
	}
%>
<%	
	int timestamp=(Integer)request.getAttribute("timestamp");
	Connection connection = (Connection)request.getAttribute("connection");
	String yesterdayposts =getValue("SELECT sum(todayposts) yesterdayposts FROM "+tablepre+"forums","yesterdayposts",connection);
	String historyposts = getValue("SELECT value FROM "+tablepre+"settings WHERE variable='historyposts'","value",connection);
	String[] hpostarray = null;
	if(historyposts==null){
		hpostarray=new String[]{"0","0"};
	}else{
		hpostarray = historyposts.split("\t");
		if(hpostarray==null||hpostarray.length<2){
			hpostarray=new String[]{"0","0"};
		}
	}
	historyposts = Integer.valueOf(hpostarray[1])<Integer.valueOf(yesterdayposts)?yesterdayposts+"\t"+yesterdayposts:yesterdayposts+"\t"+hpostarray[1];
	cronsDao.execute(connection,"UPDATE "+tablepre+"settings SET value='"+historyposts+"' WHERE variable ='historyposts'");
	cronsDao.execute(connection,"UPDATE "+tablepre+"forums SET todayposts='0'");
	RequestDispatcher dispatcher = request.getRequestDispatcher("/include/crons/setNextrun.jsp");
	try {
		dispatcher.include(request, response);
	} catch (Exception e) {
		e.printStackTrace();
	} 
	Map<String,String> crons = (Map<String,String>)request.getAttribute("crons");
	if("0".equals(crons.get("available"))){
		cronsDao.execute(connection,"UPDATE "+tablepre+"crons SET available='0' WHERE cronid="+crons.get("cronid"));
	}else{
		cronsDao.execute(connection,"UPDATE "+tablepre+"crons SET lastrun='"+timestamp+"',nextrun='"+crons.get("nextrun")+"' WHERE cronid="+crons.get("cronid"));
	}
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -