forked from chanjarster/weixin-java-tools
-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
CP_用户管理
MR-C edited this page Feb 23, 2020
·
4 revisions
WxCpUser user = new WxCpUser();
user.setUserId("demo.user");
user.setName("demo.user");
user.setDepartIds(new Integer[] { 9, 8 });
user.setEmail("demo.user@ddd.com");
user.setGender("女");
user.setMobile("87350908979");
user.setPosition("demo.user");
user.setTel("3300393");
user.addExtAttr("爱好", "旅游");
wxCpService.getUserService().create(user);
WxCpUser user = new WxCpUser();
user.setUserId("demo.user");
user.setName("demo.user.new");
user.addExtAttr("爱好", "桌游");
wxCpService.userUpdate(user);
WxCpUser user = wxCpService.getUserService().getById("demo.user");
List<WxCpUser> users = wxCpService.getUserService().listByDepartment(1, true, 0);
wxCpService.getUserService().delete("demo.user");
String encType = request.getParameter("encrypt_type");
String nonce = request.getParameter("nonce");
String timestamp = request.getParameter("timestamp");
String msgSignature = request.getParameter("msg_signature");
String signature = request.getParameter("signature");
String openid = request.getParameter("openid");
log.info("接收微信请求:[openid=[{}], [openid=[{}],[signature=[{}], encType=[{}], msgSignature=[{}],"
+ " timestamp=[{}], nonce=[{}], requestBody=[{}] ",
appid, openid, signature, encType, msgSignature, timestamp, nonce, requestBody);
// 请求里面没有对应信息。 // if (!this.wxMpService.switchover(appid)) { //appid // throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", appid)); // }
if (!wxMpService.checkSignature(timestamp, nonce, signature)) {
throw new IllegalArgumentException("非法请求,可能属于伪造的请求!");
}
return ResponseEntity.ok("");