傅行帆 před 4 roky
rodič
revize
8f518ee58e

+ 13
- 6
src/main/java/com/huiju/estateagents/third/controller/WxRedpackController.java Zobrazit soubor

@@ -46,7 +46,7 @@ public class WxRedpackController {
46 46
      * @return
47 47
      */
48 48
     @GetMapping("/third/redirect/{mpAppid}/greet")
49
-    public ResponseBean greetUser(@PathVariable String mpAppid, @RequestParam String code, @RequestParam String personId,@RequestParam String sponsorPersonId,@RequestParam String drainageId, HttpServletRequest request) {
49
+    public ResponseBean greetUser(@PathVariable String mpAppid, @RequestParam String code, @RequestParam String personId,@RequestParam String sponsorPersonId,@RequestParam String appid, HttpServletRequest request) {
50 50
         WxMpService wxService = getWxMpService();
51 51
         if (!wxService.switchover(mpAppid)) {
52 52
             throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", mpAppid));
@@ -56,9 +56,16 @@ public class WxRedpackController {
56 56
             //换取openid
57 57
             WxMpOAuth2AccessToken accessToken = wxService.oauth2getAccessToken(code);
58 58
             WxMpUser user = wxService.oauth2getUserInfo(accessToken, null);
59
+            //获取H5项目相关信息
60
+            QueryWrapper<TaThirdPartyMiniappConfig> taThirdPartyMiniappConfigQueryWrapper = new QueryWrapper<>();
59 61
 
62
+            taThirdPartyMiniappConfigQueryWrapper.eq("appid", appid);
63
+            TaThirdPartyMiniappConfig taThirdPartyMiniappConfig = iTaThirdPartyMiniappConfigService.getOne(taThirdPartyMiniappConfigQueryWrapper);
64
+            if (null == taThirdPartyMiniappConfig){
65
+                return ResponseBean.error("不存在的H5活动",ResponseBean.ERROR_UNAVAILABLE);
66
+            }
60 67
             //插入公众号人员信息并插入表
61
-            map = iTaThirdPartyMiniappConfigService.newMpPerson(user, mpAppid, drainageId, sponsorPersonId, personId);
68
+            map = iTaThirdPartyMiniappConfigService.newMpPerson(user, mpAppid, taThirdPartyMiniappConfig.getTargetId(), sponsorPersonId, personId);
62 69
         } catch (WxErrorException e) {
63 70
             e.printStackTrace();
64 71
         }
@@ -92,7 +99,7 @@ public class WxRedpackController {
92 99
      * @return
93 100
      */
94 101
     @PostMapping("/third/activity/{mpAppid}/participate")
95
-    public ResponseBean participateActivity(@PathVariable String mpAppid, @RequestParam String mpPersonId,@RequestParam String drainageId, HttpServletRequest request) {
102
+    public ResponseBean participateActivity(@PathVariable String mpAppid, @RequestParam String mpPersonId,@RequestParam String appid, HttpServletRequest request) {
96 103
         WxMpService wxService = getWxMpService();
97 104
         if (!wxService.switchover(mpAppid)) {
98 105
             throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", mpAppid));
@@ -100,7 +107,7 @@ public class WxRedpackController {
100 107
         //获取H5项目相关信息
101 108
         QueryWrapper<TaThirdPartyMiniappConfig> taThirdPartyMiniappConfigQueryWrapper = new QueryWrapper<>();
102 109
 
103
-        taThirdPartyMiniappConfigQueryWrapper.eq("appid", drainageId);
110
+        taThirdPartyMiniappConfigQueryWrapper.eq("appid", appid);
104 111
         TaThirdPartyMiniappConfig taThirdPartyMiniappConfig = iTaThirdPartyMiniappConfigService.getOne(taThirdPartyMiniappConfigQueryWrapper);
105 112
         if (null == taThirdPartyMiniappConfig){
106 113
             return ResponseBean.error("不存在的H5活动",ResponseBean.ERROR_UNAVAILABLE);
@@ -122,7 +129,7 @@ public class WxRedpackController {
122 129
      * @return
123 130
      */
124 131
     @PostMapping("/third/activity/{mpAppid}/help")
125
-    public ResponseBean helpActivity(@PathVariable String mpAppid, @RequestParam String mpPersonId, @RequestParam String sponsorPersonId,@RequestParam String drainageId, HttpServletRequest request) {
132
+    public ResponseBean helpActivity(@PathVariable String mpAppid, @RequestParam String mpPersonId, @RequestParam String sponsorPersonId,@RequestParam String appid, HttpServletRequest request) {
126 133
         WxMpService wxService = getWxMpService();
127 134
         if (!wxService.switchover(mpAppid)) {
128 135
             throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", mpAppid));
@@ -130,7 +137,7 @@ public class WxRedpackController {
130 137
         //获取H5项目相关信息
131 138
         QueryWrapper<TaThirdPartyMiniappConfig> taThirdPartyMiniappConfigQueryWrapper = new QueryWrapper<>();
132 139
 
133
-        taThirdPartyMiniappConfigQueryWrapper.eq("appid", drainageId);
140
+        taThirdPartyMiniappConfigQueryWrapper.eq("appid", appid);
134 141
         TaThirdPartyMiniappConfig taThirdPartyMiniappConfig = iTaThirdPartyMiniappConfigService.getOne(taThirdPartyMiniappConfigQueryWrapper);
135 142
         if (null == taThirdPartyMiniappConfig){
136 143
             return ResponseBean.error("不存在的H5活动",ResponseBean.ERROR_UNAVAILABLE);