Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev felmose #67

Merged
merged 3 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified lib/SastLink-Java-SDK-0.0.1.jar
Binary file not shown.
6 changes: 4 additions & 2 deletions src/main/java/sast/evento/controller/TestController.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
Expand All @@ -14,11 +15,12 @@
import sast.sastlink.sdk.service.SastLinkService;

@RestController
@ConditionalOnProperty(prefix = "test",name = "challenge")
@RequestMapping("/test")
public class TestController {
@Value("${test.challenge:}")
@Value("${test.challenge}")
private String challenge;
@Value("${test.method:}")
@Value("${test.method}")
private String method;

@Resource
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/sast/evento/service/impl/LoginServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import sast.sastlink.sdk.enums.Organization;
import sast.sastlink.sdk.exception.SastLinkException;
import sast.sastlink.sdk.model.UserInfo;
import sast.sastlink.sdk.model.response.AccessTokenResponse;
import sast.sastlink.sdk.model.response.AccessTokenData;
import sast.sastlink.sdk.service.SastLinkService;

import java.util.HashMap;
Expand Down Expand Up @@ -69,8 +69,8 @@ public Map<String, Object> linkLogin(String code, Integer type) throws SastLinkE
case 2 -> sastLinkServiceMobileDev;
default -> throw new LocalRunTimeException(ErrorEnum.COMMON_ERROR, "error link client type value: " + type);
};
AccessTokenResponse accessTokenResponse = service.accessToken(code);
UserInfo userInfo = service.userInfo(accessTokenResponse.getAccess_token());
AccessTokenData accessTokenData = service.accessToken(code);
UserInfo userInfo = service.userInfo(accessTokenData.getAccess_token());
User user = userMapper.selectOne(Wrappers.lambdaQuery(User.class)
.eq(User::getLinkId, userInfo.getUserId()));
//查看学号是否冲突,若冲突则绑定至wx账号
Expand Down Expand Up @@ -188,13 +188,13 @@ public void bindPassword(String studentId, String password) {
}
String salt = MD5Util.getSalt(5);
UserPassword userPassword = userPasswordMapper.selectOne(Wrappers.lambdaQuery(UserPassword.class)
.eq(UserPassword::getStudentId,studentId)
.eq(UserPassword::getStudentId, studentId)
.last("for update"));
if(userPassword!=null){
if (userPassword != null) {
userPassword.setPassword(password);
userPassword.setSalt(salt);
userPasswordMapper.updateById(userPassword);
}else {
} else {
userPassword = new UserPassword(null, studentId, MD5Util.md5Encode(password, salt), salt);
userPasswordMapper.insert(userPassword);
}
Expand Down