Commit 0f52b111 authored by zhouzihao's avatar zhouzihao

dev-获取消息接口

parent 26d3457a
...@@ -44,6 +44,8 @@ public class Tmp { ...@@ -44,6 +44,8 @@ public class Tmp {
// 上线前使用这段代码 // 上线前使用这段代码
// 登录 // 登录
case1 = new LoginCase(mobile, pwd); case1 = new LoginCase(mobile, pwd);
// 获取消息接口
case1 = new MsgGetDecorator(case1);
// 查询用户信息 // 查询用户信息
case1 = new UserInfoDecorator(case1); case1 = new UserInfoDecorator(case1);
case1 = new CarListDecorator(case1); case1 = new CarListDecorator(case1);
......
package com.vandyo.sentry.core.cases;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.vandyo.sentry.core.collectionMachine.CollectionMachine;
import com.vandyo.sentry.core.dto.Res;
import com.vandyo.sentry.core.tools.Signature;
import java.util.HashMap;
import java.util.Map;
/**
* 获取消息接口
*/
public class MsgGetDecorator extends CaseDecorator {
private static final String msgGetUrl = "/msg/msg_get";
public MsgGetDecorator(Case aCase) {
super(aCase);
}
@Override
public Res<Map<String, String>> check() {
Res<Map<String, String>> oldRes = super.check();
if (oldRes.getSuccess()) {
Map<String, String> data = new HashMap<>();
data.put("uid", oldRes.getUId());
data.put("size", String.valueOf(1));
HttpResponse response = HttpRequest.get(Signature.msgHost + msgGetUrl + "?"
+ Signature.getUrlParamsByMap(Signature.sign(data, oldRes.getSId())))
.execute();
Res<Map<String, String>> newRes = new Res<>();
newRes.setSId(oldRes.getSId());
newRes.setUId(oldRes.getUId());
if (response.isOk()) {
JSONObject json = JSONUtil.parseObj(response.body());
newRes.setSuccess(true);
} else {
newRes.setKey(msgGetUrl);
newRes.setStatus(Signature.matchStatus(response.getStatus()));
newRes.setSuccess(false);
}
CollectionMachine.post(newRes);
return newRes;
} else {
oldRes.setIgnore(true);
return oldRes;
}
}
}
...@@ -14,6 +14,7 @@ public class Signature { ...@@ -14,6 +14,7 @@ public class Signature {
// need be change to product env // need be change to product env
// public static final String host = "http://10.100.11.41:8080"; // public static final String host = "http://10.100.11.41:8080";
public static final String host = "http://10.100.12.42:8080"; public static final String host = "http://10.100.12.42:8080";
public static final String msgHost = "http://10.100.12.42:8088";
/** /**
* 生成签名 * 生成签名
......
...@@ -20,6 +20,7 @@ checkmeta: ...@@ -20,6 +20,7 @@ checkmeta:
"[/car/api/locus/event/v111]": 轨迹行驶行为 "[/car/api/locus/event/v111]": 轨迹行驶行为
"[/user/mall/goods/list]": 商品列表接口 "[/user/mall/goods/list]": 商品列表接口
"[/user/authorize/logout]": 注销登录接口 "[/user/authorize/logout]": 注销登录接口
"[/msg/msg_get]": 获取消息接口
test: 测试接口 test: 测试接口
timeMap: timeMap:
"[/car/my_car/info]": 6 "[/car/my_car/info]": 6
...@@ -35,6 +36,7 @@ checkmeta: ...@@ -35,6 +36,7 @@ checkmeta:
"[/car/api/locus/event/v111]": 6 "[/car/api/locus/event/v111]": 6
"[/user/mall/goods/list]": 6 "[/user/mall/goods/list]": 6
"[/user/authorize/logout]": 6 "[/user/authorize/logout]": 6
"[/msg/msg_get]": 6
test: 2 test: 2
emailList[0]: "1042181618@qq.com" emailList[0]: "1042181618@qq.com"
......
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