internal

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package internal Time : 2022/9/5 20:51 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

Index

Constants

This section is empty.

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()="提 交"]`,
	}
)

Functions

func CheckDateFormat added in v0.2.0

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

func GetDateList

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

func GetMonthList

func GetMonthList(dates []string) []string

func GetNowMonthNumber

func GetNowMonthNumber() string

func SysType added in v0.2.4

func SysType() string

Types

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 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

Jump to

Keyboard shortcuts

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