Browse Source

谁是舞王

xiongzhu 7 years ago
parent
commit
68a85a6c55

+ 90 - 0
src/main/java/com/thmodel/util/JspUtils.java

@@ -0,0 +1,90 @@
+package com.thmodel.util;
+
+import net.sf.json.JSONObject;
+import org.apache.commons.lang.StringUtils;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import java.io.IOException;
+import java.util.List;
+
+public class JspUtils {
+    public static int getInt(HttpServletRequest request, String name) {
+        int value;
+        try {
+            String str = request.getParameter(name);
+            value = Integer.valueOf(str);
+        } catch (Exception e) {
+            value = 0;
+        }
+        return value;
+    }
+
+    public static int getInt(HttpServletRequest request, HttpSession session, String name) {
+        int value;
+        try {
+            String str = request.getParameter(name);
+            value = Integer.valueOf(str);
+        } catch (Exception e) {
+            try {
+                value = (int) session.getAttribute(name);
+            } catch (Exception ee) {
+                value = 0;
+            }
+        }
+        return value;
+    }
+
+    public static String getString(HttpServletRequest request, String name) {
+        return request.getParameter(name);
+    }
+
+    public static String getString(HttpServletRequest request, HttpSession session, String name) {
+        String value = request.getParameter(name);
+        if (StringUtils.isEmpty(value)) {
+            Object obj = session.getAttribute(name);
+            if (obj instanceof String) {
+                value = (String) obj;
+            } else {
+                value = "";
+            }
+        }
+        return value;
+    }
+
+    public static boolean getBoolean(HttpServletRequest request, String name) {
+        return getBoolean(request, name, false);
+    }
+
+    public static boolean getBoolean(HttpServletRequest request, String name, boolean defValue) {
+        boolean value = defValue;
+        try {
+            value = Boolean.parseBoolean(request.getParameter(name));
+        } catch (Exception ignored) {
+        }
+        return value;
+    }
+
+    public static boolean getBoolean(HttpServletRequest request, HttpSession session, String name, boolean defValue) {
+        boolean value = defValue;
+        try {
+            value = Boolean.parseBoolean(request.getParameter(name));
+        } catch (Exception e) {
+            try {
+                value = (boolean) request.getAttribute(name);
+            } catch (Exception ignored) {
+            }
+        }
+        return value;
+    }
+
+    public static void writeJson(HttpServletResponse response, List<JSONObject> jsonObjects) {
+        response.setContentType("application/json");
+        try {
+            response.getWriter().print(jsonObjects);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+}

+ 2 - 2
src/main/webapp/dancer/component/player.jsp

@@ -59,10 +59,10 @@
         border-radius: 11px;
         border-radius: 11px;
         display: flex;
         display: flex;
         align-items: center;
         align-items: center;
-
+        justify-content: center;
     }
     }
 
 
-    .player .title .btn:active{
+    .player .title .btn:active {
         opacity: 0.8;
         opacity: 0.8;
     }
     }
 
 

+ 64 - 20
src/main/webapp/dancer/index.jsp

@@ -1,11 +1,54 @@
-<%--
-  Created by IntelliJ IDEA.
-  User: drew
-  Date: 2018/12/26
-  Time: 9:28 AM
-  To change this template use File | Settings | File Templates.
---%>
+<%@ page import="com.thmodel.dbconnection.DbConnection" %>
+<%@ page import="org.jooq.impl.DSL" %>
+<%@ page import="org.jooq.DSLContext" %>
+<%@ page import="com.thmodel.util.JspUtils" %>
+<%@ page import="static com.thmodel.jooq.Tables.PARTTYSIGN" %>
+<%@ page import="org.jooq.Result" %>
+<%@ page import="static com.thmodel.jooq.Tables.MEMBERINFO" %>
+<%@ page import="static com.thmodel.jooq.Tables.MODELINFO" %>
+<%@ page import="org.jooq.Field" %>
+<%@ page import="static com.thmodel.jooq.Tables.*" %>
+<%@ page import="com.thmodel.util.DBRecordsPack" %>
 <%@ page contentType="text/html;charset=UTF-8" language="java" %>
 <%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%
+    int activitypk = JspUtils.getInt(request, session, "activitypk");
+    session.setAttribute("activitypk", activitypk);
+
+    int modelpk = JspUtils.getInt(request, "modelpk");
+    int memberpk = JspUtils.getInt(request, "memberpk");
+    String operator = request.getParameter("operator");
+    DSLContext ctx = DSL.using(DbConnection.getPara("MySQLURL"));
+    if ("signList".equals(operator)) {
+        int pageIndex = JspUtils.getInt(request, "page");
+        pageIndex = pageIndex == 0 ? 1 : pageIndex;
+        Field<Object> gift = ctx.select(DSL.ifnull(DSL.sum(GIFT_RECORD.COIN), 0))
+                .from(GIFT_RECORD)
+                .where(GIFT_RECORD.MODELPK.equal(MODELINFO.PK))
+                .and(GIFT_RECORD.ACTIVITYPK.equal(activitypk))
+                .and(GIFT_RECORD.ACCFLAG.equal(9))
+                .asField("gift");
+        Result list = ctx.select(PARTTYSIGN.PK, PARTTYSIGN.PIC, MEMBERINFO.PET, MODELINFO.PK.as("modelpk"), gift)
+                .from(PARTTYSIGN)
+                .join(MEMBERINFO).on(PARTTYSIGN.MEMBERPK.equal(MEMBERINFO.PK))
+                .join(MODELINFO).on(MODELINFO.MEMBERPK.equal(PARTTYSIGN.MEMBERPK))
+                .where(PARTTYSIGN.PARTTYPK.equal(activitypk))
+                .orderBy(PARTTYSIGN.PK.desc())
+                .limit(20 * (pageIndex - 1), 20)
+                .fetch();
+        JspUtils.writeJson(response, DBRecordsPack.Pack(list));
+        ctx.close();
+        return;
+    }
+    pageContext.setAttribute("viewNum", ctx.select(DSL.sum(PARTTYSIGN.VIEW))
+            .from(PARTTYSIGN)
+            .where(PARTTYSIGN.PARTTYPK.equal(activitypk))
+            .fetchOne(0, int.class));
+    pageContext.setAttribute("signNum", ctx.selectCount().from(PARTTYSIGN)
+            .where(PARTTYSIGN.PARTTYPK.equal(activitypk))
+            .fetchOne(0, int.class));
+
+
+%>
 <html>
 <html>
 <head>
 <head>
     <title>谁是舞王模特大赛</title>
     <title>谁是舞王模特大赛</title>
@@ -86,7 +129,7 @@
             flex-direction: column;
             flex-direction: column;
             align-items: center;
             align-items: center;
             flex-grow: 1;
             flex-grow: 1;
-            text-decoration:none;
+            text-decoration: none;
         }
         }
 
 
         .searchContent .item .title {
         .searchContent .item .title {
@@ -115,9 +158,11 @@
             justify-content: center;
             justify-content: center;
             margin: 0 15px;
             margin: 0 15px;
         }
         }
-        .searchContent .searchBtn:active{
-            background-color:#ebebeb;
+
+        .searchContent .searchBtn:active {
+            background-color: #ebebeb;
         }
         }
+
         .searchContent .searchBtn img {
         .searchContent .searchBtn img {
             width: 30px;
             width: 30px;
             height: 30px;
             height: 30px;
@@ -144,14 +189,14 @@
             text-align: center;
             text-align: center;
         }
         }
 
 
-        .list{
+        .list {
             display: flex;
             display: flex;
             justify-content: space-between;
             justify-content: space-between;
             align-items: center;
             align-items: center;
             flex-wrap: wrap;
             flex-wrap: wrap;
         }
         }
 
 
-        .ranking{
+        .ranking {
             position: fixed;
             position: fixed;
             right: 14px;
             right: 14px;
             bottom: 5px;
             bottom: 5px;
@@ -187,7 +232,7 @@
             <div class="searchContent">
             <div class="searchContent">
                 <div class="item">
                 <div class="item">
                     <div class="title">
                     <div class="title">
-                        {{join}}
+                        ${signNum}
                     </div>
                     </div>
                     <div class="sub">
                     <div class="sub">
                         参赛人数
                         参赛人数
@@ -195,13 +240,13 @@
                 </div>
                 </div>
                 <div class="item">
                 <div class="item">
                     <div class="title">
                     <div class="title">
-                        {{watch}}
+                        ${viewNum}
                     </div>
                     </div>
                     <div class="sub">
                     <div class="sub">
                         浏览人数
                         浏览人数
                     </div>
                     </div>
                 </div>
                 </div>
-                <a href="search.jsp" class="item searchBtn" >
+                <a href="search.jsp" class="item searchBtn">
                     <img src="${pageContext.request.contextPath}/image/dancer/icon_sousuo.png" alt="">
                     <img src="${pageContext.request.contextPath}/image/dancer/icon_sousuo.png" alt="">
                     <span>搜索</span>
                     <span>搜索</span>
                 </a>
                 </a>
@@ -227,7 +272,7 @@
             </div>
             </div>
         </div>
         </div>
         <a href="rankingList.jsp">
         <a href="rankingList.jsp">
-            <img src="${pageContext.request.contextPath}/image/dancer/icon_paihang.png"  class="ranking" alt="">
+            <img src="${pageContext.request.contextPath}/image/dancer/icon_paihang.png" class="ranking" alt="">
         </a>
         </a>
 
 
     </template>
     </template>
@@ -246,7 +291,7 @@
                 join: 263,
                 join: 263,
                 watch: 38648,
                 watch: 38648,
                 swiperList: [{}, {}, {}],
                 swiperList: [{}, {}, {}],
-                joinList:[]
+                joinList: []
             }
             }
         },
         },
         mounted() {
         mounted() {
@@ -255,12 +300,11 @@
                 pagination: {
                 pagination: {
                     el: '.swiper-pagination',
                     el: '.swiper-pagination',
                     clickable: true,
                     clickable: true,
-
                 },
                 },
             })
             })
         },
         },
-        components:{
-            'player-item':playerComponent
+        components: {
+            'player-item': playerComponent
         },
         },
         methods: {}
         methods: {}
     })
     })

+ 7 - 9
src/main/webapp/dancer/modelDetail.jsp

@@ -15,13 +15,7 @@
 <%@ page import="java.util.function.Function" %>
 <%@ page import="java.util.function.Function" %>
 <%@ page import="org.jooq.Record1" %>
 <%@ page import="org.jooq.Record1" %>
 <%@ page import="java.util.regex.Pattern" %>
 <%@ page import="java.util.regex.Pattern" %>
-<%@ page import="org.jooq.Result" %><%--
-  Created by IntelliJ IDEA.
-  User: drew
-  Date: 2018/12/26
-  Time: 11:10 AM
-  To change this template use File | Settings | File Templates.
---%>
+<%@ page import="org.jooq.Result" %>
 <%@ page contentType="text/html;charset=UTF-8" language="java" %>
 <%@ page contentType="text/html;charset=UTF-8" language="java" %>
 <%
 <%
     int activitypk = Integer.valueOf(request.getParameter("activitypk"));
     int activitypk = Integer.valueOf(request.getParameter("activitypk"));
@@ -122,6 +116,10 @@
             -moz-osx-font-smoothing: grayscale;
             -moz-osx-font-smoothing: grayscale;
         }
         }
 
 
+        * {
+            outline: none;
+        }
+
         a {
         a {
             text-decoration: none;
             text-decoration: none;
         }
         }
@@ -560,7 +558,7 @@
         <div class="cover" @click="play">
         <div class="cover" @click="play">
             <img src="${pageContext.request.contextPath}/image/icon_play.png" class="play">
             <img src="${pageContext.request.contextPath}/image/icon_play.png" class="play">
         </div>
         </div>
-        <div class="intro"><%=signInfo.get("text")%>
+        <div class="intro"><%=signInfo.getOrDefault("text", "")%>
         </div>
         </div>
         <div class="fans-list">
         <div class="fans-list">
             <div style="font-size:14px;color: #000;font-weight: 700;margin-left: 15px;">粉丝团</div>
             <div style="font-size:14px;color: #000;font-weight: 700;margin-left: 15px;">粉丝团</div>
@@ -579,7 +577,7 @@
                 style="font-size: 24px;vertical-align: middle;">·</span></div>
                 style="font-size: 24px;vertical-align: middle;">·</span></div>
         <c:forEach var="item" items="${gifts}">
         <c:forEach var="item" items="${gifts}">
             <div class="gift">
             <div class="gift">
-                <img src="/${item.hPhoto}">
+                <img src="${pageContext.request.contextPath}/${item.hPhoto}">
                 <div class="info">
                 <div class="info">
                     <div class="name">${item.Pet}送给了TA一个${item.name}</div>
                     <div class="name">${item.Pet}送给了TA一个${item.name}</div>
                     <div class="date">{{getTime(${item.date})}}</div>
                     <div class="date">{{getTime(${item.date})}}</div>

+ 64 - 24
src/main/webapp/dancer/search.jsp

@@ -1,11 +1,50 @@
-<%--
-  Created by IntelliJ IDEA.
-  User: drew
-  Date: 2018/12/26
-  Time: 9:28 AM
-  To change this template use File | Settings | File Templates.
---%>
+<%@ page import="com.thmodel.dbconnection.DbConnection" %>
+<%@ page import="org.jooq.impl.DSL" %>
+<%@ page import="org.jooq.DSLContext" %>
+<%@ page import="com.thmodel.util.JspUtils" %>
+<%@ page import="static com.thmodel.jooq.Tables.PARTTYSIGN" %>
+<%@ page import="org.jooq.Result" %>
+<%@ page import="static com.thmodel.jooq.Tables.MEMBERINFO" %>
+<%@ page import="static com.thmodel.jooq.Tables.MODELINFO" %>
+<%@ page import="org.jooq.Field" %>
+<%@ page import="static com.thmodel.jooq.Tables.*" %>
+<%@ page import="com.thmodel.util.DBRecordsPack" %>
 <%@ page contentType="text/html;charset=UTF-8" language="java" %>
 <%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%
+    int activitypk = JspUtils.getInt(request, session, "activitypk");
+    session.setAttribute("activitypk", activitypk);
+
+    int modelpk = JspUtils.getInt(request, "modelpk");
+    int memberpk = JspUtils.getInt(request, "memberpk");
+
+    String operator = request.getParameter("operator");
+    DSLContext ctx = DSL.using(DbConnection.getPara("MySQLURL"));
+
+    if ("search".equals(operator)) {
+        int pageIndex = JspUtils.getInt(request, "page");
+        String keyword = JspUtils.getString(request, "keyword");
+        pageIndex = pageIndex == 0 ? 1 : pageIndex;
+        Field<Object> gift = ctx.select(DSL.ifnull(DSL.sum(GIFT_RECORD.COIN), 0))
+                .from(GIFT_RECORD)
+                .where(GIFT_RECORD.MODELPK.equal(MODELINFO.PK))
+                .and(GIFT_RECORD.ACTIVITYPK.equal(activitypk))
+                .and(GIFT_RECORD.ACCFLAG.equal(9))
+                .asField("gift");
+        Result list = ctx.select(PARTTYSIGN.PK, PARTTYSIGN.PIC, MEMBERINFO.HPHOTO, MEMBERINFO.PET, MODELINFO.PK.as("modelpk"), gift)
+                .from(PARTTYSIGN)
+                .join(MEMBERINFO).on(PARTTYSIGN.MEMBERPK.equal(MEMBERINFO.PK))
+                .join(MODELINFO).on(MODELINFO.MEMBERPK.equal(PARTTYSIGN.MEMBERPK))
+                .where(PARTTYSIGN.PARTTYPK.equal(activitypk))
+                .and(MEMBERINFO.PET.containsIgnoreCase(keyword).or(MEMBERINFO.TEL.containsIgnoreCase(keyword)))
+                .orderBy(PARTTYSIGN.PK.desc())
+                .limit(20 * (pageIndex - 1), 20)
+                .fetch();
+        JspUtils.writeJson(response, DBRecordsPack.Pack(list));
+        ctx.close();
+        return;
+    }
+    ctx.close();
+%>
 <html>
 <html>
 <head>
 <head>
     <title>搜索艺人</title>
     <title>搜索艺人</title>
@@ -113,14 +152,13 @@
 
 
         @keyframes bounce-in {
         @keyframes bounce-in {
             0% {
             0% {
-               opacity: 0;
+                opacity: 0;
             }
             }
             100% {
             100% {
                 opacity: 0;
                 opacity: 0;
             }
             }
         }
         }
 
 
-
         .result {
         .result {
             flex-grow: 1;
             flex-grow: 1;
             display: flex;
             display: flex;
@@ -140,24 +178,26 @@
             overflow: auto;
             overflow: auto;
             background: rgba(242, 244, 245, 1);
             background: rgba(242, 244, 245, 1);
         }
         }
-        .resultList{
+
+        .resultList {
             padding-top: 20px;
             padding-top: 20px;
         }
         }
 
 
-        .nothing{
+        .nothing {
             display: flex;
             display: flex;
             flex-direction: column;
             flex-direction: column;
             align-items: center;
             align-items: center;
         }
         }
-        .nothing img{
+
+        .nothing img {
             width: 140px;
             width: 140px;
             height: 140px;
             height: 140px;
         }
         }
 
 
-        .nothing p{
-            font-size:13px;
-            color:rgba(170,172,173,1);
-            line-height:18px;
+        .nothing p {
+            font-size: 13px;
+            color: rgba(170, 172, 173, 1);
+            line-height: 18px;
             margin-top: 10px;
             margin-top: 10px;
             text-align: center;
             text-align: center;
         }
         }
@@ -199,18 +239,18 @@
         </transition>
         </transition>
 
 
         <transition name="slide-right">
         <transition name="slide-right">
-        <div class="result" v-if="!showHistory">
-            <div class="resultTitle">搜索结果</div>
+            <div class="result" v-if="!showHistory">
+                <div class="resultTitle">搜索结果</div>
 
 
-            <div class="resultList">
-                <search-result v-for="item in 2"></search-result>
+                <div class="resultList">
+                    <search-result v-for="item in 2"></search-result>
 
 
-                <div class="nothing">
-                    <img src="${pageContext.request.contextPath}/image/dancer/kong_sousuo.png" alt="">
-                    <p>什么都没有搜到哦~</p>
+                    <div class="nothing">
+                        <img src="${pageContext.request.contextPath}/image/dancer/kong_sousuo.png" alt="">
+                        <p>什么都没有搜到哦~</p>
+                    </div>
                 </div>
                 </div>
             </div>
             </div>
-        </div>
         </transition>
         </transition>
 
 
     </template>
     </template>

BIN
src/main/webapp/image/1.jpg


BIN
src/main/webapp/image/2.jpg