Skip to content

Commit

Permalink
add:idl
Browse files Browse the repository at this point in the history
  • Loading branch information
FantasyRL committed Sep 28, 2024
1 parent 431f65c commit ccdc0e3
Show file tree
Hide file tree
Showing 5 changed files with 146 additions and 0 deletions.
53 changes: 53 additions & 0 deletions idl/api.thrift
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
namespace go api

struct BaseResp {
1: i64 code,
2: string msg,
}

struct User{
1:i64 id,
2:string account,
3:string name,
}

struct Picture{
1:i64 id,
2:string url,
3:string href,
4:string text,
5:i64 pic_type,
6:i64 show_times,
7:i64 point_times,
8:i64 duration,
9:i64 s_type,
10:i64 frequency,
}

struct RegisterRequest {
1: required string account,
2: required string name,
3: required string password,
}

struct RegisterResponse {
1: BaseResp base,
2: optional i64 user_id,
}

struct LoginRequest {
1: string account,
2: string password,
}

struct LoginResponse {
1: BaseResp base,
2: optional string data,
}

service UserService {
LoginResponse Login(1: LoginRequest req)(api.post="/launch_screen/api/login"),

//test for backend
RegisterResponse Register(1: RegisterRequest req)(api.post="/launch_screen/api/register"),
}
36 changes: 36 additions & 0 deletions idl/launch_screen.thrift
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
namespace go launch_screen
include"model.thrift"

struct CreateImageRequest {
1: required i64 pic_type,//1为空,2为页面跳转,3为app跳转
2: optional i64 duration,
3: optional string href,//连接
4: required binary image,
5: required string start_at,
6: required string end_at,
7: required i64 s_type,
8: required i64 frequency,
9: required i64 start_time,//比如6表示6点
10:required i64 end_time,
11:required string text,//描述图片
12:string regex,//正则匹配项

13:i64 user_id,//get by token
}

struct CreateImageResponse{
1:model.BaseResp base,
2:optional model.Picture picture,
}

struct GetImageRequest{
1:required i64 picture_id,

2:i64 user_id,
}

struct GetImageResponse{
1:required i64 picture_id,

2:i64 user_id,
}
25 changes: 25 additions & 0 deletions idl/model.thrift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
namespace go model

struct BaseResp {
1: i64 code,
2: string msg,
}

struct User{
1:i64 id,
2:string account,
3:string name,
}

struct Picture{
1:i64 id,
2:string url,
3:string href,
4:string text,
5:i64 pic_type,
6:i64 show_times,
7:i64 point_times,
8:i64 duration,
9:i64 s_type,
10:i64 frequency,
}
31 changes: 31 additions & 0 deletions idl/user.thrift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
namespace go user

include"model.thrift"

struct RegisterRequest {
1: required string account,
2: required string name,
3: required string password,
}

struct RegisterResponse {
1: model.BaseResp base,
2: optional i64 user_id,
}

struct LoginRequest {
1: string account,
2: string password,
}

struct LoginResponse {
1: model.BaseResp base,
2: optional string token,
}

service UserService {
LoginResponse Login(1: LoginRequest req)(api.post="/launch_screen/api/login"),

//test for backend
RegisterResponse Register(1: RegisterRequest req)(api.post="/launch_screen/api/register"),
}
1 change: 1 addition & 0 deletions pkg/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const (
// service name
TemplateServiceName = "template"
EmptyRoomService = "empty_room"
LaunchScreenService = "launch_screen"

// db table name
TemplateServiceTableName = "template"
Expand Down

0 comments on commit ccdc0e3

Please sign in to comment.