internal

package
v0.16.5 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: MIT Imports: 50 Imported by: 0

Documentation

Overview

Package internal Time : 2023/9/3 16:36 Author : xushiyin contact : yuqingxushiyin@gmail.com desc: get aliyun refresh token ```javascript copy(JSON.parse(localStorage.token).refresh_token); console.log(JSON.parse(localStorage.token).refresh_token); ```

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/9/18 09:28 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/8/31 13:35 Author : xushiyin contact : yuqingxushiyin@gmail.com

Package internal Time : 2023/3/20 22:11 Author : xushiyin contact : yuqingxushiyin@gmail.com

Package internal Time : 2023/4/6 13:55 Author : xushiyin contact : yuqingxushiyin@gmail.com

Package internal Time : 2023/8/30 15:15 Author : xushiyin contact : yuqingxushiyin@gmail.com

Index

Constants

View Source
const (
	TrustedClientToken = "6A5AA1D4EAFF4E9FB37E23D68491D6F4"
	WssUrl             = "wss://speech.platform.bing.com/consumer/speech/synthesize/readaloud/edge/v1?TrustedClientToken=" + TrustedClientToken + "&ConnectionId="
	VoiceListUrl       = "https://speech.platform.bing.com/consumer/speech/synthesize/readaloud/voices/list?trustedclienttoken=" + TrustedClientToken
	WebSocketMaxSize   = 65536
)
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"
)
View Source
const TtsSsmlXmlTemplate = `` /* 187-byte string literal not displayed */
View Source
const UserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36"

Variables

View Source
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()="提 交"]`,
	}
)
View Source
var (
	BuiltAt   string
	GoVersion = runtime.Version()
	GitAuthor = "Achillesxu <yuqingxushiyin@gmail.com>"
	GitCommit string
	Version   = "dev"
	Branch    string
)
View Source
var AreaCodeImidMap = map[string]string{
	"chongqing":    "494096",
	"zhejiang":     "494098",
	"yunnan":       "494102",
	"xinjiang":     "494105",
	"xizang":       "494109",
	"tianjin":      "494116",
	"sichuan":      "494120",
	"shenzhen":     "494087",
	"shanghai":     "494124",
	"shaanxi":      "494130",
	"shanxi":       "494137",
	"shandong":     "494140",
	"xiamen":       "494158",
	"ningxia":      "494163",
	"ningbo":       "494165",
	"neimeng":      "494166",
	"liaoning":     "494169",
	"jiangxi":      "494173",
	"jiangsu":      "494177",
	"jilin":        "494178",
	"hunan":        "494179",
	"hubei":        "491423",
	"heilongjiang": "541498",
	"henan":        "494182",
	"hebei":        "494184",
	"hainan":       "494190",
	"guizhou":      "494191",
	"guangxi":      "494195",
	"guangdong":    "494197",
	"gansu":        "494199",
	"fujian":       "494200",
	"dalian":       "494202",
	"beijing":      "494205",
	"anhui":        "494206",
	"qingdao":      "494208",
	"qinghai":      "494209",
}
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 EnvModeIds = map[EnvMode][]string{
	TestE: {"test"},
	StopE: {"stop"},
	ProdE: {"prod"},
}
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 GetClient added in v0.13.0

func GetClient(timeout time.Duration, isDebug bool) *req.Client

func GetDateList

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

func GetMonthList

func GetMonthList(dates []string) []string

func GetNowMonthNumber

func GetNowMonthNumber() string

func GetWebSocketClient added in v0.14.0

func GetWebSocketClient(uri string, reqHeader http.Header) (*websocket.Conn, *http.Response, error)

func IsFileDirExist added in v0.2.8

func IsFileDirExist(d string) error

func Local2Utc added in v0.11.0

func Local2Utc(d time.Time) time.Time

func MakeZip added in v0.5.0

func MakeZip(srcPath, dstPath, zipName 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 ReplaceSpecialChar added in v0.14.0

func ReplaceSpecialChar(s string) string

ReplaceSpecialChar replace special chars

func SetHMS added in v0.11.0

func SetHMS(d time.Time, h, m, s int) time.Time

func SortVersion added in v0.2.9

func SortVersion(vList []string) []string

func StrSliceJoin added in v0.2.10

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

func SysType added in v0.2.4

func SysType() string

func UTC2Local added in v0.11.0

func UTC2Local(d time.Time) time.Time

func WriteDefaultConfig added in v0.4.0

func WriteDefaultConfig() error

Types

type AccessToken added in v0.10.0

type AccessToken struct {
	GrantType    string `json:"grant_type"`
	RefreshToken string `json:"refresh_token"`
}

type AccessTokenResp added in v0.10.0

type AccessTokenResp struct {
	DefaultSboxDriveId string    `json:"default_sbox_drive_id"`
	Role               string    `json:"role"`
	DeviceId           string    `json:"device_id"`
	UserName           string    `json:"user_name"`
	NeedLink           bool      `json:"need_link"`
	ExpireTime         time.Time `json:"expire_time"`
	PinSetup           bool      `json:"pin_setup"`
	NeedRpVerify       bool      `json:"need_rp_verify"`
	Avatar             string    `json:"avatar"`
	UserData           struct {
		DingDingRobotUrl  string `json:"DingDingRobotUrl"`
		EncourageDesc     string `json:"EncourageDesc"`
		FeedBackSwitch    bool   `json:"FeedBackSwitch"`
		FollowingDesc     string `json:"FollowingDesc"`
		DingDingRobotUrl1 string `json:"ding_ding_robot_url"`
		EncourageDesc1    string `json:"encourage_desc"`
		FeedBackSwitch1   bool   `json:"feed_back_switch"`
		FollowingDesc1    string `json:"following_desc"`
	} `json:"user_data"`
	TokenType      string        `json:"token_type"`
	AccessToken    string        `json:"access_token"`
	DefaultDriveId string        `json:"default_drive_id"`
	DomainId       string        `json:"domain_id"`
	RefreshToken   string        `json:"refresh_token"`
	IsFirstLogin   bool          `json:"is_first_login"`
	UserId         string        `json:"user_id"`
	NickName       string        `json:"nick_name"`
	ExistLink      []interface{} `json:"exist_link"`
	State          string        `json:"state"`
	ExpiresIn      int           `json:"expires_in"`
	Status         string        `json:"status"`
}

type AliYun added in v0.10.0

type AliYun struct {
	Log    *log.Entry
	Client *req.Client
}

func NewAliYun added in v0.10.0

func NewAliYun(logger *log.Entry, isDebug bool) *AliYun

func (*AliYun) GetReward added in v0.10.0

func (a *AliYun) GetReward(auth AliYunCloudDriverAuth, signInLogs []SignInLog)

func (*AliYun) LogErr added in v0.10.0

func (a *AliYun) LogErr(err error, message string, args ...interface{}) error

func (*AliYun) PoolRefreshToken added in v0.11.0

func (a *AliYun) PoolRefreshToken(auths []AliYunCloudDriverAuth) (refresh []*AliYunCloudDriverAuth)

func (*AliYun) PoolSignIn added in v0.11.0

func (a *AliYun) PoolSignIn(auths []AliYunCloudDriverAuth)

func (*AliYun) RefreshToken added in v0.10.0

func (a *AliYun) RefreshToken(auth AliYunCloudDriverAuth) (*AccessTokenResp, error)

func (*AliYun) SignIn added in v0.10.0

func (a *AliYun) SignIn(auth AliYunCloudDriverAuth)

type AliYunCloudDriverAuth added in v0.11.0

type AliYunCloudDriverAuth struct {
	Id            uint      `db:"id"`
	AccountName   string    `db:"account_name"`
	Token         string    `db:"token"`
	Authorization string    `db:"authorization"`
	Created       time.Time `db:"created"`
	Updated       time.Time `db:"updated"`
}

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 AzureRestApi added in v0.14.0

type AzureRestApi struct {
	Base
	*req.Client
	IsDebug bool
}

func NewAzureRestApi added in v0.14.0

func NewAzureRestApi(timeout time.Duration, isDebug bool, logger *log.Entry) *AzureRestApi

func (*AzureRestApi) MakeAzureTtsSsml added in v0.14.0

func (a *AzureRestApi) MakeAzureTtsSsml(vp *AzureTtsVoiceProp) ([]byte, error)

func (*AzureRestApi) ReqTrans added in v0.14.0

func (a *AzureRestApi) ReqTrans(src string, dst []string, text string) error

func (*AzureRestApi) ReqTransSupportedLanguages added in v0.14.0

func (a *AzureRestApi) ReqTransSupportedLanguages() error

func (*AzureRestApi) ReqTts added in v0.14.0

func (a *AzureRestApi) ReqTts(vp *AzureTtsVoiceProp) error

func (*AzureRestApi) ReqTtsToken added in v0.14.0

func (a *AzureRestApi) ReqTtsToken() (string, error)

func (*AzureRestApi) ReqTtsVoiceList added in v0.14.0

func (a *AzureRestApi) ReqTtsVoiceList(detail bool) error

type AzureRestError added in v0.14.0

type AzureRestError struct {
	Err struct {
		Code    int    `json:"code"`
		Message string `json:"message"`
	} `json:"error"`
}

func (*AzureRestError) Error added in v0.14.0

func (e *AzureRestError) Error() string

Error convert AzureRestError to a human readable error and return.

type AzureTtsVoiceProp added in v0.14.0

type AzureTtsVoiceProp struct {
	Text      string
	Voice     string
	Pitch     string
	Rate      string
	Volume    string
	OutFormat string
	OutName   string
}

type Base added in v0.14.0

type Base struct {
	Log *log.Entry
}

func (*Base) LogErr added in v0.14.0

func (b *Base) LogErr(err error, message string, args ...interface{}) error

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 ComRes added in v0.4.0

type ComRes struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type Conditions added in v0.4.0

type Conditions struct {
	AppId      string `json:"appcode"`
	PageNo     int    `json:"pageNo"`
	PageSize   int    `json:"pageSize"`
	Message    string `json:"message"`
	SelectedEs string `json:"selected_es"`
	StartTime  string `json:"start_time"`
	EndTime    string `json:"end_time"`
}

type CosClient added in v0.7.0

type CosClient struct {
	KeyId      string
	KeySecret  string
	Region     string
	BucketName string
	Logger     *log.Entry
	Client     *cos.Client
}

func NewCosClient added in v0.7.0

func NewCosClient(bucketName, region, keyId, keySecret string, logger *log.Entry) *CosClient

func (*CosClient) DelObjectTag added in v0.7.0

func (c *CosClient) DelObjectTag(key string) error

func (*CosClient) DeleteObject added in v0.7.0

func (c *CosClient) DeleteObject(key string) error

func (*CosClient) DownloadObject added in v0.7.0

func (c *CosClient) DownloadObject(key, path string) error

func (*CosClient) GetObjectHeaders added in v0.7.0

func (c *CosClient) GetObjectHeaders(key string) (*http.Header, error)

func (*CosClient) GetObjectTag added in v0.7.0

func (c *CosClient) GetObjectTag(key string) (map[string]string, error)

func (*CosClient) IsObjectExist added in v0.7.0

func (c *CosClient) IsObjectExist(key string) (bool, error)

func (*CosClient) ListObjects added in v0.7.0

func (c *CosClient) ListObjects(prefix, delimiter string, maxKeys int) ([]string, error)

func (*CosClient) LogErr added in v0.7.0

func (c *CosClient) LogErr(err error, message string, args ...interface{}) error

func (*CosClient) NewClient added in v0.7.0

func (c *CosClient) NewClient() error

func (*CosClient) PutObjectTag added in v0.7.0

func (c *CosClient) PutObjectTag(key string, tag map[string]string) error

func (*CosClient) UploadObject added in v0.7.0

func (c *CosClient) UploadObject(key, path string, metaHeader *http.Header) error

type DailyReport added in v0.11.0

type DailyReport struct {
	Id      uint64    `db:"id"`
	Content string    `db:"content"`
	Created time.Time `db:"created"`
	Updated time.Time `db:"updated"`
}

type DbClient added in v0.11.0

type DbClient struct {
	DSN    string
	DB     *sqlx.DB
	DbName string
	Log    *log.Entry
}

func GetDb added in v0.11.0

func GetDb(logger *log.Entry) *DbClient

func NewDbClient added in v0.11.0

func NewDbClient(dsn string, logger *log.Entry) *DbClient

func (*DbClient) Close added in v0.11.0

func (d *DbClient) Close() error

func (*DbClient) LogErr added in v0.11.0

func (d *DbClient) LogErr(err error, message string, args ...interface{}) error

func (*DbClient) NamedExec added in v0.11.0

func (d *DbClient) NamedExec(queryStr string, arg interface{}) error

NamedExec contains insert, update, select

func (*DbClient) OpenPing added in v0.11.0

func (d *DbClient) OpenPing() error

func (*DbClient) PrepareSelect added in v0.11.0

func (d *DbClient) PrepareSelect(queryStr string, dest interface{}, args ...interface{}) error

type ESLogs added in v0.4.0

type ESLogs struct {
	ComRes
	Data LogData `json:"data"`
}

type EdgeTtsClient added in v0.14.0

type EdgeTtsClient struct {
	IsDebug bool
	Text    string
	Voice   string
	Format  string

	OutName string
	Log     *log.Entry
	Client  *req.Client
	// contains filtered or unexported fields
}

func NewEdgeTtsClient added in v0.14.0

func NewEdgeTtsClient(timeout time.Duration, isDebug bool, logger *log.Entry) *EdgeTtsClient

func (*EdgeTtsClient) CloseConn added in v0.15.0

func (t *EdgeTtsClient) CloseConn()

func (*EdgeTtsClient) GetAudioFile added in v0.15.0

func (t *EdgeTtsClient) GetAudioFile() error

func (*EdgeTtsClient) GetClearText added in v0.15.0

func (t *EdgeTtsClient) GetClearText(text string) (string, error)

GetClearText make text with right len and replace special char

func (*EdgeTtsClient) GetVoiceList added in v0.14.0

func (t *EdgeTtsClient) GetVoiceList(voiceResp interface{}) error

func (*EdgeTtsClient) LogErr added in v0.14.0

func (t *EdgeTtsClient) LogErr(err error, message string, args ...interface{}) error

func (*EdgeTtsClient) NewConn added in v0.15.0

func (t *EdgeTtsClient) NewConn() error

NewConn connect ws or wss

func (*EdgeTtsClient) RenderVoiceList added in v0.14.0

func (t *EdgeTtsClient) RenderVoiceList(tvs []TtsVoiceListResp)

RenderVoiceList render voices to table

type EnvMode added in v0.5.0

type EnvMode enumflag.Flag
const (
	TestE EnvMode = iota
	StopE
	ProdE
)

EnvMode test, stop, pro

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 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(logger *log.Entry) *Files

func (*Files) DeleteDir added in v0.2.8

func (f *Files) DeleteDir(path string)

func (*Files) FileExistPwd added in v0.7.0

func (f *Files) FileExistPwd(name string) (string, error)

func (*Files) GetPwd added in v0.7.0

func (f *Files) GetPwd() (string, error)

func (*Files) IsExist added in v0.2.8

func (f *Files) IsExist(path string) (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 EqualBranchName added in v0.5.0

func EqualBranchName(f string) FilterStr

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) CloneRepo added in v0.5.0

func (g *GitClient) CloneRepo(path string, opt *git.CloneOptions) 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 LogData added in v0.4.0

type LogData struct {
	Records      []Records `json:"records"`
	TotalRecords int       `json:"totalRecord"`
}

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 NuoEmployee added in v0.12.0

type NuoEmployee struct {
	Id      string    `db:"id"`
	Name    string    `db:"name"`
	Post    string    `db:"post"`
	Here    bool      `db:"here"`
	Created time.Time `db:"created"`
	Updated time.Time `db:"updated"`
}

type NuoRespBody added in v0.6.0

type NuoRespBody struct {
	ComRes
	Success bool   `json:"success"`
	Data    string `json:"data"`
	HasAuth bool   `json:"hasAuth"`
}

type OaCarbon added in v0.12.0

type OaCarbon struct {
	DimissonEmpList []struct {
		Str  string `json:"str"`
		List []struct {
			Post  string `json:"post"`
			Name  string `json:"name"`
			Photo string `json:"photo,omitempty"`
			Id    string `json:"id"`
			Type  string `json:"type"`
		} `json:"list"`
	} `json:"dimissonEmpList"`
	EmpList []struct {
		Str  string `json:"str"`
		List []struct {
			Post  string `json:"post"`
			Name  string `json:"name"`
			Photo string `json:"photo"`
			Id    string `json:"id"`
			Type  string `json:"type"`
		} `json:"list"`
	} `json:"empList"`
	DeptList []struct {
		Str  string `json:"str"`
		List []struct {
			Name string `json:"name"`
			Id   string `json:"id"`
			Type string `json:"type"`
		} `json:"list"`
	} `json:"deptList"`
}

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
	Client      *req.Client
}

func NewOaWeb added in v0.2.0

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

func NewOaWebLogin added in v0.2.0

func NewOaWebLogin(ctx context.Context, headless, remote bool, logger *log.Entry, isDebug bool) (*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) GetCarbonIds added in v0.12.0

func (o *OaWeb) GetCarbonIds(oac *OaCarbon, names []string) []string

func (*OaWeb) GetCarbonList added in v0.12.0

func (o *OaWeb) GetCarbonList(isDebug bool, c map[string]string) (*OaCarbon, error)

func (*OaWeb) GetCommonReq added in v0.12.0

func (o *OaWeb) GetCommonReq(isDebug bool) *req.Request

func (*OaWeb) GetWorkReports added in v0.12.0

func (o *OaWeb) GetWorkReports(db *DbClient, tr *TimeRange) (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) PostForm added in v0.12.0

func (o *OaWeb) PostForm(isDebug bool, uri string, useMulti bool, cookies map[string]string, form url.Values, result interface{}) error

func (*OaWeb) RenderReports added in v0.12.0

func (o *OaWeb) RenderReports(drs []DailyReport, stdOutFlag, onlyContent bool) (string, 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

func (*OaWeb) SubmitWorkReports added in v0.12.0

func (o *OaWeb) SubmitWorkReports(isDebug bool, cookies map[string]string, form url.Values) error

type ObjectStoreClient added in v0.7.0

type ObjectStoreClient interface {
	NewClient() error
	ListObjects(prefix, delimiter string, maxKeys int) ([]string, error)
	UploadObject(key, path string, metaHeader *http.Header) error
	DownloadObject(key, path string) error
	DeleteObject(key string) error
	IsObjectExist(key string) (bool, error)
	GetObjectHeaders(key string) (*http.Header, error)
	PutObjectTag(key string, tag map[string]string) error
	GetObjectTag(key string) (map[string]string, error)
	DelObjectTag(key string) error
}

type OssClient added in v0.5.0

type OssClient struct {
	KeyId      string
	KeySecret  string
	EndPoint   string
	BucketName string
	Logger     *log.Entry
	Client     *oss.Client
	Bucket     *oss.Bucket
}

func NewOssClient added in v0.5.0

func NewOssClient(bucketName, endPoint, keyId, keySecret string, logger *log.Entry) *OssClient

func (*OssClient) DelObjectTag added in v0.7.0

func (o *OssClient) DelObjectTag(key string) error

func (*OssClient) DeleteObject added in v0.5.0

func (o *OssClient) DeleteObject(key string) error

func (*OssClient) DownloadObject added in v0.5.0

func (o *OssClient) DownloadObject(key, path string) error

func (*OssClient) GetBucket added in v0.5.0

func (o *OssClient) GetBucket(bucketName string) error

func (*OssClient) GetObjectHeaders added in v0.7.0

func (o *OssClient) GetObjectHeaders(key string) (*http.Header, error)

func (*OssClient) GetObjectTag added in v0.7.0

func (o *OssClient) GetObjectTag(key string) (map[string]string, error)

func (*OssClient) IsObjectExist added in v0.7.0

func (o *OssClient) IsObjectExist(key string) (bool, error)

func (*OssClient) ListBucket added in v0.5.0

func (o *OssClient) ListBucket() error

ListBucket You are forbidden to list buckets

func (*OssClient) ListObjects added in v0.7.0

func (o *OssClient) ListObjects(prefix, delimiter string, maxKeys int) ([]string, error)

func (*OssClient) LogErr added in v0.5.0

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

func (*OssClient) NewClient added in v0.5.0

func (o *OssClient) NewClient() error

func (*OssClient) PutObjectTag added in v0.7.0

func (o *OssClient) PutObjectTag(key string, tag map[string]string) error

func (*OssClient) UploadObject added in v0.5.0

func (o *OssClient) UploadObject(key, path string, metaHeader *http.Header) error

type PageRecords added in v0.4.0

type PageRecords struct {
	PageNo  int       `json:"pageNo"`
	Records []Records `json:"records"`
	Err     error     `json:"err"`
}

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 QueryCondition struct {
	AppId     string `json:"appcode"`
	Pages     int    `json:"pages"`
	Message   string `json:"message"`
	StartTime string `json:"start_time"`
	EndTime   string `json:"end_time"`
	FileName  string `json:"file_name"`
	Ascend    bool   `json:"ascend"`
	OnlyMsg   bool   `json:"only_msg"`
}

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 RedisClient added in v0.9.0

type RedisClient struct {
	Addr     string
	Password string
	Db       int
	Logger   *log.Entry
	Redis    *redis.Client
}

func NewRedisClient added in v0.9.0

func NewRedisClient(addr, password string, db int, logger *log.Entry) *RedisClient

func NewRedisUrlClient added in v0.10.0

func NewRedisUrlClient(rdsUrl string, logger *log.Entry) *RedisClient

func (*RedisClient) Get added in v0.10.0

func (r *RedisClient) Get(ctx context.Context, key string) (string, error)

func (*RedisClient) HGetAll added in v0.12.0

func (r *RedisClient) HGetAll(key string) (map[string]string, error)

func (*RedisClient) HMGet added in v0.9.0

func (r *RedisClient) HMGet(key string, fields ...string) (map[string]interface{}, error)

func (*RedisClient) HSet added in v0.9.0

func (r *RedisClient) HSet(key string, values ...interface{}) error

func (*RedisClient) LogErr added in v0.9.0

func (r *RedisClient) LogErr(err error, message string, args ...interface{}) error

func (*RedisClient) Ping added in v0.9.0

func (r *RedisClient) Ping() error

func (*RedisClient) Set added in v0.10.0

func (r *RedisClient) Set(ctx context.Context, key string, value interface{}, expiration time.Duration) (string, error)

type ReportType added in v0.2.0

type ReportType uint
const (
	Daily ReportType = iota
	DailyMember
	Weekly
)

type RewardBody added in v0.10.0

type RewardBody struct {
	SignInDay int `json:"signInDay"`
}

type Sentry added in v0.4.0

type Sentry struct {
	Log    *log.Entry
	Client *req.Client
	Web    *OaWeb
}

func NewSentry added in v0.4.0

func NewSentry(logger *log.Entry, isDebug bool) *Sentry

func (*Sentry) GetCaptcha added in v0.4.0

func (s *Sentry) GetCaptcha(b64str string) (string, error)

func (*Sentry) GetCookies added in v0.4.0

func (s *Sentry) GetCookies() (*cookiejar.Jar, error)

func (*Sentry) GetDomainPathCookie added in v0.9.0

func (s *Sentry) GetDomainPathCookie(jar *cookiejar.Jar, uri string) *http.Cookie

func (*Sentry) GetLoginCookies added in v0.9.0

func (s *Sentry) GetLoginCookies() (*cookiejar.Jar, error)

func (*Sentry) GetLogs added in v0.4.0

func (s *Sentry) GetLogs(jar *cookiejar.Jar, query QueryCondition) ([]Records, error)

func (*Sentry) GetSentryEsLog added in v0.4.0

func (s *Sentry) GetSentryEsLog(query QueryCondition) error

func (*Sentry) InputUserInfo added in v0.4.0

func (s *Sentry) InputUserInfo() error

func (*Sentry) LogErr added in v0.4.0

func (s *Sentry) LogErr(err error, message string, args ...interface{}) error

func (*Sentry) LoginSentry added in v0.4.0

func (s *Sentry) LoginSentry(retryCnt int) error

func (*Sentry) OpenSentryLoginPage added in v0.4.0

func (s *Sentry) OpenSentryLoginPage() error

func (*Sentry) PoolReq added in v0.4.0

func (s *Sentry) PoolReq(jar *cookiejar.Jar, cons []Conditions) ([]Records, error)

func (*Sentry) Records2File added in v0.4.0

func (s *Sentry) Records2File(fileName string, records []Records, asc bool, msg bool) error

func (*Sentry) ReqLogApi added in v0.4.0

func (s *Sentry) ReqLogApi(c *cookiejar.Jar, cond Conditions) (*ESLogs, error)

func (*Sentry) RetryLoginBtn added in v0.4.0

func (s *Sentry) RetryLoginBtn(retryCnt int) error

func (*Sentry) SendNuoMsg added in v0.6.0

func (s *Sentry) SendNuoMsg(iMid, msg string, isGroup bool) error

type SignInBody added in v0.10.0

type SignInBody struct {
	IsReward bool `json:"isReward"`
}

type SignInLog added in v0.10.0

type SignInLog struct {
	Day             int         `json:"day"`
	Status          string      `json:"status"`
	Icon            string      `json:"icon"`
	PcAndWebIcon    string      `json:"pcAndWebIcon"`
	Notice          interface{} `json:"notice"`
	Type            string      `json:"type"`
	RewardAmount    int         `json:"rewardAmount"`
	Themes          string      `json:"themes"`
	CalendarChinese *string     `json:"calendarChinese"`
	CalendarDay     *string     `json:"calendarDay"`
	CalendarMonth   *string     `json:"calendarMonth"`
	Poster          interface{} `json:"poster"`
	Reward          struct {
		GoodsId       *int    `json:"goodsId"`
		Name          *string `json:"name"`
		Description   *string `json:"description"`
		Background    string  `json:"background"`
		Color         *string `json:"color"`
		Action        *string `json:"action"`
		DetailAction  *string `json:"detailAction"`
		Notice        *string `json:"notice"`
		SubNotice     *string `json:"subNotice"`
		BottleId      *int64  `json:"bottleId"`
		BottleName    *string `json:"bottleName"`
		BottleShareId *string `json:"bottleShareId"`
	} `json:"reward"`
	IsReward bool `json:"isReward"`
}

type SignInResp added in v0.10.0

type SignInResp struct {
	Success    bool        `json:"success"`
	Code       interface{} `json:"code"`
	Message    interface{} `json:"message"`
	TotalCount interface{} `json:"totalCount"`
	NextToken  interface{} `json:"nextToken"`
	MaxResults interface{} `json:"maxResults"`
	Result     struct {
		Subject             string      `json:"subject"`
		Title               string      `json:"title"`
		Description         string      `json:"description"`
		IsReward            bool        `json:"isReward"`
		Blessing            string      `json:"blessing"`
		SignInCount         int         `json:"signInCount"`
		SignInCover         string      `json:"signInCover"`
		SignInRemindCover   string      `json:"signInRemindCover"`
		RewardCover         string      `json:"rewardCover"`
		PcAndWebRewardCover string      `json:"pcAndWebRewardCover"`
		SignInLogs          []SignInLog `json:"signInLogs"`
	} `json:"result"`
	Arguments interface{} `json:"arguments"`
}

type TimeRange added in v0.11.0

type TimeRange struct {
	StartTime time.Time `db:"start_time"`
	EndTime   time.Time `db:"end_time"`
}

type Trans added in v0.13.0

type Trans struct {
	Log     *log.Entry
	Client  *req.Client
	IsDebug bool
}

type TransRes added in v0.13.0

type TransRes struct {
	DetectedLanguage struct {
		Language string  `json:"language"`
		Score    float64 `json:"score"`
	}
	Translations []struct {
		Text            string `json:"text"`
		To              string `json:"to"`
		Transliteration struct {
			Script string `json:"script"`
			Text   string `json:"text"`
		} `json:"transliteration"`
		Alignment struct {
			Proj string `json:"proj"`
		} `json:"alignment"`
		SentLen struct {
			SrcSentLen   []int `json:"srcSentLen"`
			TransSentLen []int `json:"transSentLen"`
		} `json:"sentLen"`
	} `json:"translations"`
}

type TransText added in v0.13.0

type TransText struct {
	Text string `json:"Text"`
}

type TtsVoiceListResp added in v0.14.0

type TtsVoiceListResp struct {
	Name           string `json:"Name"`
	ShortName      string `json:"ShortName"`
	Gender         string `json:"Gender"`
	Locale         string `json:"Locale"`
	SuggestedCodec string `json:"SuggestedCodec"`
	FriendlyName   string `json:"FriendlyName"`
	Status         string `json:"Status"`
	VoiceTag       struct {
		ContentCategories  []string `json:"ContentCategories"`
		VoicePersonalities []string `json:"VoicePersonalities"`
	} `json:"VoiceTag"`
}

type WorkReportRes added in v0.12.0

type WorkReportRes struct {
	Result  string `json:"result"`
	Message string `json:"message"`
}

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
Package notify Time : 2023/9/3 17:15 Author : xushiyin contact : yuqingxushiyin@gmail.com
Package notify Time : 2023/9/3 17:15 Author : xushiyin contact : yuqingxushiyin@gmail.com
telegram
Package telegram Time : 2023/9/3 17:16 Author : xushiyin contact : yuqingxushiyin@gmail.com
Package telegram Time : 2023/9/3 17:16 Author : xushiyin contact : yuqingxushiyin@gmail.com

Jump to

Keyboard shortcuts

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