Files
Kayori_MedusaPluginChargeMa…/MedusaPluginChargeMachine/Handlers/LA9/GetConfigEaChargeHandler.cs
T
Kayori e5bdb3eb95 Fix multi-bill display, charge amount parsing, and charge log responses
- chargeoptions is the real field gating 2000/5000/10000 yen display
- chargeid (not chargenum) carries the actual denomination on charge
- getrecentcharge/getlastlog: fixed num mismatch, added missing result
  section, and added placeholder items for empty result sets
2026-09-07 02:14:14 +02:00

53 lines
1.7 KiB
C#

using Abstractions.Handlers;
using Abstractions.SerializationTypes;
using MedusaPluginChargeMachine.Models.Request;
using MedusaPluginChargeMachine.Models.Response;
using Microsoft.EntityFrameworkCore;
namespace MedusaPluginChargeMachine.Handlers.LA9;
public class GetConfigEaChargeHandler(ChargeMachineDbContext db) : HandlerWithoutRequest<EaChargeConfigResponse>
{
public override void Configure()
{
Module("eacharge");
Method("getconf");
}
public override async Task<EaChargeConfigResponse> HandleAsync(GameModel model)
{
var articles = await db.ArticleContents.ToListAsync();
var articleList = articles
.Select(a => new EaChargeConfigChargeArticleItem
{
ArticleType = new XrpcString(a.ArticleType.ToString()),
ArticleDoc = new XrpcString(
a.ArticleType.ToString().StartsWith("DOCMT_") ? "" : a.ArticleDoc)
})
.ToList();
return new EaChargeConfigResponse
{
Status = 0,
Expire = 1200,
ChargeOptions = new XrpcString("multibills"),
ChargeArticle = new EaChargeConfigChargeArticle
{
ArticleRevision = new XrpcString("1"),
ArticleList = articleList
},
ChargeDetail = new EaChargeConfigChargeDetail
{
ChargeDaily = new XrpcInt(0),
ChargeDailyLimit = new XrpcInt(100000)
},
ChargeStatus = new EaChargeConfigChargeStatus
{
CurrentCode = new XrpcInt(0),
LastChargeStatus = new XrpcInt(1)
}
};
}
}