Ver Fonte

add(backend) [接口移动位置 1.0]

wangxiao há 4 anos atrás
pai
commit
698f61899b

+ 0 - 26
operation-backend/src/main/java/com/idiot/operationbackend/controller/WeChatController.java

@@ -54,13 +54,6 @@ public class WeChatController {
     private AccountService accountService;
 
 
-    @GetMapping("preAuth")
-    @ApiOperation(value = "获取预授权码地址,微信认证公众号")
-    public ResponseEntity<JsonResult<String>> getPreAuthUrl ()   {
-        return ResponseEntity.ok(JsonResult.success(weChatService.getPreAuthUrl()));
-    }
-
-
 
     @PostMapping("/notice")
     @ApiOperation(value = "验证票据接受url")
@@ -130,25 +123,6 @@ public class WeChatController {
     }
 
 
-    @GetMapping("confirmAccount")
-    @ApiOperation(value = "确认授权的微信公众号")
-    public ResponseEntity<JsonResult<Boolean>> confirmAccount (@RequestHeader String token,
-                                                               @RequestParam String accountId) {
-
-        String userId = JwtTokenUtil.getUserId(token);
-        logger.error("微信公众号:{}授权,用户:{}确认 ,",accountId,userId);
-        boolean ifUpdate = weChatService.confirmAccount(accountId,userId);
-        if (ifUpdate){
-            logger.error("微信公众号:{}授权,用户:{} 成功确认 ,开始同步用户标签数据",accountId,userId);
-            int userCount = weChatService.syncAccountUser(accountId);
-            logger.warn("同步用户数量:{}",userCount);
-            weChatService.syncTag(accountId);
-        }
-
-        return ResponseEntity.ok(JsonResult.success(ifUpdate));
-    }
-
-
     @PostMapping("/msgCallback/{appid}")
     @ApiOperation(value = "确认授权的微信公众号")
     public String receiveWeChatMessage (@PathVariable String appid,

+ 29 - 0
operation-backend/src/main/java/com/idiot/operationbackend/controller/account/AccountController.java

@@ -4,6 +4,7 @@ import com.idiot.operationbackend.entity.Account;
 import com.idiot.operationbackend.entity.AuthUser;
 import com.idiot.operationbackend.service.facade.AccountService;
 import com.idiot.operationbackend.service.facade.AuthUserService;
+import com.idiot.operationbackend.service.facade.WeChatService;
 import com.idiot.operationbackend.support.CustomException;
 import com.idiot.operationbackend.support.JsonResult;
 import com.idiot.operationbackend.util.JwtTokenUtil;
@@ -39,6 +40,10 @@ public class AccountController {
     @Autowired
     private AuthUserService userService;
 
+    @Autowired
+    private WeChatService weChatService;
+
+
 
     @GetMapping
     @ApiOperation(value = "查询公众号列表")
@@ -76,6 +81,30 @@ public class AccountController {
         return ResponseEntity.ok(JsonResult.success(account));
     }
 
+    @GetMapping("/preAuth")
+    @ApiOperation(value = "获取预授权码地址,微信认证公众号")
+    public ResponseEntity<JsonResult<String>> getPreAuthUrl ()   {
+        return ResponseEntity.ok(JsonResult.success(weChatService.getPreAuthUrl()));
+    }
+
+
+    @GetMapping("/confirmAccount")
+    @ApiOperation(value = "确认授权的微信公众号")
+    public ResponseEntity<JsonResult<Boolean>> confirmAccount (@RequestHeader String token,
+                                                               @RequestParam String accountId) {
+
+        String userId = JwtTokenUtil.getUserId(token);
+        logger.error("微信公众号:{}授权,用户:{}确认 ,",accountId,userId);
+        boolean ifUpdate = weChatService.confirmAccount(accountId,userId);
+        if (ifUpdate){
+            logger.error("微信公众号:{}授权,用户:{} 成功确认 ,开始同步用户标签数据",accountId,userId);
+            int userCount = weChatService.syncAccountUser(accountId);
+            logger.warn("同步用户数量:{}",userCount);
+            weChatService.syncTag(accountId);
+        }
+
+        return ResponseEntity.ok(JsonResult.success(ifUpdate));
+    }