...
This commit is contained in:
parent
b27b9ff60f
commit
d5a8e6fd27
@ -8,14 +8,12 @@ import kr.lunaticbum.back.lun.model.User
|
|||||||
import kr.lunaticbum.back.lun.model.UserManager
|
import kr.lunaticbum.back.lun.model.UserManager
|
||||||
import kr.lunaticbum.back.lun.utils.LogService
|
import kr.lunaticbum.back.lun.utils.LogService
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
import org.springframework.beans.factory.annotation.Autowired
|
||||||
import org.springframework.data.annotation.AccessType
|
|
||||||
import org.springframework.http.MediaType
|
import org.springframework.http.MediaType
|
||||||
import org.springframework.http.ResponseEntity
|
import org.springframework.http.ResponseEntity
|
||||||
import org.springframework.web.bind.annotation.*
|
import org.springframework.web.bind.annotation.*
|
||||||
import org.springframework.web.reactive.function.client.WebClient
|
import org.springframework.web.reactive.function.client.WebClient
|
||||||
import org.springframework.web.servlet.ModelAndView
|
import org.springframework.web.servlet.ModelAndView
|
||||||
import org.springframework.web.servlet.function.ServerResponse
|
import java.util.*
|
||||||
import reactor.core.publisher.Mono
|
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@ -35,7 +33,12 @@ class UserController {
|
|||||||
fun hello(httpServletRequest: HttpServletRequest): ModelAndView {
|
fun hello(httpServletRequest: HttpServletRequest): ModelAndView {
|
||||||
logService.log("onJoin")
|
logService.log("onJoin")
|
||||||
val vm = ModelAndView()
|
val vm = ModelAndView()
|
||||||
vm.modelMap.put("ddd","asdas")
|
when(System.currentTimeMillis() % 5L) {
|
||||||
|
0L -> vm.modelMap.put("ENC","T4")
|
||||||
|
1L -> vm.modelMap.put("ENC","T3")
|
||||||
|
2L -> vm.modelMap.put("ENC","T2")
|
||||||
|
else -> vm.modelMap.put("ENC","T0")
|
||||||
|
}
|
||||||
logService.log("${vm.toString()}")
|
logService.log("${vm.toString()}")
|
||||||
return vm
|
return vm
|
||||||
}
|
}
|
||||||
@ -48,6 +51,9 @@ class UserController {
|
|||||||
fun joinUser(httpServletRequest: HttpServletRequest, @RequestBody jsonString: String) : ResponseEntity<ResponceResult> {
|
fun joinUser(httpServletRequest: HttpServletRequest, @RequestBody jsonString: String) : ResponseEntity<ResponceResult> {
|
||||||
logService.log("${httpServletRequest.requestURI}")
|
logService.log("${httpServletRequest.requestURI}")
|
||||||
logService.log(jsonString)
|
logService.log(jsonString)
|
||||||
|
var u : User? = null
|
||||||
|
val decodedBytes: ByteArray = Base64.getDecoder().decode(jsonString)
|
||||||
|
String(decodedBytes)?.let { jsonString ->
|
||||||
val reqString = jsonString.split("_||L_")
|
val reqString = jsonString.split("_||L_")
|
||||||
var nb = arrayListOf<String>()
|
var nb = arrayListOf<String>()
|
||||||
(reqString[0].replace("_||L_","").split("")).toList().let {
|
(reqString[0].replace("_||L_","").split("")).toList().let {
|
||||||
@ -75,10 +81,10 @@ class UserController {
|
|||||||
}
|
}
|
||||||
logService.log(fullData.joinToString(""))
|
logService.log(fullData.joinToString(""))
|
||||||
var user = Gson().fromJson(fullData.joinToString(""), User::class.java)
|
var user = Gson().fromJson(fullData.joinToString(""), User::class.java)
|
||||||
var u : User? = null
|
|
||||||
if (user.checkValid()) {
|
if (user.checkValid()) {
|
||||||
u = userManager.save(user).block()
|
u = userManager.save(user).block()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
val responce = ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON).body(ResponceResult().apply {
|
val responce = ResponseEntity.ok().contentType(MediaType.APPLICATION_JSON).body(ResponceResult().apply {
|
||||||
resultCode = if (u != null) 0 else 8245
|
resultCode = if (u != null) 0 else 8245
|
||||||
resultMsg = if (u != null) "OK" else "User Insert Fail"
|
resultMsg = if (u != null) "OK" else "User Insert Fail"
|
||||||
|
|||||||
@ -63,15 +63,17 @@
|
|||||||
background-color: rgb(61, 135, 255);
|
background-color: rgb(61, 135, 255);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script th:inline="javascript">
|
||||||
function getDivder() {
|
function getDivder() {
|
||||||
return "_||L_"
|
return "_||L_"
|
||||||
}
|
}
|
||||||
function mergeData(a , b) {
|
function mergeData(a , b) {
|
||||||
return a.join("") + getDivder() + b.join("")
|
return btoa(a.join("") + getDivder() + b.join(""))
|
||||||
}
|
}
|
||||||
|
|
||||||
function userJoin() {
|
function userJoin() {
|
||||||
|
var type = [[${ENC}]]
|
||||||
|
console.log(type)
|
||||||
var httpRequest;
|
var httpRequest;
|
||||||
var user_id = document.getElementById("user_id").value;
|
var user_id = document.getElementById("user_id").value;
|
||||||
var user_pw = document.getElementById("user_pw").value;
|
var user_pw = document.getElementById("user_pw").value;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user