xiongzhu 7 лет назад
Родитель
Сommit
3086648504

+ 50 - 0
src/main/java/com/thmodel/nimserver/Nimserver.java

@@ -457,6 +457,56 @@ public class Nimserver {
         }
     }
 
+    /**
+     * 发送普通消息
+     *
+     * @param from     发送者accid,用户帐号,最大32字符,必须保证一个APP内唯一
+     * @param to       ope==0是表示accid即用户id,ope==1表示tid即群id
+     * @param type     0 表示文本消息<br>
+     *                 1 表示图片<br>
+     *                 2 表示语音<br>
+     *                 3 表示视频<br>
+     *                 4 表示地理位置信息<br>
+     *                 6 表示文件<br>
+     *                 100 自定义消息类型(特别注意,对于未对接易盾反垃圾功能的应用,该类型的消息不会提交反垃圾系统检测)<br>
+     * @param body     请参考下方消息示例说明中对应消息的body字段,最大长度5000字符,为一个JSON串
+     * @param paramMap 其他参数
+     * @return
+     */
+    public String sendBatchMsg(String from, String to, String type, String body, Map<String, String> paramMap) {
+        try {
+            String url = "https://api.netease.im/nimserver/msg/sendBatchMsg.action";
+            //初始化
+            HttpPost httpPost = init(url, NimConfig.contentType_1);
+
+            // 设置请求的参数
+            List<NameValuePair> nvps = new ArrayList<>();
+            nvps.add(new BasicNameValuePair("fromAccid", from));
+            nvps.add(new BasicNameValuePair("toAccids", to));
+            nvps.add(new BasicNameValuePair("type", type));
+            nvps.add(new BasicNameValuePair("body", body));
+
+            for (Entry<String, String> item : paramMap.entrySet()) {
+                String key = item.getKey();
+                String val = item.getValue();
+                nvps.add(new BasicNameValuePair(key, val));
+            }
+
+            httpPost.setEntity(new UrlEncodedFormEntity(nvps, "utf-8"));
+
+            // 执行请求
+            HttpResponse response = httpClient.execute(httpPost);
+
+            // 打印执行结果
+            String result = EntityUtils.toString(response.getEntity(), "utf-8");
+            return result;
+        } catch (Exception e) {
+            System.out.println(e.getMessage());
+            return NimConfig.errorNeteaseMessage;
+        }
+    }
+
+
     public String history(String from, String to, String begintime, String endtime) {
         try {
             String url = "https://api.netease.im/nimserver/history/querySessionMsg.action";

+ 2 - 0
src/main/java/com/thmodel/service/ModelInfoService.java

@@ -552,4 +552,6 @@ public interface ModelInfoService {
     List<JSONObject> fans(int modelPK, int page, int size);
 
     int fansCount(int modelPK);
+
+    String sendMsgToFans(int modelpk, String msg);
 }

+ 25 - 0
src/main/java/com/thmodel/service/impl/ModelInfoServiceImpl.java

@@ -25,6 +25,7 @@ import com.thmodel.entity.ModelPrivate;
 import com.thmodel.entity.ModelPrivateDiscuss;
 import com.thmodel.entity.ModelPrivateItem;
 import com.thmodel.entity.ReportInfo;
+import com.thmodel.nimserver.Nimserver;
 import com.thmodel.service.ModelInfoService;
 import com.thmodel.util.CommentUtils;
 import com.thmodel.util.MyDateUtil;
@@ -33,6 +34,12 @@ import net.sf.json.JSONArray;
 import net.sf.json.JSONObject;
 
 import com.thmodel.page.Page;
+import org.jooq.DSLContext;
+import org.jooq.Record;
+import org.jooq.Result;
+import org.jooq.impl.DSL;
+
+import static com.thmodel.jooq.Tables.MODELFAN;
 
 public class ModelInfoServiceImpl implements ModelInfoService {
 
@@ -911,4 +918,22 @@ public class ModelInfoServiceImpl implements ModelInfoService {
     public int fansCount(int modelPK) {
         return modelinfodao.fansCount(modelPK);
     }
+
+    @Override
+    public String sendMsgToFans(int modelpk, String msg) {
+        DSLContext ctx = DSL.using(DbConnection.getPara("MySQLURL"));
+
+        Result<Record> result = ctx.select().from(MODELFAN).where(MODELFAN.MODELPK.equal(modelpk)).fetch();
+        JSONArray toAccids = new JSONArray();
+        for (Record record : result) {
+            toAccids.add(record.get(MODELFAN.MEMBERPK));
+        }
+        Nimserver nimserver = new Nimserver();
+        JSONObject body = new JSONObject();
+        body.put("msg", msg);
+        nimserver.sendBatchMsg("system", toAccids.toString(), "0", body.toString(), new HashMap<>());
+
+        ctx.close();
+        return "success";
+    }
 }

+ 7 - 0
src/main/java/com/thmodel/servlet/ModelInfoServlet.java

@@ -782,6 +782,13 @@ public class ModelInfoServlet extends HttpServlet {
                 resultJson.put("success", modelInfoService.recommendApply(modelpk));
             }
 
+            // 群发消息
+            else if (action.equalsIgnoreCase("sendMsgToFans")) {
+                int modelpk = Integer.parseInt(CommentUtils.myToString(request.getParameter("modelpk")));//会员pk
+                String msg = CommentUtils.myToString(request.getParameter("msg"));
+                resultJson.put("success", modelInfoService.sendMsgToFans(modelpk, msg));
+            }
+
 
         } catch (Exception e) {
             e.printStackTrace();

+ 6 - 3
src/main/webapp/dancer/component/player.jsp

@@ -1,8 +1,6 @@
 <%@ page contentType="text/html;charset=UTF-8" language="java" %>
 <style>
     .player {
-        min-width: 158px;
-        width: 158px;
         height: 248px;
         background: rgba(255, 255, 255, 1);
         box-shadow: 0px 6px 12px 0px rgba(0, 0, 0, 0.08);
@@ -81,7 +79,7 @@
 <script>
     var playerComponent = {
         props: ['info'],
-        template: `<div class="player" @click="detail">
+        template: `<div class="player" @click="detail" :style="{width:width+'px'}">
                     <div class="playImg"
                          :style="{backgroundImage: 'url(../'+info.pic+')'}">
                         <div class="ad">{{info.PK}}号-{{info.gift}}礼物</div>
@@ -94,6 +92,11 @@
                         </div>
                     </div>
                 </div>`,
+        data: function () {
+            return {
+                width: (window.innerWidth - 60) / 2
+            }
+        },
         methods: {
             detail: function () {
                 function getQueryString(name) {

+ 23 - 18
src/main/webapp/dancer/index.jsp

@@ -13,6 +13,7 @@
 <%@ page import="java.util.List" %>
 <%@ page import="org.apache.commons.lang.StringUtils" %>
 <%@ page import="org.jooq.Record" %>
+<%@ page import="java.sql.Timestamp" %>
 <%@ page contentType="text/html;charset=UTF-8" language="java" %>
 <%
     int activitypk = JspUtils.getInt(request, session, "activitypk");
@@ -32,13 +33,19 @@
                 .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)
+        Field<Object> lastGift = ctx.select(DSL.ifnull(DSL.max(GIFT_RECORD.DATE), Timestamp.valueOf("1970-01-01 00:00:00")))
+                .from(GIFT_RECORD)
+                .where(GIFT_RECORD.MODELPK.equal(MODELINFO.PK))
+                .and(GIFT_RECORD.ACTIVITYPK.equal(activitypk))
+                .and(GIFT_RECORD.ACCFLAG.equal(9))
+                .asField("lastGift");
+        Result list = ctx.select(PARTTYSIGN.PK, PARTTYSIGN.PIC, MEMBERINFO.PET, MODELINFO.PK.as("modelpk"), gift, lastGift)
                 .from(PARTTYSIGN)
                 .join(MEMBERINFO).on(PARTTYSIGN.MEMBERPK.equal(MEMBERINFO.PK))
                 .join(MODELINFO).on(MODELINFO.MEMBERPK.equal(PARTTYSIGN.MEMBERPK))
                 .where(PARTTYSIGN.PARTTYPK.equal(activitypk))
                 .and(PARTTYSIGN.PASS.equal(1))
-                .orderBy(PARTTYSIGN.PK.desc())
+                .orderBy(lastGift.desc(), PARTTYSIGN.PK.desc())
                 .limit(20 * (pageIndex - 1), 20)
                 .fetch();
         JspUtils.writeJson(response, DBRecordsPack.Pack(list));
@@ -70,7 +77,6 @@
             modelpk = record1.get(MODELINFO.PK);
         }
     }
-
     ctx.close();
 %>
 <html>
@@ -220,7 +226,7 @@
             border-radius: 20px 20px 0 0;
             background: rgba(255, 255, 255, 1);
             transform: translateY(-20px);
-            padding: 20px 20px 60px 20px;
+            padding: 20px 20px 90px 20px;
         }
 
         .mainTitle {
@@ -241,7 +247,7 @@
         .ranking {
             position: fixed;
             right: 14px;
-            bottom: 5px;
+            bottom: 60px;
             width: 56px;
             z-index: 50;
         }
@@ -276,12 +282,13 @@
     <template>
         <div class="content-top">
             <div class="message">
-                <img src="${pageContext.request.contextPath}/image/dancer/img_wuwang.png" alt="">
-                <div class="text">
-                    {{time}}
+                <img src="${pageContext.request.contextPath}/image/dancer/img_wuwang.png" alt=""
+                     style="width: 202px;height: 33px;margin-top: 16px">
+                <div class="text" style="margin-top: 7px">
+                    2018.12.17-2018.12.30
                 </div>
                 <div class="text">
-                    {{message}}
+                    谁是舞王模特大赛
                 </div>
                 <a href="activityDetail.jsp" class="btn">
                     查看详情
@@ -338,10 +345,9 @@
             </div>
         </div>
         <a href="rankingList.jsp?activitypk=<%=activitypk%>&memberpk=<%=memberpk%>">
-            <img src="${pageContext.request.contextPath}/image/dancer/icon_paihang.png" class="ranking" alt=""
-                 :style="{bottom: isModel ? '60px' : '5px'}">
+            <img src="${pageContext.request.contextPath}/image/dancer/icon_paihang.png" class="ranking" alt="">
         </a>
-        <div class="btn-apply" v-if="isModel" @click="signUp" :class="btnClass">{{btnText}}</div>
+        <div class="btn-apply" @click="signUp" :class="btnClass">{{btnText}}</div>
     </template>
 </div>
 
@@ -355,8 +361,6 @@
         el: '#app',
         data() {
             return {
-                time: " 2018.12.17-2018.12.30",
-                message: "谁是舞王模特大赛",
                 ads: <%=ads%>,
                 swiperOption: {
                     autoplay: true,
@@ -376,6 +380,7 @@
                 joinFlag: true,
                 notFlag: true,
                 isModel: /chmoModel/i.test(navigator.userAgent),
+                iOS: /iPhone/i.test(navigator.userAgent),
                 signState: <%=signState%>,
                 modelpk: ''
             }
@@ -420,9 +425,6 @@
                 if (!this.joinFlag) {
                     return
                 }
-                if (this.currentPage == 1) {
-                    this.joinList = []
-                }
                 $.get({
                     url: '',
                     data: {
@@ -436,6 +438,9 @@
                         if (res.length == 0) {
                             this.joinFlag = false
                         }
+                        if (this.currentPage == 1) {
+                            this.joinList = []
+                        }
                         this.joinList = this.joinList.concat(res)
                     }.bind(this)
                 })
@@ -460,7 +465,7 @@
                             activitypk: <%=activitypk%>
                         })
                     } catch (e) {
-                        console.log(e)
+                        window.location.href = 'https://itunes.apple.com/cn/app/id1434011196?mt=8'
                     }
                 } else if (this.signState === 1) {
                     if ('<%=modelpk%>' > 0) {

+ 0 - 1
src/main/webapp/dancer/meta.jsp

@@ -10,7 +10,6 @@
 <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
 <script src="https://cdn.bootcss.com/vue/2.5.17/vue.js"></script>
 
-
 <style>
     html, body {
         padding: 0;

+ 17 - 4
src/main/webapp/dancer/modelDetail.jsp

@@ -92,7 +92,15 @@
                 .fetchOne(0, int.class) > 0;
     }
     pageContext.setAttribute("isFollow", isFollow);
-    pageContext.setAttribute("ios", request.getHeader("User-Agent").toLowerCase().contains("iphone"));
+
+    boolean isSign = false;
+    if (memberpk > 0) {
+        isSign = ctx.selectCount().from(PARTTYSIGN)
+                .where(PARTTYSIGN.PARTTYPK.equal(activitypk))
+                .and(PARTTYSIGN.MEMBERPK.equal(memberpk))
+                .fetchOne(0, int.class) > 0;
+    }
+    pageContext.setAttribute("isSign", isSign);
     ctx.close();
 %>
 <!DOCTYPE html>
@@ -109,6 +117,7 @@
     <script src="https://cdn.bootcss.com/vue/2.5.17/vue.js"></script>
     <script src="${pageContext.request.contextPath}/js/swiper.min.js"></script>
     <script src="${pageContext.request.contextPath}/js/vue-awesome-swiper.js"></script>
+
     <style>
         html, body {
             padding: 0;
@@ -532,7 +541,9 @@
         </div>
         <div style="text-align: center;margin-top: 6px">
             <button class="detail" @click="detail">查看详细资料</button>
-            <button class="follow" @click="detail" :class="{isFollow:isFollow}">{{isFollow ? '已关注' : '关注'}}</button>
+            <button class="follow" @click="detail" :class="{isFollow:isFollow}" v-if="!isModel">{{isFollow ? '已关注' :
+                '关注'}}
+            </button>
         </div>
         <div class="divider"></div>
         <div class="numbers">
@@ -573,7 +584,9 @@
             <img src="${pageContext.request.contextPath}/image/icon_into.png" class="into">
         </div>
         <div class="apply-container">
-            <button class="apply" v-if="isModel" @click="signUp">我也要参加</button>
+            <c:if test="${!isSign}">
+                <button class="apply" @click="signUp">我也要参加</button>
+            </c:if>
         </div>
         <div style="font-size:16px;font-weight:700;text-align: center;line-height: 24px;margin-top: 30px;margin-bottom: 15px"><span
                 style="font-size: 24px;vertical-align: middle;">·</span>&nbsp;礼物列表&nbsp;<span
@@ -766,7 +779,7 @@
                         activitypk: <%=activitypk%>
                     })
                 } catch (e) {
-                    console.log(e)
+                    window.location.href = 'https://itunes.apple.com/cn/app/id1434011196?mt=8'
                 }
             }
         }

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
src/main/webapp/js/inobounce.min.js


Некоторые файлы не были показаны из-за большого количества измененных файлов