aischedule

package
v0.0.0-...-23f3ce9 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2023 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AISchedulParserURL = "https://open-schedule.ai.xiaomi.com/api/schedule/parser"
	// AIScheduleTBID        = "45625"
	AIScheduleTableURL    = "https://i.ai.mi.com/course-multi/table"
	AIScheduleTablesURL   = "https://i.ai.mi.com/course-multi/tables"
	AIScheduleFeedbackURL = "https://open-schedule.ai.xiaomi.com/api/feedback"
	AIScheduleCourseURL   = "https://i.ai.mi.com/course-multi/courseInfos"
	AIScheduleShareURL    = "https://i.ai.mi.com/course-multi/shareToken"
	AIScheduleImportURL   = "https://i.ai.mi.com/h5/precache/ai-schedule"

	// 默认课表风格
	StyleList = []ScheduleStyle{{Color: "#00A6F2", Background: "#E5F4FF"},
		{Color: "#FC6B50", Background: "#FDEBDE"},
		{Color: "#3CB3C8", Background: "#DEFBF8"},
		{Color: "#7D7AEA", Background: "#EDEDFF"},
		{Color: "#FF9900", Background: "#FCEBCD"},
		{Color: "#EF5B75", Background: "#FFEFF0"},
		{Color: "#5B8EFF", Background: "#EAF1FF"},
		{Color: "#F067BB", Background: "#FFEDF8"},
		{Color: "#29BBAA", Background: "#E2F8F3"},
		{Color: "#CBA713", Background: "#FFF8C8"},
		{Color: "#B967E3", Background: "#F9EDFF"},
		{Color: "#6E8ADA", Background: "#F3F2FD"},
		{Color: "#00A6F2", Background: "#E5F4FF"},
		{Color: "#FC6B50", Background: "#FDEBDE"},
		{Color: "#3CB3C8", Background: "#DEFBF8"}}
)

Functions

func BuildSectionsStr

func BuildSectionsStr(s []Section) string

func BuildStyle

func BuildStyle() string

func BuildWeeksStr

func BuildWeeksStr(w []int) string

Types

type AIScheduleUser

type AIScheduleUser struct {
	UserID   int64
	DeviceID string // 最重要
	Client   *resty.Client
}

func NewAISchedule

func NewAISchedule() *AIScheduleUser

NewHealthUser 新建健康平台用户

func (*AIScheduleUser) AddCourses

func (u *AIScheduleUser) AddCourses(id int64, courses []AppCourse) (err error)

AddCourses 课表添加课程

func (*AIScheduleUser) CreateTable

func (u *AIScheduleUser) CreateTable(name string, isCurrent bool) (id int64, err error)

CreateTable 创建课表

func (*AIScheduleUser) DeleteTable

func (u *AIScheduleUser) DeleteTable(id int64) (err error)

DeleteTable 删除课表

func (*AIScheduleUser) EditTable

func (u *AIScheduleUser) EditTable(name string, id int64, setting TableSetting) (err error)

EditTable 修改课表

func (*AIScheduleUser) FeedbackTable

func (u *AIScheduleUser) FeedbackTable(feedbackType int64, tbID int64) (err error)

FeedbackTable 分享课表导入功能 theType {1: "完美", 2: "部分错误", 3: "不可用"}

func (*AIScheduleUser) GetTable

func (u *AIScheduleUser) GetTable(id int64) (courses []AppCourse, err error)

GetTables 获取课程列表

func (*AIScheduleUser) GetTables

func (u *AIScheduleUser) GetTables() (tables []Table, err error)

GetTables 获取课程列表

func (*AIScheduleUser) ParseTable

func (u *AIScheduleUser) ParseTable(tbID int64, html string) (schedule Schedule, err error)

ParseTable 解析课表

func (*AIScheduleUser) SetDeviceID

func (u *AIScheduleUser) SetDeviceID(deviceID string) *AIScheduleUser

SetDeviceID 设置密码

func (*AIScheduleUser) SetUserID

func (u *AIScheduleUser) SetUserID(userID int64) *AIScheduleUser

SetUserID 设置用户ID

func (*AIScheduleUser) ShareTable

func (u *AIScheduleUser) ShareTable(ctId int64) (url string, duetime int64, err error)

ShareTable 分享课表

type AddRet

type AddRet struct {
	Code int64   `json:"code"`
	Data []int64 `json:"data"`
	Desc string  `json:"desc"`
}

type AppCourse

type AppCourse struct {
	AttendTime  int64         `json:"attendTime"`
	CreateTime  int64         `json:"createTime"`
	CtID        int64         `json:"ctId"`
	Day         int64         `json:"day"`
	Extend      string        `json:"extend"`
	ID          int64         `json:"id"`
	Name        string        `json:"name"`
	Position    string        `json:"position"`
	SectionList []interface{} `json:"sectionList"`
	Sections    string        `json:"sections"`
	Style       string        `json:"style"`
	Teacher     string        `json:"teacher"`
	UpdateTime  int64         `json:"updateTime"`
	Weeks       string        `json:"weeks"`
}

func ScheduleConvertAppCourse

func ScheduleConvertAppCourse(schedule Schedule) (courses []AppCourse)

ScheduleConvertAppCourse 解析出的课表格式转换为导入的格式

type ChangeRet

type ChangeRet struct {
	Code int64  `json:"code"`
	Data bool   `json:"data"`
	Desc string `json:"desc"`
}

type Course

type Course struct {
	Day      int64  `json:"day"`
	Name     string `json:"name"`
	Position string `json:"position"`
	Sections string `json:"sections"`
	Style    string `json:"style"`
	Teacher  string `json:"teacher"`
	Weeks    string `json:"weeks"`
}

type CreateRet

type CreateRet struct {
	Code int64  `json:"code"`
	Data int64  `json:"data"`
	Desc string `json:"desc"`
}

type GetCourseRet

type GetCourseRet struct {
	Code int64 `json:"code"`
	Data struct {
		Courses []AppCourse `json:"courses"`
	} `json:"data"`
	Desc string `json:"desc"`
}

type ParseRet

type ParseRet struct {
	TBID      string `json:"tb_id"`
	ParserRet string `json:"parserRet"`
}

type Ret

type Ret struct {
	Code int64       `json:"code"`
	Data interface{} `json:"data"`
	Desc string      `json:"desc"`
}

Ret 返回结构

type Schedule

type Schedule struct {
	CourseInfos []struct {
		Day      int       `json:"day"`
		Name     string    `json:"name"`
		Position string    `json:"position"`
		Sections []Section `json:"sections"`
		Teacher  string    `json:"teacher"`
		Weeks    []int     `json:"weeks"`
	} `json:"courseInfos"`
	SectionTimes []struct {
		EndTime   string `json:"endTime"`
		Section   int    `json:"section"`
		StartTime string `json:"startTime"`
	} `json:"sectionTimes"`
}

type ScheduleStyle

type ScheduleStyle struct {
	Color      string `json:"color"`
	Background string `json:"background"`
}

ScheduleStyle 课表风格

type Section

type Section struct {
	Section int `json:"section"`
}

type ShareRet

type ShareRet struct {
	Code int64 `json:"code"`
	Data struct {
		DueTime int64  `json:"dueTime"`
		Token   string `json:"token"`
	} `json:"data"`
	Desc string `json:"desc"`
}

type Table

type Table struct {
	Courses []interface{} `json:"courses"`
	Current int64         `json:"current"`
	ID      int64         `json:"id"`
	Name    string        `json:"name"`
	Setting struct {
		AfternoonNum  int64  `json:"afternoonNum"`
		Confirm       int64  `json:"confirm"`
		CreateTime    int64  `json:"createTime"`
		Extend        string `json:"extend"`
		ID            int64  `json:"id"`
		IsWeekend     int64  `json:"isWeekend"`
		MorningNum    int64  `json:"morningNum"`
		NightNum      int64  `json:"nightNum"`
		PresentWeek   int64  `json:"presentWeek"`
		School        string `json:"school"`
		SectionTimes  string `json:"sectionTimes"`
		Speak         int64  `json:"speak"`
		StartSemester string `json:"startSemester"`
		TotalWeek     int64  `json:"totalWeek"`
		UpdateTime    int64  `json:"updateTime"`
		WeekStart     int64  `json:"weekStart"`
	} `json:"setting"`
}

type TableSetting

type TableSetting struct {
	AfternoonNum  int64  `json:"afternoonNum"`
	Extend        string `json:"extend"`
	ID            int64  `json:"id"`
	IsWeekend     int64  `json:"isWeekend"`
	MorningNum    int64  `json:"morningNum"`
	NightNum      int64  `json:"nightNum"`
	PresentWeek   int64  `json:"presentWeek"`
	School        string `json:"school"`
	Sections      string `json:"sections"`
	Speak         int64  `json:"speak"`
	StartSemester string `json:"startSemester"`
	TotalWeek     int64  `json:"totalWeek"`
	WeekStart     int64  `json:"weekStart"`
}

Jump to

Keyboard shortcuts

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