zoujiajian 3 éve
szülő
commit
30127bdcbe

+ 1 - 1
netflix-dao/src/main/java/com/cyksj/model/entity/UserGzhRelation.java

@@ -12,7 +12,7 @@ import lombok.Setter;
  */
 @Getter
 @Setter
-public class UserGzhRelation {
+public class UserGzhRelation extends BaseEntity{
 	private Long wxAppId;
 
 	private Long userId;

+ 3 - 0
netflix-service/src/main/java/com/cyksj/service/gzh/factory/EventMsgService.java

@@ -48,6 +48,7 @@ public class EventMsgService implements GzhMsgService{
 						.last("limit 1"));
 				GzhUnionidUserinfo info = weChatService.getUserInfo2(weChatService.getAccessToken(), openId);
 				if (user == null) {
+					user = new User();
 					user.setNickname(info.getNickname())
 							.setSex(info.getSex())
 							.setCountry(info.getCountry())
@@ -59,6 +60,7 @@ public class EventMsgService implements GzhMsgService{
 					userMapper.insert(user);
 
 					saveGzhUserRelation(msgEvent, user.getId(), openId, info.getUnionid());
+					return "";
 				} else {
 					//之前关注过
 					if (user.getUnionid() == null || !user.getUnionid().equals(info.getUnionid())) {
@@ -70,6 +72,7 @@ public class EventMsgService implements GzhMsgService{
 					if (userGzhRelation == null) {
 						saveGzhUserRelation(msgEvent, user.getId(), openId, info.getUnionid());
 					}
+					return "";
 				}
 			} else if (msgEvent.getEvent() == MsgEvent.Event.unsubscribe) {
 				UserGzhRelation userGzhRelation = userGzhRelationMapper.selectOne(Wrappers.lambdaQuery(UserGzhRelation.class)

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/gzh/factory/GzhMsgServiceFactory.java

@@ -21,7 +21,7 @@ public class GzhMsgServiceFactory {
 
 
 	public String handleMsg(MsgEvent msgEvent) {
-		GzhMsgService gzhMsgService = ghzMsgServiceMap.get(msgEvent.getMsgType());
+		GzhMsgService gzhMsgService = ghzMsgServiceMap.get(msgEvent.getMsgType().name());
 
 		return gzhMsgService.handleNotify(msgEvent);
 	}

+ 1 - 4
netflix-web/src/main/java/com/cyksj/web/controller/manage/gzh/GzhController.java

@@ -36,10 +36,7 @@ public class GzhController {
 	private final GzhMsgTemplateRelationMapper gzhMsgTemplateRelationMapper;
 
 	@RequestMapping(value = "/msg/notify", method = {RequestMethod.GET, RequestMethod.POST})
-	public String msgNotify(@RequestParam(value = "msg_signature") String msgSignature, String timestamp, String nonce, @RequestParam(value = "echostr", required = false) String echoStr) throws IOException {
-		if (StrUtil.hasEmpty(msgSignature, timestamp, nonce)) {
-			return StringUtil.EMPTY;
-		}
+	public String msgNotify(@RequestParam(value = "echostr", required = false) String echoStr) throws IOException {
 		if (StrUtil.endWithIgnoreCase(request.getMethod(), RequestMethod.GET.name())) {
 			if (StrUtil.isBlank(echoStr)) {
 				return StrUtil.EMPTY;