This commit is contained in:
yml2213
2026-10-25 15:02:41 +08:00
commit ccd51b91fb
32 changed files with 5811 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
import {main} from '../models';
import {pricing} from '../models';
export function Bootstrap():Promise<main.Bootstrap>;
export function Calculate(arg1:pricing.Input):Promise<pricing.Result>;
export function ExportConfig():Promise<main.ExportResult>;
export function ImportConfig():Promise<main.ImportResult>;
export function OpenConfigFolder():Promise<void>;
export function ResetConfig():Promise<pricing.Config>;
export function SaveConfig(arg1:pricing.Config):Promise<pricing.Config>;
export function SyncFromServer(arg1:string):Promise<main.SyncResult>;
+35
View File
@@ -0,0 +1,35 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export function Bootstrap() {
return window['go']['main']['App']['Bootstrap']();
}
export function Calculate(arg1) {
return window['go']['main']['App']['Calculate'](arg1);
}
export function ExportConfig() {
return window['go']['main']['App']['ExportConfig']();
}
export function ImportConfig() {
return window['go']['main']['App']['ImportConfig']();
}
export function OpenConfigFolder() {
return window['go']['main']['App']['OpenConfigFolder']();
}
export function ResetConfig() {
return window['go']['main']['App']['ResetConfig']();
}
export function SaveConfig(arg1) {
return window['go']['main']['App']['SaveConfig'](arg1);
}
export function SyncFromServer(arg1) {
return window['go']['main']['App']['SyncFromServer'](arg1);
}
+357
View File
@@ -0,0 +1,357 @@
export namespace main {
export class Bootstrap {
config: pricing.Config;
config_path: string;
server_url: string;
load_error?: string;
static createFrom(source: any = {}) {
return new Bootstrap(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.config = this.convertValues(source["config"], pricing.Config);
this.config_path = source["config_path"];
this.server_url = source["server_url"];
this.load_error = source["load_error"];
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
export class ExportResult {
path: string;
cancelled: boolean;
static createFrom(source: any = {}) {
return new ExportResult(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.path = source["path"];
this.cancelled = source["cancelled"];
}
}
export class ImportResult {
config: pricing.Config;
path: string;
cancelled: boolean;
static createFrom(source: any = {}) {
return new ImportResult(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.config = this.convertValues(source["config"], pricing.Config);
this.path = source["path"];
this.cancelled = source["cancelled"];
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
export class SyncResult {
config: pricing.Config;
server_url: string;
synced_at: string;
insurance_count: number;
ratio_item_count: number;
coin_correction_count: number;
quantity_item_count: number;
static createFrom(source: any = {}) {
return new SyncResult(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.config = this.convertValues(source["config"], pricing.Config);
this.server_url = source["server_url"];
this.synced_at = source["synced_at"];
this.insurance_count = source["insurance_count"];
this.ratio_item_count = source["ratio_item_count"];
this.coin_correction_count = source["coin_correction_count"];
this.quantity_item_count = source["quantity_item_count"];
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
}
export namespace pricing {
export class CoinCorrection {
threshold_m: number;
correction: number;
static createFrom(source: any = {}) {
return new CoinCorrection(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.threshold_m = source["threshold_m"];
this.correction = source["correction"];
}
}
export class QuantityItem {
key: string;
label: string;
price: string;
unit: string;
placeholder?: string;
disabled: boolean;
static createFrom(source: any = {}) {
return new QuantityItem(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.key = source["key"];
this.label = source["label"];
this.price = source["price"];
this.unit = source["unit"];
this.placeholder = source["placeholder"];
this.disabled = source["disabled"];
}
}
export class RatioConfigItem {
key: string;
label: string;
kind: string;
group_key?: string;
missing_penalty: number;
static createFrom(source: any = {}) {
return new RatioConfigItem(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.key = source["key"];
this.label = source["label"];
this.kind = source["kind"];
this.group_key = source["group_key"];
this.missing_penalty = source["missing_penalty"];
}
}
export class InsuranceBaseRatio {
insurance: string;
ratio: number;
static createFrom(source: any = {}) {
return new InsuranceBaseRatio(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.insurance = source["insurance"];
this.ratio = source["ratio"];
}
}
export class Config {
schema_version: number;
insurance_base_ratios: InsuranceBaseRatio[];
ratio_config_items: RatioConfigItem[];
coin_corrections: CoinCorrection[];
quantity_items: QuantityItem[];
daily_loss_options: number[];
accelerated_max_ratio: number;
sync_url: string;
static createFrom(source: any = {}) {
return new Config(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.schema_version = source["schema_version"];
this.insurance_base_ratios = this.convertValues(source["insurance_base_ratios"], InsuranceBaseRatio);
this.ratio_config_items = this.convertValues(source["ratio_config_items"], RatioConfigItem);
this.coin_corrections = this.convertValues(source["coin_corrections"], CoinCorrection);
this.quantity_items = this.convertValues(source["quantity_items"], QuantityItem);
this.daily_loss_options = source["daily_loss_options"];
this.accelerated_max_ratio = source["accelerated_max_ratio"];
this.sync_url = source["sync_url"];
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
export class Input {
coin_m: number;
insurance: string;
states: Record<string, boolean>;
daily_loss_m: number;
sale_ratio: number;
quantities: Record<string, number>;
free_items: Record<string, boolean>;
static createFrom(source: any = {}) {
return new Input(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.coin_m = source["coin_m"];
this.insurance = source["insurance"];
this.states = source["states"];
this.daily_loss_m = source["daily_loss_m"];
this.sale_ratio = source["sale_ratio"];
this.quantities = source["quantities"];
this.free_items = source["free_items"];
}
}
export class ItemLine {
key: string;
label: string;
quantity: number;
unit: string;
unit_price: number;
amount: number;
free: boolean;
disabled: boolean;
static createFrom(source: any = {}) {
return new ItemLine(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.key = source["key"];
this.label = source["label"];
this.quantity = source["quantity"];
this.unit = source["unit"];
this.unit_price = source["unit_price"];
this.amount = source["amount"];
this.free = source["free"];
this.disabled = source["disabled"];
}
}
export class Result {
reference_ratio: number;
final_ratio: number;
max_ratio: number;
insurance_base_ratio: number;
config_penalty: number;
coin_correction: number;
daily_loss_adjustment: number;
coin_base_price: number;
item_price: number;
total_price: number;
items: ItemLine[];
valid: boolean;
message?: string;
static createFrom(source: any = {}) {
return new Result(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.reference_ratio = source["reference_ratio"];
this.final_ratio = source["final_ratio"];
this.max_ratio = source["max_ratio"];
this.insurance_base_ratio = source["insurance_base_ratio"];
this.config_penalty = source["config_penalty"];
this.coin_correction = source["coin_correction"];
this.daily_loss_adjustment = source["daily_loss_adjustment"];
this.coin_base_price = source["coin_base_price"];
this.item_price = source["item_price"];
this.total_price = source["total_price"];
this.items = this.convertValues(source["items"], ItemLine);
this.valid = source["valid"];
this.message = source["message"];
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
}