This commit is contained in:
oneao committed 2026-01-13 22:18:01 +08:00
1 parent 6277fb2f9e
commit 8ecac0d7dd
270 files changed
+40438 -529

No files matched your search

@@ -0,0 +1,36 @@
syntax = "proto3";
package money;
option go_package = "money";
import "api.proto";
import "money/money_category_types.proto";
import "money/money_record_types.proto";
service MoneyCategoryService {
rpc QueryUserMoneyCategory(QueryMoneyCategoryReq) returns (QueryMoneyCategoryResp){
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';
};
}
service MoneyRecordService {
rpc QueryMoneyRecord(QueryMoneyRecordsParams) returns (QueryMoneyRecordsResult){
option (api.post) = '/money/record/query';
}
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';
}
}
@@ -0,0 +1,45 @@
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 QueryMoneyCategoryReq {}
// 查询记账分类响应
message QueryMoneyCategoryResp {
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 {}
@@ -0,0 +1,94 @@
syntax = "proto3";
package money;
option go_package = "money";
import "api.proto";
// 单条记账记录
message MoneyRecordItem {
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"];
string CreateTime = 7 [(api.body)="create_time"];
string UpdateTime = 8 [(api.body)="update_time"];
string Username = 9 [(api.body)="username"];
int32 CategoryType = 10 [(api.body)="category_type"];
string CategoryIcon = 11 [(api.body)="category_icon"];
string CategoryName = 12 [(api.body)="category_name"];
}
// 同一天的记账记录分组
message MoneyRecordGroup {
string RecordTime = 1 [(api.body)="record_time"];
string Expense = 2 [(api.body)="expense"];
string Income = 3 [(api.body)="income"];
repeated MoneyRecordItem Records = 4 [(api.body)="records"];
}
// 查询记账记录请求参数
message QueryMoneyRecordsParams {
string RecordTime = 1 [(api.body)="record_time"];
}
// 查询记账记录结果
message QueryMoneyRecordsResult {
repeated MoneyRecordGroup Records = 1 [(api.body)="records"];
string TotalIncome = 2 [(api.body)="total_income"];
string TotalExpense = 3 [(api.body)="total_expense"];
string TotalBalance = 4 [(api.body)="total_balance"];
}
// 新增记账记录参数
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 {
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"];
string CreateTime = 7 [(api.body)="create_time"];
string UpdateTime = 8 [(api.body)="update_time"];
}
// 更新记账记录
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 {
}