Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 ¶
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
Click to show internal directories.
Click to hide internal directories.