123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- syntax = "proto3";
- package live.liveadmin.v2;
- option go_package = "v2";
- import "github.com/gogo/protobuf/gogoproto/gogo.proto";
- // 请求创建资源
- message UserResourceAddReq {
- //资源类型
- int32 res_type = 1 [(gogoproto.moretags) = 'form:"res_type" validate:"required"'];
- //名称
- string title = 2 [(gogoproto.moretags) = 'form:"title" validate:"required"'];
- //URL
- string url = 3 [(gogoproto.moretags) = 'form:"url" validate:"required"'];
- //权重
- int32 weight = 4 [(gogoproto.moretags) = 'form:"weight" validate:"required"'];
- //创建人
- string creator = 5 [(gogoproto.moretags) = 'form:"creator" validate:"required"'];
- }
- // 返回创建结果
- message UserResourceAddResp {
- //ID
- int32 id = 1 [(gogoproto.jsontag) = "id"];
- //资源ID
- int32 custom_id = 3 [(gogoproto.jsontag) = "custom_id"];
- }
- // 请求编辑资源
- message UserResourceEditReq {
- //资源类型
- int32 res_type = 1 [(gogoproto.moretags) = 'form:"res_type" validate:"required"'];
- //资源ID
- int32 custom_id = 2 [(gogoproto.moretags) = 'form:"custom_id" validate:"required"'];
- //名称
- string title = 3 [(gogoproto.moretags) = 'form:"title"'];
- //URL
- string url = 4 [(gogoproto.moretags) = 'form:"url"'];
- //权重
- int32 weight = 5 [(gogoproto.moretags) = 'form:"weight"'];
- }
- // 返回编辑结果
- message UserResourceEditResp {
- }
- // 请求资源列表
- message UserResourceListReq {
- //资源类型
- int32 res_type = 1 [(gogoproto.moretags) = 'form:"res_type" validate:"required"'];
- //页码
- int32 page = 2 [(gogoproto.moretags) = 'form:"page"'];
- //每页数据量
- int32 page_size = 3 [(gogoproto.moretags) = 'form:"page_size"'];
- }
- // 返回资源列表
- message UserResourceListResp {
- int32 currentPage = 1 [(gogoproto.jsontag) = "currentPage"];
- int32 totalCount = 2 [(gogoproto.jsontag) = "totalCount"];
- repeated List list = 3 [(gogoproto.jsontag) = "list"];
- message List {
- //ID
- int32 id = 1 [(gogoproto.jsontag) = "id"];
- //资源类型
- int32 res_type = 2 [(gogoproto.jsontag) = "res_type"];
- //资源ID
- int32 custom_id = 3 [(gogoproto.jsontag) = "custom_id"];
- //名称
- string title = 4 [(gogoproto.jsontag) = "title"];
- //URL
- string url = 5 [(gogoproto.jsontag) = "url"];
- //权重
- int32 weight = 6 [(gogoproto.jsontag) = "weight"];
- //创建人
- string creator = 7 [(gogoproto.jsontag) = "creator"];
- //"状态1.上线中2.下线"
- int32 status = 8 [(gogoproto.jsontag) = "status"];
- //创建时刻
- string ctime = 9 [(gogoproto.jsontag) = "ctime"];
- //修改时刻
- string mtime = 10 [(gogoproto.jsontag) = "mtime"];
- }
- }
- // 请求变更资源状态
- message UserResourceSetStatusReq {
- //资源类型
- int32 res_type = 1 [(gogoproto.moretags) = 'form:"res_type" validate:"required"'];
- //页码
- int32 custom_id = 2 [(gogoproto.moretags) = 'form:"custom_id" validate:"required"'];
- //每页数据量
- int32 status = 3 [(gogoproto.moretags) = 'form:"status" validate:"required"'];
- }
- // 返回变更结果
- message UserResourceSetStatusResp {
- }
- // 请求单个资源
- message UserResourceGetSingleReq {
- //资源类型
- int32 res_type = 1 [(gogoproto.moretags) = 'form:"res_type" validate:"required"'];
- //资源ID
- int32 custom_id = 2 [(gogoproto.moretags) = 'form:"custom_id" validate:"required"'];
- }
- // 返回单个资源
- message UserResourceGetSingleResp {
- //ID
- int32 id = 1 [(gogoproto.jsontag) = "id"];
- //资源类型
- int32 res_type = 2 [(gogoproto.jsontag) = "res_type"];
- //资源ID
- int32 custom_id = 3 [(gogoproto.jsontag) = "custom_id"];
- //名称
- string title = 4 [(gogoproto.jsontag) = "title"];
- //URL
- string url = 5 [(gogoproto.jsontag) = "url"];
- //权重
- int32 weight = 6 [(gogoproto.jsontag) = "weight"];
- //创建人
- string creator = 7 [(gogoproto.jsontag) = "creator"];
- //"状态1.上线中2.下线"
- int32 status = 8 [(gogoproto.jsontag) = "status"];
- //创建时刻
- string ctime = 9 [(gogoproto.jsontag) = "ctime"];
- //修改时刻
- string mtime = 10 [(gogoproto.jsontag) = "mtime"];
- }
- service UserResource {
- //Add 添加资源接口
- // `method:"POST" internal:"true" `
- rpc add(UserResourceAddReq) returns (UserResourceAddResp);
- //Edit 编辑现有资源
- // `method:"POST" internal:"true" `
- rpc edit(UserResourceEditReq) returns (UserResourceEditResp);
- //List 获取资源列表
- // `method:"GET" internal:"true" `
- rpc get(UserResourceListReq) returns (UserResourceListResp);
- //SetStatus 更改资源状态
- // `method:"POST" internal:"true" `
- rpc setStatus(UserResourceSetStatusReq) returns (UserResourceSetStatusResp);
- //Query 请求单个资源
- // `method:"GET" internal:"true" `
- rpc getSingle(UserResourceGetSingleReq) returns (UserResourceGetSingleResp);
- }
|