u
This commit is contained in:
1 parent
835958886e
commit
d04d22723b
155 files changed
+543
-9793
No files matched your search
@@ -0,0 +1,52 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package money;
|
||||
|
||||
option go_package = "money";
|
||||
|
||||
import "api.proto";
|
||||
import "money/money_category_types.proto";
|
||||
import "money/money_record_types.proto";
|
||||
import "money/money_analysis_types.proto";
|
||||
|
||||
service MoneyCategoryService {
|
||||
rpc List(ListMoneyCategoryReq) returns (ListMoneyCategoryResp){
|
||||
option (api.get) = '/money/category';
|
||||
};
|
||||
rpc DeleteUserMoneyCategory(DeleteMoneyCategoryReq) returns (DeleteMoneyCategoryResp){
|
||||
option (api.post) = '/money/category/delete';
|
||||
};
|
||||
rpc UpdateMoneyCategorySort(UpdateMoneyCategorySortReq) returns (UpdateMoneyCategorySortResp){
|
||||
option (api.post) = '/money/category/updateSort';
|
||||
};
|
||||
rpc CreateMoneyCategory(CreateMoneyCategoryReq) returns (CreateMoneyCategoryResp){
|
||||
option (api.post) = '/money/category/create';
|
||||
};
|
||||
rpc UpdateMoneyCategory(UpdateMoneyCategoryReq) returns (UpdateMoneyCategoryResp){
|
||||
option (api.post) = '/money/category/update';
|
||||
};
|
||||
}
|
||||
|
||||
service MoneyRecordService {
|
||||
rpc ListMoneyRecords(ListMoneyRecordsParams) returns (ListMoneyRecordsResult){
|
||||
option (api.post) = '/money/records';
|
||||
}
|
||||
rpc InsertMoneyRecord(InsertMoneyRecordParams) returns (InsertMoneyRecordResult){
|
||||
option (api.post) = '/money/record/insert';
|
||||
}
|
||||
rpc UpdateMoneyRecord(UpdateMoneyRecordParams) returns (UpdateMoneyRecordResult){
|
||||
option (api.post) = '/money/record/update';
|
||||
}
|
||||
rpc DeleteMoneyRecord(DeleteMoneyRecordParams) returns (DeleteMoneyRecordResult){
|
||||
option (api.post) = '/money/record/delete';
|
||||
}
|
||||
}
|
||||
|
||||
service MoneyAnalysisService {
|
||||
rpc AnalysisMoneyLine(AnalysisMoneyParams) returns (AnalysisMoneyLineResult){
|
||||
option (api.post) = '/money/analysis/line';
|
||||
}
|
||||
rpc AnalysisMoneyPie(AnalysisMoneyParams) returns (AnalysisMoneyPieResult){
|
||||
option (api.post) = '/money/analysis/pie';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
syntax = "proto3";
|
||||
|
||||
import "api.proto";
|
||||
package money;
|
||||
|
||||
option go_package = "money";
|
||||
|
||||
message AnalysisMoneyParams {
|
||||
string StartDate = 1 [(api.body) = "start_date"]; // 开始时间
|
||||
string EndDate = 2 [(api.body) = "end_date"]; // 结束时间
|
||||
int32 Type = 3 [(api.body) = "type"];// 0 支出 1 收入
|
||||
int32 PeriodType = 4 [(api.body) = "period_type"]; // 0 = 日分析, 1 = 月分析, 2 = 年分析
|
||||
}
|
||||
|
||||
// PeriodAmount 用于存储按天、月、年汇总的金额
|
||||
message AnalysisMoneyAmount {
|
||||
string X = 1 [(api.body) = "x"]; // 时间段(按天、月、年)
|
||||
string Y = 2 [(api.body) = "y"]; // 汇总金额
|
||||
}
|
||||
|
||||
message AnalysisMoneyLineResult {
|
||||
repeated AnalysisMoneyAmount Records = 1 [(api.body) = "records"];
|
||||
}
|
||||
|
||||
message AnalysisMoneyPieResult {
|
||||
repeated AnalysisMoneyAmount Records = 1 [(api.body) = "records"];
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
syntax = "proto3";
|
||||
|
||||
import "api.proto";
|
||||
package money;
|
||||
|
||||
option go_package = "money";
|
||||
|
||||
// 记账分类
|
||||
message MoneyCategory {
|
||||
int64 Id = 1 [(api.body)="id"];
|
||||
string Name = 2 [(api.body)="name"];
|
||||
string Icon = 3 [(api.body)="icon"];
|
||||
int32 Type = 4 [(api.body)="type"];
|
||||
int32 SortNumber = 5 [(api.body)="sort_number"];
|
||||
}
|
||||
|
||||
// 查询记账分类请求
|
||||
message ListMoneyCategoryReq {}
|
||||
|
||||
// 查询记账分类响应
|
||||
message ListMoneyCategoryResp {
|
||||
repeated MoneyCategory Categories = 1 [(api.body)="categories"];
|
||||
}
|
||||
|
||||
// 删除记账分类请求
|
||||
message DeleteMoneyCategoryReq {
|
||||
int64 Id = 1 [(api.body)="id", (api.vd)="$ != 0"];
|
||||
}
|
||||
|
||||
// 删除记账分类响应
|
||||
message DeleteMoneyCategoryResp {}
|
||||
|
||||
// 修改分类排序项
|
||||
message MoneyCategorySortItem {
|
||||
int64 Id = 1 [(api.body)="id"];
|
||||
int32 SortNumber = 2 [(api.body)="sort_number"];
|
||||
}
|
||||
|
||||
// 修改分类排序请求
|
||||
message UpdateMoneyCategorySortReq {
|
||||
repeated MoneyCategorySortItem Data = 1 [(api.body)="data"];
|
||||
}
|
||||
|
||||
// 修改分类排序响应
|
||||
message UpdateMoneyCategorySortResp {}
|
||||
|
||||
message CreateMoneyCategoryReq {
|
||||
string Name = 1 [
|
||||
(api.body)="name",
|
||||
(api.vd) = "$ != ''"
|
||||
];
|
||||
string Icon = 2 [
|
||||
(api.body)="icon",
|
||||
(api.vd) = "$ != ''"
|
||||
];
|
||||
int32 Type = 3 [(api.body)="type"];
|
||||
int32 SortNumber = 4 [(api.body)="sort_number"];
|
||||
}
|
||||
|
||||
message CreateMoneyCategoryResp {
|
||||
int64 Id = 1 [(api.body)="id"];
|
||||
}
|
||||
|
||||
message UpdateMoneyCategoryReq {
|
||||
int64 Id = 1[
|
||||
(api.body)="id"
|
||||
];
|
||||
string Name = 2 [
|
||||
(api.body)="name",
|
||||
(api.vd) = "$ != ''"
|
||||
];
|
||||
string Icon = 3 [
|
||||
(api.body)="icon",
|
||||
(api.vd) = "$ != ''"
|
||||
];
|
||||
}
|
||||
|
||||
message UpdateMoneyCategoryResp {}
|
||||
@@ -0,0 +1,72 @@
|
||||
syntax = "proto3";
|
||||
package money;
|
||||
|
||||
option go_package = "money";
|
||||
|
||||
import "api.proto";
|
||||
|
||||
|
||||
// 单条记账记录
|
||||
message MoneyRecord {
|
||||
int64 Id = 1 [(api.body)="id"];
|
||||
int64 CategoryId = 2 [(api.body)="category_id"];
|
||||
int64 UserId = 3 [(api.body)="user_id"];
|
||||
string Amount = 4 [(api.body)="amount"];
|
||||
string Remark = 5 [(api.body)="remark"];
|
||||
string RecordTime = 6 [(api.body)="record_time"];
|
||||
int64 CreateTime = 7 [(api.body)="create_time"];
|
||||
int64 UpdateTime = 8 [(api.body)="update_time"];
|
||||
string Username = 9 [(api.body)="username"];
|
||||
}
|
||||
|
||||
// 查询记账记录请求参数
|
||||
message ListMoneyRecordsParams {
|
||||
string StartTime = 1 [(api.body)="start_time"];
|
||||
string EndTime = 2 [(api.body)="end_time"];
|
||||
int64 CategoryId = 3 [(api.body)="category_id"];
|
||||
}
|
||||
|
||||
// 查询记账记录结果
|
||||
message ListMoneyRecordsResult {
|
||||
repeated MoneyRecord Records = 1 [(api.body)="records"];
|
||||
}
|
||||
|
||||
// 新增记账记录参数
|
||||
message InsertMoneyRecordParams {
|
||||
int64 CategoryId = 1 [(api.body)="category_id",(api.vd)="$!=''"];
|
||||
string Amount = 2 [
|
||||
(api.body)="amount",
|
||||
(api.vd)="$!='' && regexp('^\\d+(\\.\\d{1,2})?$', $)"
|
||||
];
|
||||
string Remark = 3 [(api.body)="remark"];
|
||||
string RecordTime = 4 [
|
||||
(api.body)="record_time",
|
||||
(api.vd)="$!='' && regexp('^\\d{4}-\\d{2}-\\d{2}$', $)"
|
||||
];
|
||||
}
|
||||
|
||||
// 新增记账记录结果
|
||||
message InsertMoneyRecordResult {
|
||||
|
||||
}
|
||||
|
||||
// 更新记账记录
|
||||
message UpdateMoneyRecordParams {
|
||||
int64 Id = 1 [(api.body)="id",(api.vd)="$!=0"];
|
||||
int64 CategoryId = 2 [(api.body)="category_id"];
|
||||
string Amount = 3 [(api.body)="amount"];
|
||||
string Remark = 4 [(api.body)="remark"];
|
||||
string RecordTime = 5 [(api.body)="record_time"];
|
||||
}
|
||||
|
||||
message UpdateMoneyRecordResult {
|
||||
|
||||
}
|
||||
|
||||
// 删除记账记录
|
||||
message DeleteMoneyRecordParams{
|
||||
int64 Id = 1 [(api.body)="id",(api.vd)="$!=0"];
|
||||
}
|
||||
message DeleteMoneyRecordResult {
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user