초기커밋

This commit is contained in:
2025-05-01 07:20:41 +09:00
commit 98bb2e3c5c
2747 changed files with 646947 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
using Newtonsoft.Json;
namespace ServerCommon;
public enum CaliumEventType
{
none = 0,
calium_get = 1,
extra_get = 2,
calium_burn = 3
}
public class CaliumEventRequest : CaliumEventData
{
// ?????
[JsonProperty("monitor_log_test")]
public bool m_monitor_log_test { get; set; }
}

View File

@@ -0,0 +1,21 @@
using Newtonsoft.Json;
namespace ServerCommon;
public class CaliumEventResponse : EchoSystemBaseResponse
{
[JsonProperty("data")]
public EchoEventData? m_data { get; set; } = new();
}
public class EchoEventData
{
// 등록 Id
[JsonProperty("_id")]
public string? m_id { get; set; }
// 등록 시간
[JsonProperty("create_time")]
public DateTime? m_create_time { get; set; }
}

View File

@@ -0,0 +1,107 @@
using Newtonsoft.Json;
namespace ServerCommon;
public class CaliumRollUpResponse : EchoSystemBaseResponse
{
[JsonProperty("data")]
public List<RollUpData>? m_list { get; set; } = new();
}
public class RollUpData
{
// Epoch 값
[JsonProperty("seq")] public int m_epoch { get; set; }
// 회차 적용 날짜 ( yyyyMMdd )
[JsonProperty("ymd")] public int m_date { get; set; }
// 교환소 총 발행량
[JsonProperty("calium_exchange_volume")] public double m_exchange_volume { get; set; }
// 컨버터 배정 수량
[JsonProperty("calium_convertor_volume")] public double m_convertor_volume { get; set; }
// 재원저장소 적재량 ( 교환소 )
[JsonProperty("calium_get_repository_volume")] public double m_exchange_repo_volume { get; set; }
// 재원저장소 적재량 ( 교환소 외 )
[JsonProperty("extra_get_repository_volume")] public double m_extra_exchange_repo_volume { get; set; }
// 적재량 합계
[JsonProperty("total_repository_volume")] public double m_total_repo_volume { get; set; }
// 차감 수량
[JsonProperty("repo_confirm_total_amount")] public double m_confirm_total_amount { get; set; }
// 재원저장소 적재량(누적)
[JsonProperty("stack_repository_count")] public double m_stack_repo_count { get; set; }
// 당일 발행량 합계
[JsonProperty("total_today_get_volume")] public double m_today_total_volume { get; set; }
// 타입별 당일 소각량 합계
[JsonProperty("total_today_calium_burn")]
public Dictionary<string, double> m_today_total_burn { get; set; } = new();
// 당일 소각량 합계
[JsonProperty("total_today_burn_volume")] public double m_today_total_burn_volume { get; set; }
// 당일 유통 공급량
[JsonProperty("total_today_circ_volume")] public double m_today_total_circ_volume { get; set; }
// 누적 발행량
[JsonProperty("stack_volume")] public double m_stack_volume { get; set; }
// 교환 가중치
[JsonProperty("swap_rate")] public double m_daily_inflation_rate { get; set; }
// 롤업 트랜젝션 상태
[JsonProperty("tx_state_info")] public RollUpState m_rollup_state { get; set; } = new();
// 생성일자
[JsonProperty("create_time")] public DateTime m_create_time { get; set; }
// 갱신일자
[JsonProperty("update_time")] public DateTime m_update_time { get; set; }
// Web2 롤업 여부 (최초 롤업)
[JsonProperty("is_web2_data")] public bool m_is_web2_data { get; set; }
// 지연확정 여부
[JsonProperty("is_delay_confirm")] public bool m_is_delay_confirm { get; set; }
// 전일자 롤업 필드 캐시
[JsonProperty("previous")] public PreviousRollUpData m_previous_roll_up { get; set; } = new();
// 컨버터 배정 누적 수량
[JsonProperty("stack_convertor_volume")] public double m_stack_converter_volume { get; set; }
// 기본 배정 물량
[JsonProperty("standard_alloc_amount")] public double m_standard_alloc_amount { get; set; }
// ObjectId
[JsonProperty("ccvid")] public string m_ccv_id { get; set; } = string.Empty;
// 컨버터 변환율
[JsonProperty("converter_pod_rate")] public double m_daily_converter_rate { get; set; }
}
public class RollUpState
{
// Pending 결과 : string.Empty - 전송대기 / pending - 결과 대기 / success - 성공
[JsonProperty("state")] public string m_state { get; set; } = string.Empty;
// 트랜젝션 id
[JsonProperty("hash")] public string m_hash { get; set; } = string.Empty;
}
public class PreviousRollUpData
{
[JsonProperty("total_today_circ_volume")] public double m_today_total_circ_volume { get; set; }
[JsonProperty("stack_volume")] public double m_stack_volume { get; set; }
[JsonProperty("swap_rate")] public double m_daily_inflation_rate { get; set; }
[JsonProperty("stack_convertor_volume")] public double m_stack_converter_volume { get; set; }
[JsonProperty("missing_volume")] public double m_missing_volume { get; set; }
}

View File

@@ -0,0 +1,26 @@
using Newtonsoft.Json;
namespace ServerCommon;
public class ConverterSyncResponse : EchoSystemBaseResponse
{
[JsonProperty("data")]
public ConverterSyncData? m_sync { get; set; } = new();
}
public class ConverterSyncData
{
// 현재까지 제공된 Epoch 값
[JsonProperty("seq")]
public int m_epoch { get; set; }
// 현재까지 제공된 회차 날짜 ( yyyyMMdd )
[JsonProperty("ymd")]
public int m_date { get; set; }
// 현재까지 제공된 칼리움 컨버터 총 누적 수량
[JsonProperty("acc_volume")]
public double m_stack_calium { get; set; }
}

View File

@@ -0,0 +1,16 @@
using Newtonsoft.Json;
namespace ServerCommon;
public class EchoSystemBaseResponse
{
[JsonProperty("success")]
public bool m_success { get; set; }
[JsonProperty("code")]
public string? m_code { get; set; }
[JsonProperty("message")]
public List<string>? m_messages { get; set; }
}

View File

@@ -0,0 +1,62 @@
using Newtonsoft.Json;
namespace ServerCommon;
public class EchoSystemSlackMessage
{
[JsonProperty("text")] public string Text { get; set; } = string.Empty;
}
public class EchoSystemSlackMessageBuilder
{
private EchoSystemSlackMessage m_message { get; set; } = new();
private string m_title { get; set; }
private string m_server_name { get; set; }
private string m_ip_port { get; set; }
private Dictionary<string, string> m_members { get; set; } = new();
public EchoSystemSlackMessageBuilder(string title, string serverName, string ipPort)
{
m_title = title;
m_server_name = serverName;
m_ip_port = ipPort;
}
public EchoSystemSlackMessageBuilder appendValue(string key, string value, bool useCodeBlock = false)
{
if (useCodeBlock)
{
value = $"```{value}```";
}
m_members.TryAdd(key, value);
return this;
}
public string build()
{
var txt = $">*Title*: {m_title}";
foreach (var member in m_members)
{
txt += $"\n>*{member.Key}*: {member.Value}";
}
if (!string.IsNullOrEmpty(m_server_name))
{
txt += $"\n>*Server*: {m_server_name}";
}
if (!string.IsNullOrEmpty(m_ip_port))
{
txt += $"\n>*IP/Port*: {m_ip_port}";
}
m_message = new EchoSystemSlackMessage { Text = txt };
var message = JsonConvert.SerializeObject(m_message);
return message;
}
}