傅行帆 4 years ago
parent
commit
8f518ee58e

+ 13
- 6
src/main/java/com/huiju/estateagents/third/controller/WxRedpackController.java View File

46
      * @return
46
      * @return
47
      */
47
      */
48
     @GetMapping("/third/redirect/{mpAppid}/greet")
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
         WxMpService wxService = getWxMpService();
50
         WxMpService wxService = getWxMpService();
51
         if (!wxService.switchover(mpAppid)) {
51
         if (!wxService.switchover(mpAppid)) {
52
             throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", mpAppid));
52
             throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", mpAppid));
56
             //换取openid
56
             //换取openid
57
             WxMpOAuth2AccessToken accessToken = wxService.oauth2getAccessToken(code);
57
             WxMpOAuth2AccessToken accessToken = wxService.oauth2getAccessToken(code);
58
             WxMpUser user = wxService.oauth2getUserInfo(accessToken, null);
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
         } catch (WxErrorException e) {
69
         } catch (WxErrorException e) {
63
             e.printStackTrace();
70
             e.printStackTrace();
64
         }
71
         }
92
      * @return
99
      * @return
93
      */
100
      */
94
     @PostMapping("/third/activity/{mpAppid}/participate")
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
         WxMpService wxService = getWxMpService();
103
         WxMpService wxService = getWxMpService();
97
         if (!wxService.switchover(mpAppid)) {
104
         if (!wxService.switchover(mpAppid)) {
98
             throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", mpAppid));
105
             throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", mpAppid));
100
         //获取H5项目相关信息
107
         //获取H5项目相关信息
101
         QueryWrapper<TaThirdPartyMiniappConfig> taThirdPartyMiniappConfigQueryWrapper = new QueryWrapper<>();
108
         QueryWrapper<TaThirdPartyMiniappConfig> taThirdPartyMiniappConfigQueryWrapper = new QueryWrapper<>();
102
 
109
 
103
-        taThirdPartyMiniappConfigQueryWrapper.eq("appid", drainageId);
110
+        taThirdPartyMiniappConfigQueryWrapper.eq("appid", appid);
104
         TaThirdPartyMiniappConfig taThirdPartyMiniappConfig = iTaThirdPartyMiniappConfigService.getOne(taThirdPartyMiniappConfigQueryWrapper);
111
         TaThirdPartyMiniappConfig taThirdPartyMiniappConfig = iTaThirdPartyMiniappConfigService.getOne(taThirdPartyMiniappConfigQueryWrapper);
105
         if (null == taThirdPartyMiniappConfig){
112
         if (null == taThirdPartyMiniappConfig){
106
             return ResponseBean.error("不存在的H5活动",ResponseBean.ERROR_UNAVAILABLE);
113
             return ResponseBean.error("不存在的H5活动",ResponseBean.ERROR_UNAVAILABLE);
122
      * @return
129
      * @return
123
      */
130
      */
124
     @PostMapping("/third/activity/{mpAppid}/help")
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
         WxMpService wxService = getWxMpService();
133
         WxMpService wxService = getWxMpService();
127
         if (!wxService.switchover(mpAppid)) {
134
         if (!wxService.switchover(mpAppid)) {
128
             throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", mpAppid));
135
             throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", mpAppid));
130
         //获取H5项目相关信息
137
         //获取H5项目相关信息
131
         QueryWrapper<TaThirdPartyMiniappConfig> taThirdPartyMiniappConfigQueryWrapper = new QueryWrapper<>();
138
         QueryWrapper<TaThirdPartyMiniappConfig> taThirdPartyMiniappConfigQueryWrapper = new QueryWrapper<>();
132
 
139
 
133
-        taThirdPartyMiniappConfigQueryWrapper.eq("appid", drainageId);
140
+        taThirdPartyMiniappConfigQueryWrapper.eq("appid", appid);
134
         TaThirdPartyMiniappConfig taThirdPartyMiniappConfig = iTaThirdPartyMiniappConfigService.getOne(taThirdPartyMiniappConfigQueryWrapper);
141
         TaThirdPartyMiniappConfig taThirdPartyMiniappConfig = iTaThirdPartyMiniappConfigService.getOne(taThirdPartyMiniappConfigQueryWrapper);
135
         if (null == taThirdPartyMiniappConfig){
142
         if (null == taThirdPartyMiniappConfig){
136
             return ResponseBean.error("不存在的H5活动",ResponseBean.ERROR_UNAVAILABLE);
143
             return ResponseBean.error("不存在的H5活动",ResponseBean.ERROR_UNAVAILABLE);