|
@@ -1,7 +1,9 @@
|
|
package com.book.push.controller;
|
|
package com.book.push.controller;
|
|
|
|
|
|
|
|
+import com.book.dao.cps.pojo.AdminConfig;
|
|
import com.book.dao.cps.pojo.Platform;
|
|
import com.book.dao.cps.pojo.Platform;
|
|
import com.book.dao.utils.DateUtils;
|
|
import com.book.dao.utils.DateUtils;
|
|
|
|
+import com.book.push.service.dao.AdminConfigService;
|
|
import com.book.push.service.dao.PlatformService;
|
|
import com.book.push.service.dao.PlatformService;
|
|
import com.book.push.service.dao.UserService;
|
|
import com.book.push.service.dao.UserService;
|
|
import com.book.push.service.wx.WxThirdPartService;
|
|
import com.book.push.service.wx.WxThirdPartService;
|
|
@@ -34,6 +36,8 @@ public class WxEventController {
|
|
private PlatformService platformService;
|
|
private PlatformService platformService;
|
|
@Autowired
|
|
@Autowired
|
|
private UserService userService;
|
|
private UserService userService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private AdminConfigService adminConfigService;
|
|
|
|
|
|
@RequestMapping("/mpapi/appid/{appId}")
|
|
@RequestMapping("/mpapi/appid/{appId}")
|
|
public Object callback(@RequestBody(required = false) String requestBody,
|
|
public Object callback(@RequestBody(required = false) String requestBody,
|
|
@@ -50,9 +54,11 @@ public class WxEventController {
|
|
appId, openid, signature, encType, msgSignature, timestamp, nonce, requestBody);
|
|
appId, openid, signature, encType, msgSignature, timestamp, nonce, requestBody);
|
|
|
|
|
|
|
|
|
|
- Platform platform = platformService.selectByAppid(appId);
|
|
|
|
|
|
+// Platform platform = platformService.selectByAppid(appId);
|
|
|
|
+ AdminConfig adminConfig = adminConfigService.selectByAppid(appId);
|
|
|
|
+ Integer platformId = adminConfig.getPlatformId();
|
|
|
|
|
|
- WxOpenService wxOpenService = thirdPartService.getWxOpenServiceByPlatFormId(platform.getId());
|
|
|
|
|
|
+ WxOpenService wxOpenService = thirdPartService.getWxOpenServiceByPlatFormId(platformId);
|
|
|
|
|
|
if (!StringUtils.equalsIgnoreCase("aes", encType)
|
|
if (!StringUtils.equalsIgnoreCase("aes", encType)
|
|
|| !wxOpenService.getWxOpenComponentService().checkSignature(timestamp, nonce, signature)) {
|
|
|| !wxOpenService.getWxOpenComponentService().checkSignature(timestamp, nonce, signature)) {
|
|
@@ -72,7 +78,7 @@ public class WxEventController {
|
|
logger.error("测试报错:", e);
|
|
logger.error("测试报错:", e);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- WxMpXmlOutMessage outMessage = thirdPartService.getWxThirdPartMessageRouter().route(inMessage, platform.getId(), appId);
|
|
|
|
|
|
+ WxMpXmlOutMessage outMessage = thirdPartService.getWxThirdPartMessageRouter().route(inMessage, platformId, appId);
|
|
//todo update user operate time
|
|
//todo update user operate time
|
|
userService.updateOperateTimeByOpenid(inMessage.getFromUser(), DateUtils.getNow());
|
|
userService.updateOperateTimeByOpenid(inMessage.getFromUser(), DateUtils.getNow());
|
|
if (outMessage != null) {
|
|
if (outMessage != null) {
|