lexvalueexchangeservice

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action string
const (
	DataRequestActionPreview             Action = "PreviewResource"
	OperateRequestActionIncreaseResource Action = "IncreaseResource"
)

type IService

type IService interface {
	// 預覽交換後的資源(獎勵)
	DataRequest(req *ResourceDataRequest, trace ...tracehandler.Trace) (*ResourceDataResponse, error)
	// 等價資源 : 請server 派發resources要等價交換的獎勵給玩家
	OperateRequest(req *ResourceOperateRequest, trace ...tracehandler.Trace) (*ResourceOperateResponse, error)
}

func NewService

func NewService(client *http.Client, lexCommonURL string) IService

type IServiceExt

type IServiceExt interface {
	// 預覽單個但不執行交換後的資源(獎勵)
	Preview(memberID string, resourceReward reward.Nodes, trace ...tracehandler.Trace) (*PreviewInfo, error)
	// 預覽多個但不執行交換後的資源(獎勵)
	MultiPreview(memberID string, resources ResourcePreviewInfos, trace ...tracehandler.Trace) (*PreviewInfos, error)
	// 透過交換服務去派獎給玩家
	IncreaseResource(memberID, source, description string, resourceReward reward.Nodes, trace ...tracehandler.Trace) error
}

func NewExt

func NewExt(service IService) IServiceExt

type PreviewInfo

type PreviewInfo struct {
	SN    string       `json:"sn"`
	Base  reward.Nodes `json:"basePreviewInfos"`
	Bonus reward.Nodes `json:"bonusPreviewInfos"`
}

type PreviewInfos

type PreviewInfos []PreviewInfo

type ResourceDataRequest

type ResourceDataRequest struct {
	Action               Action               `json:"action"`
	MemberId             string               `json:"memberId"`
	ResourcePreviewInfos ResourcePreviewInfos `json:"resourcePreviewInfos"`
}

type ResourceDataResponse

type ResourceDataResponse struct {
	RetStatus    baseProtocol.RetStatus `json:"retStatus"`
	PreviewInfos PreviewInfos           `json:"previewInfos"`
}

type ResourceOperateRequest

type ResourceOperateRequest struct {
	Action      Action       `json:"action"`
	MemberID    string       `json:"memberId"`
	Source      string       `json:"source"`
	Description string       `json:"description"`
	Resources   reward.Nodes `json:"resources"` // 等價交換的內容
}

type ResourceOperateResponse

type ResourceOperateResponse struct {
	RetStatus baseProtocol.RetStatus `json:"retStatus"`
}

type ResourcePreviewInfo

type ResourcePreviewInfo struct {
	SN          string       `json:"sn"`
	RewardNodes reward.Nodes `json:"nodes"`
}

type ResourcePreviewInfos

type ResourcePreviewInfos []ResourcePreviewInfo

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL