Implement notice endpoint

This commit is contained in:
Ethan O'Brien 2024-02-26 20:41:26 -06:00
parent 05bf6c011e
commit 0ec158b889
3 changed files with 22 additions and 0 deletions

View file

@ -75,6 +75,9 @@ async fn lottery_tutorial(req: HttpRequest, body: String) -> HttpResponse { rout
#[post("/api/lottery")]
async fn lottery(req: HttpRequest, body: String) -> HttpResponse { router::lottery::lottery(req, body) }
#[get("/api/notice/reward")]
async fn reward(req: HttpRequest) -> HttpResponse { router::notice::reward(req) }
async fn log_unknown_request(req: HttpRequest, body: String) -> HttpResponse {
if body != String::new() {
println!("{}", encryption::decrypt_packet(&body).unwrap());
@ -92,6 +95,7 @@ async fn main() -> std::io::Result<()> {
println!("Request: {}", req.path());
srv.call(req)
})
.service(reward)
.service(live_guest)
.service(live_clearrate)
.service(live_start)

View file

@ -13,3 +13,4 @@ pub mod live;
pub mod event;
pub mod chat;
pub mod story;
pub mod notice;

17
src/router/notice.rs Normal file
View file

@ -0,0 +1,17 @@
use json;
use json::object;
use crate::router::global;
use actix_web::{HttpResponse, HttpRequest};
//todo
pub fn reward(_req: HttpRequest) -> HttpResponse {
let resp = object!{
"code": 0,
"server_time": global::timestamp(),
"data": {
"reward_list": []
}
};
global::send(resp)
}