Publisher rewarding

This commit is contained in:
2025-11-02 11:59:02 +08:00
parent 5e5f4528b9
commit 322dee4453
8 changed files with 312 additions and 50 deletions

View File

@@ -14,25 +14,25 @@ import "google/protobuf/field_mask.proto";
// SocialCreditRecord represents a record of social credit changes for an account
message SocialCreditRecord {
string id = 1; // UUID string
string reason_type = 2;
string reason = 3;
double delta = 4;
string account_id = 5; // UUID string
google.protobuf.Timestamp created_at = 6;
google.protobuf.Timestamp updated_at = 7;
string id = 1; // UUID string
string reason_type = 2;
string reason = 3;
double delta = 4;
string account_id = 5; // UUID string
google.protobuf.Timestamp created_at = 6;
google.protobuf.Timestamp updated_at = 7;
}
// ExperienceRecord represents a record of experience points gained by an account
message ExperienceRecord {
string id = 1; // UUID string
string reason_type = 2;
string reason = 3;
int64 delta = 4;
double bonus_multiplier = 5;
string account_id = 6; // UUID string
google.protobuf.Timestamp created_at = 7;
google.protobuf.Timestamp updated_at = 8;
string id = 1; // UUID string
string reason_type = 2;
string reason = 3;
int64 delta = 4;
double bonus_multiplier = 5;
string account_id = 6; // UUID string
google.protobuf.Timestamp created_at = 7;
google.protobuf.Timestamp updated_at = 8;
}
// ====================================
@@ -41,26 +41,27 @@ message ExperienceRecord {
// Social Credit Requests/Responses
message AddSocialCreditRecordRequest {
string reason_type = 1;
string reason = 2;
double delta = 3;
string account_id = 4; // UUID string
string reason_type = 1;
string reason = 2;
double delta = 3;
string account_id = 4; // UUID string
google.protobuf.Timestamp expired_at = 5;
}
message GetSocialCreditRequest {
string account_id = 1; // UUID string
string account_id = 1; // UUID string
}
message SocialCreditResponse {
double amount = 1;
double amount = 1;
}
// Experience Requests/Responses
message AddExperienceRecordRequest {
string reason_type = 1;
string reason = 2;
int64 delta = 3;
string account_id = 4; // UUID string
string reason_type = 1;
string reason = 2;
int64 delta = 3;
string account_id = 4; // UUID string
}
// ====================================
@@ -69,15 +70,15 @@ message AddExperienceRecordRequest {
// SocialCreditService provides operations for managing social credit scores
service SocialCreditService {
// Adds a new social credit record for an account
rpc AddRecord(AddSocialCreditRecordRequest) returns (SocialCreditRecord);
// Gets the current social credit score for an account
rpc GetSocialCredit(GetSocialCreditRequest) returns (SocialCreditResponse);
// Adds a new social credit record for an account
rpc AddRecord(AddSocialCreditRecordRequest) returns (SocialCreditRecord);
// Gets the current social credit score for an account
rpc GetSocialCredit(GetSocialCreditRequest) returns (SocialCreditResponse);
}
// ExperienceService provides operations for managing experience points
service ExperienceService {
// Adds a new experience record for an account
rpc AddRecord(AddExperienceRecordRequest) returns (ExperienceRecord);
// Adds a new experience record for an account
rpc AddRecord(AddExperienceRecordRequest) returns (ExperienceRecord);
}

View File

@@ -71,6 +71,18 @@ public static class ServiceInjectionHelper
{ ServerCertificateCustomValidationCallback = (_, _, _, _) => true }
);
services.AddSingleton<RemoteRealmService>();
services
.AddGrpcClient<SocialCreditService.SocialCreditServiceClient>(o => o.Address = new Uri("https://_grpc.pass"))
.ConfigurePrimaryHttpMessageHandler(_ => new HttpClientHandler()
{ ServerCertificateCustomValidationCallback = (_, _, _, _) => true }
);
services
.AddGrpcClient<ExperienceService.ExperienceServiceClient>(o => o.Address = new Uri("https://_grpc.pass"))
.ConfigurePrimaryHttpMessageHandler(_ => new HttpClientHandler()
{ ServerCertificateCustomValidationCallback = (_, _, _, _) => true }
);
return services;
}