Compare commits

..

No commits in common. 'e0455950adadf3aa001874df0ee974205eec7b1a' and '2a64fd359971ff01604398b286c3defdbf9697cb' have entirely different histories.

@ -76,19 +76,6 @@
<artifactId>java-jwt</artifactId>
<version>4.4.0</version>
</dependency>
<!--openapi 依赖-->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-api</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>2.6.0</version>
</dependency>
</dependencies>
<build>

@ -1,18 +1,13 @@
package com.trading_platform;
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.info.Info;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@OpenAPIDefinition(info = @Info(title = "Trading Platform API", version = "1.0"))
@MapperScan("com.trading_platform.mapper")
public class TradingPlatformApplication {
public static void main(String[] args) {
SpringApplication.run(TradingPlatformApplication.class, args);
}
public static void main(String[] args) {
SpringApplication.run(TradingPlatformApplication.class, args);
}
}

@ -33,7 +33,7 @@ public class WebConfig implements WebMvcConfigurer {
@Override
public void addInterceptors(InterceptorRegistry registry) {
// 登录和注册路径不进行拦截,以允许未登录用户访问这些路径
registry.addInterceptor(loginInterceptor).excludePathPatterns("/user/login", "/user/register", "/swagger-ui/**", "/v3/api-docs/**");
registry.addInterceptor(loginInterceptor).excludePathPatterns("/user/login", "/user/register");
}
}

@ -20,7 +20,7 @@ import java.util.Map;
* UserService
*/
@RestController
@RequestMapping("/users")
@RequestMapping("/user")
@Validated
/**
* UserController
@ -82,7 +82,7 @@ public class UsersController {
return Result.error("用户名错误");
}
// 比较密码,使用SHA256加密后的密码与数据库中存储的密码进行比较
// 比较密码,使用MD5加密后的密码与数据库中存储的密码进行比较
if (Sha256Util.getSHA256String(password).equals(loginUser.getPassword())) {
// 如果密码正确返回成功信息及JWT令牌
Map<String, Object> claims = new HashMap<>();

@ -5,7 +5,6 @@ import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import java.util.Optional;
/**
@ -28,8 +27,8 @@ public interface UsersMapper {
*
*
* @param user
* 使MyBatis@InsertSQL
* 使@Optionsuserid
* 使MyBatis@InsertSQL
* 使@Optionsuserid
*/
@Insert("INSERT INTO users (headPicUrl, nickName, username, mobile, password, sex, email, address, status, create_time, update_time) " +
"VALUES (#{headPicUrl}, #{nickName}, #{username}, #{mobile}, #{password}, #{sex}, #{email}, #{address}, #{status}, #{createTime}, #{updateTime})")

@ -7,7 +7,7 @@ import java.util.Date;
import java.util.Map;
public class JwtUtil {
private static final String KEY = "slqcz";
private static final String KEY = "itheima";
/**
* JWT

@ -4,13 +4,3 @@ spring:
url: jdbc:mysql://localhost:3306/secondhandtransactions?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password: 123456
springdoc:
api-docs:
path: /v3/api-docs
swagger-ui:
path: /swagger-ui.html
logging:
level:
root: debug
com.trading_platform: debug

@ -4,13 +4,3 @@ spring:
url: jdbc:mysql://localhost:3306/secondhandtransactions?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password: 123456
springdoc:
api-docs:
path: /v3/api-docs
swagger-ui:
path: /swagger-ui.html
logging:
level:
root: debug
com.trading_platform: debug
Loading…
Cancel
Save