<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page import="com.Admin.daoimpl.SubTypeDaoImpl"%> <%@ page import="com.Admin.daoimpl.SuperTypeDaoImpl"%> <%@ page import="com.Admin.daoimpl.AdminUserDaoImpl"%> <%@ page import="com.Admin.daoimpl.AdminProdDaoImpl"%> <%@ page import="com.Admin.vo.SubType"%> <%@ page import="com.Admin.vo.SuperType"%> <%@ page import="com.Admin.vo.User"%> <%@ page import="com.Admin.vo.Recommend"%> <%@ page import="java.util.ArrayList"%> <%@ page import="java.io.File"%> <%@ page import="net.sf.json.JSONArray"%> <%@ page import="net.sf.json.JSONObject"%> <%@ page import="com.common.IConstant"%> <%@ page import="com.common.Redis"%> <%@ page import="com.common.ReadDBPropertiesFile"%> <%@ page import="redis.clients.jedis.Jedis"%> <%@ 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"%> <% 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("/tpl/nm"); String apppath = getServletContext().getRealPath("/" + context); //System.out.println("app path is "+apppath); String tp = request.getParameter("tp"); if (tp != null) { apppath = getServletContext().getRealPath("/tpl/" + tp); } response.setCharacterEncoding("utf-8"); request.setCharacterEncoding("utf-8"); String t = "1";//request.getParameter("t"); String bid = request.getParameter("bid"); if(bid==null){ bid="0"; } String appid = request.getParameter("appid"); if(appid==null) { appid = IConstant.getCurrentAppid(apppath); if(appid==null){ response.sendRedirect(basePath+"app/error.html?c=1"); return; } } SuperTypeDaoImpl superTypeDao = new SuperTypeDaoImpl(); SubTypeDaoImpl subTypeDao = new SubTypeDaoImpl(); ArrayList superTypes = superTypeDao.getSuperType(appid); ArrayList subTypes = null; Jedis redis = null; redis = Redis.getReadRedis(); int role = 301; //get data JSONArray jsonTypes = IConstant.getCacheTypes(redis, appid, role, t); JSONArray products = IConstant.getCacheProducts(redis, appid, role, t); AdminProdDaoImpl prod = new AdminProdDaoImpl(); //get notices JSONArray notices = null; if(bid.equals("0")){ notices = IConstant.getCacheNotices(redis, appid, t); if (notices.size() == 0) { notices = IConstant.getCacheNotices(redis, "1", t); } } else{ notices = prod.getAppBranchNewsPage( appid, bid,0); if (notices.size() == 0) { notices = IConstant.getCacheNotices(redis, "1", t); } } JSONObject jsonUser = null; //get index recommend String type = "0"; JSONArray recommends = null; if(bid.equals("0")){ recommends = IConstant.getRecommends(redis, appid, type, t); if (recommends.size() == 0) { recommends = IConstant.getRecommends(redis, "1", type, t); } }else{ ArrayList rs = prod.getBranchRecommend(appid,type,Integer.valueOf(bid)); recommends = JSONArray.fromObject(rs); if (recommends.size() == 0) { recommends = IConstant.getRecommends(redis, "1", type, t); } } //get app JSONObject app = null; app = IConstant.getAppInfo(appid); if (app == null) { response.sendRedirect(basePath + "app/error.html?c=1"); return; } String email = null; try { email = app.getString("email"); } catch (Exception ex) { email = "bd@andisk.com"; } String web_title = null, web_keywords = null, web_desc = null; JSONObject menumap = new JSONObject(); menumap.put("course.jsp","1"); menumap.put("live.jsp","1"); menumap.put("vip.jsp","1"); menumap.put("train.jsp","1"); menumap.put("aboutus.jsp","1"); menumap.put("news.jsp","1"); menumap.put("score.jsp","0"); menumap.put("paper.jsp","0"); String stats = null; JSONArray menus = null; boolean isstatic = false; String cachefile = IConstant.getRootCacheDir(appid) + File.separator + "static.txt"; if (new File(cachefile).exists()) { //静态化 isstatic = true; } String webfile = IConstant.getRootDir() + File.separator + "tpl" + File.separator + app.getString("template") + File.separator + "webinfo.js"; System.out.println("web path is " + webfile); if (new File(webfile).exists()) { String webinfo = IConstant.readFile(webfile); JSONObject web = null; try { web = JSONObject.fromObject(webinfo); web_title = web.getString("title"); web_keywords = web.getString("keywords"); web_desc = web.getString("description"); } catch (Exception ex) { } } //菜单 String webcats = IConstant.getRootDir()+File.separator+"tpl"+File.separator+app.getString("template")+File.separator+"catalogs.js"; System.out.println("web cats path is "+webcats); if(new File(webcats).exists()) { String cts = IConstant.readFile(webcats); System.out.println(" menus content "+cts); try{ menus = JSONArray.fromObject(cts); for(int i=0;i <%=(web_title == null ? "在线教育" : web_title)%> "> ">
  • 官方微信平台

  • 手机APP

    <% for (int i = 0; i < recommends.size(); i++) { %> <% JSONObject r = recommends.getJSONObject(i); String picture = null; if (r.getString("picture").contains("http://")) { picture = r.getString("picture"); picture = picture.replaceAll("www.andisk.com/andisk", "js.andisk.com"); } else { picture = IConstant.getPresentRootURL(r.getString("appid")) + "/" + r.getString("picture"); } %>
  • " title="<%=r.getString("title")%>" target="_blank"> <%=r.getString(" />
  • <% } %>
通知公告
    <% for (int m = notices.size() - 1; m >= 0; m--) { JSONObject n = notices.getJSONObject(m); String title = ""; try { title = n.getString("title"); if (title.length() > 17) title = title.substring(0, 17); out.print("
  • " + title + "
  • "); } catch (Exception e) { } } %>

推荐新闻

<% if (news.size() > 0) { JSONObject r = news.getJSONObject(news.size() - 1); String url = r.getString("url"); %> " onerror="lods(this)" title="">
<% } %>
    <% for (int i = news.size() - 2; i >= 0; i--) { if ((news.size() - 2 - i) > 4) break; JSONObject r = news.getJSONObject(i); String url = r.getString("url"); if (i == 0) { %>
  • <%=r.getString("title")%>
  • <% } else { %>
  • <%=r.getString("title")%>
  • <% } } %>

最新公告

    <% if (notices.size() > 0) { JSONObject n1 = notices.getJSONObject(0); String url = IConstant.toStaticURL("n.jsp?id=" + n1.getString("id"), appid); %>
  • <% if (notices.size() > 1) { %> <% JSONObject r = notices.getJSONObject(1); url = IConstant.toStaticURL("n.jsp?id=" + r.getString("id"), appid); %>
    <%=r.getString("title")%>...
    <% } %> <% if (notices.size() > 2) { %> <% JSONObject r = notices.getJSONObject(2); url = IConstant.toStaticURL("n.jsp?id=" + r.getString("id"), appid); %>
    <%=r.getString("title")%>...
    <% } %> <% if (notices.size() > 3) { %> <% JSONObject r = notices.getJSONObject(3); url = IConstant.toStaticURL("n.jsp?id=" + r.getString("id"), appid); %>
    <%=r.getString("title")%>...
    <% } %>
  • <% if (notices.size() > 4) { JSONObject n2 = notices.getJSONObject(4); url = IConstant.toStaticURL("n.jsp?id=" + n2.getString("id"), appid); %>
    <% if (notices.size() > 5) { %> <% JSONObject r = notices.getJSONObject(5); url = IConstant.toStaticURL("n.jsp?id=" + r.getString("id"), appid); %>
    <%=r.getString("title")%>...
    <% } %> <% if (notices.size() > 6) { %> <% JSONObject r = notices.getJSONObject(6); url = IConstant.toStaticURL("n.jsp?id=" + r.getString("id"), appid); %>
    <%=r.getString("title")%>...
    <% } %> <% if (notices.size() > 7) { %> <% JSONObject r = notices.getJSONObject(7); url = IConstant.toStaticURL("n.jsp?id=" + r.getString("id"), appid); %>
    <%=r.getString("title")%>...
    <% } %>
  • <% } } %>

新闻资讯

    <% for (int i = 7; i < notices.size(); i++) { if (i - 7 > 5) break; JSONObject r = notices.getJSONObject(i); String url = IConstant.toStaticURL("n.jsp?id=" + r.getString("id"), appid); if (i == 11 || i == notices.size()) { %>
  • <%=r.getString("title")%>
  • <% } else { %>
  • <%=r.getString("title")%>
  • <% } } %>
<% String adpicture = "//s.vipkidstatic.com/fe-static/parent/panda/web/home/img/section02/section2_c68aa6be.png"; String adtitle = "刘涛倾力推荐"; String adurl = "//bk.andisk.com/tpl/nm/images/1539597232057-video-liutao.mp4"; String adintroduce = "VIPKID严选北美好外教,让孩子口音更纯正,用孩子喜欢的方式,激发更多自信表达,每时每刻关注成长,学会更多拥有更多,让世界没有边界"; if(ads1!=null && !ads1.isEmpty()){ JSONArray jsonAds1 = JSONArray.fromObject(ads1); if(jsonAds1.size()>0){ JSONObject item = jsonAds1.getJSONObject(0); adpicture = item.getString("picture"); adtitle = item.getString("title"); adurl = item.getString("url"); adintroduce = ""; try{ adintroduce = item.getString("introduce"); }catch(Exception ex){ } } } %>
  • <%=adtitle%>

    <%=adintroduce %>

<% adpicture = "//s.vipkidstatic.com/fe-static/parent/panda/web/home/img/section02/section1_a27c7322.png"; adtitle = "纯北美优质外教"; adurl = "//bk.andisk.com/tpl/nm/images/1539597158785-video-beimeiTeachers.mp4"; adintroduce = "爱孩子、懂教育,让孩子拥有更多选择,激发孩子的探索欲,打造个性化学习,让孩子爱上英语"; if(ads1!=null && !ads1.isEmpty()){ JSONArray jsonAds1 = JSONArray.fromObject(ads1); if(jsonAds1.size()>1){ JSONObject item = jsonAds1.getJSONObject(1); adpicture = item.getString("picture"); adtitle = item.getString("title"); adurl = item.getString("url"); adintroduce = ""; try{ adintroduce = item.getString("introduce"); }catch(Exception ex){ } } } %>
  • <%=adtitle%>

    <%=adintroduce%>

培训课程

  • 全部课程
  • 热门推荐
  • 主推课程
  • 免费课程
    <% JSONObject ct = null; boolean isfull = false; int pages = 0; String str = ""; for (int n = 0; n < types.size(); n++) { ct = types.getJSONObject(n); JSONArray subs = ct.getJSONArray("subtype"); for (int i = 0; i < subs.size(); i++) { JSONObject sub = subs.getJSONObject(i); str += "
  • "; pages = (int) (i / 8) + 1; if (pages > 1) { isfull = true; break; } String url = IConstant.toStaticURL("iType.jsp?ar=" + sub.getString("subTypeId"), appid); str += "
    "; str += " "; str += "
    "; str += "
    "; str += "
    "; str += "
    " + sub.getString("subType") + "
    "; str += "
    "; str += " " + sub.getString("tip") + "|"; str += " " + sub.getString("viewnumber") + ""; str += "
    "; str += "
    "; str += "
    "; str += ""; str += "
  • "; } if (isfull) { break; } } out.print(str); %>
    <% ct = null; //显示热门列表 isfull = false; pages = 0; str = ""; for (int i = 0; i < hots.size(); i++) { JSONObject sub = hots.getJSONObject(i); str += "
  • "; pages = (int) (i / 8) + 1; if (pages > 1) { isfull = true; break; } String url = IConstant.toStaticURL("iType.jsp?ar=" + sub.getString("subTypeId"), appid); str += "
    "; str += " "; str += "
    "; str += "
    "; str += "
    "; str += "
    " + sub.getString("subType") + "
    "; str += "
    "; str += " 价格:" + sub.getString("price") + "元|"; str += " " + sub.getString("viewnumber") + ""; str += "
    "; str += "
    "; str += "
    "; str += ""; str += "
  • "; } //热门是第2个 out.print(str); %>
    <% ct = null; //显示免费课程列表 isfull = false; pages = 0; str = ""; for (int i = 0; i < frees.size(); i++) { JSONObject sub = frees.getJSONObject(i); str += "
  • "; pages = (int) (i / 8) + 1; if (pages > 1) { isfull = true; break; } String url = sub.getString("picture"); str += "
    "; str += " "; str += "
    "; str += "
    "; str += "
    "; str += "
    " + sub.getString("productname") + "
    "; str += "
    "; str += " 免费|"; str += " " + sub.getString("tip") + ""; str += "
    "; str += "
    "; str += "
    "; str += "
    "; str += "
  • "; } //免费是第4个 out.print(str); %>
<% adpicture = "/andisk/tpl/nm/images/1539667910430-waijiaodahui.png"; adtitle = "北美好外教 为全球小朋友提供高品质教学服务"; adurl = "aboutus.html"; adintroduce = " "; if(ads1!=null && !ads1.isEmpty()){ JSONArray jsonAds1 = JSONArray.fromObject(ads1); if(jsonAds1.size()>2){ JSONObject item = jsonAds1.getJSONObject(2); adpicture = item.getString("picture"); adtitle = item.getString("title"); adurl = item.getString("url"); adintroduce = ""; try{ adintroduce = item.getString("introduce"); }catch(Exception ex){ } } } %>

<%=adtitle %>

    <% if(ads2!=null && !ads2.isEmpty()){ JSONArray jsonAds1 = JSONArray.fromObject(ads2); if(jsonAds1.size()>=2){ for(int i=0;i=4) break; JSONObject item = jsonAds1.getJSONObject(i); String adtitle1 = item.getString("title"); String adurl1 = item.getString("url"); String adintroduce1 = ""; try{ adintroduce1 = item.getString("introduce"); }catch(Exception ex){ } out.println("
  • "); out.println(adtitle1+""+adurl1+""); out.println("
    "); out.println("

    "+adintroduce1+"

  • "); } } } %>
<% if (roles.size() > 0) { %>

购买套餐

    <% for (int i = 0; i < roles.size(); i++) { if (i >= 4) break; JSONObject r = roles.getJSONObject(i); String url = IConstant.toStaticURL("iRole.jsp?ar=" + r.getString("id"), appid); String pic = r.getString("picture"); pic = pic.replaceAll("bk.andisk.com", "js.andisk.com"); %>
  • ">
    <%=r.getString("role")%>
    <%=r.getString("roledesc")%>| 价格<%=r.getString("price")%>元
  • <% } %>
<% } %>
<% adpicture = "/andisk/tpl/nm/index_files/20160121102950_41218.jpg"; adtitle = "线下课堂"; adurl = "train.html"; adintroduce = " "; if(ads1!=null && !ads1.isEmpty()){ JSONArray jsonAds1 = JSONArray.fromObject(ads1); if(jsonAds1.size()>3){ JSONObject item = jsonAds1.getJSONObject(3); adpicture = item.getString("picture"); adtitle = item.getString("title"); adurl = item.getString("url"); adintroduce = ""; try{ adintroduce = item.getString("introduce"); }catch(Exception ex){ } } } %>

<%=adtitle %>

常见问题

<% for (int i = 0; i < questions.size(); i++) { JSONObject q = questions.getJSONObject(i); if (i == 0) { %>

<%=q.getString("question")%>

<% } else { %>

<%=q.getString("question")%>

<% } } %>

最近开班

    <% for (int i = 0; i < trains.size(); i++) { JSONObject ta = trains.getJSONObject(i); String sch = ta.getString("schedule_date"); String start = ""; if (sch == null || sch.isEmpty()) { start = "每月开班"; } else { start = sch; } String url = IConstant .toStaticURL("iTrain.jsp?ac=" + ta.getString("id") + "&ar=" + ta.getString("trainid"), appid); if (i == trains.size() - 1 || i == 4) { %>
  • <%=ta.getString("classname")%><%=start%>
  • <% } else { %>
  • <%=ta.getString("classname")%><%=start%>
  • <% } } %>

<%if(stats!=null){ out.print(stats); } %>