internal

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

Package internal Time : 2022/9/5 20:51 Author : xushiyin contact : yuqingxushiyin@gmail.com

Package internal Time : 2023/1/14 14:24 Author : xushiyin contact : yuqingxushiyin@gmail.com

Package internal Time : 2023/1/15 10:58 Author : xushiyin contact : yuqingxushiyin@gmail.com

Package internal Time : 2023/1/15 17:43 Author : xushiyin contact : yuqingxushiyin@gmail.com

Package internal Time : 2022/11/7 21:53 Author : xushiyin contact : yuqingxushiyin@gmail.com

Package internal Time : 2022/9/7 22:01 Author : xushiyin contact : yuqingxushiyin@gmail.com

Package internal Time : 2022/9/11 16:24 Author : xushiyin contact : yuqingxushiyin@gmail.com

Package internal Time : 2023/2/13 22:10 Author : xushiyin contact : yuqingxushiyin@gmail.com

Index

Constants

View Source
const (
	NormalBlack   = "\033[38;5;0m  \033[0m"
	NormalRed     = "\033[38;5;1m  \033[0m"
	NormalGreen   = "\033[38;5;2m  \033[0m"
	NormalYellow  = "\033[38;5;3m  \033[0m"
	NormalBlue    = "\033[38;5;4m  \033[0m"
	NormalMagenta = "\033[38;5;5m  \033[0m"
	NormalCyan    = "\033[38;5;6m  \033[0m"
	NormalWhite   = "\033[38;5;7m  \033[0m"

	BrightBlack   = "\033[48;5;0m  \033[0m"
	BrightRed     = "\033[48;5;1m  \033[0m"
	BrightGreen   = "\033[48;5;2m  \033[0m"
	BrightYellow  = "\033[48;5;3m  \033[0m"
	BrightBlue    = "\033[48;5;4m  \033[0m"
	BrightMagenta = "\033[48;5;5m  \033[0m"
	BrightCyan    = "\033[48;5;6m  \033[0m"
	BrightWhite   = "\033[48;5;7m  \033[0m"
)

Variables

View Source
var (
	CopyToClickXPath = map[ReportType]string{
		Daily:  `//*[@id="z-day-form"]//div[@_search_]`,
		Weekly: `//*[@id="z-week-form"]//div[@_search_]`,
	}
	ReportTypeBtnXPath = map[ReportType]string{
		Daily:  `//a[@href="javascript:void(0);" and string()="日报"]`,
		Weekly: `//a[@href="javascript:void(0);" and string()="周报"]`,
	}
	ReportTextareaXPath = map[ReportType]string{
		Daily:  `//label[contains(text(),'今日完成工作')]/following-sibling::textarea`,
		Weekly: `//label[contains(text(),'本周完成工作')]/following-sibling::textarea`,
	}
	ReportSubmitBtnXPath = map[ReportType]string{
		Daily:  `//*[@id="z-day-form"]/a[string()="提 交"]`,
		Weekly: `//*[@id="z-week-form"]/a[string()="提 交"]`,
	}
)
View Source
var AreaNameCodeMap = map[string]string{
	"chongqing":    "500000",
	"zhejiang":     "330000",
	"yunnan":       "530000",
	"xinjiang":     "650000",
	"xizang":       "540000",
	"tianjin":      "120000",
	"sichuan":      "510000",
	"shenzhen":     "440300",
	"shanghai":     "310000",
	"shaanxi":      "610000",
	"shanxi":       "140000",
	"shandong":     "370000",
	"xiamen":       "350200",
	"ningxia":      "640000",
	"ningbo":       "330200",
	"neimeng":      "150000",
	"liaoning":     "210000",
	"jiangxi":      "360000",
	"jiangsu":      "320000",
	"jilin":        "220000",
	"hunan":        "430000",
	"hubei":        "420000",
	"heilongjiang": "230000",
	"henan":        "410000",
	"hebei":        "130000",
	"hainan":       "460000",
	"guizhou":      "520000",
	"guangxi":      "450000",
	"guangdong":    "440000",
	"gansu":        "620000",
	"fujian":       "350000",
	"dalian":       "210200",
	"beijing":      "110000",
	"anhui":        "340000",
	"qingdao":      "370200",
	"qinghai":      "630000",
}
View Source
var AreaNameModeIds = map[AreaCodeMode][]string{
	ChongQingA: {"chongqing"},
	ZheJiangA:  {"zhejiang"},
	YunNanA:    {"yunnan"},
	XinJiangA:  {"xinjiang"},
	XiZangA:    {"xizang"},
	TianJinA:   {"tianjin"},
	SiChuanA:   {"sichuan"},
	ShenZhenA:  {"shenzhen"},
	ShangHaiA:  {"shanghai"},
	ShaanxiA:   {"shaanxi"},

	ShanDongA:     {"shandong"},
	XiaMenA:       {"xiamen"},
	NingXiaA:      {"ningxia"},
	NingBoA:       {"ningbo"},
	NeiMengA:      {"neimeng"},
	LiaoNingA:     {"liaoning"},
	JiangXiA:      {"jiangxi"},
	JiangSuA:      {"jiangsu"},
	JiLinA:        {"jilin"},
	HuNanA:        {"hunan"},
	HuBeiA:        {"hubei"},
	HeiLongJiangA: {"heilongjiang"},
	HeNanA:        {"henan"},
	HeBeiA:        {"hebei"},
	HaiNanA:       {"hainan"},
	GuiZhouA:      {"guizhou"},
	GuangXiA:      {"guangxi"},
	GuangDongA:    {"guangdong"},
	GanSuA:        {"gansu"},
	FuJianA:       {"fujian"},
	DaLianA:       {"dalian"},
	BeiJingA:      {"beijing"},
	AnHuiA:        {"anhui"},
	QingDaoA:      {"qingdao"},
	QingHaiA:      {"qinghai"},
	// contains filtered or unexported fields
}
View Source
var CategoryModeIds = map[CategoryMode][]string{
	OtherC:             {"其他"},
	ChangeHolidayC:     {"调休"},
	LeaveAbsenceC:      {"请假"},
	BusinessTripC:      {"出差"},
	MeetingC:           {"会议"},
	LearningC:          {"学习提升"},
	TechnicalResearchC: {"技术调研"},
	AssistingOthersC:   {"协助他人"},
	CodeOptimisationC:  {"代码优化"},
	MaintenanceIssuesC: {"运维问题"},
	TaskRequirementC:   {"任务需求"},
}

CategoryModeIds Defines the textual representations for the CategoryMode values.

View Source
var IsCompletedModeIds = map[IsCompletedMode][]string{
	YeahI: {"是"},
	NopeI: {"否"},
}
View Source
var ProgressModeIds = map[ProgressMode][]string{
	HundredP: {"100%"},
	NinetyP:  {"90%"},
	EightyP:  {"80%"},
	SeventyP: {"70%"},
	SixtyP:   {"60%"},
	FiftyP:   {"50%"},
	FortyP:   {"40%"},
	ThirtyP:  {"30%"},
	TwentyP:  {"20%"},
	TenP:     {"10%"},
	ZeroP:    {"0%"},
}

Functions

func CheckDateFormat added in v0.2.0

func CheckDateFormat(date string) (*time.Time, error)

func CopyFile added in v0.2.8

func CopyFile(src, dst string, perm os.FileMode) error

func GetDateList

func GetDateList(start string, r int) ([]string, error)

func GetMonthList

func GetMonthList(dates []string) []string

func GetNowMonthNumber

func GetNowMonthNumber() string

func IsFileDirExist added in v0.2.8

func IsFileDirExist(d string) error

func PrintQrCode2TTY added in v0.3.0

func PrintQrCode2TTY(frontColor, backgroundColor, levelStr, content string) error

PrintQrCode2TTY support as following: Supported background colors: [black, red, green, yellow, blue, magenta, cyan, white] Supported front colors: [black, red, green, yellow, blue, magenta, cyan, white] Supported error correction levels: [L, M, Q, H]

func SortVersion added in v0.2.9

func SortVersion(vList []string) []string

func StrSliceJoin added in v0.2.10

func StrSliceJoin(gbk bool, s ...string) string

func SysType added in v0.2.4

func SysType() string

Types

type AreaCodeMode added in v0.2.8

type AreaCodeMode enumflag.Flag
const (
	ChongQingA AreaCodeMode = iota
	ZheJiangA
	YunNanA
	XinJiangA
	XiZangA
	TianJinA
	SiChuanA
	ShenZhenA
	ShangHaiA
	ShaanxiA

	ShanDongA
	XiaMenA
	NingXiaA
	NingBoA
	NeiMengA
	LiaoNingA
	JiangXiA
	JiangSuA
	JiLinA
	HuNanA
	HuBeiA
	HeiLongJiangA
	HeNanA
	HeBeiA
	HaiNanA
	GuiZhouA
	GuangXiA
	GuangDongA
	GanSuA
	FuJianA
	DaLianA
	BeiJingA
	AnHuiA
	QingDaoA
	QingHaiA
)

AreaCodeMode 36 areas code

type AreaNameMode added in v0.2.8

type AreaNameMode enumflag.Flag

type CategoryMode added in v0.2.8

type CategoryMode enumflag.Flag
const (
	OtherC CategoryMode = iota // always colorize
	ChangeHolidayC
	LeaveAbsenceC
	BusinessTripC
	MeetingC
	LearningC
	TechnicalResearchC
	AssistingOthersC
	CodeOptimisationC
	MaintenanceIssuesC
	TaskRequirementC
)

CategoryMode 其他,调休,请假、出差,会议,学习提升,技术调研,协助他人,代码优化,运维问题,任务需求

type Files added in v0.2.8

type Files struct {
	RootPath string
	Logger   *log.Entry
}

Files for files dealing with

func NewFiles added in v0.2.8

func NewFiles(ctx context.Context, path string, logger *log.Entry) *Files

func (*Files) DeleteDir added in v0.2.8

func (f *Files) DeleteDir(path string)

func (*Files) IsExist added in v0.2.8

func (f *Files) IsExist() (bool, error)

func (*Files) ListDir added in v0.2.8

func (f *Files) ListDir(path string) ([]os.DirEntry, error)

func (*Files) LogErr added in v0.2.8

func (f *Files) LogErr(err error, message string, args ...interface{}) error

type FilterStr added in v0.2.9

type FilterStr func(string) bool

func FilterBranchName added in v0.2.9

func FilterBranchName(f string) FilterStr

type GitClient added in v0.2.8

type GitClient struct {
	Repo   *git.Repository
	Remote *git.Remote
	Logger *log.Entry
}

func NewGitClient added in v0.2.9

func NewGitClient(log *log.Entry) (*GitClient, error)

func (*GitClient) ListRefs added in v0.2.9

func (g *GitClient) ListRefs(f func(s string) bool) ([]string, error)

func (*GitClient) LogErr added in v0.2.8

func (g *GitClient) LogErr(err error, message string, args ...interface{}) error

func (*GitClient) PushDelete added in v0.2.9

func (g *GitClient) PushDelete(branchName string) error

type IsCompletedMode added in v0.2.8

type IsCompletedMode enumflag.Flag
const (
	YeahI IsCompletedMode = iota + 1
	NopeI
)

IsCompletedMode 是,否

type Mover added in v0.2.8

type Mover struct {
	Logger *log.Entry
	// contains filtered or unexported fields
}

func NewMover added in v0.2.8

func NewMover(ctx context.Context, areaCode, ver string, logger *log.Entry) *Mover

func (*Mover) CheckConf added in v0.2.8

func (m *Mover) CheckConf() error

func (*Mover) LogErr added in v0.2.8

func (m *Mover) LogErr(err error, message string, args ...interface{}) error

func (*Mover) MoveThem added in v0.2.8

func (m *Mover) MoveThem() (e error)

type OaWeb added in v0.2.0

type OaWeb struct {
	IsHeadless  bool
	IsRemote    bool
	BrowserPath string
	Logger      *log.Entry
	Browser     *rod.Browser
	Launcher    *launcher.Launcher
	Page        *rod.Page
}

func NewOaWeb added in v0.2.0

func NewOaWeb(headless, remote bool, logger *log.Entry) *OaWeb

func NewOaWebLogin added in v0.2.0

func NewOaWebLogin(ctx context.Context, headless, remote bool, logger *log.Entry) (*OaWeb, error)

func (*OaWeb) ClickBtnX added in v0.2.0

func (o *OaWeb) ClickBtnX(selector string) error

func (*OaWeb) ClickWorkingReportBtn added in v0.2.0

func (o *OaWeb) ClickWorkingReportBtn() error

func (*OaWeb) ElementAttribute added in v0.2.0

func (o *OaWeb) ElementAttribute(selector, name string) (value *string, err error)

func (*OaWeb) FindDefaultBrowserPath added in v0.2.0

func (o *OaWeb) FindDefaultBrowserPath() error

func (*OaWeb) GetAttrUrl added in v0.2.0

func (o *OaWeb) GetAttrUrl(selector, name, host string) (*url.URL, error)

func (*OaWeb) GetCaptchaStr added in v0.2.0

func (o *OaWeb) GetCaptchaStr(u *url.URL) (string, error)

func (*OaWeb) GoLoginPage added in v0.2.0

func (o *OaWeb) GoLoginPage(ctx context.Context) error

func (*OaWeb) HasX added in v0.2.0

func (o *OaWeb) HasX(selector string) (*rod.Element, error)

func (*OaWeb) InputTextX added in v0.2.0

func (o *OaWeb) InputTextX(selector, input string) error

func (*OaWeb) LogErr added in v0.2.0

func (o *OaWeb) LogErr(err error, message string, args ...interface{}) error

func (*OaWeb) LoginOa added in v0.2.0

func (o *OaWeb) LoginOa(ctx context.Context) error

func (*OaWeb) RetryLoginBtn added in v0.2.0

func (o *OaWeb) RetryLoginBtn(retryCnt int) error

func (*OaWeb) SelectCopyTo added in v0.2.0

func (o *OaWeb) SelectCopyTo(rType ReportType, copyTo []string) error

func (*OaWeb) Start added in v0.2.0

func (o *OaWeb) Start() error

func (*OaWeb) Stop added in v0.2.0

func (o *OaWeb) Stop() error

func (*OaWeb) StuffLoginInfo added in v0.2.0

func (o *OaWeb) StuffLoginInfo(ctx context.Context) error

func (*OaWeb) StuffReport added in v0.2.0

func (o *OaWeb) StuffReport(rType ReportType, report string, copyTo []string, autoSubmit bool) error

type ProgressMode added in v0.2.8

type ProgressMode enumflag.Flag
const (
	HundredP ProgressMode = iota
	NinetyP
	EightyP
	SeventyP
	SixtyP
	FiftyP
	FortyP
	ThirtyP
	TwentyP
	TenP
	ZeroP
)

ProgressMode 100%,,0%

type ReportType added in v0.2.0

type ReportType uint
const (
	Daily ReportType = iota
	Weekly
)

Directories

Path Synopsis
Package commands Time : 2022/9/25 23:05 Author : xushiyin contact : yuqingxushiyin@gmail.com
Package commands Time : 2022/9/25 23:05 Author : xushiyin contact : yuqingxushiyin@gmail.com
Package excels Package internal Time : 2022/9/3 15:26 Author : xushiyin contact : yuqingxushiyin@gmail.com
Package excels Package internal Time : 2022/9/3 15:26 Author : xushiyin contact : yuqingxushiyin@gmail.com
Package files_watcher Time : 2022/11/2 20:18 Author : xushiyin contact : yuqingxushiyin@gmail.com
Package files_watcher Time : 2022/11/2 20:18 Author : xushiyin contact : yuqingxushiyin@gmail.com

Jump to

Keyboard shortcuts

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