Commit cb6e0544 authored by 张艳玲's avatar 张艳玲

update

parent 94bcd229
...@@ -91,25 +91,25 @@ public class Boss { ...@@ -91,25 +91,25 @@ public class Boss {
}*/ }*/
//邀请结果判断 //邀请结果判断
// @Test(description="邀请结果",priority = 7) @Test(description="邀请结果",priority = 7)
// public void 邀请结果() throws IOException{ public void 邀请结果() throws IOException{
// Map<String, Object> params = new HashMap<String, Object>(); Map<String, Object> params = new HashMap<String, Object>();
// params.put("inviterSid",sellerId); params.put("inviterSid",sellerId);
// params.put("inviteType",2); params.put("inviteType",2);
// network.agentCookies.put("tku",VISITOR_TKU); network.agentCookies.put("tku",VISITOR_TKU);
// Response response = network.getResponse(params,BOSS_BOUND); Response response = network.getResponse(params,BOSS_BOUND);
// boolean data =true;// response.jsonPath().getBoolean("data"); //1 true:邀请成功;2 false:邀请失败 boolean data =true;// response.jsonPath().getBoolean("data"); //1 true:邀请成功;2 false:邀请失败
// Assert.assertTrue(data, network.message(params,BOSS_BOUND,"接受邀请失败",response.body().asString())); Assert.assertTrue(data, network.message(params,BOSS_BOUND,"接受邀请失败",response.body().asString()));
//
//
//
// //获取被邀请人上级昵称 //获取被邀请人上级昵称
// Map<String, Object> inviteparams = new HashMap<String, Object>(); Map<String, Object> inviteparams = new HashMap<String, Object>();
// params.put("sellerId",vistorId); params.put("sellerId",vistorId);
// Response responses = network.getResponse(inviteparams,BOSS_BOSS); Response responses = network.getResponse(inviteparams,BOSS_BOSS);
// String name = responses.jsonPath().getString("data"); String name = responses.jsonPath().getString("data");
// Assert.assertEquals(name,sellerName,network.message(params,BOSS_BOSS,"昵称不匹配",response.body().asString())); Assert.assertEquals(name,sellerName,network.message(params,BOSS_BOSS,"昵称不匹配",response.body().asString()));
// } }
//重新获取列表,代理人有无上下级判断; //重新获取列表,代理人有无上下级判断;
@Test(description="当前代理人角色二次判断",priority = 8) @Test(description="当前代理人角色二次判断",priority = 8)
......
...@@ -6,6 +6,7 @@ import com.kjj.bean.RewardPkBean; ...@@ -6,6 +6,7 @@ import com.kjj.bean.RewardPkBean;
import com.kjj.config.BasicConfig; import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants; import com.kjj.constants.LiveConstants;
import com.kjj.utils.BaseUtils; import com.kjj.utils.BaseUtils;
import com.kjj.utils.IdMakeUtil;
import io.restassured.response.Response; import io.restassured.response.Response;
import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.lang3.time.DateUtils;
import org.testng.Assert; import org.testng.Assert;
...@@ -15,6 +16,7 @@ import java.util.*; ...@@ -15,6 +16,7 @@ import java.util.*;
public class SaveAndUpdate implements AdminAuthorization { public class SaveAndUpdate implements AdminAuthorization {
public String liveID; public String liveID;
public String EncodeLiveID;
@Test(description = "创建直播", priority = 1) @Test(description = "创建直播", priority = 1)
public void 创建直播() { public void 创建直播() {
...@@ -31,7 +33,6 @@ public class SaveAndUpdate implements AdminAuthorization { ...@@ -31,7 +33,6 @@ public class SaveAndUpdate implements AdminAuthorization {
saveAndUpdateParam.put("companyId", 101); saveAndUpdateParam.put("companyId", 101);
saveAndUpdateParam.put("agentInviteAuthType", 1); saveAndUpdateParam.put("agentInviteAuthType", 1);
saveAndUpdateParam.put("agentInviteAuthLimitNum", 1); saveAndUpdateParam.put("agentInviteAuthLimitNum", 1);
long noticeTime = DateUtils.addHours(new Date(), 2).getTime(); long noticeTime = DateUtils.addHours(new Date(), 2).getTime();
long broadcastTime = DateUtils.addHours(new Date(), 5).getTime(); long broadcastTime = DateUtils.addHours(new Date(), 5).getTime();
saveAndUpdateParam.put("noticeTime", noticeTime); saveAndUpdateParam.put("noticeTime", noticeTime);
...@@ -42,8 +43,10 @@ public class SaveAndUpdate implements AdminAuthorization { ...@@ -42,8 +43,10 @@ public class SaveAndUpdate implements AdminAuthorization {
Response response = network.postResponse(saveAndUpdateParam, BasicConfig.MANAGER_SAVEANDUPDATE); Response response = network.postResponse(saveAndUpdateParam, BasicConfig.MANAGER_SAVEANDUPDATE);
liveID = response.jsonPath().getString("data"); liveID = response.jsonPath().getString("data");
EncodeLiveID = IdMakeUtil.encodingId(Long.valueOf(liveID));
System.out.println(liveID); System.out.println(liveID);
LiveConstants.setValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey(),liveID); LiveConstants.setValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey(),liveID);
LiveConstants.setValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey(),EncodeLiveID);
Assert.assertNotNull(liveID, network.message(saveAndUpdateParam, BasicConfig.MANAGER_SAVEANDUPDATE, "新增直播失败", response.body().asString())); Assert.assertNotNull(liveID, network.message(saveAndUpdateParam, BasicConfig.MANAGER_SAVEANDUPDATE, "新增直播失败", response.body().asString()));
LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()); LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey());
......
...@@ -83,6 +83,8 @@ public class BasicConfig { ...@@ -83,6 +83,8 @@ public class BasicConfig {
public static final String MOBILE_ClueNum = MOBILE_HOST + "/kjy/live/agent/clue/clueNum"; public static final String MOBILE_ClueNum = MOBILE_HOST + "/kjy/live/agent/clue/clueNum";
public static final String MOBILE_ClueList = MOBILE_HOST + "/kjy/live/agent/clue/list"; public static final String MOBILE_ClueList = MOBILE_HOST + "/kjy/live/agent/clue/list";
public static final String MOBILE_AGENTSPECIFYAWARDSUBMIN = MOBILE_HOST + "/kjy/live/agent/agentSpecifyAwardSubmit"; public static final String MOBILE_AGENTSPECIFYAWARDSUBMIN = MOBILE_HOST + "/kjy/live/agent/agentSpecifyAwardSubmit";
public static final String MOBILE_GETSHARESIGN = MOBILE_HOST + "/kjy/live/getShareSign";
public static final String MOBILE_BINDING = MOBILE_HOST + "/clue/invitation/binding";
//***************直播素材***************** //***************直播素材*****************
public static final String MANAGER_SAVEORUPDATE6 = MANAGER_HOST+ "/kjy/manager/conf/base/welfare/saveOrUpdate"; public static final String MANAGER_SAVEORUPDATE6 = MANAGER_HOST+ "/kjy/manager/conf/base/welfare/saveOrUpdate";
......
...@@ -21,6 +21,7 @@ public class LiveConstants { ...@@ -21,6 +21,7 @@ public class LiveConstants {
@AllArgsConstructor @AllArgsConstructor
public enum StringKeyEnum{ public enum StringKeyEnum{
LIVE_ID(1,"直播ID的key"), LIVE_ID(1,"直播ID的key"),
ENCODE_LIVE_ID(2,"直播加密ID的key"),
; ;
private Integer key; private Integer key;
private String desc; private String desc;
......
package com.kjj.utils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import java.util.Base64;
/**
* Created by dugq on 2019-10-23.
*
* 把ID转换后通过base64编码得出来的值
* 规律: 以Kj2 开头。第四位为base64结尾'='的个数。避免url encoding
* 数字部分利用二进制左移3位,后三位补1 把数字变换掉,再base64转码。支持最大值为 2^(64-4)
* 兼容:旧版本以kjj开头 第四位取原数字第一位补充。 加密已删除,揭秘通过kjj 和 kj2 区分
* 修改原因: 旧版本太长, 且要处理URL编码问题导致多了一次转换16进制。 加密的主要方案在于 数字左移和补最高位,鉴于base64的高效,所以使用base64encode来美化ID
*
* base64加密效率: 加密 1 - 2千万 1s以内完成
*/
public class IdMakeUtil {
private static final Base64.Encoder encoder = Base64.getEncoder();
private static final Base64.Decoder decoder = Base64.getDecoder();
private static final String PREFIX = "Kj2";
private IdMakeUtil(){}
public static String encodingId(Long id) {
id = (id << 3) ^ 7;
String encode = encoder.encodeToString(Long.toString(id).getBytes());
String replace = encode.replace("=", "");
return PREFIX + (encode.length() - replace.length()) + replace;
}
public static Long decodingId(String encode) {
if (StringUtils.isBlank(encode)) {
return null;
}
try {
StringBuilder substring = new StringBuilder(encode.substring(4));
String decode = new String(decoder.decode(substring.toString()));
return Long.valueOf(decode) >> 3;
} catch (Exception e) {
return null;
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment