fix🛠️: 修改bill api

This commit is contained in:
车厘子 2022-12-09 17:54:06 +08:00
parent 7e3e2ff227
commit 7c41b42fb1

View File

@ -40,7 +40,6 @@ fun Route.billRoute() {
}.onSuccess {
call.respond(Resp.Ok(it).json())
}.onFailure {
it.printStackTrace()
call.respond(Resp.Error(it.message, code = -1).json())
}
}
@ -57,9 +56,14 @@ fun Route.billRoute() {
}
put("/") {
val bill = call.receive<BillVO>().bill()
val count = billService.updateOneBill(bill)
call.respond(status = HttpStatusCode.OK, Resp.Ok(count).json())
runCatching {
val bill = call.receive<BillVO>().bill()
billService.updateOneBill(bill)
}.onSuccess {
call.respond(status = HttpStatusCode.OK, Resp.Ok(it).json())
}.onFailure {
call.respond(Resp.Error(it.message).json())
}
}
}
}