%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page session="false" %>
<%@ page import="com.Admin.daoimpl.SubTypeDaoImpl" %>
<%@ page import="com.Admin.daoimpl.SuperTypeDaoImpl" %>
<%@ page import="com.Admin.daoimpl.AdminProdDaoImpl" %>
<%@ page import="com.Admin.vo.SubType"%>
<%@ page import="com.Admin.vo.SuperType"%>
<%@ page import="com.Admin.vo.Product"%>
<%@ page import="com.Admin.vo.Attr"%>
<%@ page import="com.Admin.vo.User"%>
<%@ page import="com.Admin.vo.AppUser"%>
<%@ page import="net.sf.json.JSONArray"%>
<%@ page import="net.sf.json.JSONObject"%>
<%@ page import="com.common.Redis"%>
<%@ page import="redis.clients.jedis.Jedis"%>
<%@ page import="java.util.ArrayList"%>
<%@ page import="java.util.List"%>
<%@ page import="com.common.IConstant"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="cf" uri="/WEB-INF/els.tld" %>
<%
response.setCharacterEncoding("utf-8");
request.setCharacterEncoding("utf-8");
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String realPath = "http://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath()+request.getServletPath().substring(0,request.getServletPath().lastIndexOf("/")+1);
String context = request.getServletPath().substring(1,request.getServletPath().lastIndexOf("/"));
String apppath = getServletContext().getRealPath("/"+context);
String tp = request.getParameter("tp");
String appurl = null;
if(tp!=null){
apppath = getServletContext().getRealPath("/tpl/"+tp);
}
String appid = request.getParameter("appid");
if(appid==null)
{
appid = IConstant.getCurrentAppid(apppath);
System.out.println("++live appid "+appid+"&apppath "+apppath);
if(appid==null){
response.sendRedirect(basePath+"app/error.html?c=1");
return;
}
}
JSONObject app = IConstant.getAppInfo( appid);
if(app==null){
response.sendRedirect(basePath+"app/error.html?c=1");
return;
}
String template = null;
template = app.getString("template");
if(tp!=null){
apppath = getServletContext().getRealPath("/tpl/"+tp);
String webroot=null;
try{
webroot = app.getString("web_url");
}catch(Exception ex){
}
if(webroot==null){
webroot="http://www.andisk.com";
}
System.out.println("app path is "+apppath+" appid is "+appid+" with webroot "+webroot);
appurl = webroot+"/andisk/tpl/"+tp+"/";
}
else{
tp = template;
apppath = getServletContext().getRealPath("/tpl/"+tp);
String webroot=null;
try{
webroot = app.getString("web_url");
}catch(Exception ex){
}
if(webroot==null){
webroot="http://www.andisk.com";
}
appurl = webroot+"/andisk/tpl/"+tp+"/";
}
String bid = request.getParameter("bid");
if(bid==null){
bid="0";
}
User user = null;
try{
user = IConstant.getSessionU(request);
}catch(Exception e){
user = null;
}
JSONObject jsonUser=null;
if(user!=null){
jsonUser = JSONObject.fromObject(user);
}
int row=0;
String type = request.getParameter("ar");
String lp = request.getParameter("lp");
String pg = request.getParameter("pn");
String t = request.getParameter("t");
String hot = request.getParameter("hot");
String wd = request.getParameter("wd");
String islogin="登录或注册";
String loginClass="notlogin";
JSONObject jsonRtn = null;
JSONArray jsonTypes = null;
int pn = 0;
if(pg!=null){
pn = Integer.valueOf(pg);
}
System.out.println("3appid is "+appid+",type is "+type+" lp is "+lp+",pn is "+pn);
JSONArray products =new JSONArray();
JSONObject product = null;
JSONArray recommend_products=new JSONArray();
JSONArray jsonAttrs=null;
int pageCount = 30;
System.out.println("4appid is "+appid);
if(wd==null){
products = IConstant.getList(appid, type, lp, pn, t);
}
else{
products = new AdminProdDaoImpl().getAppListByWord(appid, wd, pn);
}
jsonTypes = IConstant.getTypes(appid, "301");
Jedis redis =null;
try{
redis = Redis.getRedis();
recommend_products = IConstant.getRecommendProducts(redis, appid, t);
if(recommend_products.size()==0){
recommend_products = IConstant.getRecommendProducts(redis, "1", t);
}
}catch(Exception ex){
ex.printStackTrace();
}
finally{
if(redis!=null){
redis.close();
}
}
%>
云课堂搜索