diff --git a/build.gradle.kts b/build.gradle.kts index c02e31b..3b1179f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,7 +6,7 @@ plugins { } group = "cn.esuny" -version = "0.0.1-SNAPSHOT" +version = "0.0.2-SNAPSHOT" java { } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 9f4197d..1af9e09 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/java/cn/esuny/super_cube/constants/core_constant.kt b/src/main/java/cn/esuny/super_cube/constants/core_constant.kt index 5e9f97f..990a278 100644 --- a/src/main/java/cn/esuny/super_cube/constants/core_constant.kt +++ b/src/main/java/cn/esuny/super_cube/constants/core_constant.kt @@ -22,6 +22,8 @@ open class core_constant { const val API_V1_GETDATA: String = API_PREFIX_V1 + "fileData" const val API_V1_SETDATA: String = API_PREFIX_V1 + "setfileData" + const val API_V1_FITNESS_WX: String = API_V1_FITNESS + "/wx" + /** * @author esuny * @description 用户类数据库查询设定 diff --git a/src/main/java/cn/esuny/super_cube/controller/sports_data/FitnessController.kt b/src/main/java/cn/esuny/super_cube/controller/sports_data/FitnessController.kt index 8958a7b..3740664 100644 --- a/src/main/java/cn/esuny/super_cube/controller/sports_data/FitnessController.kt +++ b/src/main/java/cn/esuny/super_cube/controller/sports_data/FitnessController.kt @@ -10,6 +10,7 @@ import io.jsonwebtoken.Claims import org.springframework.beans.factory.annotation.Autowired import org.springframework.core.io.Resource import org.springframework.core.io.UrlResource +import org.springframework.http.HttpHeaders import org.springframework.http.ResponseEntity import org.springframework.web.bind.annotation.* import java.nio.file.Paths @@ -54,4 +55,23 @@ class FitnessController { return ResponseEntity.notFound().build() } } + + @GetMapping(value = [core_constant.API_V1_FITNESS + "/wxresource/{id}"]) + fun getwxResource(@PathVariable id: String, @RequestHeader token: String): ResponseEntity? { + jwtUtils?.verify(token) ?: return ResponseEntity.notFound().build() + val file = Paths.get("wxstorage/", id).toAbsolutePath().normalize().toFile() + if (file.exists()) { + val resource: Resource = UrlResource(file.toURI()) + return ResponseEntity.ok() + .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + resource.filename + "\"") + .body(resource) + } else { + return ResponseEntity.notFound().build() + } + } + + @GetMapping(value = [core_constant.API_V1_FITNESS_WX]) + fun fitnessWx(@RequestBody id: String) { + + } } \ No newline at end of file diff --git a/src/main/java/cn/esuny/super_cube/controller/user_account/LoginController.kt b/src/main/java/cn/esuny/super_cube/controller/user_account/LoginController.kt index 80997b9..6821603 100644 --- a/src/main/java/cn/esuny/super_cube/controller/user_account/LoginController.kt +++ b/src/main/java/cn/esuny/super_cube/controller/user_account/LoginController.kt @@ -34,13 +34,18 @@ class LoginController { fun getLogin(@RequestBody getLoginAuthentication: GetLoginAuthentication): Result_general? { if(jwtUtils != null) { return Result_general( - language.tr("super_cube.service.LoginService.failedCode").toInt(), + language.tr("super_cube.service.LoginService.successCode").toInt(), null, jwtUtils!!.verify(getLoginAuthentication.token).toString(), "验证成功" ) } - return null + return Result_general( + language.tr("super_cube.service.LoginService.failedCode").toInt(), + null, + jwtUtils!!.verify(getLoginAuthentication.token).toString(), + "验证失败" + ) } @PostMapping(value = [core_constant.API_V1_REGISTER]) diff --git a/src/main/java/cn/esuny/super_cube/controller/weixin/WXController.kt b/src/main/java/cn/esuny/super_cube/controller/weixin/WXController.kt new file mode 100644 index 0000000..6d3ff3f --- /dev/null +++ b/src/main/java/cn/esuny/super_cube/controller/weixin/WXController.kt @@ -0,0 +1,25 @@ +package cn.esuny.super_cube.controller.weixin + +import org.springframework.web.bind.annotation.GetMapping +import org.springframework.web.bind.annotation.RequestParam + +class WXController { + @GetMapping("/wx") + fun wx(@RequestParam info: String): String { + // 这里的 appId 和 path 应该替换为你的小程序的实际 appId 和路径 + val appId = "wxcf381a11b2490818" + val path = "pages/login/login" + return """ + + + + + + """.trimIndent() + } +} \ No newline at end of file diff --git a/src/main/java/cn/esuny/super_cube/service/interceptor/LoginInterceptorReg.kt b/src/main/java/cn/esuny/super_cube/service/interceptor/LoginInterceptorReg.kt index faa2385..8cfc104 100644 --- a/src/main/java/cn/esuny/super_cube/service/interceptor/LoginInterceptorReg.kt +++ b/src/main/java/cn/esuny/super_cube/service/interceptor/LoginInterceptorReg.kt @@ -15,7 +15,8 @@ open class LoginInterceptorReg : WebMvcConfigurer { registration.addPathPatterns("/**") //所有路径都被拦截 registration.excludePathPatterns( //添加不拦截路径 core_constant.API_V1_LOGIN, - core_constant.API_V1_REGISTER + core_constant.API_V1_REGISTER, + core_constant.API_V1_GETLOGIN ) } } \ No newline at end of file diff --git a/wxstorage/a.txt b/wxstorage/a.txt new file mode 100644 index 0000000..23a3a9d --- /dev/null +++ b/wxstorage/a.txt @@ -0,0 +1 @@ +asdfasdf \ No newline at end of file