Browse Source

谁是舞王

xiongzhu 7 years ago
parent
commit
01b5a65973

+ 3 - 1
src/main/java/com/thmodel/dao/MemberinfoDao.java

@@ -10,6 +10,8 @@ import com.thmodel.page.Page;
 import net.sf.json.JSONObject;
 import org.jooq.Record;
 
+import javax.servlet.http.HttpServletRequest;
+
 public interface MemberinfoDao {
 
     /**
@@ -19,7 +21,7 @@ public interface MemberinfoDao {
      * @param memberinfo
      * @return
      */
-    public int insertMemberinfoByRegister(MemberInfo memberinfo, String qrcode);
+    public int insertMemberinfoByRegister(MemberInfo memberinfo, String qrcode, HttpServletRequest request);
 
     /**
      * 模特端注册

+ 16 - 16
src/main/java/com/thmodel/dao/impl/MemberinfoDaoImpl.java

@@ -10,6 +10,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import javax.servlet.http.HttpServletRequest;
 import javax.sql.rowset.CachedRowSet;
 
 import com.thmodel.constants.AccountConstants;
@@ -41,7 +42,7 @@ public class MemberinfoDaoImpl implements MemberinfoDao {
     private static final Logger logger = LoggerFactory.getLogger(MemberinfoDaoImpl.class);
 
     @Override
-    public int insertMemberinfoByRegister(MemberInfo memberinfo, String qrcode) {
+    public int insertMemberinfoByRegister(MemberInfo memberinfo, String qrcode, HttpServletRequest request) {
         String tel = memberinfo.getTel();
         String pass = memberinfo.getPass();
         String pet = memberinfo.getPet();
@@ -63,12 +64,11 @@ public class MemberinfoDaoImpl implements MemberinfoDao {
 
         //给默认头像
         String hphoto = Constants.ERROR_IMG_HP2X;
-
-        MemberinfoRecord record = ctx.insertInto(MEMBERINFO, MEMBERINFO.TEL, MEMBERINFO.PHONE, MEMBERINFO.PASS, MEMBERINFO.PET, MEMBERINFO.MEMBTYPE, MEMBERINFO.TOKEN, MEMBERINFO.HPHOTO, MEMBERINFO.QRCODE, MEMBERINFO.INTRODUCERPK, MEMBERINFO.MDATE)
-                .values(tel, tel, pass, pet, membtype, token, hphoto, getNewMemQrCode(), introducerPK != 0 ? introducerPK : null, Timestamp.valueOf(LocalDateTime.now()))
+        String ip = CommentUtils.getIpAddr(request);
+        MemberinfoRecord record = ctx.insertInto(MEMBERINFO, MEMBERINFO.TEL, MEMBERINFO.PHONE, MEMBERINFO.PASS, MEMBERINFO.PET, MEMBERINFO.MEMBTYPE, MEMBERINFO.TOKEN, MEMBERINFO.HPHOTO, MEMBERINFO.QRCODE, MEMBERINFO.INTRODUCERPK, MEMBERINFO.MDATE, MEMBERINFO.IP)
+                .values(tel, tel, pass, pet, membtype, token, hphoto, getNewMemQrCode(), introducerPK != 0 ? introducerPK : null, Timestamp.valueOf(LocalDateTime.now()), ip)
                 .returning(MEMBERINFO.PK)
                 .fetchOne();
-
         if (introducerPK > 0) {
             int num = ctx.selectCount()
                     .from(MEMBERINFO)
@@ -85,17 +85,17 @@ public class MemberinfoDaoImpl implements MemberinfoDao {
             }
 
             if (num == 3) {
-                ctx.update(MEMBERINFO)
-                        .set(MEMBERINFO.COIN_A, MEMBERINFO.COIN_A.add(20))
-                        .where(MEMBERINFO.PK.equal(introducerPK))
-                        .execute();
-                double balance = ctx.select(MEMBERINFO.COIN_A)
-                        .from(MEMBERINFO)
-                        .where(MEMBERINFO.PK.equal(introducerPK))
-                        .fetchOne(0, double.class);
-                ctx.insertInto(ACCOUNTRECORD, ACCOUNTRECORD.MEMBERPK, ACCOUNTRECORD.ADATE, ACCOUNTRECORD.STYPE, ACCOUNTRECORD.ATYPE, ACCOUNTRECORD.COIN, ACCOUNTRECORD.ABSTRACT, ACCOUNTRECORD.BALANCE)
-                        .values(introducerPK, Timestamp.valueOf(LocalDateTime.now()), AccountConstants.accountrecord_S_TYPE_WITHDRAW, AccountConstants.ACCOUNTRECORD_A_TYPE_INCOME_PROMOTE, BigDecimal.valueOf(20), "", BigDecimal.valueOf(balance))
-                        .execute();
+                // ctx.update(MEMBERINFO)
+                //         .set(MEMBERINFO.COIN_A, MEMBERINFO.COIN_A.add(20))
+                //         .where(MEMBERINFO.PK.equal(introducerPK))
+                //         .execute();
+                // double balance = ctx.select(MEMBERINFO.COIN_A)
+                //         .from(MEMBERINFO)
+                //         .where(MEMBERINFO.PK.equal(introducerPK))
+                //         .fetchOne(0, double.class);
+                // ctx.insertInto(ACCOUNTRECORD, ACCOUNTRECORD.MEMBERPK, ACCOUNTRECORD.ADATE, ACCOUNTRECORD.STYPE, ACCOUNTRECORD.ATYPE, ACCOUNTRECORD.COIN, ACCOUNTRECORD.ABSTRACT, ACCOUNTRECORD.BALANCE)
+                //         .values(introducerPK, Timestamp.valueOf(LocalDateTime.now()), AccountConstants.accountrecord_S_TYPE_WITHDRAW, AccountConstants.ACCOUNTRECORD_A_TYPE_INCOME_PROMOTE, BigDecimal.valueOf(20), "", BigDecimal.valueOf(balance))
+                //         .execute();
             }
         }
 

+ 11 - 6
src/main/java/com/thmodel/dao/impl/ParttyInfoDaoImpl.java

@@ -65,10 +65,10 @@ public class ParttyInfoDaoImpl implements ParttyInfoDao {
                     pi.setSendt(rs.getDate("Sendt"));
                     pi.setTerm(rs.getString("Term"));
                     pi.setIssign(rs.getInt("issign"));
-
                     pi.setSigncount(rs.getInt("signcount"));
                     pi.setIssigndate(rs.getInt("issigndate"));
-
+                    pi.setIsTop(rs.getInt("isTop"));
+                    pi.setUrl(rs.getString("url"));
                     list.add(pi);
                 }
                 db.close(rs);
@@ -138,6 +138,8 @@ public class ParttyInfoDaoImpl implements ParttyInfoDao {
                     pi.setSendt(rs.getDate("Sendt"));
                     pi.setTerm(rs.getString("Term"));
                     pi.setIssign(rs.getInt("issign"));
+                    pi.setIsTop(rs.getInt("isTop"));
+                    pi.setUrl(rs.getString("url"));
                     list.add(pi);
                 }
                 db.close(rs);
@@ -196,9 +198,10 @@ public class ParttyInfoDaoImpl implements ParttyInfoDao {
                     pi.setSendt(rs.getDate("Sendt"));
                     pi.setTerm(rs.getString("Term"));
                     pi.setIssign(rs.getInt("issign"));
-
                     pi.setSigncount(rs.getInt("signcount"));
                     pi.setIssigndate(rs.getInt("issigndate"));
+                    pi.setIsTop(rs.getInt("isTop"));
+                    pi.setUrl(rs.getString("url"));
                     list.add(pi);
                 }
                 db.close(rs);
@@ -281,21 +284,21 @@ public class ParttyInfoDaoImpl implements ParttyInfoDao {
     public boolean isParttySBeg(int parttypk) {
         String sql = "select count(1) from ParttyInfo where pk = " + parttypk + " and SBeg <= now()";
         int count = new DbConnection().queryOneCount(sql);
-        return count > 0 ? true : false;
+        return count > 0;
     }
 
     @Override
     public boolean isParttySEndt(int parttypk) {
         String sql = "select count(1) from ParttyInfo where pk = " + parttypk + " and SEndt >= now()";
         int count = new DbConnection().queryOneCount(sql);
-        return count > 0 ? true : false;
+        return count > 0;
     }
 
     @Override
     public boolean isParttySign(int parttyPk) {
         String sql = "select count(1) from ParttyInfo where pk = " + parttyPk + " and SBeg <= now() and SEndt >= now()";
         int count = new DbConnection().queryOneCount(sql);
-        return count > 0 ? true : false;
+        return count > 0;
     }
 
     @Override
@@ -320,6 +323,8 @@ public class ParttyInfoDaoImpl implements ParttyInfoDao {
                 pi.setTerm(rs.getString("Term"));
                 pi.setIsbanner(rs.getInt("Isbanner"));
                 pi.setBanner(rs.getString("Banner"));
+                pi.setIsTop(rs.getInt("isTop"));
+                pi.setUrl(rs.getString("url"));
                 db.close(rs);
             }
         } catch (Exception e) {

+ 16 - 0
src/main/java/com/thmodel/entity/ParttyInfo.java

@@ -27,6 +27,8 @@ public class ParttyInfo {
     private int    signcount;   //活动报名人数
     private int    issigndate;  //是否到活动开始报名时间之后
     private int    issign;
+    private int    isTop;
+    private String url;
 
     public int getSigncount() {
         return signcount;
@@ -164,5 +166,19 @@ public class ParttyInfo {
         this.issigndate = issigndate;
     }
 
+    public int getIsTop() {
+        return isTop;
+    }
+
+    public void setIsTop(int isTop) {
+        this.isTop = isTop;
+    }
 
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
 }

+ 14 - 4
src/main/java/com/thmodel/jooq/tables/Memberinfo.java

@@ -43,7 +43,7 @@ import org.jooq.impl.TableImpl;
 @SuppressWarnings({ "all", "unchecked", "rawtypes" })
 public class Memberinfo extends TableImpl<MemberinfoRecord> {
 
-    private static final long serialVersionUID = 1765796072;
+    private static final long serialVersionUID = -1865616130;
 
     /**
      * The reference instance of <code>thmodel.memberinfo</code>
@@ -281,7 +281,7 @@ public class Memberinfo extends TableImpl<MemberinfoRecord> {
     /**
      * The column <code>thmodel.memberinfo.income_ratio_gift</code>.
      */
-    public final TableField<MemberinfoRecord, BigDecimal> INCOME_RATIO_GIFT = createField("income_ratio_gift", org.jooq.impl.SQLDataType.DECIMAL(18, 4).defaultValue(org.jooq.impl.DSL.inline("100.0000", org.jooq.impl.SQLDataType.DECIMAL)), this, "");
+    public final TableField<MemberinfoRecord, BigDecimal> INCOME_RATIO_GIFT = createField("income_ratio_gift", org.jooq.impl.SQLDataType.DECIMAL(18, 4).defaultValue(org.jooq.impl.DSL.inline("50.0000", org.jooq.impl.SQLDataType.DECIMAL)), this, "");
 
     /**
      * The column <code>thmodel.memberinfo.income_ratio_video</code>.
@@ -296,7 +296,7 @@ public class Memberinfo extends TableImpl<MemberinfoRecord> {
     /**
      * The column <code>thmodel.memberinfo.share_ratio_gift</code>.
      */
-    public final TableField<MemberinfoRecord, BigDecimal> SHARE_RATIO_GIFT = createField("share_ratio_gift", org.jooq.impl.SQLDataType.DECIMAL(18, 4).defaultValue(org.jooq.impl.DSL.inline("0.0000", org.jooq.impl.SQLDataType.DECIMAL)), this, "");
+    public final TableField<MemberinfoRecord, BigDecimal> SHARE_RATIO_GIFT = createField("share_ratio_gift", org.jooq.impl.SQLDataType.DECIMAL(18, 4).defaultValue(org.jooq.impl.DSL.inline("10.0000", org.jooq.impl.SQLDataType.DECIMAL)), this, "");
 
     /**
      * The column <code>thmodel.memberinfo.share_ratio_video</code>.
@@ -311,7 +311,7 @@ public class Memberinfo extends TableImpl<MemberinfoRecord> {
     /**
      * The column <code>thmodel.memberinfo.broker_ratio_git</code>.
      */
-    public final TableField<MemberinfoRecord, BigDecimal> BROKER_RATIO_GIT = createField("broker_ratio_git", org.jooq.impl.SQLDataType.DECIMAL(18, 4).defaultValue(org.jooq.impl.DSL.inline("0.0000", org.jooq.impl.SQLDataType.DECIMAL)), this, "");
+    public final TableField<MemberinfoRecord, BigDecimal> BROKER_RATIO_GIT = createField("broker_ratio_git", org.jooq.impl.SQLDataType.DECIMAL(18, 4).defaultValue(org.jooq.impl.DSL.inline("10.0000", org.jooq.impl.SQLDataType.DECIMAL)), this, "");
 
     /**
      * The column <code>thmodel.memberinfo.broker_ratio_video</code>.
@@ -333,6 +333,16 @@ public class Memberinfo extends TableImpl<MemberinfoRecord> {
      */
     public final TableField<MemberinfoRecord, Integer> CAN_CHAT = createField("can_chat", org.jooq.impl.SQLDataType.INTEGER.defaultValue(org.jooq.impl.DSL.inline("0", org.jooq.impl.SQLDataType.INTEGER)), this, "");
 
+    /**
+     * The column <code>thmodel.memberinfo.ip</code>.
+     */
+    public final TableField<MemberinfoRecord, String> IP = createField("ip", org.jooq.impl.SQLDataType.VARCHAR(255), this, "");
+
+    /**
+     * The column <code>thmodel.memberinfo.uuid</code>.
+     */
+    public final TableField<MemberinfoRecord, String> UUID = createField("uuid", org.jooq.impl.SQLDataType.VARCHAR(255), this, "");
+
     /**
      * Create a <code>thmodel.memberinfo</code> table reference
      */

+ 7 - 1
src/main/java/com/thmodel/jooq/tables/Sharerecord.java

@@ -9,6 +9,7 @@ import com.thmodel.jooq.Keys;
 import com.thmodel.jooq.Thmodel;
 import com.thmodel.jooq.tables.records.SharerecordRecord;
 
+import java.sql.Timestamp;
 import java.util.Arrays;
 import java.util.List;
 
@@ -41,7 +42,7 @@ import org.jooq.impl.TableImpl;
 @SuppressWarnings({ "all", "unchecked", "rawtypes" })
 public class Sharerecord extends TableImpl<SharerecordRecord> {
 
-    private static final long serialVersionUID = 382704215;
+    private static final long serialVersionUID = -2011501441;
 
     /**
      * The reference instance of <code>thmodel.sharerecord</code>
@@ -71,6 +72,11 @@ public class Sharerecord extends TableImpl<SharerecordRecord> {
      */
     public final TableField<SharerecordRecord, String> CODE = createField("code", org.jooq.impl.SQLDataType.VARCHAR(255), this, "");
 
+    /**
+     * The column <code>thmodel.sharerecord.create_time</code>.
+     */
+    public final TableField<SharerecordRecord, Timestamp> CREATE_TIME = createField("create_time", org.jooq.impl.SQLDataType.TIMESTAMP.defaultValue(org.jooq.impl.DSL.field("CURRENT_TIMESTAMP", org.jooq.impl.SQLDataType.TIMESTAMP)), this, "");
+
     /**
      * Create a <code>thmodel.sharerecord</code> table reference
      */

+ 32 - 2
src/main/java/com/thmodel/jooq/tables/records/MemberinfoRecord.java

@@ -28,7 +28,7 @@ import org.jooq.impl.UpdatableRecordImpl;
 @SuppressWarnings({ "all", "unchecked", "rawtypes" })
 public class MemberinfoRecord extends UpdatableRecordImpl<MemberinfoRecord> {
 
-    private static final long serialVersionUID = -2093684802;
+    private static final long serialVersionUID = -1350285515;
 
     /**
      * Setter for <code>thmodel.memberinfo.PK</code>.
@@ -800,6 +800,34 @@ public class MemberinfoRecord extends UpdatableRecordImpl<MemberinfoRecord> {
         return (Integer) get(54);
     }
 
+    /**
+     * Setter for <code>thmodel.memberinfo.ip</code>.
+     */
+    public void setIp(String value) {
+        set(55, value);
+    }
+
+    /**
+     * Getter for <code>thmodel.memberinfo.ip</code>.
+     */
+    public String getIp() {
+        return (String) get(55);
+    }
+
+    /**
+     * Setter for <code>thmodel.memberinfo.uuid</code>.
+     */
+    public void setUuid(String value) {
+        set(56, value);
+    }
+
+    /**
+     * Getter for <code>thmodel.memberinfo.uuid</code>.
+     */
+    public String getUuid() {
+        return (String) get(56);
+    }
+
     // -------------------------------------------------------------------------
     // Primary key information
     // -------------------------------------------------------------------------
@@ -826,7 +854,7 @@ public class MemberinfoRecord extends UpdatableRecordImpl<MemberinfoRecord> {
     /**
      * Create a detached, initialised MemberinfoRecord
      */
-    public MemberinfoRecord(Integer pk, Integer membtype, Integer membclass, String qrcode, String tel, String pass, String paypass, String pet, String hphoto, String photo, Integer area, String age, String id, Integer islive, Timestamp mdate, String token, Integer acc, Timestamp lastsign, Integer signdays, Integer introducerpk, String identify, String idA, String idB, String idC, String wid, BigDecimal coinA, BigDecimal coinIr, BigDecimal coinIv, BigDecimal coinIs, BigDecimal coinIrr, BigDecimal coinIvv, BigDecimal coinIss, BigDecimal coinIll, BigDecimal coinI, BigDecimal coinOr, BigDecimal coinOv, BigDecimal coinOs, BigDecimal coinOm, BigDecimal coinO, BigDecimal coinOi, BigDecimal coinOp, String phone, BigDecimal coinIrrr, BigDecimal coinIrrrm, BigDecimal incomeRatioGift, BigDecimal incomeRatioVideo, BigDecimal incomeRatioService, BigDecimal shareRatioGift, BigDecimal shareRatioVideo, BigDecimal shareRatioService, BigDecimal brokerRatioGit, BigDecimal brokerRatioVideo, BigDecimal brokerRatioService, BigDecimal coinShare, Integer canChat) {
+    public MemberinfoRecord(Integer pk, Integer membtype, Integer membclass, String qrcode, String tel, String pass, String paypass, String pet, String hphoto, String photo, Integer area, String age, String id, Integer islive, Timestamp mdate, String token, Integer acc, Timestamp lastsign, Integer signdays, Integer introducerpk, String identify, String idA, String idB, String idC, String wid, BigDecimal coinA, BigDecimal coinIr, BigDecimal coinIv, BigDecimal coinIs, BigDecimal coinIrr, BigDecimal coinIvv, BigDecimal coinIss, BigDecimal coinIll, BigDecimal coinI, BigDecimal coinOr, BigDecimal coinOv, BigDecimal coinOs, BigDecimal coinOm, BigDecimal coinO, BigDecimal coinOi, BigDecimal coinOp, String phone, BigDecimal coinIrrr, BigDecimal coinIrrrm, BigDecimal incomeRatioGift, BigDecimal incomeRatioVideo, BigDecimal incomeRatioService, BigDecimal shareRatioGift, BigDecimal shareRatioVideo, BigDecimal shareRatioService, BigDecimal brokerRatioGit, BigDecimal brokerRatioVideo, BigDecimal brokerRatioService, BigDecimal coinShare, Integer canChat, String ip, String uuid) {
         super(Memberinfo.MEMBERINFO);
 
         set(0, pk);
@@ -884,5 +912,7 @@ public class MemberinfoRecord extends UpdatableRecordImpl<MemberinfoRecord> {
         set(52, brokerRatioService);
         set(53, coinShare);
         set(54, canChat);
+        set(55, ip);
+        set(56, uuid);
     }
 }

+ 62 - 11
src/main/java/com/thmodel/jooq/tables/records/SharerecordRecord.java

@@ -6,12 +6,14 @@ package com.thmodel.jooq.tables.records;
 
 import com.thmodel.jooq.tables.Sharerecord;
 
+import java.sql.Timestamp;
+
 import javax.annotation.Generated;
 
 import org.jooq.Field;
 import org.jooq.Record1;
-import org.jooq.Record3;
-import org.jooq.Row3;
+import org.jooq.Record4;
+import org.jooq.Row4;
 import org.jooq.impl.UpdatableRecordImpl;
 
 
@@ -26,9 +28,9 @@ import org.jooq.impl.UpdatableRecordImpl;
     comments = "This class is generated by jOOQ"
 )
 @SuppressWarnings({ "all", "unchecked", "rawtypes" })
-public class SharerecordRecord extends UpdatableRecordImpl<SharerecordRecord> implements Record3<Integer, String, String> {
+public class SharerecordRecord extends UpdatableRecordImpl<SharerecordRecord> implements Record4<Integer, String, String, Timestamp> {
 
-    private static final long serialVersionUID = 2073706131;
+    private static final long serialVersionUID = 1865613933;
 
     /**
      * Setter for <code>thmodel.sharerecord.id</code>.
@@ -72,6 +74,20 @@ public class SharerecordRecord extends UpdatableRecordImpl<SharerecordRecord> im
         return (String) get(2);
     }
 
+    /**
+     * Setter for <code>thmodel.sharerecord.create_time</code>.
+     */
+    public void setCreateTime(Timestamp value) {
+        set(3, value);
+    }
+
+    /**
+     * Getter for <code>thmodel.sharerecord.create_time</code>.
+     */
+    public Timestamp getCreateTime() {
+        return (Timestamp) get(3);
+    }
+
     // -------------------------------------------------------------------------
     // Primary key information
     // -------------------------------------------------------------------------
@@ -85,23 +101,23 @@ public class SharerecordRecord extends UpdatableRecordImpl<SharerecordRecord> im
     }
 
     // -------------------------------------------------------------------------
-    // Record3 type implementation
+    // Record4 type implementation
     // -------------------------------------------------------------------------
 
     /**
      * {@inheritDoc}
      */
     @Override
-    public Row3<Integer, String, String> fieldsRow() {
-        return (Row3) super.fieldsRow();
+    public Row4<Integer, String, String, Timestamp> fieldsRow() {
+        return (Row4) super.fieldsRow();
     }
 
     /**
      * {@inheritDoc}
      */
     @Override
-    public Row3<Integer, String, String> valuesRow() {
-        return (Row3) super.valuesRow();
+    public Row4<Integer, String, String, Timestamp> valuesRow() {
+        return (Row4) super.valuesRow();
     }
 
     /**
@@ -128,6 +144,14 @@ public class SharerecordRecord extends UpdatableRecordImpl<SharerecordRecord> im
         return Sharerecord.SHARERECORD.CODE;
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Field<Timestamp> field4() {
+        return Sharerecord.SHARERECORD.CREATE_TIME;
+    }
+
     /**
      * {@inheritDoc}
      */
@@ -152,6 +176,14 @@ public class SharerecordRecord extends UpdatableRecordImpl<SharerecordRecord> im
         return getCode();
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Timestamp component4() {
+        return getCreateTime();
+    }
+
     /**
      * {@inheritDoc}
      */
@@ -176,6 +208,14 @@ public class SharerecordRecord extends UpdatableRecordImpl<SharerecordRecord> im
         return getCode();
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Timestamp value4() {
+        return getCreateTime();
+    }
+
     /**
      * {@inheritDoc}
      */
@@ -207,10 +247,20 @@ public class SharerecordRecord extends UpdatableRecordImpl<SharerecordRecord> im
      * {@inheritDoc}
      */
     @Override
-    public SharerecordRecord values(Integer value1, String value2, String value3) {
+    public SharerecordRecord value4(Timestamp value) {
+        setCreateTime(value);
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public SharerecordRecord values(Integer value1, String value2, String value3, Timestamp value4) {
         value1(value1);
         value2(value2);
         value3(value3);
+        value4(value4);
         return this;
     }
 
@@ -228,11 +278,12 @@ public class SharerecordRecord extends UpdatableRecordImpl<SharerecordRecord> im
     /**
      * Create a detached, initialised SharerecordRecord
      */
-    public SharerecordRecord(Integer id, String phone, String code) {
+    public SharerecordRecord(Integer id, String phone, String code, Timestamp createTime) {
         super(Sharerecord.SHARERECORD);
 
         set(0, id);
         set(1, phone);
         set(2, code);
+        set(3, createTime);
     }
 }

+ 467 - 426
src/main/java/com/thmodel/nimserver/Nimserver.java

@@ -19,434 +19,475 @@ import java.util.Map.Entry;
 /**
  * 网易通讯接口
  * 只对接网易通讯
+ *
  * @author 刘迎奥
- * @date 2018年7月5日
  * @version v1.0
+ * @date 2018年7月5日
  */
 public class Nimserver {
-	
-	DefaultHttpClient httpClient = new DefaultHttpClient();
-	private String appKey = NimConfig.appKey;//开发者平台分配的appkey
-	private String appSecret = NimConfig.appSecret;
-	
-	public HttpPost init(String url, String contentType){
-
-		String nonce =  (int)(Math.random() * 1000000)+"";//随机数(最大长度128个字符)
-		String curTime = String.valueOf((new Date()).getTime() / 1000L);
-		String checkSum = CheckSumBuilder.getCheckSum(appSecret, nonce ,curTime);//参考 计算CheckSum的java代码
-		
-		HttpPost httpPost = new HttpPost(url);
-		// 设置请求的header
-		httpPost.addHeader("AppKey", appKey);
-		httpPost.addHeader("Nonce", nonce);
-		httpPost.addHeader("CurTime", curTime);
-		httpPost.addHeader("CheckSum", checkSum);
-		httpPost.addHeader("Content-Type", contentType);
-		return httpPost;
-	}
-	
-	
-	/**
-	 * 注册
-	 * @return
-	 */
-	public String createUser(String accid, String name){
-		try {
-			String url = "https://api.netease.im/nimserver/user/create.action";
-			//初始化
-			HttpPost httpPost = init(url, NimConfig.contentType_1);
-			
-			// 设置请求的参数
-			List<NameValuePair> nvps = new ArrayList<NameValuePair>();
-			nvps.add(new BasicNameValuePair("accid", accid));
-			nvps.add(new BasicNameValuePair("name", name == null ? "" : name));
-			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;
-		}
-	}
-	
-	/**
-	 * 获取用户名片
-	 * @return
-	 */
-	public  String getUinfos(String[] accids){
-		try {
-			
-			String url = "https://api.netease.im/nimserver/user/getUinfos.action";
-			//初始化
-			HttpPost httpPost = init(url, NimConfig.contentType_1);
-			
-			// 设置请求的参数
-			List<NameValuePair> nvps = new ArrayList<NameValuePair>();
-			nvps.add(new BasicNameValuePair("accids", JSON.toJSONString(accids)));
-			httpPost.setEntity(new UrlEncodedFormEntity(nvps, "utf-8"));
-
-			// 执行请求
-			HttpResponse response = httpClient.execute(httpPost);
-			
-			// 打印执行结果
-			String result = EntityUtils.toString(response.getEntity(), "utf-8");
-			//{"code":200,"uinfos":[{"accid":"liuyingao","gender":0}]}
-			return result;
-		} catch (Exception e) {
-			System.out.println(e.getMessage());
-			return NimConfig.errorNeteaseMessage;
-		}
-	}
-	
-	/**
-	 * 更新用户 token
-	 * @return
-	 */
-	public String refreshToken(String accid){
-		try {
-			
-			String url = "https://api.netease.im/nimserver/user/refreshToken.action";
-			//初始化
-			HttpPost httpPost = init(url, NimConfig.contentType_1);
-			
-			// 设置请求的参数
-			List<NameValuePair> nvps = new ArrayList<NameValuePair>();
-			nvps.add(new BasicNameValuePair("accid", accid));
-			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;
-		}
-	}
-	
-	/**
-	 * 网易云通信ID更新
-	 * 可以修改指定的 token
-	 * @return
-	 */
-	public String update(String accid, String token, String props){
-		try {
-			
-			String url = "https://api.netease.im/nimserver/user/update.action";
-			//初始化
-			HttpPost httpPost = init(url, NimConfig.contentType_1);
-			
-			// 设置请求的参数
-			List<NameValuePair> nvps = new ArrayList<NameValuePair>();
-			nvps.add(new BasicNameValuePair("accid", accid));
-			
-			if(token != null && !token.equals("")) {
-				nvps.add(new BasicNameValuePair("token", token));
-			}
-			
-			//json属性,第三方可选填,最大长度1024字符
-			if(props != null && !props.equals("")) {
-				nvps.add(new BasicNameValuePair("props", props));
-			}
-			
-			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;
-		}
-	}
-	
-	/**
-	 * 更新用户名片
-	 * @return
-	 */
-	public String updateUinfo(String accid, Map<String, String> paramMap){
-		try {
-			
-			String url = "https://api.netease.im/nimserver/user/updateUinfo.action";
-			//初始化
-			HttpPost httpPost = init(url, NimConfig.contentType_1);
-			
-			// 设置请求的参数
-			List<NameValuePair> nvps = new ArrayList<NameValuePair>();
-			nvps.add(new BasicNameValuePair("accid", accid));
-			if(paramMap!=null) {
-				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;
-		}
-	}
-	/**
-	 * 设置桌面端在线时,移动端是否需要推送
-	 * @param accid
-	 * @param donnopOpen
-	 * @return
-	 */
-	public  String setDonnop(String accid, String donnopOpen){
-		try {
-			
-			String url = "https://api.netease.im/nimserver/user/setDonnop.action";
-			//初始化
-			HttpPost httpPost = init(url, NimConfig.contentType_1);
-			
-			// 设置请求的参数
-			List<NameValuePair> nvps = new ArrayList<NameValuePair>();
-			nvps.add(new BasicNameValuePair("accid", accid));
-			nvps.add(new BasicNameValuePair("donnopOpen", donnopOpen));
-			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;
-		}
-	}
-	
-	/**
-	 * 加好友
-	 * @param accid 加好友发起者accid
-	 * @param faccid 加好友接收者accid
-	 * @param type 1直接加好友,2请求加好友,3同意加好友,4拒绝加好友
-	 * @param msg 加好友对应的请求消息,第三方组装,最长256字符(不是必须参数)
-	 * @return
-	 */
-	public  String addFriend(String accid, String faccid, String type, String msg){
-		try {
-			String url = "https://api.netease.im/nimserver/friend/add.action";
-			//初始化
-			HttpPost httpPost = init(url, NimConfig.contentType_1);
-			
-			// 设置请求的参数
-			List<NameValuePair> nvps = new ArrayList<NameValuePair>();
-			nvps.add(new BasicNameValuePair("accid", accid));
-			nvps.add(new BasicNameValuePair("faccid", faccid));
-			nvps.add(new BasicNameValuePair("type", type));
-			
-			if(msg!=null && !msg.equals("")){
-				nvps.add(new BasicNameValuePair("faccid", faccid));
-			}
-			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;
-		}
-	}
-	
-	/**
-	 * 更新好友相关信息
-	 * @param accid 发起者accid
-	 * @param faccid 要修改朋友的accid
-	 * @param alias 给好友增加备注名,限制长度128(不是必须参数)
-	 * @param ex 修改ex字段,限制长度256(不是必须参数)
-	 * @return
-	 */
-	public  String updateFriend(String accid, String faccid, String alias, String ex){
-		try {
-			String url = "https://api.netease.im/nimserver/friend/update.action";
-			//初始化
-			HttpPost httpPost = init(url, NimConfig.contentType_1);
-			
-			// 设置请求的参数
-			List<NameValuePair> nvps = new ArrayList<NameValuePair>();
-			nvps.add(new BasicNameValuePair("accid", accid));
-			nvps.add(new BasicNameValuePair("faccid", faccid));
-			
-			if(alias!=null && !alias.equals("")){
-				nvps.add(new BasicNameValuePair("alias", alias));
-			}
-			if(ex!=null && !ex.equals("")){
-				nvps.add(new BasicNameValuePair("ex", ex));
-			}
-			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;
-		}
-	}
-	
-	/**
-	 * 删除好友
-	 * @param accid 发起者accid
-	 * @param faccid 要删除朋友的accid
-	 * @return
-	 */
-	public String deleteFriend(String accid, String faccid){
-		try {
-			String url = "https://api.netease.im/nimserver/friend/delete.action";
-			//初始化
-			HttpPost httpPost = init(url, NimConfig.contentType_1);
-			
-			// 设置请求的参数
-			List<NameValuePair> nvps = new ArrayList<NameValuePair>();
-			nvps.add(new BasicNameValuePair("accid", accid));
-			nvps.add(new BasicNameValuePair("faccid", faccid));
-			
-			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;
-		}
-	}
-	
-	/**
-	 * 发送普通消息
-	 * @param from 发送者accid,用户帐号,最大32字符,必须保证一个APP内唯一
-	 * @param ope 0:点对点个人消息,1:群消息(高级群),其他返回414
-	 * @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 sendMsg(String from, String ope, String to, String type, String body, Map<String, String> paramMap){
-		try {
-			String url = "https://api.netease.im/nimserver/msg/sendMsg.action";
-			//初始化
-			HttpPost httpPost = init(url, NimConfig.contentType_1);
-			
-			// 设置请求的参数
-			List<NameValuePair> nvps = new ArrayList<NameValuePair>();
-			nvps.add(new BasicNameValuePair("from", from));
-			nvps.add(new BasicNameValuePair("ope", ope));
-			nvps.add(new BasicNameValuePair("to", 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;
-		}
-	}
-	
-	/**
-	 * 发送自定义系统通知
-	 * @param from 发送者accid,用户帐号,最大32字符,APP内唯一
-	 * @param msgtype 	0:点对点自定义通知,1:群消息自定义通知,其他返回414
-	 * @param to 	msgtype==0是表示accid即用户id,msgtype==1表示tid即群id
-	 * @param attach 	自定义通知内容,第三方组装的字符串,建议是JSON串,最大长度4096字符
-	 * @param paramMap 
-	 * 			pushcontent	String	否	iOS推送内容,第三方自己组装的推送内容,不超过150字符
-	 *			payload		String	否	iOS推送对应的payload,必须是JSON,不能超过2k字符
-	 *			sound		String	否	如果有指定推送,此属性指定为客户端本地的声音文件名,长度不要超过30个字符,如果不指定,会使用默认声音
-	 *			save		int		否	1表示只发在线,2表示会存离线,其他会报414错误。默认会存离线
-	 *			option	String	否	
-	 *				发消息时特殊指定的行为选项,Json格式,可用于指定消息计数等特殊行为;option中字段不填时表示默认值。
-	 *				option示例:
-	 *				{"badge":false,"needPushNick":false,"route":false}
-	 *				字段说明:
-	 *				1. badge:该消息是否需要计入到未读计数中,默认true;
-	 *				2. needPushNick: 推送文案是否需要带上昵称,不设置该参数时默认false(ps:注意与sendMsg.action接口有别);
-	 *				3. route: 该消息是否需要抄送第三方;默认true (需要app开通消息抄送功能)
-	 * @return
-	 */
-	public String sendAttachMsg(String from, int msgtype, String to, String attach, Map<String, String> paramMap) {
-		try {
-			String url = "https://api.netease.im/nimserver/msg/sendAttachMsg.action";
-			//初始化
-			HttpPost httpPost = init(url, NimConfig.contentType_1);
-			
-			// 设置请求的参数
-			List<NameValuePair> nvps = new ArrayList<NameValuePair>();
-			nvps.add(new BasicNameValuePair("from", from));
-			nvps.add(new BasicNameValuePair("msgtype", msgtype+""));
-			nvps.add(new BasicNameValuePair("to", to));
-			nvps.add(new BasicNameValuePair("attach", attach));
-			
-			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;
-		}
-	}
-	
-	
-	
-
-	
+
+    DefaultHttpClient httpClient = new DefaultHttpClient();
+    private String appKey    = NimConfig.appKey;//开发者平台分配的appkey
+    private String appSecret = NimConfig.appSecret;
+
+    public HttpPost init(String url, String contentType) {
+
+        String nonce = (int) (Math.random() * 1000000) + "";//随机数(最大长度128个字符)
+        String curTime = String.valueOf((new Date()).getTime() / 1000L);
+        String checkSum = CheckSumBuilder.getCheckSum(appSecret, nonce, curTime);//参考 计算CheckSum的java代码
+
+        HttpPost httpPost = new HttpPost(url);
+        // 设置请求的header
+        httpPost.addHeader("AppKey", appKey);
+        httpPost.addHeader("Nonce", nonce);
+        httpPost.addHeader("CurTime", curTime);
+        httpPost.addHeader("CheckSum", checkSum);
+        httpPost.addHeader("Content-Type", contentType);
+        return httpPost;
+    }
+
+
+    /**
+     * 注册
+     *
+     * @return
+     */
+    public String createUser(String accid, String name) {
+        try {
+            String url = "https://api.netease.im/nimserver/user/create.action";
+            //初始化
+            HttpPost httpPost = init(url, NimConfig.contentType_1);
+
+            // 设置请求的参数
+            List<NameValuePair> nvps = new ArrayList<NameValuePair>();
+            nvps.add(new BasicNameValuePair("accid", accid));
+            nvps.add(new BasicNameValuePair("name", name == null ? "" : name));
+            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;
+        }
+    }
+
+    /**
+     * 获取用户名片
+     *
+     * @return
+     */
+    public String getUinfos(String[] accids) {
+        try {
+
+            String url = "https://api.netease.im/nimserver/user/getUinfos.action";
+            //初始化
+            HttpPost httpPost = init(url, NimConfig.contentType_1);
+
+            // 设置请求的参数
+            List<NameValuePair> nvps = new ArrayList<NameValuePair>();
+            nvps.add(new BasicNameValuePair("accids", JSON.toJSONString(accids)));
+            httpPost.setEntity(new UrlEncodedFormEntity(nvps, "utf-8"));
+
+            // 执行请求
+            HttpResponse response = httpClient.execute(httpPost);
+
+            // 打印执行结果
+            String result = EntityUtils.toString(response.getEntity(), "utf-8");
+            //{"code":200,"uinfos":[{"accid":"liuyingao","gender":0}]}
+            return result;
+        } catch (Exception e) {
+            System.out.println(e.getMessage());
+            return NimConfig.errorNeteaseMessage;
+        }
+    }
+
+    /**
+     * 更新用户 token
+     *
+     * @return
+     */
+    public String refreshToken(String accid) {
+        try {
+
+            String url = "https://api.netease.im/nimserver/user/refreshToken.action";
+            //初始化
+            HttpPost httpPost = init(url, NimConfig.contentType_1);
+
+            // 设置请求的参数
+            List<NameValuePair> nvps = new ArrayList<NameValuePair>();
+            nvps.add(new BasicNameValuePair("accid", accid));
+            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;
+        }
+    }
+
+    /**
+     * 网易云通信ID更新
+     * 可以修改指定的 token
+     *
+     * @return
+     */
+    public String update(String accid, String token, String props) {
+        try {
+
+            String url = "https://api.netease.im/nimserver/user/update.action";
+            //初始化
+            HttpPost httpPost = init(url, NimConfig.contentType_1);
+
+            // 设置请求的参数
+            List<NameValuePair> nvps = new ArrayList<NameValuePair>();
+            nvps.add(new BasicNameValuePair("accid", accid));
+
+            if (token != null && !token.equals("")) {
+                nvps.add(new BasicNameValuePair("token", token));
+            }
+
+            //json属性,第三方可选填,最大长度1024字符
+            if (props != null && !props.equals("")) {
+                nvps.add(new BasicNameValuePair("props", props));
+            }
+
+            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;
+        }
+    }
+
+    /**
+     * 更新用户名片
+     *
+     * @return
+     */
+    public String updateUinfo(String accid, Map<String, String> paramMap) {
+        try {
+
+            String url = "https://api.netease.im/nimserver/user/updateUinfo.action";
+            //初始化
+            HttpPost httpPost = init(url, NimConfig.contentType_1);
+
+            // 设置请求的参数
+            List<NameValuePair> nvps = new ArrayList<NameValuePair>();
+            nvps.add(new BasicNameValuePair("accid", accid));
+            if (paramMap != null) {
+                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;
+        }
+    }
+
+    /**
+     * 设置桌面端在线时,移动端是否需要推送
+     *
+     * @param accid
+     * @param donnopOpen
+     * @return
+     */
+    public String setDonnop(String accid, String donnopOpen) {
+        try {
+
+            String url = "https://api.netease.im/nimserver/user/setDonnop.action";
+            //初始化
+            HttpPost httpPost = init(url, NimConfig.contentType_1);
+
+            // 设置请求的参数
+            List<NameValuePair> nvps = new ArrayList<NameValuePair>();
+            nvps.add(new BasicNameValuePair("accid", accid));
+            nvps.add(new BasicNameValuePair("donnopOpen", donnopOpen));
+            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;
+        }
+    }
+
+    /**
+     * 加好友
+     *
+     * @param accid  加好友发起者accid
+     * @param faccid 加好友接收者accid
+     * @param type   1直接加好友,2请求加好友,3同意加好友,4拒绝加好友
+     * @param msg    加好友对应的请求消息,第三方组装,最长256字符(不是必须参数)
+     * @return
+     */
+    public String addFriend(String accid, String faccid, String type, String msg) {
+        try {
+            String url = "https://api.netease.im/nimserver/friend/add.action";
+            //初始化
+            HttpPost httpPost = init(url, NimConfig.contentType_1);
+
+            // 设置请求的参数
+            List<NameValuePair> nvps = new ArrayList<NameValuePair>();
+            nvps.add(new BasicNameValuePair("accid", accid));
+            nvps.add(new BasicNameValuePair("faccid", faccid));
+            nvps.add(new BasicNameValuePair("type", type));
+
+            if (msg != null && !msg.equals("")) {
+                nvps.add(new BasicNameValuePair("faccid", faccid));
+            }
+            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;
+        }
+    }
+
+    /**
+     * 更新好友相关信息
+     *
+     * @param accid  发起者accid
+     * @param faccid 要修改朋友的accid
+     * @param alias  给好友增加备注名,限制长度128(不是必须参数)
+     * @param ex     修改ex字段,限制长度256(不是必须参数)
+     * @return
+     */
+    public String updateFriend(String accid, String faccid, String alias, String ex) {
+        try {
+            String url = "https://api.netease.im/nimserver/friend/update.action";
+            //初始化
+            HttpPost httpPost = init(url, NimConfig.contentType_1);
+
+            // 设置请求的参数
+            List<NameValuePair> nvps = new ArrayList<NameValuePair>();
+            nvps.add(new BasicNameValuePair("accid", accid));
+            nvps.add(new BasicNameValuePair("faccid", faccid));
+
+            if (alias != null && !alias.equals("")) {
+                nvps.add(new BasicNameValuePair("alias", alias));
+            }
+            if (ex != null && !ex.equals("")) {
+                nvps.add(new BasicNameValuePair("ex", ex));
+            }
+            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;
+        }
+    }
+
+    /**
+     * 删除好友
+     *
+     * @param accid  发起者accid
+     * @param faccid 要删除朋友的accid
+     * @return
+     */
+    public String deleteFriend(String accid, String faccid) {
+        try {
+            String url = "https://api.netease.im/nimserver/friend/delete.action";
+            //初始化
+            HttpPost httpPost = init(url, NimConfig.contentType_1);
+
+            // 设置请求的参数
+            List<NameValuePair> nvps = new ArrayList<NameValuePair>();
+            nvps.add(new BasicNameValuePair("accid", accid));
+            nvps.add(new BasicNameValuePair("faccid", faccid));
+
+            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;
+        }
+    }
+
+    /**
+     * 发送普通消息
+     *
+     * @param from     发送者accid,用户帐号,最大32字符,必须保证一个APP内唯一
+     * @param ope      0:点对点个人消息,1:群消息(高级群),其他返回414
+     * @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 sendMsg(String from, String ope, String to, String type, String body, Map<String, String> paramMap) {
+        try {
+            String url = "https://api.netease.im/nimserver/msg/sendMsg.action";
+            //初始化
+            HttpPost httpPost = init(url, NimConfig.contentType_1);
+
+            // 设置请求的参数
+            List<NameValuePair> nvps = new ArrayList<NameValuePair>();
+            nvps.add(new BasicNameValuePair("from", from));
+            nvps.add(new BasicNameValuePair("ope", ope));
+            nvps.add(new BasicNameValuePair("to", 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;
+        }
+    }
+
+    /**
+     * 发送自定义系统通知
+     *
+     * @param from     发送者accid,用户帐号,最大32字符,APP内唯一
+     * @param msgtype  0:点对点自定义通知,1:群消息自定义通知,其他返回414
+     * @param to       msgtype==0是表示accid即用户id,msgtype==1表示tid即群id
+     * @param attach   自定义通知内容,第三方组装的字符串,建议是JSON串,最大长度4096字符
+     * @param paramMap pushcontent	String	否	iOS推送内容,第三方自己组装的推送内容,不超过150字符
+     *                 payload		String	否	iOS推送对应的payload,必须是JSON,不能超过2k字符
+     *                 sound		String	否	如果有指定推送,此属性指定为客户端本地的声音文件名,长度不要超过30个字符,如果不指定,会使用默认声音
+     *                 save		int		否	1表示只发在线,2表示会存离线,其他会报414错误。默认会存离线
+     *                 option	String	否
+     *                 发消息时特殊指定的行为选项,Json格式,可用于指定消息计数等特殊行为;option中字段不填时表示默认值。
+     *                 option示例:
+     *                 {"badge":false,"needPushNick":false,"route":false}
+     *                 字段说明:
+     *                 1. badge:该消息是否需要计入到未读计数中,默认true;
+     *                 2. needPushNick: 推送文案是否需要带上昵称,不设置该参数时默认false(ps:注意与sendMsg.action接口有别);
+     *                 3. route: 该消息是否需要抄送第三方;默认true (需要app开通消息抄送功能)
+     * @return
+     */
+    public String sendAttachMsg(String from, int msgtype, String to, String attach, Map<String, String> paramMap) {
+        try {
+            String url = "https://api.netease.im/nimserver/msg/sendAttachMsg.action";
+            //初始化
+            HttpPost httpPost = init(url, NimConfig.contentType_1);
+
+            // 设置请求的参数
+            List<NameValuePair> nvps = new ArrayList<NameValuePair>();
+            nvps.add(new BasicNameValuePair("from", from));
+            nvps.add(new BasicNameValuePair("msgtype", msgtype + ""));
+            nvps.add(new BasicNameValuePair("to", to));
+            nvps.add(new BasicNameValuePair("attach", attach));
+
+            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";
+            //初始化
+            HttpPost httpPost = init(url, NimConfig.contentType_1);
+
+            // 设置请求的参数
+            List<NameValuePair> nvps = new ArrayList<NameValuePair>();
+            nvps.add(new BasicNameValuePair("from", from));
+            nvps.add(new BasicNameValuePair("to", to));
+            nvps.add(new BasicNameValuePair("begintime", begintime));
+            nvps.add(new BasicNameValuePair("endtime", endtime));
+            nvps.add(new BasicNameValuePair("limit", "100"));
+
+
+            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 static void main(String[] args) {
+        Nimserver nimserver = new Nimserver();
+        System.out.println(nimserver.history("269", "1391", "1546013440000", "1546423840000"));;
+    }
+
 }

+ 3 - 1
src/main/java/com/thmodel/service/MemberinfoService.java

@@ -9,6 +9,8 @@ import com.thmodel.entity.Nexus;
 import com.thmodel.page.Page;
 import net.sf.json.JSONObject;
 
+import javax.servlet.http.HttpServletRequest;
+
 //会员用户信息
 public interface MemberinfoService {
 
@@ -26,7 +28,7 @@ public interface MemberinfoService {
      * @param memberinfo
      * @return
      */
-    public int doRegister(MemberInfo memberinfo, String qrcode);
+    public int doRegister(MemberInfo memberinfo, String qrcode, HttpServletRequest request);
 
     /**
      * 模特端注册

+ 3 - 2
src/main/java/com/thmodel/service/impl/MemberinfoServiceImpl.java

@@ -11,6 +11,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import javax.servlet.http.HttpServletRequest;
 import javax.sql.rowset.CachedRowSet;
 
 import com.thmodel.constants.AccountConstants;
@@ -59,10 +60,10 @@ public class MemberinfoServiceImpl implements MemberinfoService {
     }
 
     @Override
-    public int doRegister(MemberInfo memberinfo, String qrcode) {
+    public int doRegister(MemberInfo memberinfo, String qrcode, HttpServletRequest request) {
         //注册
         if (CommentUtils.isNull(memberinfo.getTel()) && CommentUtils.isNull(memberinfo.getPass())) {
-            int pk = memberinfoDao.insertMemberinfoByRegister(memberinfo, qrcode);
+            int pk = memberinfoDao.insertMemberinfoByRegister(memberinfo, qrcode, request);
             return pk;
         } else {
             return -1;

+ 1 - 1
src/main/java/com/thmodel/servlet/MemberInfoServlet.java

@@ -93,7 +93,7 @@ public class MemberInfoServlet extends HttpServlet {
                     memberinfo.setPass(pass);
                     memberinfo.setPet(pet);
 
-                    int pk = memberinfoService.doRegister(memberinfo, qrcode);
+                    int pk = memberinfoService.doRegister(memberinfo, qrcode, request);
                     if (pk > 0) {//注册成功
                         //创建网易通讯账号
 

+ 2 - 2
src/main/java/com/thmodel/servlet/ModelInfoServlet.java

@@ -666,7 +666,7 @@ public class ModelInfoServlet extends HttpServlet {
             //doGetModelFigure
             else if (action.equalsIgnoreCase("findmodelallinfo")) {
                 int modelPk = Integer.parseInt(CommentUtils.myToString(request.getParameter("ModelPK")));//人才PK
-                int memberPK = modelinfodao.findModelPKByMemberPK(modelPk);
+                // int memberPK = modelinfodao.findModelPKByMemberPK(modelPk);
                 System.out.println(modelPk);
 
                 if (modelPk > 0) {
@@ -681,7 +681,7 @@ public class ModelInfoServlet extends HttpServlet {
                     resultJson.put("dogethonorname", JsonUtils.tofastjson(doGetHonorName));
                     resultJson.put("dogetprice", JsonUtils.tofastjson(doGetPrice));
                     resultJson.put("dogetmodelfigure", JsonUtils.tofastjson(doGetModelFigure));
-                    resultJson.put("topParty", activityService.getModelTopParty(memberPK));
+                    resultJson.put("topParty", activityService.getModelTopParty(modelPk));
                     resultJson.put("fans", modelInfoService.fans(modelPk, 1, 3));
                 } else {
                     resultJson.put("msg", Constants.fail);

+ 37 - 0
src/main/java/com/thmodel/util/CommentUtils.java

@@ -297,4 +297,41 @@ public class CommentUtils {
         }
     }
 
+    public static String getIpAddr(HttpServletRequest request) {
+        String ip = request.getHeader("x-forwarded-for");
+        System.out.println("x-forwarded-for ip: " + ip);
+        if (ip != null && ip.length() != 0 && !"unknown".equalsIgnoreCase(ip)) {
+            // 多次反向代理后会有多个ip值,第一个ip才是真实ip
+            if (ip.indexOf(",") != -1) {
+                ip = ip.split(",")[0];
+            }
+        }
+        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+            ip = request.getHeader("Proxy-Client-IP");
+            System.out.println("Proxy-Client-IP ip: " + ip);
+        }
+        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+            ip = request.getHeader("WL-Proxy-Client-IP");
+            System.out.println("WL-Proxy-Client-IP ip: " + ip);
+        }
+        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+            ip = request.getHeader("HTTP_CLIENT_IP");
+            System.out.println("HTTP_CLIENT_IP ip: " + ip);
+        }
+        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+            ip = request.getHeader("HTTP_X_FORWARDED_FOR");
+            System.out.println("HTTP_X_FORWARDED_FOR ip: " + ip);
+        }
+        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+            ip = request.getHeader("X-Real-IP");
+            System.out.println("X-Real-IP ip: " + ip);
+        }
+        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
+            ip = request.getRemoteAddr();
+            System.out.println("getRemoteAddr ip: " + ip);
+        }
+        System.out.println("获取客户端ip: " + ip);
+        return ip;
+    }
+
 }

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

@@ -62,7 +62,7 @@
 
     }
 
-    .player .title .btn:active{
+    .player .title .btn:active {
         opacity: 0.8;
     }
 
@@ -81,7 +81,7 @@
 <script>
     var playerComponent = {
         props: ['info'],
-        template: `<div class="player">
+        template: `<div class="player" @click="detail">
                     <div class="playImg"
                          :style="{backgroundImage: 'url(../'+info.pic+')'}">
                         <div class="ad">{{info.PK}}号-{{info.gift}}礼物</div>
@@ -93,6 +93,20 @@
                             <span>礼物</span>
                         </div>
                     </div>
-                </div>`
+                </div>`,
+        methods: {
+            detail: function () {
+                function getQueryString(name) {
+                    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
+                    var r = window.location.search.substr(1).match(reg);
+                    if (r != null) return unescape(r[2]);
+                    return null;
+                }
+
+                var memberpk = getQueryString('memberpk');
+                var activitypk = getQueryString('activitypk');
+                window.location.href = '${pageContext.request.contextPath}/dancer/modelDetail.jsp?memberpk=' + memberpk + '&activitypk=' + activitypk + '&modelpk=' + this.info.modelpk;
+            }
+        }
     }
 </script>

+ 90 - 53
src/main/webapp/dancer/index.jsp

@@ -9,6 +9,8 @@
 <%@ page import="org.jooq.Field" %>
 <%@ page import="static com.thmodel.jooq.Tables.*" %>
 <%@ page import="com.thmodel.util.DBRecordsPack" %>
+<%@ page import="net.sf.json.JSONObject" %>
+<%@ page import="java.util.List" %>
 <%@ page contentType="text/html;charset=UTF-8" language="java" %>
 <%
     int activitypk = JspUtils.getInt(request, session, "activitypk");
@@ -16,6 +18,7 @@
 
     int modelpk = JspUtils.getInt(request, "modelpk");
     int memberpk = JspUtils.getInt(request, session, "memberpk");
+
     String operator = request.getParameter("operator");
     DSLContext ctx = DSL.using(DbConnection.getPara("MySQLURL"));
     if ("signList".equals(operator)) {
@@ -39,6 +42,9 @@
         ctx.close();
         return;
     }
+    if (modelpk > 0) {
+        response.sendRedirect("modelDetail.jsp?activitypk=" + activitypk + "&modelpk=" + modelpk + "&memberpk=" + memberpk);
+    }
     pageContext.setAttribute("viewNum", ctx.select(DSL.sum(PARTTYSIGN.VIEW))
             .from(PARTTYSIGN)
             .where(PARTTYSIGN.PARTTYPK.equal(activitypk))
@@ -46,15 +52,53 @@
     pageContext.setAttribute("signNum", ctx.selectCount().from(PARTTYSIGN)
             .where(PARTTYSIGN.PARTTYPK.equal(activitypk))
             .fetchOne(0, int.class));
-
+    List<JSONObject> ads = DBRecordsPack.Pack(ctx.select().from(ADS).where(ADS.PARTTYPK.equal(activitypk)).fetch());
 
 %>
 <html>
 <head>
     <title>谁是舞王模特大赛</title>
+    <link rel="stylesheet" href="${pageContext.request.contextPath}/js/swiper.min.css" charset="utf-8">
     <jsp:include page="meta.jsp"/>
-    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.0.2/css/swiper.min.css">
     <style>
+        .swiper-pagination-bullet {
+            width: 6px;
+            height: 1px;
+            background: rgba(255, 255, 255, 1);
+            border-radius: 1px;
+            opacity: 0.5989;
+            margin: 0 1px;
+        }
+
+        .swiper-pagination-bullet-active {
+            opacity: 1;
+        }
+
+        .swiper {
+            width: 100%;
+            height: 100px;
+            margin: 15px 20px 0 20px;
+        }
+
+        .swiper .swiper-slide {
+            height: 100px;
+            border-radius: 8px;
+            background-position: center;
+            background-size: cover;
+            background-repeat: no-repeat;
+        }
+
+        .swiper-wrapper {
+            position: relative;
+        }
+
+        .swiper-pagination {
+            position: absolute;
+            bottom: 10px;
+            left: 0;
+            right: 0;
+        }
+
         .content-top {
             background: rgba(255, 64, 149, 1);
             overflow: hidden;
@@ -95,26 +139,6 @@
             opacity: 0.8;
         }
 
-        .swiper-container {
-            width: 335px;
-            height: 100px;
-            border-radius: 8px;
-            margin-top: 15px;
-        }
-
-        .swiper-slide {
-            background-color: #ccc;
-        }
-
-        .swiper-pagination-bullet {
-            width: 6px;
-            height: 1px;
-        }
-
-        .swiper-pagination-bullet-active {
-            background: rgba(255, 255, 255, 1);
-        }
-
         .searchContent {
             margin: 10px 20px 40px;
             background: rgba(255, 255, 255, 1);
@@ -221,11 +245,11 @@
                     查看详情
                 </a>
             </div>
-            <div class="swiper-container">
-                <div class="swiper-wrapper">
-                    <a href="brandDetail.jsp" class="swiper-slide" v-for="item in swiperList"></a>
-
-                </div>
+            <div class="swiper-wrapper" style="height: auto;">
+                <swiper class="swiper" :options="swiperOption">
+                    <swiper-slide v-for="item in ads" class="swiper-slide"
+                                  :style="{backgroundImage: 'url(${pageContext.request.contextPath}/'+item.pic+')'}"></swiper-slide>
+                </swiper>
                 <div class="swiper-pagination"></div>
             </div>
 
@@ -246,7 +270,7 @@
                         浏览人数
                     </div>
                 </div>
-                <a href="search.jsp" class="item searchBtn">
+                <a href="search.jsp?activitypk=<%=activitypk%>&memberpk=<%=memberpk%>" class="item searchBtn">
                     <img src="${pageContext.request.contextPath}/image/dancer/icon_sousuo.png" alt="">
                     <span>搜索</span>
                 </a>
@@ -279,22 +303,34 @@
 
 </body>
 <jsp:include page="component/player.jsp"/>
-<script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.0.2/js/swiper.min.js"></script>
+<script src="${pageContext.request.contextPath}/js/swiper.min.js"></script>
+<script src="${pageContext.request.contextPath}/js/vue-awesome-swiper.js"></script>
 <script>
+    Vue.use(window.VueAwesomeSwiper);
     new Vue({
         el: '#app',
         data() {
             return {
                 time: " 2018.12.17-2018.12.30",
-                message: "简短介绍文字简短介绍文字",
-                join: 263,
-                watch: 38648,
-                swiperList: [{}, {}, {}],
+                message: "谁是舞王模特大赛",
+                ads: <%=ads%>,
+                swiperOption: {
+                    autoplay: true,
+                    loop: true,
+                    direction: 'horizontal',
+                    slidesPerView: 1,
+                    spaceBetween: 0,
+                    observeParents: true,
+                    pagination: {
+                        el: '.swiper-pagination',
+                        type: 'bullets'
+                    }
+                },
                 joinList: [],
-                currentPage:1,
-                notJoin:[],
-                joinFlag:true,
-                notFlag:true
+                currentPage: 1,
+                notJoin: [],
+                joinFlag: true,
+                notFlag: true
             }
         },
         mounted() {
@@ -311,37 +347,38 @@
             'player-item': playerComponent
         },
         methods: {
-            getJoinPlayer(){
-                if(!this.joinFlag){
+            getJoinPlayer() {
+                if (!this.joinFlag) {
                     return
                 }
-                if(this.currentPage==1){
-                    this.joinList=[]
+                if (this.currentPage == 1) {
+                    this.joinList = []
                 }
                 $.get({
                     url: '',
                     data: {
                         modelpk: '322',
                         memberpk: 858,
-                        activitypk:8,
-                        operator:'signList',
-                        page:this.currentPage
+                        activitypk: 8,
+                        operator: 'signList',
+                        page: this.currentPage
                     },
-                    success: function(res){
-                        if(res.length==0){
-                            this.joinFlag=false
+                    success: function (res) {
+                        if (res.length == 0) {
+                            this.joinFlag = false
                         }
-                        this.joinList=this.joinList.concat(res)
+                        this.joinList = this.joinList.concat(res)
                     }.bind(this)
                 })
             },
-            getNot(){},
-            menu(){
-                if($('#app').scrollTop()+$('#app').height()+50>=document.getElementById('app').scrollHeight){
-                    if(this.joinFlag){
+            getNot() {
+            },
+            menu() {
+                if ($('#app').scrollTop() + $('#app').height() + 50 >= document.getElementById('app').scrollHeight) {
+                    if (this.joinFlag) {
                         this.currentPage++
                         this.getJoinPlayer()
-                    }else if(this.notFlag){
+                    } else if (this.notFlag) {
                         this.getNot()
                     }
 

+ 12 - 2
src/main/webapp/dancer/meta.jsp

@@ -12,12 +12,22 @@
 
 
 <style>
-    .container{
+    html, body {
+        padding: 0;
+        margin: 0;
+        font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB",
+        "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
+        -webkit-font-smoothing: antialiased;
+        -moz-osx-font-smoothing: grayscale;
+    }
+
+    .container {
         overflow: auto;
         position: absolute;
-        top:0;
+        top: 0;
         left: 0;
         width: 100%;
         height: 100%;
+        -webkit-overflow-scrolling: touch;
     }
 </style>

+ 83 - 24
src/main/webapp/dancer/modelDetail.jsp

@@ -16,12 +16,13 @@
 <%@ page import="org.jooq.Record1" %>
 <%@ page import="java.util.regex.Pattern" %>
 <%@ page import="org.jooq.Result" %>
+<%@ page import="com.thmodel.util.JspUtils" %>
 <%@ page contentType="text/html;charset=UTF-8" language="java" %>
 <%
-    int activitypk = Integer.valueOf(request.getParameter("activitypk"));
-    int modelpk = Integer.valueOf(request.getParameter("modelpk"));
-    int memberpk = Integer.valueOf(request.getParameter("memberpk"));
-    String operator = request.getParameter("operator");
+    int activitypk = JspUtils.getInt(request, "activitypk");
+    int modelpk = JspUtils.getInt(request, "modelpk");
+    int memberpk = JspUtils.getInt(request, "memberpk");
+    String operator = JspUtils.getString(request, "operator");
 
 
     DSLContext ctx = DSL.using(DbConnection.getPara("MySQLURL"));
@@ -46,7 +47,8 @@
             .where(MODELFAN.MODELPK.equal(modelpk))
             .fetchOne(0, int.class);
     String[] fans = ctx.select(MEMBERINFO.HPHOTO).from(MODELFAN).join(MEMBERINFO)
-            .on(MODELFAN.MODELPK.equal(MEMBERINFO.PK))
+            .on(MODELFAN.MEMBERPK.equal(MEMBERINFO.PK))
+            .where(MODELFAN.MODELPK.equal(modelpk))
             .orderBy(MODELFAN.PK.desc())
             .limit(3)
             .fetch().stream().map((Function<Record1<String>, Object>) Record1::value1).toArray(String[]::new);
@@ -527,8 +529,8 @@
         <div class="name"><%=modelInfo.get("Pet")%>
         </div>
         <div style="text-align: center;margin-top: 6px">
-            <button class="detail">查看详细资料</button>
-            <button class="follow" :class="{isFollow:isFollow}">{{isFollow ? '已关注' : '关注'}}</button>
+            <button class="detail" @click="detail">查看详细资料</button>
+            <button class="follow" @click="detail" :class="{isFollow:isFollow}">{{isFollow ? '已关注' : '关注'}}</button>
         </div>
         <div class="divider"></div>
         <div class="numbers">
@@ -558,7 +560,7 @@
         </div>
         <div class="intro"><%=signInfo.getOrDefault("text", "")%>
         </div>
-        <div class="fans-list">
+        <div class="fans-list" @click="fansList">
             <div style="font-size:14px;color: #000;font-weight: 700;margin-left: 15px;">粉丝团</div>
             <div style="font-size:13px;color: #999;margin-left: 6px;flex-grow: 1;"><%=fansNum%>
             </div>
@@ -582,9 +584,9 @@
                 </div>
             </div>
         </c:forEach>
-        <div style="font-size:16px;font-weight:700;text-align: center;line-height: 24px;margin-top: 30px;margin-bottom: 20px"><span
-                style="font-size: 24px;vertical-align: middle;">·</span>&nbsp;更多选手&nbsp;<span
-                style="font-size: 24px;vertical-align: middle;">·</span></div>
+        <div style="font-size:16px;font-weight:700;text-align: center;line-height: 24px;margin-top: 30px;margin-bottom: 20px">
+            •&nbsp;更多选手&nbsp;•
+        </div>
         <div style="font-size: 0;padding: 0 10px;">
             <c:forEach var="item" items="${moreList}">
                 <div class="more-item-wrapper">
@@ -674,26 +676,83 @@
             getTime: function (t) {
                 return new Date(t).toLocaleString()
             },
-            video: function () {
-
-            },
-            sendGift: function () {
+            checkApp: function () {
                 if (this.inApp) {
-                    if (this.isIOS) {
-                        window.webkit.messageHandlers.chmo.postMessage({
-                            action: 'sendGift',
-                            modelpk: <%=modelpk%>,
-                            activitypk: <%=activitypk%>
-                        })
-                    } else {
-
-                    }
+                    return true;
                 } else {
                     if (this.isIOS) {
                         window.location = 'https://itunes.apple.com/cn/app/id1434021876?mt=8'
                     } else {
                         window.location = 'http://a.app.qq.com/o/simple.jsp?pkgname=com.android.chmo'
                     }
+                    return false;
+                }
+            },
+            detail: function () {
+                if (this.checkApp()) {
+                    try {
+                        if (this.isIOS) {
+                            window.webkit.messageHandlers.chmo.postMessage({
+                                action: 'detail',
+                                modelpk: <%=modelpk%>,
+                                activitypk: <%=activitypk%>
+                            })
+                        } else {
+                            window.chmo.modelDetail(<%=modelpk%>);
+                        }
+                    } catch (e) {
+                        console.log(e)
+                    }
+                }
+            },
+            video: function () {
+                if (this.checkApp()) {
+                    try {
+                        if (this.isIOS) {
+                            window.webkit.messageHandlers.chmo.postMessage({
+                                action: 'video',
+                                modelpk: <%=modelpk%>,
+                                activitypk: <%=activitypk%>
+                            })
+                        } else {
+                            window.chmo.sendVideo(<%=modelpk%>);
+                        }
+                    } catch (e) {
+                        console.log(e)
+                    }
+                }
+            },
+            sendGift: function () {
+                if (this.checkApp()) {
+                    try {
+                        if (this.isIOS) {
+                            window.webkit.messageHandlers.chmo.postMessage({
+                                action: 'sendGift',
+                                modelpk: <%=modelpk%>,
+                                activitypk: <%=activitypk%>
+                            })
+                        } else {
+                            window.chmo.sendGift(<%=modelpk%>, <%=activitypk%>);
+                        }
+                    } catch (e) {
+                        console.log(e)
+                    }
+                }
+            },
+            fansList: function () {
+                if (this.checkApp()) {
+                    try {
+                        if (this.isIOS) {
+                            window.webkit.messageHandlers.chmo.postMessage({
+                                action: 'fansList',
+                                modelpk: <%=modelpk%>
+                            })
+                        } else {
+                            window.chmo.fansList(<%=modelpk%>);
+                        }
+                    } catch (e) {
+                        console.log(e)
+                    }
                 }
             }
         }

+ 17 - 9
src/main/webapp/dancer/search.jsp

@@ -60,6 +60,7 @@
             display: flex;
             padding: 0 0 10px;
             min-height: 36px;
+            padding-top: 10px;
         }
 
         .searchContent .search {
@@ -217,7 +218,7 @@
                 <img class="del" v-show="searchVal&&isFocus" @click="searchVal=''"
                      src="${pageContext.request.contextPath}/image/dancer/sousuo_icon_del.png" alt="">
             </div>
-            <div class="cancel" @click="showHistory=true"> 取消</div>
+            <div class="cancel" @click="back"> 取消</div>
         </div>
 
 
@@ -244,7 +245,7 @@
 
                 <div class="resultList">
                     <template v-if="resultList.length>0">
-                        <search-result v-for="item in resultList" :info="item"></search-result>
+                        <search-result v-for="item in resultList" :info="item" @click.native="detail(item)"></search-result>
                     </template>
 
 
@@ -270,7 +271,7 @@
                 isFocus: false,
                 history: [],
                 showHistory: true,
-                resultList:[]
+                resultList: []
             }
         },
         mounted() {
@@ -280,6 +281,13 @@
             'search-result': searchResult
         },
         methods: {
+            back: function () {
+                history.go(-1)
+            },
+            detail: function (item) {
+                window.location.href = '${pageContext.request.contextPath}/dancer/modelDetail.jsp?modelpk=' + item.modelpk
+                    + '&memberpk=<%=memberpk%>&activitypk=<%=activitypk%>';
+            },
             getHistory() {
                 var history = localStorage['thmodelDancerHistory'] == null ? [] : JSON.parse(localStorage['thmodelDancerHistory']);
 
@@ -306,16 +314,16 @@
             inputEvent(e) {
                 if (e.keyCode == 13) {
                     if (!this.searchVal) {
-                        alert('搜索内容不能为空!')
+                        alert('搜索内容不能为空!');
                         return
                     }
-                    this.addHistory(this.searchVal)
+                    this.addHistory(this.searchVal);
                     this.getSearch(this.searchVal)
                 }
             },
             getSearch(keyword) {
-                this.showHistory = false
-                this.searchVal=keyword
+                this.showHistory = false;
+                this.searchVal = keyword;
                 $.get({
                     url: '',
                     data: {
@@ -323,8 +331,8 @@
                         keyword: keyword,
                         page: 1
                     },
-                    success: function(res){
-                        this.resultList=res
+                    success: function (res) {
+                        this.resultList = res
                     }.bind(this)
                 })
             }

+ 0 - 1
src/test/java/MemberTest.java

@@ -103,7 +103,6 @@ public class MemberTest {
             memberInfo.setTel(tel);
             memberInfo.setPass("111111");
             memberInfo.setPet(tel);
-            memberinfoService.doRegister(memberInfo, "411525");
         }
 
         String[] arr1 = {"15077881111", "15077881112", "15077881113"};