Parcourir la source

2020-01-15 年前修改

hugeng il y a 4 ans
Parent
commit
f2c4ae86c3

+ 24 - 19
src/main/java/com/yc/education/controller/ForumController.java

@@ -55,27 +55,32 @@ public class ForumController {
      * @Date: 2019-12-12
      */
     @RequestMapping("forumadd")
-    public ModelAndView forumInsert(Forum forum) {
+    public ModelAndView forumInsert(Forum forum, HttpSession httpSession) {
+        Object attribute = httpSession.getAttribute(userSessionname);
         ModelAndView modelAndView = new ModelAndView("index");
-        forum.setAddtime(new Date());
-        forum.setShows(0);
-        forum.setStatus(0);
-        forum.setTop(0);
-        forum.setLovecount(0);
-        try {
-            String types = StringUtils.join(forum.getTypearr(), ",");
-            boolean empty = StringUtils.isEmpty(types);
-            if (!empty) forum.setTypes(types);
-            String idas = StringUtils.join(forum.getIdas(), ",");
-            boolean emptys = StringUtils.isEmpty(idas);
-            if (!emptys) forum.setIda(idas);
-        } catch (Exception e) {
-            e.printStackTrace();
+        if (attribute != null) {
+            Users users = (Users) attribute;
+            forum.setAddtime(new Date());
+            forum.setShows(0);
+            forum.setStatus(0);
+            forum.setUsersid(users.getId());
+            forum.setTop(0);
+            forum.setLovecount(0);
+            try {
+                String types = StringUtils.join(forum.getTypearr(), ",");
+                boolean empty = StringUtils.isEmpty(types);
+                if (!empty) forum.setTypes(types);
+                String idas = StringUtils.join(forum.getIdas(), ",");
+                boolean emptys = StringUtils.isEmpty(idas);
+                if (!emptys) forum.setIda(idas);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            forum.setCounts(0);
+            forum.setCountup(0);
+            forumService.save(forum);
+            modelAndView.setViewName("redirect:/index.html");
         }
-        forum.setCounts(0);
-        forum.setCountup(0);
-        forumService.save(forum);
-        modelAndView.setViewName("redirect:/index.html");
         return modelAndView;
     }
 

+ 9 - 2
src/main/java/com/yc/education/controller/PersonController.java

@@ -185,13 +185,21 @@ public class PersonController {
     public ModelAndView download(int usersid,
                                  @RequestParam(required = false, defaultValue = "1") int type,
                                  @RequestParam(required = false, defaultValue = "1") int page,
-                                 @RequestParam(required = false, defaultValue = "10") int rows,
+                                 @RequestParam(required = false, defaultValue = "1000") int rows,
                                  @RequestParam(required = false, defaultValue = "") String data,
                                  @RequestParam(required = false, defaultValue = "") String ri,
                                  HttpSession httpSession) {
         ModelAndView modelAndView = new ModelAndView();
         List<Forum> forumList = new ArrayList<>();
         Users users = usersService.selectByKey(usersid);
+        Object attribute = httpSession.getAttribute(userSessionname);
+        if (attribute != null) {
+            Users users1 = (Users) attribute;
+            List<Downloadlist> downloadlistuser = downloadlistService.downloadListByUsersidOrForumid(users1.getId(), 0);
+            modelAndView.addObject("downloadlist", downloadlistuser);
+        }else {
+            modelAndView.addObject("downloadlist", null);
+        }
         List<Downloadlist> downloadlists = downloadlistService.downloadListByUsersidOrForumid(usersid, 0);
         if (type == 1) {
             for (Downloadlist downloadlist : downloadlists) {
@@ -241,7 +249,6 @@ public class PersonController {
         modelAndView.addObject("loveing", mvbianl);
         if (forumList.size() != 0)
             selectForums(forumList, usersService, htypeService);
-        PageHelper.startPage(page, rows);
         modelAndView.addObject("pageInfo", new PageInfo<>(forumList));
         modelAndView.addObject("users", users);
         return modelAndView;

+ 4 - 4
src/main/java/com/yc/education/mapper/ForumMapper.java

@@ -31,8 +31,8 @@ public interface ForumMapper extends MyMapper<Forum> {
             "   and types like concat('%',#{typeid},'%') " +
             " </if>" +
             " <if test='types == 3'>" +
-            "   and title like concat('%',#{title},'%') " +
-            "   or contexts like concat('%',#{title},'%') " +
+            "   and ( title like concat('%',#{title},'%') " +
+            "   or contexts like concat('%',#{title},'%') )" +
             " </if>" +
             " <if test='types == 1'>" +
             "   and title like concat('%',#{title},'%') " +
@@ -88,8 +88,8 @@ public interface ForumMapper extends MyMapper<Forum> {
             "  and status = #{status} " +
             " </if>" +
             " <if test='types == 3'>" +
-            "   and title like concat('%',#{title},'%') " +
-            "   or contexts like concat('%',#{title},'%') " +
+            "   and ( title like concat('%',#{title},'%') " +
+            "   or contexts like concat('%',#{title},'%') )" +
             " </if>" +
             " <if test='types == 1'>" +
             "   and title like concat('%',#{title},'%') " +

+ 28 - 17
src/main/webapp/WEB-INF/jsp/collect.jsp

@@ -129,7 +129,7 @@ To change this template use File | Settings | File Templates.
                                 <li class="true"><a
                                         href="${pageContext.request.contextPath}/person.html?usesrid=${users.id}">
                                     <c:if test="${userSession.id==users.id}">我的发布</c:if>
-                                    <c:if test="${userSession.id!=users.id}">TA的发布</c:if>(${pageInfo.total})</a>
+                                    <c:if test="${userSession.id!=users.id}">TA的发布</c:if>(${userscount})</a>
                                 </li>
                                 <li class="true"><a
                                         href="${pageContext.request.contextPath}/download.html?usersid=${users.id}&type=1">
@@ -191,7 +191,8 @@ To change this template use File | Settings | File Templates.
                                         </c:if>
                                         <div class="mess-meta clearfix">
                                             <c:forEach items="${itme.htype}" var="htypes">
-                                                <a class="mess-tag select" id="${htypes.id}">#${htypes.title}</a>
+                                                <a class="mess-tag select" onclick="sechindex(${htypes.id})"
+                                                   id="${htypes.id}">#${htypes.title}</a>
                                             </c:forEach>
                                         </div>
                                         <div class="mess-meta mess-meta-cmt clearfix">
@@ -247,9 +248,9 @@ To change this template use File | Settings | File Templates.
                                                 <span id="loves">${itme.lovecount}</span></a>
                                             <div class="mess-btn">
                                                 <c:if test="${itme.fileurl != null && itme.fileurl != ''}">
-                                                    <c:if test="${downloadlists != null && downloadlists != ''}">
+                                                    <c:if test="${downloadlist != null && downloadlist != ''}">
                                                         <c:set var="download" value="1" scope="session"/>
-                                                        <c:forEach items="${downloadlists}" var="downloadlists">
+                                                        <c:forEach items="${downloadlist}" var="downloadlists">
                                                             <c:if test="${downloadlists.forumid == itme.id}">
                                                                 <c:set var="download" value="2" scope="session"/>
                                                             </c:if>
@@ -276,7 +277,7 @@ To change this template use File | Settings | File Templates.
                                                             </c:if>
                                                         </c:if>
                                                     </c:if>
-                                                    <c:if test="${downloadlists == null || downloadlists == ''}">
+                                                    <c:if test="${downloadlist == null || downloadlist == ''}">
                                                         <c:if test="${itme.money == 0}">
                                                             <a class="my-download my-downloadbtn xiaz"
                                                                id="${itme.fileurl}" title="${itme.id}"><i
@@ -366,16 +367,16 @@ To change this template use File | Settings | File Templates.
                                     <%--</li>--%>
                                 </ul>
                             </div>
-                            <c:if test="${pageInfo.total > 10}">
-                                <div class="load-more">
-                                    <div class="load-more-content" style="display: block;">
-                                        <i class="iconfont"></i><input type="button" onclick="getfourm()"
-                                                                        class="load-more-content-btn"
-                                                                        value="加载更多">
-                                        <input hidden value="${pageInfo.nextPage}" id="pagenum"/>
-                                    </div>
-                                </div>
-                            </c:if>
+                            <%--                            <c:if test="${pageInfo.total > 10}">--%>
+                            <%--                                <div class="load-more">--%>
+                            <%--                                    <div class="load-more-content" style="display: block;">--%>
+                            <%--                                        <i class="iconfont"></i><input type="button" onclick="getfourm()"--%>
+                            <%--                                                                        class="load-more-content-btn"--%>
+                            <%--                                                                        value="加载更多">--%>
+                            <%--                                        <input hidden value="${pageInfo.nextPage}" id="pagenum"/>--%>
+                            <%--                                    </div>--%>
+                            <%--                                </div>--%>
+                            <%--                            </c:if>--%>
                         </div>
 
                     </div>
@@ -498,7 +499,7 @@ To change this template use File | Settings | File Templates.
             $.post("${pageContext.request.contextPath}/ajaxperson", {
                 "page": pagenum,
                 "rows": 10,
-                "types": 1,
+                "types": 2,
                 "usersid": '${users.id}',
             }, function (data) {
                 if (data.is) {
@@ -579,7 +580,7 @@ To change this template use File | Settings | File Templates.
                         if (x.htype != null && x.htype != '') {
                             for (var p = 0; p < x.htype.length; p++) {
                                 if (x.htype[p] != null && x.htype[p] != '') {
-                                    htypehtml = '<a class="mess-tag select" id=' + x.htype[p].id + ' >#' + x.htype[p].title + '</a>' + htypehtml;
+                                    htypehtml = '<a class="mess-tag select htypes" id=' + x.htype[p].id + ' >#' + x.htype[p].title + '</a>' + htypehtml;
                                 }
                             }
                         }
@@ -639,6 +640,12 @@ To change this template use File | Settings | File Templates.
         return oTime;
     }
 
+    $("body").on('click', ".htypes", function () {
+        var id = $(this).attr("id");
+        window.location.href = 'sechindex.html?typeid=' + id;
+    })
+
+
     //补零操作
     function addZero(num) {
         if (parseInt(num) < 10) {
@@ -647,6 +654,10 @@ To change this template use File | Settings | File Templates.
         return num;
     }
 
+    function sechindex(id) {
+        window.location.href = 'sechindex.html?typeid=' + id;
+    }
+
 
     /**
      * 下载

+ 29 - 18
src/main/webapp/WEB-INF/jsp/download.jsp

@@ -129,12 +129,12 @@ To change this template use File | Settings | File Templates.
                                 <li class="true"><a
                                         href="${pageContext.request.contextPath}/person.html?usesrid=${users.id}">
                                     <c:if test="${userSession.id==users.id}">我的发布</c:if>
-                                    <c:if test="${userSession.id!=users.id}">TA的发布</c:if>(${pageInfo.total})</a>
+                                    <c:if test="${userSession.id!=users.id}">TA的发布</c:if>(${userscount})</a>
                                 </li>
                                 <li class="my-current"><a
                                         href="${pageContext.request.contextPath}/download.html?usersid=${users.id}&type=1">
                                     <c:if test="${userSession.id==users.id}">我的下载</c:if>
-                                    <c:if test="${userSession.id!=users.id}">TA的下载</c:if>(${downloadlists.size()})</a>
+                                    <c:if test="${userSession.id!=users.id}">TA的下载</c:if>(${pageInfo.total})</a>
                                 </li>
                                 <li class="true"><a
                                         href="${pageContext.request.contextPath}/collect.html?usersid=${users.id}&type=2">
@@ -159,7 +159,7 @@ To change this template use File | Settings | File Templates.
                                             </span>
 
                                             <span class="fl"><a
-                                                    href="${pageContext.request.contextPath}/person.html?usesrid=${users.id}.html"
+                                                    href="${pageContext.request.contextPath}/person.html?usesrid=${users.id}"
                                                     class="mess-avatar"
                                                     style="background-image: url(${pageContext.request.contextPath}/${itme.users.tximg});"></a></span>
                                             <div class="clearfix fl">
@@ -191,7 +191,8 @@ To change this template use File | Settings | File Templates.
                                         </c:if>
                                         <div class="mess-meta clearfix">
                                             <c:forEach items="${itme.htype}" var="htypes">
-                                                <a class="mess-tag select" id="${htypes.id}">#${htypes.title}</a>
+                                                <a class="mess-tag select" onclick="sechindex(${htypes.id})"
+                                                   id="${htypes.id}">#${htypes.title}</a>
                                             </c:forEach>
                                         </div>
                                         <div class="mess-meta mess-meta-cmt clearfix">
@@ -247,9 +248,9 @@ To change this template use File | Settings | File Templates.
                                                 <span id="loves">${itme.lovecount}</span></a>
                                             <div class="mess-btn">
                                                 <c:if test="${itme.fileurl != null && itme.fileurl != ''}">
-                                                    <c:if test="${downloadlists != null && downloadlists != ''}">
+                                                    <c:if test="${downloadlist != null && downloadlist != ''}">
                                                         <c:set var="download" value="1" scope="session"/>
-                                                        <c:forEach items="${downloadlists}" var="downloadlists">
+                                                        <c:forEach items="${downloadlist}" var="downloadlists">
                                                             <c:if test="${downloadlists.forumid == itme.id}">
                                                                 <c:set var="download" value="2" scope="session"/>
                                                             </c:if>
@@ -276,7 +277,7 @@ To change this template use File | Settings | File Templates.
                                                             </c:if>
                                                         </c:if>
                                                     </c:if>
-                                                    <c:if test="${downloadlists == null || downloadlists == ''}">
+                                                    <c:if test="${downloadlist == null || downloadlist == ''}">
                                                         <c:if test="${itme.money == 0}">
                                                             <a class="my-download my-downloadbtn xiaz"
                                                                id="${itme.fileurl}" title="${itme.id}"><i
@@ -366,16 +367,16 @@ To change this template use File | Settings | File Templates.
                                     <%--</li>--%>
                                 </ul>
                             </div>
-                            <c:if test="${pageInfo.total > 10}">
-                                <div class="load-more">
-                                    <div class="load-more-content" style="display: block;">
-                                        <i class="iconfont"></i><input type="button" onclick="getfourm()"
-                                                                        class="load-more-content-btn"
-                                                                        value="加载更多">
-                                        <input hidden value="${pageInfo.nextPage}" id="pagenum"/>
-                                    </div>
-                                </div>
-                            </c:if>
+                            <%--                            <c:if test="${pageInfo.total > 10}">--%>
+                            <%--                                <div class="load-more">--%>
+                            <%--                                    <div class="load-more-content" style="display: block;">--%>
+                            <%--                                        <i class="iconfont"></i><input type="button" onclick="getfourm()"--%>
+                            <%--                                                                        class="load-more-content-btn"--%>
+                            <%--                                                                        value="加载更多">--%>
+                            <%--                                        <input hidden value="${pageInfo.nextPage}" id="pagenum"/>--%>
+                            <%--                                    </div>--%>
+                            <%--                                </div>--%>
+                            <%--                            </c:if>--%>
                         </div>
 
                     </div>
@@ -494,6 +495,7 @@ To change this template use File | Settings | File Templates.
      */
     function getfourm() {
         var pagenum = $("#pagenum").val();
+        console.log(pagenum);
         if (0 != pagenum) {
             $.post("${pageContext.request.contextPath}/ajaxperson", {
                 "page": pagenum,
@@ -579,7 +581,7 @@ To change this template use File | Settings | File Templates.
                         if (x.htype != null && x.htype != '') {
                             for (var p = 0; p < x.htype.length; p++) {
                                 if (x.htype[p] != null && x.htype[p] != '') {
-                                    htypehtml = '<a class="mess-tag select" id=' + x.htype[p].id + ' >#' + x.htype[p].title + '</a>' + htypehtml;
+                                    htypehtml = '<a class="mess-tag select htypes" id=' + x.htype[p].id + ' >#' + x.htype[p].title + '</a>' + htypehtml;
                                 }
                             }
                         }
@@ -659,6 +661,15 @@ To change this template use File | Settings | File Templates.
         $("#dload-urls").attr("title", $(this).attr('title'));
     })
 
+    function sechindex(id) {
+        window.location.href = 'sechindex.html?typeid=' + id;
+    }
+
+
+    $("body").on('click', ".htypes", function () {
+        var id = $(this).attr("id");
+        window.location.href = 'sechindex.html?typeid=' + id;
+    })
 
     $("body").on('click', ".goum", function () {
         $("#mibi").text($(this).attr('id') + "金币");

+ 24 - 8
src/main/webapp/WEB-INF/jsp/person.jsp

@@ -376,7 +376,8 @@ To change this template use File | Settings | File Templates.
                                         </c:if>
                                         <div class="mess-meta clearfix">
                                             <c:forEach items="${itme.htype}" var="htypes">
-                                                <a class="mess-tag select" id="${htypes.id}">#${htypes.title}</a>
+                                                <a class="mess-tag select" onclick="sechindex(${htypes.id})"
+                                                   id="${htypes.id}">#${htypes.title}</a>
                                             </c:forEach>
                                         </div>
 
@@ -433,9 +434,9 @@ To change this template use File | Settings | File Templates.
                                                 <span id="loves">${itme.lovecount}</span></a>
                                             <div class="mess-btn">
                                                 <c:if test="${itme.fileurl != null && itme.fileurl != ''}">
-                                                    <c:if test="${downloadlists != null && downloadlists != ''}">
+                                                    <c:if test="${downloadlist != null && downloadlist != ''}">
                                                         <c:set var="download" value="1" scope="session"/>
-                                                        <c:forEach items="${downloadlists}" var="downloadlists">
+                                                        <c:forEach items="${downloadlist}" var="downloadlists">
                                                             <c:if test="${downloadlists.forumid == itme.id}">
                                                                 <c:set var="download" value="2" scope="session"/>
                                                             </c:if>
@@ -462,7 +463,7 @@ To change this template use File | Settings | File Templates.
                                                             </c:if>
                                                         </c:if>
                                                     </c:if>
-                                                    <c:if test="${downloadlists == null || downloadlists == ''}">
+                                                    <c:if test="${downloadlist == null || downloadlist == ''}">
                                                         <c:if test="${itme.money == 0}">
                                                             <a class="my-download my-downloadbtn xiaz"
                                                                id="${itme.fileurl}" title="${itme.id}"><i
@@ -739,6 +740,10 @@ To change this template use File | Settings | File Templates.
         $(this).parents(".tag").remove();
     });
 
+    function sechindex(id) {
+        window.location.href = 'sechindex.html?typeid=' + id;
+    }
+
 
     function searchdata(data, riqi) {
         window.location.href = 'person.html?usesrid=' + '${users.id}' + '&data=' + data + '&ri=' + riqi;
@@ -785,7 +790,9 @@ To change this template use File | Settings | File Templates.
                     var html = '';
                     var yhtml = $(".list-item").html();
                     var list = data.data.list;
-                    console.log(list);
+                    if (data.data.nextPage == 0) {
+                        $(".load-more").hide();
+                    }
                     for (var i = list.length - 1; i >= 0; i--) {
                         var moneyhtml = '';
                         var imgurlhtml = '';
@@ -855,11 +862,14 @@ To change this template use File | Settings | File Templates.
                             }
                             imgurlhtml = imgurlhtml + '</ul>';
                         }
-                        for (var p = 0; p < x.htype.length; p++) {
-                            if (x.htype[p] != null && x.htype[p] != '') {
-                                htypehtml = '<a class="mess-tag select" id=' + x.htype[p].id + ' >#' + x.htype[p].title + '</a>' + htypehtml;
+                        if (x.htype != null && x.htype != '') {
+                            for (var p = 0; p < x.htype.length; p++) {
+                                if (x.htype[p] != null && x.htype[p] != '') {
+                                    htypehtml = '<a class="mess-tag select htypes"  id=' + x.htype[p].id + ' >#' + x.htype[p].title + '</a>' + htypehtml;
+                                }
                             }
                         }
+                        console.log(x);
                         if (x.fileurl != null && x.fileurl != '') {
                             if (downloadarr != null && downloadarr != '') {
                                 var vals = 1;
@@ -916,6 +926,12 @@ To change this template use File | Settings | File Templates.
         return oTime;
     }
 
+
+    $("body").on('click', ".htypes", function () {
+        var id = $(this).attr("id");
+        window.location.href = 'sechindex.html?typeid=' + id;
+    })
+
     //补零操作
     function addZero(num) {
         if (parseInt(num) < 10) {