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
Package internal Time : 2023/3/20 22:11 Author : xushiyin contact : yuqingxushiyin@gmail.com
Index ¶
- Constants
- Variables
- func CheckDateFormat(date string) (*time.Time, error)
- func CopyFile(src, dst string, perm os.FileMode) error
- func GetDateList(start string, r int) ([]string, error)
- func GetMonthList(dates []string) []string
- func GetNowMonthNumber() string
- func IsFileDirExist(d string) error
- func PrintQrCode2TTY(frontColor, backgroundColor, levelStr, content string) error
- func SortVersion(vList []string) []string
- func StrSliceJoin(gbk bool, sep string, s ...string) string
- func SysType() string
- func WriteDefaultConfig() error
- type AreaCodeMode
- type AreaNameMode
- type CategoryMode
- type ComRes
- type Conditions
- type ESLogs
- type ErrorMessage
- type Files
- type FilterStr
- type GitClient
- type IsCompletedMode
- type LogData
- type Mover
- type OaWeb
- func (o *OaWeb) ClickBtnX(selector string) error
- func (o *OaWeb) ClickWorkingReportBtn() error
- func (o *OaWeb) ElementAttribute(selector, name string) (value *string, err error)
- func (o *OaWeb) FindDefaultBrowserPath() error
- func (o *OaWeb) GetAttrUrl(selector, name, host string) (*url.URL, error)
- func (o *OaWeb) GetCaptchaStr(u *url.URL) (string, error)
- func (o *OaWeb) GoLoginPage(ctx context.Context) error
- func (o *OaWeb) HasX(selector string) (*rod.Element, error)
- func (o *OaWeb) InputTextX(selector, input string) error
- func (o *OaWeb) LogErr(err error, message string, args ...interface{}) error
- func (o *OaWeb) LoginOa(ctx context.Context) error
- func (o *OaWeb) RetryLoginBtn(retryCnt int) error
- func (o *OaWeb) SelectCopyTo(rType ReportType, copyTo []string) error
- func (o *OaWeb) Start() error
- func (o *OaWeb) Stop() error
- func (o *OaWeb) StuffLoginInfo(ctx context.Context) error
- func (o *OaWeb) StuffReport(rType ReportType, report string, copyTo []string, autoSubmit bool) error
- type PageRecords
- type ProgressMode
- type QueryCondition
- type Records
- type ReportType
- type Sentry
- func (s *Sentry) GetCaptcha(b64str string) (string, error)
- func (s *Sentry) GetCookies() (*cookiejar.Jar, error)
- func (s *Sentry) GetLogs(jar *cookiejar.Jar, query QueryCondition) ([]Records, error)
- func (s *Sentry) GetSentryEsLog(query QueryCondition) error
- func (s *Sentry) InputUserInfo() error
- func (s *Sentry) LogErr(err error, message string, args ...interface{}) error
- func (s *Sentry) LoginSentry(retryCnt int) error
- func (s *Sentry) OpenSentryLoginPage() error
- func (s *Sentry) PoolReq(jar *cookiejar.Jar, cons []Conditions) ([]Records, error)
- func (s *Sentry) Records2File(fileName string, records []Records, asc bool) error
- func (s *Sentry) ReqLogApi(c *cookiejar.Jar, cond Conditions) (*ESLogs, error)
- func (s *Sentry) RetryLoginBtn(retryCnt int) error
Constants ¶
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" )
const UserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36"
Variables ¶
var ( CopyToClickXPath = map[ReportType]string{ Daily: `//*[@id="z-day-form"]//div[@_search_]`, DailyMember: `/html/body//a[contains(text(), "同事")]`, 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()="提 交"]`, } )
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",
}
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 }
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.
var IsCompletedModeIds = map[IsCompletedMode][]string{ YeahI: {"是"}, NopeI: {"否"}, }
Functions ¶
func GetMonthList ¶
func GetNowMonthNumber ¶
func GetNowMonthNumber() string
func IsFileDirExist ¶ added in v0.2.8
func PrintQrCode2TTY ¶ added in v0.3.0
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 WriteDefaultConfig ¶ added in v0.4.0
func WriteDefaultConfig() error
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 Conditions ¶ added in v0.4.0
type ErrorMessage ¶ added in v0.4.0
type ErrorMessage struct {
Message string `json:"message"`
}
func (*ErrorMessage) Error ¶ added in v0.4.0
func (msg *ErrorMessage) Error() string
type FilterStr ¶ added in v0.2.9
func FilterBranchName ¶ added in v0.2.9
type GitClient ¶ added in v0.2.8
func (*GitClient) PushDelete ¶ added in v0.2.9
type IsCompletedMode ¶ added in v0.2.8
type IsCompletedMode enumflag.Flag
const ( YeahI IsCompletedMode = iota + 1 NopeI )
IsCompletedMode 是,否
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 NewOaWebLogin ¶ added in v0.2.0
func (*OaWeb) ClickWorkingReportBtn ¶ added in v0.2.0
func (*OaWeb) ElementAttribute ¶ added in v0.2.0
func (*OaWeb) FindDefaultBrowserPath ¶ added in v0.2.0
func (*OaWeb) GetAttrUrl ¶ added in v0.2.0
func (*OaWeb) GetCaptchaStr ¶ added in v0.2.0
func (*OaWeb) InputTextX ¶ added in v0.2.0
func (*OaWeb) RetryLoginBtn ¶ added in v0.2.0
func (*OaWeb) SelectCopyTo ¶ added in v0.2.0
func (o *OaWeb) SelectCopyTo(rType ReportType, copyTo []string) error
func (*OaWeb) StuffLoginInfo ¶ added in v0.2.0
func (*OaWeb) StuffReport ¶ added in v0.2.0
type PageRecords ¶ added in v0.4.0
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 QueryCondition ¶ added in v0.4.0
type Records ¶ added in v0.4.0
type Records struct { AppId string `json:"app_id"` AppModel string `json:"app_model"` AppName string `json:"app_name"` AppTag string `json:"app_tag"` ClientIp string `json:"client_ip"` HostName string `json:"host_name,omitempty"` LogCreate string `json:"log_create"` LogNo string `json:"log_no"` Message string `json:"message"` UserId string `json:"user_id"` Action string `json:"action"` }
type ReportType ¶ added in v0.2.0
type ReportType uint
const ( Daily ReportType = iota DailyMember Weekly )
type Sentry ¶ added in v0.4.0
func (*Sentry) GetCaptcha ¶ added in v0.4.0
func (*Sentry) GetSentryEsLog ¶ added in v0.4.0
func (s *Sentry) GetSentryEsLog(query QueryCondition) error
func (*Sentry) InputUserInfo ¶ added in v0.4.0
func (*Sentry) LoginSentry ¶ added in v0.4.0
func (*Sentry) OpenSentryLoginPage ¶ added in v0.4.0
func (*Sentry) Records2File ¶ added in v0.4.0
func (*Sentry) RetryLoginBtn ¶ added in v0.4.0
Source Files ¶
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 |