Просмотр исходного кода

小程序接口权限查看待完成版

xujunwei 3 лет назад
Родитель
Сommit
84db733eb2

+ 20 - 1
framework-common/src/main/java/com/mrxu/framework/common/weixin/msg/InMsgParaser.java

@@ -5,6 +5,8 @@ import com.mrxu.framework.common.util.StrFunc;
 import com.mrxu.framework.common.weixin.msg.in.*;
 import com.mrxu.framework.common.weixin.msg.in.event.*;
 import com.mrxu.framework.common.weixin.msg.in.speech_recognition.InSpeechRecognitionResults;
+import com.mrxu.framework.common.xcx.msg.in.AuditFailMsg;
+import com.mrxu.framework.common.xcx.msg.in.AuditSuccessMsg;
 import org.dom4j.Document;
 import org.dom4j.DocumentException;
 import org.dom4j.DocumentHelper;
@@ -56,6 +58,10 @@ public class InMsgParaser {
         	return parseInLinkMsg(root, toUserName, fromUserName, createTime, msgType);
         if ("event".equals(msgType))
         	return parseInEvent(root, toUserName, fromUserName, createTime, msgType);
+		if ("weapp_audit_success".equals(msgType))
+			return parseInEvent(root, toUserName, fromUserName, createTime, msgType);
+		if ("weapp_audit_fail".equals(msgType))
+			return parseInEvent(root, toUserName, fromUserName, createTime, msgType);
         throw new RuntimeException("无法识别的消息类型,请查阅微信公众平台开发文档");
 	}
 	
@@ -182,7 +188,20 @@ public class InMsgParaser {
 			e.setStatus(root.elementText("Status"));
 			return e;
 		}
-		
+
+		// 小程序审核通过
+		if ("weapp_audit_success".equals(event)) {
+			AuditSuccessMsg e = new AuditSuccessMsg(toUserName, fromUserName, createTime, msgType);
+			return e;
+		}
+
+		// 小程序审核不通过
+		if ("weapp_audit_fail".equals(event)) {
+			AuditFailMsg e = new AuditFailMsg(toUserName, fromUserName, createTime, msgType);
+			e.setReason(root.elementText("Reason"));
+			e.setScreenShot(root.elementText("ScreenShot`"));
+			return e;
+		}
 		throw new RuntimeException("无法识别的事件类型,请查阅微信公众平台开发文档");
 	}
 	

+ 44 - 0
framework-common/src/main/java/com/mrxu/framework/common/xcx/msg/in/AuditFailMsg.java

@@ -0,0 +1,44 @@
+package com.mrxu.framework.common.xcx.msg.in;
+
+import com.mrxu.framework.common.weixin.msg.in.InMsg;
+
+
+/**
+ * https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/code/audit_event.html
+ * <xml>
+ *   <ToUserName><![CDATA[gh_fb9688c2a4b2]]></ToUserName>
+ *   <FromUserName><![CDATA[od1P50M-fNQI5Gcq-trm4a7apsU8]]></FromUserName>
+ *   <CreateTime>1488856591</CreateTime>
+ *   <MsgType><![CDATA[event]]></MsgType>
+ *   <Event><![CDATA[weapp_audit_fail]]></Event>
+ *   <Reason><![CDATA[1:账号信息不符合规范:<br>(1):包含色情因素<br>2:服务类目"金融业 - 保险_"与你提交代码审核时设置的功能页面内容不一致:<br>(1):功能页面设置的部分标签不属于所选的服务类目范围。<br>(2):功能页面设置的部分标签与该页面内容不相关。<br>]]></Reason>
+ *   <FailTime>1488856591</FailTime>
+ *   <ScreenShot>xxx|yyy|zzz</ScreenShot>
+ * </xml>
+ */
+public class AuditFailMsg extends InMsg {
+
+    private String reason;
+
+    private String screenShot;
+
+    public AuditFailMsg(String toUserName, String fromUserName, Integer createTime, String msgType) {
+        super(toUserName, fromUserName, createTime, msgType);
+    }
+
+    public String getReason() {
+        return reason;
+    }
+
+    public void setReason(String reason) {
+        this.reason = reason;
+    }
+
+    public String getScreenShot() {
+        return screenShot;
+    }
+
+    public void setScreenShot(String screenShot) {
+        this.screenShot = screenShot;
+    }
+}

+ 23 - 0
framework-common/src/main/java/com/mrxu/framework/common/xcx/msg/in/AuditSuccessMsg.java

@@ -0,0 +1,23 @@
+package com.mrxu.framework.common.xcx.msg.in;
+
+import com.mrxu.framework.common.weixin.msg.in.InMsg;
+
+
+/**
+ * https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/code/audit_event.html
+ * <xml>
+ *   <ToUserName><![CDATA[gh_fb9688c2a4b2]]></ToUserName>
+ *   <FromUserName><![CDATA[od1P50M-fNQI5Gcq-trm4a7apsU8]]></FromUserName>
+ *   <CreateTime>1488856741</CreateTime>
+ *   <MsgType><![CDATA[event]]></MsgType>
+ *   <Event><![CDATA[weapp_audit_success]]></Event>
+ *   <SuccTime>1488856741</SuccTime>
+ * </xml>
+ */
+public class AuditSuccessMsg extends InMsg {
+
+    public AuditSuccessMsg(String toUserName, String fromUserName, Integer createTime, String msgType) {
+        super(toUserName, fromUserName, createTime, msgType);
+    }
+
+}