新增企业号工程并完成【部门管理】【成员管理】【标签管理】三个接口
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
weixin4j-mp-server
|
||||
==================
|
||||
|
||||
微信netty服务
|
||||
微信公众平台netty服务
|
||||
------------
|
||||
|
||||
功能列表
|
||||
@@ -26,7 +26,7 @@ weixin4j-mp-server
|
||||
|
||||
示例(properties中换行用右斜杆\\)
|
||||
|
||||
> account={"appId":"appId","appSecret":"appSecret",
|
||||
> account={"id":"appId","secret":"appSecret",
|
||||
> "token":"开放者的token 非必须","openId":"公众号的openid 非必须",
|
||||
> "encodingAesKey":"公众号设置了加密方式且为「安全模式」时需要填入",
|
||||
> "mchId":"V3.x版本下的微信商户号",
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
</parent>
|
||||
<artifactId>weixin4j-mp-server</artifactId>
|
||||
<name>weixin4j-mp-server</name>
|
||||
<url>https://github.com/foxinmy/weixin4j/tree/master/weixin4j-mp/weixin4j-server</url>
|
||||
<url>https://github.com/foxinmy/weixin4j/tree/master/weixin4j-mp/weixin4j-mp-server</url>
|
||||
<description>微信公众号服务</description>
|
||||
<build>
|
||||
<finalName>weixin-mp-server</finalName>
|
||||
|
||||
+5
-5
@@ -13,7 +13,7 @@ import org.apache.http.Consts;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.foxinmy.weixin4j.model.WeixinAccount;
|
||||
import com.foxinmy.weixin4j.model.WeixinMpAccount;
|
||||
import com.foxinmy.weixin4j.mp.model.HttpWeixinMessage;
|
||||
import com.foxinmy.weixin4j.mp.type.EncryptType;
|
||||
import com.foxinmy.weixin4j.util.ConfigUtil;
|
||||
@@ -37,7 +37,7 @@ public class WeixinMessageDecoder extends
|
||||
@Override
|
||||
protected void decode(ChannelHandlerContext ctx, FullHttpRequest req,
|
||||
List<Object> out) throws Exception {
|
||||
WeixinAccount account = ConfigUtil.getWeixinAccount();
|
||||
WeixinMpAccount mpAccount = ConfigUtil.getWeixinMpAccount();
|
||||
String xmlContent = req.content().toString(Consts.UTF_8);
|
||||
HttpWeixinMessage message = new HttpWeixinMessage();
|
||||
if (StringUtils.isNotBlank(xmlContent)) {
|
||||
@@ -72,10 +72,10 @@ public class WeixinMessageDecoder extends
|
||||
|
||||
message.setXmlContent(xmlContent);
|
||||
if (message.getEncryptType() == EncryptType.AES) {
|
||||
message.setXmlContent(MessageUtil.aesDecrypt(account.getAppId(),
|
||||
account.getEncodingAesKey(), message.getEncryptContent()));
|
||||
message.setXmlContent(MessageUtil.aesDecrypt(mpAccount.getId(),
|
||||
mpAccount.getEncodingAesKey(), message.getEncryptContent()));
|
||||
}
|
||||
message.setToken(account.getToken());
|
||||
message.setToken(mpAccount.getToken());
|
||||
out.add(message);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -11,7 +11,7 @@ import java.util.Map;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.foxinmy.weixin4j.model.WeixinAccount;
|
||||
import com.foxinmy.weixin4j.model.WeixinMpAccount;
|
||||
import com.foxinmy.weixin4j.mp.response.BaseResponse;
|
||||
import com.foxinmy.weixin4j.mp.util.HttpUtil;
|
||||
import com.foxinmy.weixin4j.util.ConfigUtil;
|
||||
@@ -45,13 +45,13 @@ public class WeixinMessageEncoder extends MessageToMessageEncoder<BaseResponse>
|
||||
@Override
|
||||
protected void encode(ChannelHandlerContext ctx, BaseResponse response,
|
||||
List<Object> out) throws Exception {
|
||||
WeixinAccount account = ConfigUtil.getWeixinAccount();
|
||||
WeixinMpAccount mpAccount = ConfigUtil.getWeixinMpAccount();
|
||||
String xmlContent = response.toXml();
|
||||
String nonce = RandomUtil.generateString(32);
|
||||
String timestamp = DateUtil.timestamp2string();
|
||||
String encrtypt = MessageUtil.aesEncrypt(account.getAppId(),
|
||||
account.getEncodingAesKey(), xmlContent);
|
||||
String msgSignature = MessageUtil.signature(account.getToken(), nonce,
|
||||
String encrtypt = MessageUtil.aesEncrypt(mpAccount.getId(),
|
||||
mpAccount.getEncodingAesKey(), xmlContent);
|
||||
String msgSignature = MessageUtil.signature(mpAccount.getToken(), nonce,
|
||||
timestamp, encrtypt);
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put("Encrypt", encrtypt);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# \u516c\u4f17\u53f7\u4fe1\u606f
|
||||
account={"appId":"wx4ab8f8de58159a57","appSecret":"1d4eb0f4bf556aaed539f30ed05ca795",\
|
||||
account={"id":"wx4ab8f8de58159a57","secret":"1d4eb0f4bf556aaed539f30ed05ca795",\
|
||||
"token":"\u5f00\u653e\u8005\u7684token \u975e\u5fc5\u987b","openId":"\u516c\u4f17\u53f7\u7684openid \u975e\u5fc5\u987b",\
|
||||
"encodingAesKey":"\u516c\u4f17\u53f7\u8bbe\u7f6e\u4e86\u52a0\u5bc6\u65b9\u5f0f\u4e14\u4e3a\u300c\u5b89\u5168\u6a21\u5f0f\u300d\u9700\u8981\u586b\u5165",\
|
||||
"mchId":"V3.x\u7248\u672c\u4e0b\u7684\u5fae\u4fe1\u5546\u6237\u53f7",\
|
||||
|
||||
Reference in New Issue
Block a user