You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
136 lines
5.9 KiB
136 lines
5.9 KiB
syntax = "proto3";
|
|
option go_package = ".;pb";
|
|
import "memory/memory_db.proto";
|
|
|
|
// ===== 查询 =====
|
|
|
|
// 按日期范围/分类拉取记忆项
|
|
message MemoryListReq {
|
|
string start_date = 1; //@go_tags(`json:"start_date"`) 起始日期 YYYY-MM-DD(含)
|
|
string end_date = 2; //@go_tags(`json:"end_date"`) 结束日期 YYYY-MM-DD(含)
|
|
repeated string categories = 3; //@go_tags(`json:"categories"`) 分类筛选,空=全部
|
|
repeated int32 states = 4; //@go_tags(`json:"states"`) 状态筛选,空=全部
|
|
string tz = 5; //@go_tags(`json:"tz"`) 客户端时区(IANA名)
|
|
int32 page = 6; //@go_tags(`json:"page"`) 页码,从1开始;0/1 均按第一页
|
|
int32 size = 7; //@go_tags(`json:"size"`) 每页数量,0=默认200,上限1000
|
|
}
|
|
message MemoryListResp {
|
|
repeated DBMemoryItem items = 1; //@go_tags(`json:"items"`)
|
|
int64 total = 2; //@go_tags(`json:"total"`) 满足条件的总数(用于判断还有没有下一页)
|
|
}
|
|
|
|
// 当天全部事项(每日弹窗直接用,含待确认报告标记)
|
|
message MemoryTodayReq {
|
|
string date = 1; //@go_tags(`json:"date"`) 客户端本地日期 YYYY-MM-DD
|
|
string tz = 2; //@go_tags(`json:"tz"`) 客户端时区(IANA名)
|
|
}
|
|
message MemoryTodayResp {
|
|
repeated DBMemoryItem items = 1; //@go_tags(`json:"items"`) 当天事项
|
|
uint64 pending_report_id = 2; //@go_tags(`json:"pending_report_id"`) 有待确认的周报/月报时给出其id,0=没有
|
|
string pending_report_type = 3; //@go_tags(`json:"pending_report_type"`) week/month,配合上一字段
|
|
}
|
|
|
|
// 未来N天待提醒项:重复项已按 tz 展开成绝对时刻,客户端直接排通知
|
|
message MemoryUpcomingReq {
|
|
int32 days = 1; //@go_tags(`json:"days"`) 天数,0=默认7,上限30
|
|
string tz = 2; //@go_tags(`json:"tz"`) 客户端时区(IANA名)
|
|
}
|
|
// 一个展开后的提醒时刻
|
|
message MemoryRemindSlot {
|
|
uint64 item_id = 1; //@go_tags(`json:"item_id"`) 对应记忆项id
|
|
int64 remind_at = 2; //@go_tags(`json:"remind_at"`) 提醒时刻 unix 秒(已扣减 remind_ahead)
|
|
int64 happen_at = 3; //@go_tags(`json:"happen_at"`) 事项本身的时刻 unix 秒
|
|
string title = 4; //@go_tags(`json:"title"`) 冗余下发,客户端排通知不必再查
|
|
string detail = 5; //@go_tags(`json:"detail"`)
|
|
string category = 6; //@go_tags(`json:"category"`)
|
|
}
|
|
message MemoryUpcomingResp {
|
|
repeated MemoryRemindSlot slots = 1; //@go_tags(`json:"slots"`) 按 remind_at 升序
|
|
}
|
|
|
|
// 即时统计(EMAI问答与页面头部用)
|
|
message MemoryStatsReq {
|
|
string start_date = 1; //@go_tags(`json:"start_date"`)
|
|
string end_date = 2; //@go_tags(`json:"end_date"`)
|
|
repeated string categories = 3; //@go_tags(`json:"categories"`) 空=全部
|
|
}
|
|
// 单币种花销小计(不做汇率换算,多币种分行给出)
|
|
message MemoryExpenseSum {
|
|
string currency = 1; //@go_tags(`json:"currency"`)
|
|
int64 total_cents = 2; //@go_tags(`json:"total_cents"`)
|
|
int32 count = 3; //@go_tags(`json:"count"`)
|
|
}
|
|
message MemoryStatsResp {
|
|
int32 todo_total = 1; //@go_tags(`json:"todo_total"`)
|
|
int32 todo_done = 2; //@go_tags(`json:"todo_done"`)
|
|
int32 todo_undone = 3; //@go_tags(`json:"todo_undone"`)
|
|
int32 idea_count = 4; //@go_tags(`json:"idea_count"`)
|
|
int32 alarm_total = 5; //@go_tags(`json:"alarm_total"`)
|
|
repeated MemoryExpenseSum expenses = 6; //@go_tags(`json:"expenses"`) 按币种分行
|
|
}
|
|
|
|
// ===== 写入 =====
|
|
|
|
// 新增:整个 item 提交;client_key 非空时做幂等(重复提交返回已存在那条)
|
|
message MemoryAddReq {
|
|
DBMemoryItem item = 1; //@go_tags(`json:"item"`)
|
|
}
|
|
message MemoryAddResp {
|
|
DBMemoryItem item = 1; //@go_tags(`json:"item"`) 落库后的记录(含id)
|
|
bool duplicated = 2; //@go_tags(`json:"duplicated"`) true=命中幂等键,返回的是既有记录
|
|
}
|
|
|
|
// 修改:只覆盖 fields 里点名的字段,并自动置 user_edited=true
|
|
message MemoryUpdateReq {
|
|
uint64 id = 1; //@go_tags(`json:"id"`)
|
|
DBMemoryItem item = 2; //@go_tags(`json:"item"`) 新值载体
|
|
repeated string fields = 3; //@go_tags(`json:"fields"`) 要更新的字段名(json名),空=按白名单全量覆盖
|
|
}
|
|
message MemoryUpdateResp {
|
|
DBMemoryItem item = 1; //@go_tags(`json:"item"`)
|
|
}
|
|
|
|
message MemoryDelReq {
|
|
repeated uint64 ids = 1; //@go_tags(`json:"ids"`)
|
|
}
|
|
message MemoryDelResp {
|
|
int32 affected = 1; //@go_tags(`json:"affected"`)
|
|
}
|
|
|
|
// 标记完成/取消完成
|
|
message MemoryCompleteReq {
|
|
repeated uint64 ids = 1; //@go_tags(`json:"ids"`)
|
|
bool done = 2; //@go_tags(`json:"done"`) true=完成,false=退回未完成
|
|
}
|
|
message MemoryCompleteResp {
|
|
int32 affected = 1; //@go_tags(`json:"affected"`)
|
|
}
|
|
|
|
// ===== 周期报告 =====
|
|
|
|
// 取周报/月报;period_type 与 period_key 都为空时,返回最近一份未确认的
|
|
message MemoryGetReportReq {
|
|
string period_type = 1; //@go_tags(`json:"period_type"`) week/month
|
|
string period_key = 2; //@go_tags(`json:"period_key"`) 2026-W35 / 2026-08
|
|
}
|
|
message MemoryGetReportResp {
|
|
DBMemoryReport report = 1; //@go_tags(`json:"report"`) 没有时为 null
|
|
}
|
|
|
|
message MemoryConfirmReportReq {
|
|
uint64 report_id = 1; //@go_tags(`json:"report_id"`)
|
|
}
|
|
message MemoryConfirmReportResp {
|
|
DBMemoryReport report = 1; //@go_tags(`json:"report"`)
|
|
}
|
|
|
|
// 列出历史报告(拾忆页里翻旧报告用,避免一次弹多份)
|
|
message MemoryListReportsReq {
|
|
string period_type = 1; //@go_tags(`json:"period_type"`) 空=全部
|
|
int32 page = 2; //@go_tags(`json:"page"`)
|
|
int32 size = 3; //@go_tags(`json:"size"`)
|
|
}
|
|
message MemoryListReportsResp {
|
|
repeated DBMemoryReport reports = 1; //@go_tags(`json:"reports"`)
|
|
int64 total = 2; //@go_tags(`json:"total"`)
|
|
}
|
|
|