219 lines
4.2 KiB
TypeScript
219 lines
4.2 KiB
TypeScript
|
import { NetRequest } from "../../Engine/CatanEngine/NetManagerV2/NetRequest";
|
||
|
import { ResourceInfo } from "../resource";
|
||
|
|
||
|
/**
|
||
|
* @link dlygo(得來購) https://docs.google.com/spreadsheets/d/1bm1FwHyY2X7JGkCqSeCUoZAgaMcT7fUB7K4SiDtkyig
|
||
|
*/
|
||
|
|
||
|
// #region Request
|
||
|
|
||
|
export type RpcDlygoListRequest = { t: DlygoMainType }
|
||
|
export type RpcDlygoListResponse = TDlygoList[]
|
||
|
|
||
|
/** 商品清單 */
|
||
|
export class DlygoListRequest extends NetRequest<RpcDlygoListRequest, RpcDlygoListResponse> {
|
||
|
get Method(): string {
|
||
|
return "dlygo.list";
|
||
|
}
|
||
|
constructor(type: DlygoMainType) {
|
||
|
super();
|
||
|
this.Data = {
|
||
|
t: type
|
||
|
};
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export type RpcDlygoSNRequest = { i: number; }
|
||
|
export type RpcDlygoSNResponse = TDlygoSN
|
||
|
|
||
|
/** 商品明細 */
|
||
|
export class DlygoSNRequest extends NetRequest<RpcDlygoSNRequest, RpcDlygoSNResponse> {
|
||
|
get Method(): string {
|
||
|
return "dlygo.sn";
|
||
|
}
|
||
|
constructor(id: number) {
|
||
|
super();
|
||
|
this.Data = {
|
||
|
i: id
|
||
|
};
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export type RpcDlygoRedeemRequest = { i: number; p: number; }
|
||
|
export type RpcDlygoRedeemResponse = TDlygoRedeem
|
||
|
|
||
|
/** 商品兌換 */
|
||
|
export class DlygoRedeemRequest extends NetRequest<RpcDlygoRedeemRequest, RpcDlygoRedeemResponse> {
|
||
|
get Method(): string {
|
||
|
return "dlygo.redeem";
|
||
|
}
|
||
|
constructor(id: number, p: number) {
|
||
|
super();
|
||
|
this.Data = {
|
||
|
i: id,
|
||
|
p: p
|
||
|
};
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export type RpcDlygoExchangeRequest = RpcDlygoSNRequest
|
||
|
export type RpcDlygoExchangeResponse = TDlygoExchange
|
||
|
|
||
|
/** 金幣兌換 */
|
||
|
export class DlygoExchangeRequest extends NetRequest<RpcDlygoExchangeRequest, RpcDlygoExchangeResponse> {
|
||
|
get Method(): string {
|
||
|
return "dlygo.exchange";
|
||
|
}
|
||
|
constructor(id: number) {
|
||
|
super();
|
||
|
this.Data = {
|
||
|
i: id
|
||
|
};
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export type RpcDlygoLogRequest = {
|
||
|
/**
|
||
|
* @param u true: 使用時間,
|
||
|
* @param u false: 領獎時間,
|
||
|
*/
|
||
|
u: boolean;
|
||
|
}
|
||
|
export type RpcDlygoLogResponse = TDlygoLog[]
|
||
|
|
||
|
/** 商品記錄 */
|
||
|
export class DlygoLogRequest extends NetRequest<RpcDlygoLogRequest, RpcDlygoLogResponse> {
|
||
|
get Method(): string {
|
||
|
return "dlygo.log";
|
||
|
}
|
||
|
constructor(u: boolean) {
|
||
|
super();
|
||
|
this.Data = {
|
||
|
u: u
|
||
|
};
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export type RpcDlygoUsedRequest = [productId: number, productSerialNumber: string]
|
||
|
export type RpcDlygoUsedResponse = TDlygoUsed
|
||
|
|
||
|
/** 商品使用 */
|
||
|
export class DlygoUsedRequest extends NetRequest<RpcDlygoUsedRequest[], RpcDlygoUsedResponse> {
|
||
|
get Method(): string {
|
||
|
return "dlygo.used";
|
||
|
}
|
||
|
constructor(arg: RpcDlygoUsedRequest[]) {
|
||
|
super();
|
||
|
this.Data = arg;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// #endregion
|
||
|
|
||
|
// #region Type
|
||
|
|
||
|
export type TDlygoItem = [
|
||
|
dataType: DlygoDataType,
|
||
|
productId: number,
|
||
|
productName: string,
|
||
|
productDisplayName: string,
|
||
|
productSerialNumber: string,
|
||
|
expiryDate: number,
|
||
|
prizeRedemptionTime: number,
|
||
|
]
|
||
|
|
||
|
export type TDlygoList = [
|
||
|
id: number,
|
||
|
name: string,
|
||
|
price: number,
|
||
|
discountPrice: number,
|
||
|
tag: DlygoTag,
|
||
|
remainQuantity: number,
|
||
|
dayLimitAmount: number,
|
||
|
];
|
||
|
|
||
|
export type TDlygoSN = {
|
||
|
/** 本日已兌換數量 */
|
||
|
q: number,
|
||
|
|
||
|
/** 說明1 */
|
||
|
c1: string,
|
||
|
|
||
|
/** 說明2 */
|
||
|
c2: string,
|
||
|
}
|
||
|
|
||
|
export type TDlygoRedeem = [TDlygoItem, ResourceInfo[]]
|
||
|
|
||
|
export type TDlygoExchange = [TDlygoItem, ResourceInfo[]]
|
||
|
|
||
|
export type TDlygoLog = [
|
||
|
dataType: DlygoDataType,
|
||
|
productId: number,
|
||
|
productName: string,
|
||
|
productDisplayName: string,
|
||
|
productSerialNumber: string,
|
||
|
expiryDate: number,
|
||
|
time: number,
|
||
|
]
|
||
|
|
||
|
export type TDlygoUsed = {
|
||
|
/** 使用時間 */
|
||
|
t: number,
|
||
|
}
|
||
|
|
||
|
// #endregion
|
||
|
|
||
|
// #region Server Error Enum
|
||
|
|
||
|
export enum DlygoRedeemStatus {
|
||
|
NotEnough = 11,
|
||
|
NoMoney = 12,
|
||
|
ExceededDailyLimit = 13,
|
||
|
DBError = 14,
|
||
|
PriceUpdated = 15,
|
||
|
}
|
||
|
|
||
|
export enum DlygoExchangeStatus {
|
||
|
NoMoney = 11,
|
||
|
DBError = 12,
|
||
|
}
|
||
|
|
||
|
export enum DlygoUsedStatus {
|
||
|
DBError = 11,
|
||
|
}
|
||
|
|
||
|
// #endregion
|
||
|
|
||
|
// #region Enum
|
||
|
|
||
|
export enum DlygoMainType {
|
||
|
/** 點子點數 */
|
||
|
Point = 1,
|
||
|
/** 精緻餐飲 */
|
||
|
Food = 2,
|
||
|
/** 超商禮券 */
|
||
|
Seven = 3,
|
||
|
/** 生活百貨 */
|
||
|
Shop = 4,
|
||
|
/** 其他品項 */
|
||
|
Other = 5,
|
||
|
/** Coin */
|
||
|
Coin = 99
|
||
|
}
|
||
|
|
||
|
export enum DlygoDataType {
|
||
|
/** 商品 */
|
||
|
Product = 1,
|
||
|
/** 金幣 */
|
||
|
Coin = 2,
|
||
|
}
|
||
|
|
||
|
export enum DlygoTag {
|
||
|
None,
|
||
|
New,
|
||
|
Popular,
|
||
|
SpecialOffer,
|
||
|
}
|
||
|
|
||
|
// #endregion
|