sign

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TagTodayTotal = "sign:today" // 今日签到
	TagUser       = "sign:user"  // 签到人
)
View Source
const (
	Sign3Day = 7   // 7 => 0000 0111
	Sign7Day = 127 // 127   => 01111 1111
)
View Source
const (
	OneDayTime = 3600 * 24
)

Variables

View Source
var CurrentKey string

Functions

func GetTodayTotalNum

func GetTodayTotalNum() int64

GetTodayTotalNum 获取今日签到人数

func GetYesterdayNum

func GetYesterdayNum() int64

GetYesterdayNum 获取昨日签到人数

func Init

func Init(db *gorm.DB, rdb *redis2.Client)

func SignGetTodayNum

func SignGetTodayNum() int64

SignGetTodayNum 统计今日签到人数

func SignToday

func SignToday() int64

SignToday 统计今日签到人数 返回当前第几个签到

func SignUser

func SignUser(userID uint32) (int64, error)

SignUser 人员打卡, 返回今日第几个签到

func SignUserCheckToday

func SignUserCheckToday(userID uint32) bool

SignUserCheckToday 今日是否已经打卡

func SignUserGetUint8

func SignUserGetUint8(userID uint32) []int64

SignUserGetUint8 获取近8日打卡数据

func TotalToday

func TotalToday() int64

TotalToday 签到总人次, 返回今日第几个签到

Types

type Config

type Config struct {
	NumDaysAgo int64 `json:"num_days_ago"` // 距今多少天, 为第一天(至少为当前天数 - 20天, 防止偏移超出范围)
}

type SignData

type SignData struct {
	Consecutive3   bool       // 连续三天
	Consecutive7   bool       // 连续七天
	ConsecutiveNum int        // 连续签到几天
	List           []SignInfo // 打卡情况
}

func SignUserGetInfo

func SignUserGetInfo(userID uint32) (*SignData, error)

SignUserGetInfo 获取近8日打卡情况

type SignDay

type SignDay struct {
	TimeAt  int64  `json:"time_at"`
	TimeStr string `json:"time_str"`
	IsSign  bool   `json:"is_sign"`
}

type SignInfo

type SignInfo struct {
	TimeAt  int64  `json:"time_at"`  // 时间戳
	TimeStr string `json:"time_str"` // 打卡时间
	IsSign  bool   `json:"is_sign"`  //是否打卡
}

Jump to

Keyboard shortcuts

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