// 生活帮 @WebMethod public ModelAndView tips(Page<Map> page) { ModelAndView mv = new ModelAndView(); page.setPageSize(3); page = dao.findPage( page, "select art.id as id, art.title as title , art.isAd as isTop, art.conts as conts, img.path as img from Article art , Image img where img.id=art.imgId" + " and art.leibie='tips' and art.publishFlag=1 order by art.setTopTime desc, art.id desc ", true, new Object[] {}); // make abstract for (Map art : page.getResult()) { String conts = art.get("conts").toString(); conts = HTMLSpirithHelper.delHTMLTag(conts); if (conts.length() > 70) { conts = conts.substring(0, 70); } art.put("conts", conts); } mv.data.put("tips", JSONHelper.toJSONArray(page.getResult())); mv.data.put( "imgUrl", "http://" + ConfigCache.get("image_host", "localhost") + "/article_image_path"); mv.data.put( "tipsDetailUrl", "https://" + ConfigCache.get("app_host", "localhost") + "/article/view.jsp"); return mv; }
// 首页初始化 @WebMethod public ModelAndView init(String tel) { // https://localhost:8181/c/app/init ModelAndView mv = new ModelAndView(); // 新闻 Page<Map> page = new Page<Map>(); page.setPageSize(2); page = dao.findPage( page, "select art.id as id, art.title as title , art.conts as conts, img.path as img from Article art , Image img where img.id=art.imgId and art.publishFlag=1" + " and art.leibie='news' order by art.setTopTime desc, art.id desc ", true, new Object[] {}); // make abstract for (Map art : page.getResult()) { String conts = art.get("conts").toString(); conts = HTMLSpirithHelper.delHTMLTag(conts); if (conts.length() > 70) { conts = conts.substring(0, 70); } art.put("conts", conts); } mv.data.put("news", JSONHelper.toJSONArray(page.getResult())); page = dao.findPage( page, "select product.id as id, product.title as title , img.path as img from Product product , Image img where img.id=product.imgId and product.isAd=1", true, new Object[] {}); mv.data.put("products", JSONHelper.toJSONArray(page.getResult())); mv.data.put( "imgUrl", "http://" + ConfigCache.get("image_host", "localhost") + "/article_image_path"); mv.data.put( "productDetailUrl", "https://" + ConfigCache.get("app_host", "localhost") + "/product/view.jsp"); mv.data.put( "goodsDetailUrl", "https://" + ConfigCache.get("app_host", "localhost") + "/goods/view.jsp"); mv.data.put( "newsDetailUrl", "https://" + ConfigCache.get("app_host", "localhost") + "/article/view.jsp"); return mv; }