mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2025-11-28 16:10:25 +08:00
支持购买套餐/续费套餐/用户账户操作等
This commit is contained in:
15
pkg/rpc/protos/models/model_user_account.proto
Normal file
15
pkg/rpc/protos/models/model_user_account.proto
Normal file
@@ -0,0 +1,15 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
import "models/model_user.proto";
|
||||
|
||||
message UserAccount {
|
||||
int64 id = 1;
|
||||
int64 userId = 2;
|
||||
float total = 3;
|
||||
float totalFrozen = 4;
|
||||
|
||||
User user = 30;
|
||||
}
|
||||
12
pkg/rpc/protos/models/model_user_account_daily_stat.proto
Normal file
12
pkg/rpc/protos/models/model_user_account_daily_stat.proto
Normal file
@@ -0,0 +1,12 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
message UserAccountDailyStat {
|
||||
int64 id = 1;
|
||||
string day = 2;
|
||||
string month = 3;
|
||||
float income = 4;
|
||||
float expense = 5;
|
||||
}
|
||||
24
pkg/rpc/protos/models/model_user_account_log.proto
Normal file
24
pkg/rpc/protos/models/model_user_account_log.proto
Normal file
@@ -0,0 +1,24 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
import "models/model_user.proto";
|
||||
import "models/model_user_account.proto";
|
||||
|
||||
message UserAccountLog {
|
||||
int64 id = 1;
|
||||
int64 userId = 2;
|
||||
int64 userAccountId = 3;
|
||||
float delta = 4;
|
||||
float deltaFrozen = 5;
|
||||
float total = 6;
|
||||
float totalFrozen = 7;
|
||||
string eventType = 8;
|
||||
string description = 9;
|
||||
int64 createdAt = 10;
|
||||
bytes paramsJSON = 11;
|
||||
|
||||
User user = 30;
|
||||
UserAccount userAccount = 31;
|
||||
}
|
||||
68
pkg/rpc/protos/service_user_account.proto
Normal file
68
pkg/rpc/protos/service_user_account.proto
Normal file
@@ -0,0 +1,68 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
import "models/model_user_account.proto";
|
||||
import "models/rpc_messages.proto";
|
||||
|
||||
// 用户账户服务
|
||||
service UserAccountService {
|
||||
// 计算账户数量
|
||||
rpc countUserAccounts(CountUserAccountsRequest) returns (RPCCountResponse);
|
||||
|
||||
// 列出单页账户
|
||||
rpc listUserAccounts(ListUserAccountsRequest) returns (ListUserAccountsResponse);
|
||||
|
||||
// 根据用户ID查找单个账户
|
||||
rpc findEnabledUserAccountWithUserId(FindEnabledUserAccountWithUserIdRequest) returns (FindEnabledUserAccountWithUserIdResponse);
|
||||
|
||||
// 查找单个账户
|
||||
rpc findEnabledUserAccount(FindEnabledUserAccountRequest) returns (FindEnabledUserAccountResponse);
|
||||
|
||||
// 修改用户账户
|
||||
rpc updateUserAccount(UpdateUserAccountRequest) returns (RPCSuccess);
|
||||
}
|
||||
|
||||
// 计算账户数量
|
||||
message CountUserAccountsRequest {
|
||||
string keyword = 1;
|
||||
}
|
||||
|
||||
// 列出单页账户
|
||||
message ListUserAccountsRequest {
|
||||
string keyword = 1;
|
||||
int64 offset = 2;
|
||||
int64 size = 3;
|
||||
}
|
||||
|
||||
message ListUserAccountsResponse {
|
||||
repeated UserAccount userAccounts = 1;
|
||||
}
|
||||
|
||||
// 根据用户ID查找单个账户
|
||||
message FindEnabledUserAccountWithUserIdRequest {
|
||||
int64 userId = 1;
|
||||
}
|
||||
|
||||
message FindEnabledUserAccountWithUserIdResponse {
|
||||
UserAccount userAccount = 1;
|
||||
}
|
||||
|
||||
// 查找单个账户
|
||||
message FindEnabledUserAccountRequest {
|
||||
int64 userAccountId = 1;
|
||||
}
|
||||
|
||||
message FindEnabledUserAccountResponse {
|
||||
UserAccount userAccount = 1;
|
||||
}
|
||||
|
||||
// 修改用户账户
|
||||
message UpdateUserAccountRequest {
|
||||
int64 userAccountId = 1;
|
||||
float delta = 2;
|
||||
string eventType = 3;
|
||||
string description = 4;
|
||||
bytes paramsJSON = 5;
|
||||
}
|
||||
45
pkg/rpc/protos/service_user_account_daily_stat.proto
Normal file
45
pkg/rpc/protos/service_user_account_daily_stat.proto
Normal file
@@ -0,0 +1,45 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
// 用户账户统计服务
|
||||
service UserAccountDailyStatService {
|
||||
// 列出按天统计
|
||||
rpc listUserAccountDailyStats(ListUserAccountDailyStatsRequest) returns (ListUserAccountDailyStatsResponse);
|
||||
|
||||
// 列出按月统计
|
||||
rpc listUserAccountMonthlyStats(ListUserAccountMonthlyStatsRequest) returns (ListUserAccountMonthlyStatsResponse);
|
||||
}
|
||||
|
||||
// 列出按天统计
|
||||
message ListUserAccountDailyStatsRequest {
|
||||
string dayFrom = 1;
|
||||
string dayTo = 2;
|
||||
}
|
||||
|
||||
message ListUserAccountDailyStatsResponse {
|
||||
repeated Stat stats = 1;
|
||||
|
||||
message Stat {
|
||||
string day = 1; // YYYYMMDD
|
||||
float income = 2;
|
||||
float expense = 3;
|
||||
}
|
||||
}
|
||||
|
||||
// 列出按月统计
|
||||
message ListUserAccountMonthlyStatsRequest {
|
||||
string dayFrom = 1;
|
||||
string dayTo = 2;
|
||||
}
|
||||
|
||||
message ListUserAccountMonthlyStatsResponse {
|
||||
repeated Stat stats = 1;
|
||||
|
||||
message Stat {
|
||||
string month = 1; // YYYYMM
|
||||
float income = 2;
|
||||
float expense = 3;
|
||||
}
|
||||
}
|
||||
37
pkg/rpc/protos/service_user_account_log.proto
Normal file
37
pkg/rpc/protos/service_user_account_log.proto
Normal file
@@ -0,0 +1,37 @@
|
||||
syntax = "proto3";
|
||||
option go_package = "./pb";
|
||||
|
||||
package pb;
|
||||
|
||||
import "models/model_user_account_log.proto";
|
||||
import "models/rpc_messages.proto";
|
||||
|
||||
// 用户账户日志服务
|
||||
service UserAccountLogService {
|
||||
// 计算日志数量
|
||||
rpc countUserAccountLogs(CountUserAccountLogsRequest) returns (RPCCountResponse);
|
||||
|
||||
// 列出单页日志
|
||||
rpc listUserAccountLogs(ListUserAccountLogsRequest) returns (ListUserAccountLogsResponse);
|
||||
}
|
||||
|
||||
// 计算日志数量
|
||||
message CountUserAccountLogsRequest {
|
||||
int64 userAccountId = 1;
|
||||
string keyword = 2;
|
||||
string eventType = 3;
|
||||
}
|
||||
|
||||
// 列出单页日志
|
||||
message ListUserAccountLogsRequest {
|
||||
int64 userAccountId = 1;
|
||||
string keyword = 2;
|
||||
string eventType = 3;
|
||||
int64 offset = 4;
|
||||
int64 size = 5;
|
||||
}
|
||||
|
||||
message ListUserAccountLogsResponse {
|
||||
repeated UserAccountLog userAccountLogs = 1;
|
||||
}
|
||||
|
||||
@@ -8,8 +8,11 @@ import "models/model_user_plan.proto";
|
||||
|
||||
// 用户购买的套餐
|
||||
service UserPlanService {
|
||||
// 添加已购套餐
|
||||
rpc createUserPlan(CreateUserPlanRequest) returns (CreateUserPlanResponse);
|
||||
// 购买套餐
|
||||
rpc buyUserPlan(BuyUserPlanRequest) returns (BuyUserPlanResponse);
|
||||
|
||||
// 续费套餐
|
||||
rpc renewUserPlan(RenewUserPlanRequest) returns (RPCSuccess);
|
||||
|
||||
// 查找单个已购套餐信息
|
||||
rpc findEnabledUserPlan(FindEnabledUserPlanRequest) returns (FindEnabledUserPlanResponse);
|
||||
@@ -28,16 +31,26 @@ service UserPlanService {
|
||||
}
|
||||
|
||||
// 添加已购套餐
|
||||
message CreateUserPlanRequest{
|
||||
message BuyUserPlanRequest{
|
||||
int64 userId = 1;
|
||||
int64 planId = 2;
|
||||
string dayTo = 3;
|
||||
string period = 4;
|
||||
int32 countPeriod = 5;
|
||||
}
|
||||
|
||||
message CreateUserPlanResponse {
|
||||
message BuyUserPlanResponse {
|
||||
int64 userPlanId = 1;
|
||||
}
|
||||
|
||||
// 续费套餐
|
||||
message RenewUserPlanRequest {
|
||||
int64 userPlanId = 1;
|
||||
string dayTo = 3;
|
||||
string period = 4;
|
||||
int32 countPeriod = 5;
|
||||
}
|
||||
|
||||
// 查找单个已购套餐信息
|
||||
message FindEnabledUserPlanRequest {
|
||||
int64 userPlanId = 1;
|
||||
|
||||
Reference in New Issue
Block a user