lefttk

package
v0.0.0-...-566e6f4 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DAY_FORMAT      = "2006-01-02"
	CONF_12306_FILE = "conf/12306.ini"
	CONF_FILE       = "conf/conf.ini"
)
View Source
const (
	//access_token url
	CORP_TOKEN_URL = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=${corpid}&corpsecret=${corpsecret}"
	//send msg url
	CORP_MSG_URL = "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=${access_token}"
)

Variables

View Source
var (
	//是否发送邮件
	Mailflag = false
)
View Source
var (
	//微信发送标志
	Weixinflag = false
)

Functions

func GetChnameByCode

func GetChnameByCode(code string) string

通过code返回中文名称

func GetCodeByChname

func GetCodeByChname(chname string) string

通过站点中文名称返回code

func GetSectionCfg

func GetSectionCfg(file string, sectionName string) map[string]string

读取ini文件中的某个section,返回map键值对,忽略行内注释

func InitConf

func InitConf() (bool, string)

初始任务配置

func InitMail

func InitMail() (bool, string)

初始化邮件配置,成功返回true,"",失败返回false,msg

func InitQyweixin

func InitQyweixin() (bool, string)

初始化微信配置

func SendText

func SendText(subjectText, text string)

发送邮件,如果未初始化,先初始化

func SendToQyweixin

func SendToQyweixin(textmsg string)

通过企业微信号发送消息

func StartMission

func StartMission()

开始任务

Types

type AccessTokenMsg

type AccessTokenMsg struct {
	Errcode      int    `json:"errcode"`
	Errmsg       string `json:"errmsg"`
	Access_token string `json:"access_token"`
	Expires_in   int    `json:"expires_in"`
}

access_token 返回消息体

type QueryInfo

type QueryInfo struct {
	Day        string //日志,yyyy-MM-dd
	From       string //乘车站,中文名
	To         string //抵达站,中文名
	FromCode   string //乘车站code
	ToCode     string //抵达站code
	Starttime  string //发车时间,最小值
	Endtime    string //发车时间,最大值
	Train_type string //火车类型,G-高铁 C-城际 D-动车 Z-直达 T-特快 K-快速 QT-其他
	Train      string //车次
	Prior_seat string //坐席,商务座,特等座,一等座,二等座,高级软卧,软卧,硬卧,动卧,软座,硬座,无座,其他
}

查询信息

type ResultMsg

type ResultMsg struct {
	Errcode     int    `json:"errcode"`
	Errmsg      string `json:"errmsg"`
	Invaliduser string `json:"invaliduser"`
}

返回消息体

type Station

type Station struct {
	// contains filtered or unexported fields
}

bjb|北京北|VAP|beijingbei|bjb|0

type Text

type Text struct {
	Content string `json:"content"`
}

type TextMsg

type TextMsg struct {
	//touser	否	成员ID列表(消息接收者,多个接收者用‘|’分隔,最多支持1000个)。特殊情况:指定为@all,则向该企业应用的全部成员发送
	Touser string `json:"touser"`
	//toparty	否	部门ID列表,多个接收者用‘|’分隔,最多支持100个。当touser为@all时忽略本参数
	Toparty string `json:"toparty"`
	//totag	否	标签ID列表,多个接收者用‘|’分隔,最多支持100个。当touser为@all时忽略本参数
	Totag string `json:"totag"`
	//msgtype	是	消息类型,此时固定为:text
	Msgtype string `json:"msgtype"`
	//agentid	是	企业应用的id,整型。可在应用的设置页面查看
	Agentid string `json:"agentid"`
	//text	是	消息内容,最长不超过2048个字节
	Text Text `json:"text"`
	//safe	否	表示是否是保密消息,0表示否,1表示是,默认0
	Safe int `json:"safe"`
}

文本消息

type TicketInfo

type TicketInfo struct {
	Train_no               string //[2]
	Station_train_code     string //[3] 车次号
	Start_station_telecode string //[4] 始发站
	End_station_telecode   string //[5] 终点站
	From_station_telecode  string //[6] 乘车站
	To_station_telecode    string //[7] 抵达车站
	Start_time             string //[8] 乘车时间
	Arrive_time            string //[9] 抵达时间
	Lishi                  string //[10] 耗时
	CanWebBuy              string //[11] Y-可购买,N-不可购买
	Yp_info                string //[12]
	Start_train_date       string //[13]
	Train_seat_feature     string //[14]
	Location_code          string //[15]
	From_station_no        string //[16]
	To_station_no          string //[17]
	Is_support_card        string //[18]
	Controlled_train_flag  string //[19]
	Gg_num                 string //[20]
	Gr_num                 string //[21] 高级软卧
	Qt_num                 string //[22] 其他
	Rw_num                 string //[23] 软卧
	Rz_num                 string //[24] 软座
	Tz_num                 string //[25] 特等座
	Wz_num                 string //[26] 无座
	Yb_num                 string //[27]
	Yw_num                 string //[28] 硬卧
	Yz_num                 string //[29] 硬座
	Ze_num                 string //[30] 二等座
	Zy_num                 string //[31] 一等座
	Swz_num                string //[32] 商务座
	Srrb_num               string //[33] 动卧
	Yp_ex                  string //[34]
	Seat_types             string //[35]
}

车次票务信息

Jump to

Keyboard shortcuts

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