Skip to content
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
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}

group = "cn.esuny"
version = "0.0.1-SNAPSHOT"
version = "0.0.2-SNAPSHOT"

java {
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/cn/esuny/super_cube/constants/core_constant.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 用户类数据库查询设定
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<Any>? {
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) {

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
Original file line number Diff line number Diff line change
@@ -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 """
<html>
<body>
<script type="text/javascript">
// 当页面加载完成后,跳转到小程序
window.onload = function() {
wx.miniProgram.navigateTo({url: '/${path}?info=${info}'});
}
</script>
</body>
</html>
""".trimIndent()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
}
}
1 change: 1 addition & 0 deletions wxstorage/a.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
asdfasdf
Loading