ソースを参照

微信小程序banner生成

XMTT 7 年 前
コミット
a9f136b1f4
共有1 個のファイルを変更した29 個の追加3 個の削除を含む
  1. 29 3
      src/main/java/com/ekexiu/console/system/service/DiscoverBannerService.java

+ 29 - 3
src/main/java/com/ekexiu/console/system/service/DiscoverBannerService.java

115
            "    <div class=\"mui-indicator\"></div>\n" +
115
            "    <div class=\"mui-indicator\"></div>\n" +
116
            "    <div class=\"mui-indicator\"></div>\n" +
116
            "    <div class=\"mui-indicator\"></div>\n" +
117
            "</div>";
117
            "</div>";
118
    private String templateWx = "{\n" +
119
            "  \"success\": true,\n" +
120
            "  \"data\": [\n" +
121
            "    <#list banner as banner>\n" +
122
            "    <#if banner_has_next>\n" +
123
            "    {\n" +
124
            "      \"articleId\": \"${banner.articleId}\",\n" +
125
            "      \"title\": \"${banner.title}\",\n" +
126
            "      \"image\": \"${banner.image}\",\n" +
127
            "      \"banner\":\"${banner.banner}\",\n" +
128
            "      \"bannerId\":\"${banner.bannerId}\"\n" +
129
            "    },\n" +
130
            "    <#else>\n" +
131
            "    {\n" +
132
            "      \"articleId\": \"${banner.articleId}\",\n" +
133
            "      \"title\": \"${banner.title}\",\n" +
134
            "      \"image\": \"${banner.image}\",\n" +
135
            "      \"banner\":\"${banner.banner}\",\n" +
136
            "      \"bannerId\":\"${banner.bannerId}\"\n" +
137
            "    }\n" +
138
            "    </#if>\n" +
139
            "    </#list>\n" +
140
            "  ]\n" +
141
            "}";
118
    @Autowrie
142
    @Autowrie
119
    private DiscoverBannerDao discoverBannerDao;
143
    private DiscoverBannerDao discoverBannerDao;
120
    @Autowrie
144
    @Autowrie
252
        StringTemplateLoader stringLoader = new StringTemplateLoader();
276
        StringTemplateLoader stringLoader = new StringTemplateLoader();
253
        stringLoader.putTemplate("slideTab.html", templatePc);
277
        stringLoader.putTemplate("slideTab.html", templatePc);
254
        stringLoader.putTemplate("appfound.html", templateApp);
278
        stringLoader.putTemplate("appfound.html", templateApp);
279
        stringLoader.putTemplate("wxfound",templateWx);
255
        Configuration cfg = templateService.getCfg();
280
        Configuration cfg = templateService.getCfg();
256
        cfg.setTemplateLoader(stringLoader);
281
        cfg.setTemplateLoader(stringLoader);
257
        this.discoverBannerDao.end(con);
282
        this.discoverBannerDao.end(con);
269
            //this.genCnt("appfound.html", new File(generatePath+"/col_bannerApp.html"), root);
294
            //this.genCnt("appfound.html", new File(generatePath+"/col_bannerApp.html"), root);
270
            templateService.genCnt(cfg,"slideTab.html", new File(generatePath+"/col_banner.html"), root);
295
            templateService.genCnt(cfg,"slideTab.html", new File(generatePath+"/col_banner.html"), root);
271
            templateService.genCnt(cfg,"appfound.html", new File(generatePath+"/col_bannerApp.html"), root);
296
            templateService.genCnt(cfg,"appfound.html", new File(generatePath+"/col_bannerApp.html"), root);
297
            templateService.genCnt(cfg,"wxfound", new File(generatePath+"/col_bannerApp.json"), root);
272
        } catch (IOException | TemplateException e) {
298
        } catch (IOException | TemplateException e) {
273
            e.printStackTrace();
299
            e.printStackTrace();
274
        }
300
        }
298
        if (Objects.equals(banner, 1) || Objects.equals(banner, 2)) {
324
        if (Objects.equals(banner, 1) || Objects.equals(banner, 2)) {
299
            return "原创";
325
            return "原创";
300
        } else if (Objects.equals(banner, 3)) {
326
        } else if (Objects.equals(banner, 3)) {
301
            return "前沿";
327
            return "科研";
302
        } else if (Objects.equals(banner, 4)) {
328
        } else if (Objects.equals(banner, 4)) {
303
            return "经验";
329
            return "智库";
304
        } else if (Objects.equals(banner, 5)) {
330
        } else if (Objects.equals(banner, 5)) {
305
            return "检测";
331
            return "检测";
306
        } else if (Objects.equals(banner, 6)) {
332
        } else if (Objects.equals(banner, 6)) {
307
            return "会议";
333
            return "会议";
308
        } else if (Objects.equals(banner, 7)) {
334
        } else if (Objects.equals(banner, 7)) {
309
            return "访谈";
335
            return "企业";
310
        } else if (Objects.equals(banner, 8)) {
336
        } else if (Objects.equals(banner, 8)) {
311
            return "招聘";
337
            return "招聘";
312
        } else if (Objects.equals(banner, 9)) {
338
        } else if (Objects.equals(banner, 9)) {