Browse Source

激活BUG修复

wangliang 2 năm trước cách đây
mục cha
commit
d8b964a904

+ 5 - 6
teachcloud-common-api/src/main/java/com/qmth/teachcloud/common/api/api/TSAuthController.java

@@ -24,7 +24,7 @@ import org.springframework.web.multipart.MultipartFile;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 import java.io.ByteArrayInputStream;
-import java.io.IOException;
+import java.util.Objects;
 
 /**
  * <p>
@@ -76,11 +76,7 @@ public class TSAuthController {
     @ApiResponses({@ApiResponse(code = 200, message = "授权配置信息", response = Boolean.class)})
     @RequestMapping(value = "/offline/activation", method = RequestMethod.POST)
     public Result offlineActivation(@ApiParam(value = "上传文件", required = true) @RequestParam(required = true) MultipartFile file) throws Exception {
-        try {
-            authInfoService.updateLicense(file.getBytes());
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
+        authInfoService.updateLicense(file.getBytes());
         return ResultUtil.ok(true);
     }
 
@@ -90,6 +86,9 @@ public class TSAuthController {
     public Result onlineActivation(@ApiParam(value = "accessKey", required = true) @RequestParam(required = true) String accessKey,
                                    @ApiParam(value = "accessSecret", required = true) @RequestParam(required = true) String accessSecret) throws Exception {
         AppInfo appInfo = solarService.update(accessKey, accessSecret);
+        if (Objects.isNull(appInfo)) {
+            throw new RuntimeException("激活失败,请检查key和secret输入是否正确");
+        }
         authInfoService.appInfoInit(appInfo, accessKey, accessSecret);
         return ResultUtil.ok(true);
     }