domain

package
v1.7.7 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(cfg *Config)

Types

type Config

type Config struct {
	MaxPointsOfDay int `json:"max_points_of_day"`
}

func (*Config) SetDefault

func (cfg *Config) SetDefault()

type PointsDetail

type PointsDetail struct {
	Id     string `json:"id"` // serial number
	Desc   string `json:"desc"`
	Time   string `json:"time"`
	Points int    `json:"points"`
}

PointsDetail

type PointsItem

type PointsItem struct {
	Date    string
	TaskId  string
	Details []PointsDetail
}

PointsItem

func (*PointsItem) LatestDetail

func (item *PointsItem) LatestDetail() *PointsDetail

type Rule

type Rule struct {
	Descs          map[string]string `json:"descs"`
	CreatedAt      string            `json:"created_at"`
	OnceOnly       bool              `json:"once_only"` // only can do once
	PointsPerOnce  int               `json:"points_per_once"`
	MaxPointsOfDay int               `json:"max_points_of_day"`
	MaxPointsDescs map[string]string `json:"max_points_descs"`
}

Rule

type Task

type Task struct {
	Id      string            `json:"id"`
	Names   map[string]string `json:"names"`
	Kind    string            `json:"kind"` // Novice, EveryDay, Activity, PassiveItem
	Addr    string            `json:"addr"` // The website address of task
	Rule    Rule              `json:"rule"`
	Version int               `json:"version"`
}

Task

func (*Task) IsPassiveTask

func (t *Task) IsPassiveTask() bool

func (*Task) MaxPointsDesc

func (t *Task) MaxPointsDesc(lang common.Language) string

func (*Task) Name

func (t *Task) Name(lang common.Language) string

func (*Task) RuleDesc

func (t *Task) RuleDesc(lang common.Language) string

type UserPoints

type UserPoints struct {
	User    types.Account
	Total   int
	Items   []PointsItem // items of day or all the items
	Dones   []string     // tasks that user has done
	Version int
}

UserPoints

func (*UserPoints) AddPointsItem

func (entity *UserPoints) AddPointsItem(task *Task, date string, detail *PointsDetail) *PointsItem

func (*UserPoints) DetailsNum

func (entity *UserPoints) DetailsNum() int

func (*UserPoints) IsCompleted

func (entity *UserPoints) IsCompleted(task *Task) bool

func (*UserPoints) IsFirstPointsDetailOfDay

func (entity *UserPoints) IsFirstPointsDetailOfDay() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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