service

package
v0.0.0-...-37de6bf Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2020 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAX_INVITATION_TOKEN = 10
)
View Source
const (
	MAX_MEETING_DURATION = 60 * 60 * 24 * 5 // In seconds.
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClassInfo

type ClassInfo struct {
	ID                      int
	Name                    string
	Subjects                []int
	Teachers                []int
	Keepers                 string
	Students                []int
	Meetings                []int
	Deleted                 []int
	NumberOfFinishedMeeting int
	Parent                  []int
	GroupID                 int
	GdCourseID              int
	Template                int
	PlatformID              int
	PlatformData            string
	Ally                    int
	StartTime               int
	EndTime                 int
	Schedule                string
	NextTime                int
	UpdateTime              int
	UpdateIP                string
	Updater                 int
}

func NewClassInfoFromMap

func NewClassInfoFromMap(m map[string]string, id int) *ClassInfo

func (*ClassInfo) ToJSON

func (ci *ClassInfo) ToJSON(forStudent bool) string

type ClassInfoSlice

type ClassInfoSlice []*ClassInfo

func (ClassInfoSlice) Len

func (s ClassInfoSlice) Len() int

func (ClassInfoSlice) Less

func (s ClassInfoSlice) Less(i, j int) bool

func (ClassInfoSlice) Swap

func (s ClassInfoSlice) Swap(i, j int)

func (ClassInfoSlice) ToJSON

func (s ClassInfoSlice) ToJSON(forStudent bool) string

type ClassInvitationInfo

type ClassInvitationInfo struct {
	EndTime     int
	Duration    int
	ExpiredTime int
	Teacher     int
	Channel     string
	UpdateTime  int
	Updater     int
	UpdateIP    string
}

type ClassService

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

func NewClassService

func NewClassService(db *common.Database, cache *common.Cache, oss *common.ObjectStorage, ms *MeetingService) (*ClassService, error)

func (*ClassService) AddClass

func (cs *ClassService) AddClass(name string, subjects []int, groupID int, gdCourseID int, template int, platformID int, platformData string, session *Session) (int, error)

func (*ClassService) AddMeeting

func (cs *ClassService) AddMeeting(name string, subjects []int, section int, startTime int, duration int, classID int, t int, data string, session *Session, unset bool) (int, error)

func (*ClassService) AddSubClass

func (cs *ClassService) AddSubClass(classID int, subClassID int, session *Session) error

func (*ClassService) CacheClassProgress

func (cs *ClassService) CacheClassProgress(classID int, userID int) (int, error)

func (*ClassService) CacheMeetingProgress

func (cs *ClassService) CacheMeetingProgress(meetingID int, userID int) (int, error)

func (*ClassService) ChangeClass

func (cs *ClassService) ChangeClass(classID int, name string, subjects []int, gdCourseID int, template int, platformID int, platformData string, session *Session) error

func (*ClassService) ChangeKeeperStudentRelation

func (cs *ClassService) ChangeKeeperStudentRelation(classID int, studentID int, keeperID int, add bool, session *Session) error

func (*ClassService) ChangeUser

func (cs *ClassService) ChangeUser(userID int, classID int, isTeacher bool, add bool, session *Session) error

func (*ClassService) CloneClass

func (cs *ClassService) CloneClass(classID int, name string, platformID int, platformData string, session *Session) (int, error)

func (*ClassService) CopyMeetingTo

func (cs *ClassService) CopyMeetingTo(meetingID int, destClassID int, session *Session) error

func (*ClassService) Count

func (cs *ClassService) Count() (int, error)

func (*ClassService) DeleteClass

func (cs *ClassService) DeleteClass(classID int, session *Session) error

func (*ClassService) DeleteMeeting

func (cs *ClassService) DeleteMeeting(meetingID int, classID int, session *Session) error

func (*ClassService) DeleteMeetingPermanently

func (cs *ClassService) DeleteMeetingPermanently(meetingID int, classID int, session *Session) error

func (*ClassService) DeleteSubClass

func (cs *ClassService) DeleteSubClass(classID int, subClassID int, session *Session) error

func (*ClassService) EndClass

func (cs *ClassService) EndClass(classID int, session *Session) error

func (*ClassService) EndMeeting

func (cs *ClassService) EndMeeting(classID int, meetingID int, session *Session) error

func (*ClassService) GenerateInvitationToken

func (cs *ClassService) GenerateInvitationToken(classID int, endTime int, duration int, teacherID int, channel string, size int, session *Session) error

func (*ClassService) GetAssociatedStudentsForKeeper

func (cs *ClassService) GetAssociatedStudentsForKeeper(classID int, userID int) (string, error)

func (*ClassService) GetCachedUserProgresses

func (cs *ClassService) GetCachedUserProgresses(meetingIDs []int, studentIDs []int) (string, error)

func (*ClassService) GetClass

func (cs *ClassService) GetClass(classID int, session *Session) (*ClassInfo, error)

func (*ClassService) GetClassIDViaGdCourseID

func (cs *ClassService) GetClassIDViaGdCourseID(gdCourseID int) (int, error)

func (*ClassService) GetClassIDViaUserID

func (cs *ClassService) GetClassIDViaUserID(potentialParentClassID int, userID int) (int, int, error)

func (*ClassService) GetClassOverallProgress

func (cs *ClassService) GetClassOverallProgress(classID int, userID int) (int, error)

func (*ClassService) GetClasses

func (cs *ClassService) GetClasses(groupID int, session *Session) (ClassInfoSlice, int, error)

func (*ClassService) GetMeeting

func (cs *ClassService) GetMeeting(meetingID int, session *Session) (*MeetingInfo, int, error)

func (*ClassService) GetMeetingList

func (cs *ClassService) GetMeetingList(classID int) (string, error)

func (*ClassService) GetMeetings

func (cs *ClassService) GetMeetings(classID int, session *Session) (*MeetingInfoArray, int, error)

func (*ClassService) GetUserClassRelation

func (cs *ClassService) GetUserClassRelation(userID int) (string, error)

func (*ClassService) Init

func (cs *ClassService) Init() error

func (*ClassService) LoginAsExperienceUser

func (cs *ClassService) LoginAsExperienceUser(classID int, phone int, ip string) (*UserInfo, int, string, error)

func (*ClassService) PackageClass

func (cs *ClassService) PackageClass(classID int, session *Session) error

func (*ClassService) Preload

func (cs *ClassService) Preload() (int, int, int, error)

func (*ClassService) PublishClass

func (cs *ClassService) PublishClass(classID int, session *Session) error

func (*ClassService) QueryClassBriefs

func (cs *ClassService) QueryClassBriefs(session *Session) (string, error)

func (*ClassService) QueryExperienceUserLog

func (cs *ClassService) QueryExperienceUserLog(classID int, isToken bool, session *Session) (string, error)

func (*ClassService) QueryInvitationToken

func (cs *ClassService) QueryInvitationToken(classID int, isToken bool, session *Session) (string, error)

func (*ClassService) QuerySubClasses

func (cs *ClassService) QuerySubClasses(classID int, session *Session) (ClassInfoSlice, error)

func (*ClassService) QueryUserProgress

func (cs *ClassService) QueryUserProgress(classID int, userID int, session *Session) (*UserMeetingProgressInfoArray, error)

func (*ClassService) QueryUserProgresses

func (cs *ClassService) QueryUserProgresses(classID int, session *Session) (string, error)

func (*ClassService) QueryUserProgressesA

func (cs *ClassService) QueryUserProgressesA(classID int, session *Session) (string, error)

func (*ClassService) QueryUsers

func (cs *ClassService) QueryUsers(classID int, isTeacher bool, session *Session) (*UserInfoArray, error)

func (*ClassService) RefreshKeeperList

func (cs *ClassService) RefreshKeeperList(classID int) error

func (*ClassService) RegisterExperienceUser

func (cs *ClassService) RegisterExperienceUser(classID int, teacherID int, endTime int, token string, phone int, verificationCode int, ip string) (*UserInfo, int, string, error)

func (*ClassService) SetAlly

func (cs *ClassService) SetAlly(classID int, ally int, session *Session) error

func (*ClassService) SetCover

func (cs *ClassService) SetCover(classID int, file io.Reader, session *Session) error

func (*ClassService) UpdateMeetingTime

func (cs *ClassService) UpdateMeetingTime(classID int, session *Session) error

type ExamInfo

type ExamInfo struct {
	ID         int
	Name       string
	Key        string
	IV         string
	Count      int
	GdExamID   int
	Answer     string
	GroupID    int
	UpdateIP   string
	UpdateTime int
	Updater    int
}

func NewExamInfoFromMap

func NewExamInfoFromMap(m map[string]string, id int) *ExamInfo

func (*ExamInfo) ToJSON

func (ei *ExamInfo) ToJSON() string

type ExamQuestionService

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

func NewExamQuestionService

func NewExamQuestionService(db *common.Database, cache *common.Cache) (*ExamQuestionService, error)

func (*ExamQuestionService) AddSelection

func (qs *ExamQuestionService) AddSelection(body string, choices string, answer string, analysis string, knowledgeID int, session *Session) (int, error)

func (*ExamQuestionService) DeleteSelection

func (qs *ExamQuestionService) DeleteSelection(id int, session *Session) error

func (*ExamQuestionService) GetSelection

func (qs *ExamQuestionService) GetSelection(selectionID int, session *Session) (*QuestionInfo, error)

func (*ExamQuestionService) GetSelections

func (qs *ExamQuestionService) GetSelections(selectionIDs []int, session *Session) (*QuestionInfoArray, error)

func (*ExamQuestionService) Init

func (qs *ExamQuestionService) Init() error

func (*ExamQuestionService) IsCorrect

func (qs *ExamQuestionService) IsCorrect(selectionID int, answer string) (bool, error)

func (*ExamQuestionService) Preload

func (qs *ExamQuestionService) Preload() (int, error)

type ExamResult

type ExamResult struct {
	UserID     int
	Answer     string
	Rank       int
	Count      int
	UpdateTime int
}

func NewExamResultFromString

func NewExamResultFromString(s string) *ExamResult

func (*ExamResult) ToJSON

func (er *ExamResult) ToJSON() string

type ExamResultSlice

type ExamResultSlice []*ExamResult

func (ExamResultSlice) Len

func (s ExamResultSlice) Len() int

func (ExamResultSlice) Less

func (s ExamResultSlice) Less(i, j int) bool

func (ExamResultSlice) Swap

func (s ExamResultSlice) Swap(i, j int)

type ExamService

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

func NewExamService

func NewExamService(db *common.Database, cache *common.Cache, oss *common.ObjectStorage, prefix string, gda *GdAdapter) (*ExamService, error)

func (*ExamService) Answer

func (es *ExamService) Answer(meetingID int, examID int, objectiveAnswers string, subjectiveAnswers string, session *Session) error

func (*ExamService) GetExam

func (es *ExamService) GetExam(id int, session *Session) (*ExamInfo, error)

func (*ExamService) GetGdQuestionID

func (es *ExamService) GetGdQuestionID(examID int, questionID int) (int, error)

func (*ExamService) GetMyResult

func (es *ExamService) GetMyResult(meetingID int, examID int, session *Session) (string, error)

func (*ExamService) GetResults

func (es *ExamService) GetResults(meetingID int, examID int, session *Session) (string, error)

func (*ExamService) Import

func (es *ExamService) Import(name string, groupID int, id int, gdExamID int, session *Session) (int, int, error)

func (*ExamService) ImportGdExam

func (es *ExamService) ImportGdExam(name string, groupID int, id int, gdExam *GdTikuExam, session *Session) (int, int, error)

func (*ExamService) Init

func (es *ExamService) Init() error

func (*ExamService) Preload

func (es *ExamService) Preload() (int, int, error)

func (*ExamService) Resync

func (es *ExamService) Resync(id int, session *Session) (int, error)

type ExamTask

type ExamTask struct {
	ExamID int
	UserID int
	Answer string
}

type GdAdapter

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

func NewGdAdapter

func NewGdAdapter(db *common.Database) *GdAdapter

func (*GdAdapter) GetCourse

func (ga *GdAdapter) GetCourse(courseID int) (*GdCourse, error)

func (*GdAdapter) GetCourseware

func (ga *GdAdapter) GetCourseware(coursewareID int) (*GdCourseware, error)

func (*GdAdapter) GetExam

func (ga *GdAdapter) GetExam(id int) (*GdTikuExam, error)

func (*GdAdapter) GetQuestion

func (ga *GdAdapter) GetQuestion(id int) (interface{}, error)

func (*GdAdapter) Parse

func (ga *GdAdapter) Parse(s string) (string, error)

type GdCourse

type GdCourse struct {
	ID          int
	Coursewares *list.List
}

func NewGdCourse

func NewGdCourse(id int) *GdCourse

func (*GdCourse) ToJSON

func (gc *GdCourse) ToJSON() string

type GdCourseware

type GdCourseware struct {
	ID        int
	Name      string
	Resources *list.List
}

func NewGdCourseware

func NewGdCourseware(id int, name string) *GdCourseware

func (*GdCourseware) ToJSON

func (gcw *GdCourseware) ToJSON() string

type GdPass

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

func NewGdPass

func NewGdPass(cs *ClassService, us *UserService, key string) *GdPass

func (*GdPass) CheckLogin

func (gdp *GdPass) CheckLogin(session string) (int, error)

func (*GdPass) GetClassListOfStudent

func (gdp *GdPass) GetClassListOfStudent(id int) string

func (*GdPass) GetStudentID

func (gdp *GdPass) GetStudentID(account string) int

func (*GdPass) GetStudentName

func (gdp *GdPass) GetStudentName(id int) (string, error)

func (*GdPass) GetSutdentInfo

func (gdp *GdPass) GetSutdentInfo(id int) (string, string, string)

func (*GdPass) HasClass

func (gdp *GdPass) HasClass(studentID int, courseID int) bool

func (*GdPass) Login

func (gdp *GdPass) Login(name string, password string) (int, error)

func (*GdPass) LoginAs3rd

func (gdp *GdPass) LoginAs3rd(id string, t int) (int, error)

func (*GdPass) Pass

func (gdp *GdPass) Pass(password string, ip string) (*UserInfo, int, int, int, error)

type GdSessionService

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

func NewGdSessionService

func NewGdSessionService() *GdSessionService

func (*GdSessionService) GetStudentID

func (gss *GdSessionService) GetStudentID(sessionID string) (int, error)

type GdTikuComposedItem

type GdTikuComposedItem struct {
	GdQuestionID int
	Body         string
	Items        *list.List
}

func NewGdTikuComposedItem

func NewGdTikuComposedItem() *GdTikuComposedItem

func (*GdTikuComposedItem) ToJSON

func (gtci *GdTikuComposedItem) ToJSON(id *int) string

type GdTikuExam

type GdTikuExam struct {
	ID       int
	Name     string
	Count    int
	Answer   string
	Subjects *list.List
}

func NewGdTikuExam

func NewGdTikuExam(gdExamID int) *GdTikuExam

func (*GdTikuExam) Solve

func (gte *GdTikuExam) Solve()

func (*GdTikuExam) Sort

func (gte *GdTikuExam) Sort()

func (*GdTikuExam) ToJSON

func (gte *GdTikuExam) ToJSON() string

type GdTikuItem

type GdTikuItem struct {
	GdQuestionID int
	Type         int
	Body         string
	Choice       string
	Answer       string
	Analysis     string
}

func (*GdTikuItem) ToCSV

func (gti *GdTikuItem) ToCSV() string

func (*GdTikuItem) ToJSON

func (gti *GdTikuItem) ToJSON(id *int) string

type GdTikuSubExam

type GdTikuSubExam struct {
	Name  string
	Items *list.List
}

func NewGdTikuSubExam

func NewGdTikuSubExam() *GdTikuSubExam

func (*GdTikuSubExam) ToJSON

func (gtes *GdTikuSubExam) ToJSON(id *int) string

type GdTikuSubExamSlice

type GdTikuSubExamSlice []*GdTikuSubExam

func (GdTikuSubExamSlice) Len

func (s GdTikuSubExamSlice) Len() int

func (GdTikuSubExamSlice) Less

func (s GdTikuSubExamSlice) Less(i, j int) bool

func (GdTikuSubExamSlice) Swap

func (s GdTikuSubExamSlice) Swap(i, j int)

type GdVideoResource

type GdVideoResource struct {
	ID   string
	Name string
}

func (*GdVideoResource) ToJSON

func (gvr *GdVideoResource) ToJSON() string

type GroupInfo

type GroupInfo struct {
	ID          int
	Name        string
	InstituteID int
}

func (*GroupInfo) ToJSON

func (gi *GroupInfo) ToJSON(isSystem bool) string

type GroupService

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

func NewGroupService

func NewGroupService(db *common.Database, cache *common.Cache) (*GroupService, error)

func (*GroupService) AddGroup

func (gs *GroupService) AddGroup(name string, session *Session) error

func (*GroupService) Count

func (gs *GroupService) Count() (int, error)

func (*GroupService) DeleteGroup

func (gs *GroupService) DeleteGroup(groupID int, session *Session) error

func (*GroupService) Init

func (gs *GroupService) Init() error

func (*GroupService) Preload

func (gs *GroupService) Preload() (int, error)

func (*GroupService) QueryGroup

func (gs *GroupService) QueryGroup() (string, error)

func (*GroupService) SetCachedQuery

func (gs *GroupService) SetCachedQuery() (string, error)

type IDPositionPair

type IDPositionPair struct {
	ID       int
	Position int
}

type IDPositionSlice

type IDPositionSlice []*IDPositionPair

func (IDPositionSlice) Len

func (s IDPositionSlice) Len() int

func (IDPositionSlice) Less

func (s IDPositionSlice) Less(i, j int) bool

func (IDPositionSlice) Swap

func (s IDPositionSlice) Swap(i, j int)

type InstituteService

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

func NewInstituteService

func NewInstituteService(db *common.Database, cache *common.Cache) (*InstituteService, error)

func (*InstituteService) Init

func (is *InstituteService) Init() error

func (*InstituteService) Preload

func (is *InstituteService) Preload() (int, error)

type IssueInfo

type IssueInfo struct {
	ID                 int
	GroupID            int
	ClassID            int
	MeetingID          int
	Type               int
	Key                string
	SubKey             int
	QuestionBody       string
	QuestionUpdateIP   string
	QuestionUpdateTime int
	QuestionUpdater    int
	AnswerBody         string
	AnswerUpdateIP     string
	AnswerUpdateTime   int
	AnswerUpdater      int
}

func NewIssueInfoFromMap

func NewIssueInfoFromMap(m map[string]string, groupID int, id int) (*IssueInfo, int)

func (*IssueInfo) ToJSON

func (ii *IssueInfo) ToJSON() string

type IssueService

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

func NewIssueService

func NewIssueService(db *common.Database, cache *common.Cache, cs *ClassService, ms *MeetingService) (*IssueService, error)

func (*IssueService) Answer

func (is *IssueService) Answer(classID int, issueID int, body string, session *Session) error

func (*IssueService) Ask

func (is *IssueService) Ask(meetingID int, t int, key string, subKey int, body string, session *Session) (int, error)

func (*IssueService) Change

func (is *IssueService) Change(classID int, issueID int, body string, session *Session) error

func (*IssueService) Get

func (is *IssueService) Get(classID int, session *Session) (string, error)

func (*IssueService) GetIssueQuestion

func (is *IssueService) GetIssueQuestion(groupID int, issueID int) (string, error)

func (*IssueService) GetIssueResource

func (is *IssueService) GetIssueResource(groupID int, issueID int) (string, error)

func (*IssueService) GetIssueResourceKey

func (is *IssueService) GetIssueResourceKey(groupID int, issueID int) string

func (*IssueService) Init

func (is *IssueService) Init() error

func (*IssueService) Preload

func (is *IssueService) Preload() (int, error)

type MeetingInfo

type MeetingInfo struct {
	ID               int
	Name             string
	Subjects         []int
	Section          int
	Type             int
	Data             string
	Ally             int
	Scores           []int
	ScoreCount       int
	NumberOfAttendee int
	Coursewares      []string
	Videos           []string
	Exams            []string
	Replays          []string
	ClassID          int
	GroupID          int
	StartTime        int
	Duration         int
	EndTime          int
	UpdateTime       int
	UpdateIP         string
	Updater          int
}

func NewMeetingInfoFromMap

func NewMeetingInfoFromMap(m map[string]string, id int) *MeetingInfo

func (*MeetingInfo) ToJSON

func (mi *MeetingInfo) ToJSON(isTeacher bool) string

type MeetingInfoArray

type MeetingInfoArray struct {
	Meetinigs *list.List
}

func (*MeetingInfoArray) ToJSON

func (mia *MeetingInfoArray) ToJSON(isTeacher bool) string

type MeetingInfoSlice

type MeetingInfoSlice []*MeetingInfo

func (MeetingInfoSlice) Len

func (s MeetingInfoSlice) Len() int

func (MeetingInfoSlice) Less

func (s MeetingInfoSlice) Less(i, j int) bool

func (MeetingInfoSlice) Swap

func (s MeetingInfoSlice) Swap(i, j int)

func (MeetingInfoSlice) ToJSON

func (s MeetingInfoSlice) ToJSON() string

type MeetingService

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

func NewMeetingService

func NewMeetingService(db *common.Database, cache *common.Cache, liveServerUrl string, ts *TranscodingService, es *ExamService) (*MeetingService, error)

func (*MeetingService) AddExam

func (ms *MeetingService) AddExam(meetingID int, examID int, gdExamID int, name string, startTime int, duration int, preparation int, isNecessary bool, groupID int, session *Session) error

func (*MeetingService) AddMeeting

func (ms *MeetingService) AddMeeting(name string, subjects []int, section int, studentList string, startTime int, duration int, t int, data string, classID int, groupID int, session *Session, unset bool) (int, error)

func (*MeetingService) AddPDF

func (ms *MeetingService) AddPDF(filename string, id string, name string, meetingID int, preparation int, necessary int, session *Session) (string, error)

func (*MeetingService) AddReplay

func (ms *MeetingService) AddReplay(videoID string, meetingID int, session *Session) error

func (*MeetingService) AddVideo

func (ms *MeetingService) AddVideo(videoID string, videoName string, meetingID int, preparation int, necessary int, session *Session) error

func (*MeetingService) AnswerExam

func (ms *MeetingService) AnswerExam(meetingID int, examID int, answer string, session *Session) error

func (*MeetingService) AnswerExamQuestion

func (ms *MeetingService) AnswerExamQuestion(meetingID int, examID int, questionID int, answer string, session *Session) error

func (*MeetingService) ArrangeResource

func (ms *MeetingService) ArrangeResource(meetingID int, resourceType int, expectedOrder []string, session *Session) error

func (*MeetingService) AuthorizeExam

func (ms *MeetingService) AuthorizeExam(meetingID int, examID int, session *Session) (*ExamInfo, error)

func (*MeetingService) ChangeMeeting

func (ms *MeetingService) ChangeMeeting(meetingID int, name string, subjects []int, section int, startTime int, duration int, t int, data string, session *Session) (int, error)

func (*MeetingService) ChangeMeetingAlly

func (ms *MeetingService) ChangeMeetingAlly(meetingID int, ally int, session *Session) error

func (*MeetingService) ChangeMeetingName

func (ms *MeetingService) ChangeMeetingName(meetingID int, name string, session *Session) error

func (*MeetingService) ChangeMeetingSection

func (ms *MeetingService) ChangeMeetingSection(meetingID int, section int, session *Session) error

func (*MeetingService) ChangeMeetingSubjects

func (ms *MeetingService) ChangeMeetingSubjects(meetingID int, subjects []int, session *Session) error

func (*MeetingService) ChangeMeetingTime

func (ms *MeetingService) ChangeMeetingTime(meetingID int, startTime int, duration int, session *Session) error

func (*MeetingService) ChangeMeetingType

func (ms *MeetingService) ChangeMeetingType(meetingID int, t int, data string, session *Session) error

func (*MeetingService) CloneMeeting

func (ms *MeetingService) CloneMeeting(meetingID int, destClassID int, session *Session) (int, error)

func (*MeetingService) Count

func (ms *MeetingService) Count() (int, error)

func (*MeetingService) DeleteCachedUserProgress

func (ms *MeetingService) DeleteCachedUserProgress(meetingID int, userID int) error

func (*MeetingService) DeleteCourseware

func (ms *MeetingService) DeleteCourseware(coursewareID string, meetingID int, session *Session) error

func (*MeetingService) DeleteExam

func (ms *MeetingService) DeleteExam(meetingID int, examID int, session *Session) error

func (*MeetingService) DeleteMeeting

func (ms *MeetingService) DeleteMeeting(meetingID int, session *Session) error

func (*MeetingService) DeleteReplay

func (ms *MeetingService) DeleteReplay(videoID string, meetingID int, session *Session) error

func (*MeetingService) DeleteVideo

func (ms *MeetingService) DeleteVideo(videoID string, meetingID int, session *Session) error

func (*MeetingService) EndMeeting

func (ms *MeetingService) EndMeeting(meetingID int, session *Session) error

func (*MeetingService) GetCachedUserProgress

func (ms *MeetingService) GetCachedUserProgress(meetingID int, userID int, withHead bool) (string, error)

func (*MeetingService) GetCachedUserProgressesByMeeting

func (ms *MeetingService) GetCachedUserProgressesByMeeting(meetingID int, studentIDs []int, withHead bool) (string, error)

func (*MeetingService) GetExamResults

func (ms *MeetingService) GetExamResults(meetingID int, examID int, session *Session) (string, error)

func (*MeetingService) GetMeeting

func (ms *MeetingService) GetMeeting(meetingID int, session *Session, checkAuthority bool) (*MeetingInfo, error)

func (*MeetingService) GetMeetingClassID

func (ms *MeetingService) GetMeetingClassID(meetingID int) (int, error)

func (*MeetingService) GetMeetingFeedback

func (ms *MeetingService) GetMeetingFeedback(meetingID int, session *Session) (string, error)

func (*MeetingService) GetMeetingProgresses

func (ms *MeetingService) GetMeetingProgresses(meetingID int, session *Session) (*UserMeetingProgressInfoArray, error)

func (*MeetingService) GetMeetings

func (ms *MeetingService) GetMeetings(meetingIDs []int, session *Session, checkAuthority bool) (*MeetingInfoArray, error)

func (*MeetingService) GetMyExamResult

func (ms *MeetingService) GetMyExamResult(meetingID int, examID int, session *Session) (string, error)

func (*MeetingService) GetUUID

func (ms *MeetingService) GetUUID() string

func (*MeetingService) GetUserProgress

func (ms *MeetingService) GetUserProgress(meetingID int, userID int) (*UserMeetingProgressInfo, error)

func (*MeetingService) Init

func (ms *MeetingService) Init() error

func (*MeetingService) JoinMeeting

func (ms *MeetingService) JoinMeeting(meetingID int, session *Session) (string, error)

func (*MeetingService) LeaveMeeting

func (ms *MeetingService) LeaveMeeting(meetingID int, cancel int, session *Session) error

func (*MeetingService) Preload

func (ms *MeetingService) Preload(meetingOnly bool) (int, int, error)

func (*MeetingService) ResyncExam

func (ms *MeetingService) ResyncExam(meetingID int, examID int, session *Session) error

func (*MeetingService) ScoreMeeting

func (ms *MeetingService) ScoreMeeting(meetingID int, scores []int, feedback string, session *Session) error

func (*MeetingService) SetCoursewareProgress

func (ms *MeetingService) SetCoursewareProgress(meetingID int, coursewareID string, session *Session) error

func (*MeetingService) SetMeetingProgress

func (ms *MeetingService) SetMeetingProgress(meetingID int, seconds int, session *Session) error

func (*MeetingService) SetReplayProgress

func (ms *MeetingService) SetReplayProgress(meetingID int, session *Session) error

func (*MeetingService) SetVideoProgress

func (ms *MeetingService) SetVideoProgress(meetingID int, videoID string, session *Session) error

func (*MeetingService) SyncMeeting

func (ms *MeetingService) SyncMeeting(from int, to []int, data string, session *Session) error

type MessageService

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

func NewMessageService

func NewMessageService(cache *common.Cache, db *common.Database) (*MessageService, error)

type Note

type Note struct {
	ID         int
	ClassID    int
	MeetingID  int
	UserID     int
	Type       int
	Key        string
	SubKey     int
	Body       string
	UpdateIP   string
	UpdateTime int
}

func NewNoteFromString

func NewNoteFromString(s string) *Note

func (*Note) GetStringPrefix

func (n *Note) GetStringPrefix() string

func (*Note) ToJSON

func (n *Note) ToJSON() string

func (*Note) ToString

func (n *Note) ToString() string

type NoteMap

type NoteMap map[string]string

func (*NoteMap) ToJSON

func (nm *NoteMap) ToJSON() string

type NoteService

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

func NewNoteService

func NewNoteService(db *common.Database, cache *common.Cache, backlog int) (*NoteService, error)

func (*NoteService) AddNote

func (ns *NoteService) AddNote(classID int, meetingID int, t int, key string, subKey int, body string, session *Session) (int, error)

func (*NoteService) DeleteNote

func (ns *NoteService) DeleteNote(id int, classID int, meetingID int, t int, key string, session *Session) error

func (*NoteService) GetMyNote

func (ns *NoteService) GetMyNote(classID int, session *Session) (*NoteMap, error)

func (*NoteService) GetTypedNote

func (ns *NoteService) GetTypedNote(t int, key string, session *Session) (*NoteMap, error)

func (*NoteService) Init

func (ns *NoteService) Init() error

func (*NoteService) Preload

func (ns *NoteService) Preload() (int, int, error)

type NoteTask

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

type QuestionInfo

type QuestionInfo struct {
	ID          int
	Body        []string
	Choices     []string
	Answer      []int
	Analysis    []string
	KnowledgeID int
}

func NewQuestionInfoFromMap

func NewQuestionInfoFromMap(m map[string]string, id int) *QuestionInfo

func (*QuestionInfo) ToJSON

func (qi *QuestionInfo) ToJSON() string

type QuestionInfoArray

type QuestionInfoArray struct {
	Questions *list.List
}

func (*QuestionInfoArray) ToJSON

func (qia *QuestionInfoArray) ToJSON() string

type Session

type Session struct {
	UserID        int
	Nickname      string
	GroupID       int
	IP            string
	Token         string
	AppToken      string
	WeixinToken   string
	WeixinOpenID  string
	UMengDeviceID string
}

func NewSessionFromMap

func NewSessionFromMap(m map[string]string, userID int) *Session

func (*Session) CheckAppToken

func (s *Session) CheckAppToken(token string) bool

func (*Session) CheckToken

func (s *Session) CheckToken(token string) bool

func (*Session) CheckWeixinToken

func (s *Session) CheckWeixinToken(token string) bool

func (*Session) IsAdmin

func (s *Session) IsAdmin() bool

func (*Session) IsAssistant

func (s *Session) IsAssistant() bool

func (*Session) IsAssistantOrAbove

func (s *Session) IsAssistantOrAbove() bool

func (*Session) IsExperienceStudent

func (s *Session) IsExperienceStudent() bool

func (*Session) IsKeeper

func (s *Session) IsKeeper() bool

func (*Session) IsKeeperOrAbove

func (s *Session) IsKeeperOrAbove() bool

func (*Session) IsStudent

func (s *Session) IsStudent() bool

func (*Session) IsSystem

func (s *Session) IsSystem() bool

func (*Session) IsTeacher

func (s *Session) IsTeacher() bool

func (*Session) IsTeacherOrAbove

func (s *Session) IsTeacherOrAbove() bool

type SessionService

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

func NewSessionService

func NewSessionService(cache *common.Cache, accessLog *log.Logger) *SessionService

func (*SessionService) CheckHttpSessionForAssitant

func (ss *SessionService) CheckHttpSessionForAssitant(w http.ResponseWriter, r *http.Request) (*Session, error)

func (*SessionService) CheckHttpSessionForKeeper

func (ss *SessionService) CheckHttpSessionForKeeper(w http.ResponseWriter, r *http.Request) (*Session, error)

func (*SessionService) CheckHttpSessionForStudent

func (ss *SessionService) CheckHttpSessionForStudent(w http.ResponseWriter, r *http.Request) (*Session, error)

func (*SessionService) CheckHttpSessionForSystem

func (ss *SessionService) CheckHttpSessionForSystem(w http.ResponseWriter, r *http.Request) (*Session, error)

func (*SessionService) CheckHttpSessionForTeacher

func (ss *SessionService) CheckHttpSessionForTeacher(w http.ResponseWriter, r *http.Request) (*Session, error)

func (*SessionService) CheckHttpSessionForUser

func (ss *SessionService) CheckHttpSessionForUser(w http.ResponseWriter, r *http.Request) (*Session, error)

func (*SessionService) ExpireSession

func (ss *SessionService) ExpireSession(userID int, duration time.Duration) error

func (*SessionService) GetHttpSession

func (ss *SessionService) GetHttpSession(r *http.Request) (*Session, error)

func (*SessionService) GetSession

func (ss *SessionService) GetSession(userID int) (*Session, error)

func (*SessionService) GetUUID

func (ss *SessionService) GetUUID() string

func (*SessionService) Go404

func (ss *SessionService) Go404(w http.ResponseWriter, r *http.Request)

func (*SessionService) SetHttpSession

func (ss *SessionService) SetHttpSession(id int, group int, nickname string, w http.ResponseWriter, r *http.Request) string

func (*SessionService) SetSession

func (ss *SessionService) SetSession(id int, group int, nickname string, ip string, app int, device string) (string, string)

func (*SessionService) SetWeixinOpenID

func (ss *SessionService) SetWeixinOpenID(session *Session, openID string) error

func (*SessionService) UpdateHttpSession

func (ss *SessionService) UpdateHttpSession(session *Session, w http.ResponseWriter, r *http.Request) error

func (*SessionService) UpdateSessionNickname

func (ss *SessionService) UpdateSessionNickname(session *Session, nickname string) error

func (*SessionService) UpdateSessionToken

func (ss *SessionService) UpdateSessionToken(session *Session, app int) error

type SubjectService

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

func NewSubjectService

func NewSubjectService(db *common.Database, cache *common.Cache) (*SubjectService, error)

func (*SubjectService) AddSubject

func (ss *SubjectService) AddSubject(name string, session *Session) (int, error)

func (*SubjectService) ChangeSubject

func (ss *SubjectService) ChangeSubject(subjectID int, name string, session *Session) error

func (*SubjectService) ChangeSubjectList

func (ss *SubjectService) ChangeSubjectList(groupID int, subjectID int, isAdd bool, session *Session) error

func (*SubjectService) GetSubject

func (ss *SubjectService) GetSubject() (string, error)

func (*SubjectService) GetSubjectList

func (ss *SubjectService) GetSubjectList(groupID int) (string, error)

func (*SubjectService) Init

func (ss *SubjectService) Init() error

func (*SubjectService) Preload

func (ss *SubjectService) Preload() (int, int, error)

type TagService

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

func NewTagService

func NewTagService(db *common.Database, cache *common.Cache) (*TagService, error)

func (*TagService) AddTag

func (ts *TagService) AddTag(name string, groupID int, session *Session) (int, int, error)

func (*TagService) ChangeTag

func (ts *TagService) ChangeTag(id int, name string, groupID int, session *Session) (int, error)

func (*TagService) Init

func (ts *TagService) Init() error

func (*TagService) QueryTags

func (ts *TagService) QueryTags(groupID int) (string, int, error)

type TranscodingResult

type TranscodingResult struct {
	UserID     int
	StorageKey string
	Pages      int
	Status     int
	Info       string
}

type TranscodingService

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

func NewTranscodingService

func NewTranscodingService(cwOss *common.ObjectStorage, cwKeyPrefix string, ghostScript string, tmpDir string, results chan *TranscodingResult) *TranscodingService

func (*TranscodingService) AddFile

func (ts *TranscodingService) AddFile(fileName string, taskType TranscodingTaskType, ip string, userID int) (string, error)

func (*TranscodingService) ConvertPDF2PNG

func (ts *TranscodingService) ConvertPDF2PNG(destDir string, srcFile string) error

func (*TranscodingService) TrascodePDF

func (ts *TranscodingService) TrascodePDF(t *TranscodingTask) (int, int, error)

type TranscodingTask

type TranscodingTask struct {
	FileName   string
	StorageKey string
	Type       TranscodingTaskType
	UserID     int
	UserIP     string
}

type TranscodingTaskType

type TranscodingTaskType int
const (
	PDF TranscodingTaskType = 1 + iota
	IMAGE
	AUDIO
	VIDEO
)

type UserInfo

type UserInfo struct {
	ID          int
	Nickname    string
	Remark      string
	GdStudentID int
	GroupID     int
	Weixin      string
}

func NewUserInfoFromMap

func NewUserInfoFromMap(m map[string]string, id int) *UserInfo

func (*UserInfo) ToJSON

func (ui *UserInfo) ToJSON() string

type UserInfoArray

type UserInfoArray struct {
	Users *list.List
}

func (*UserInfoArray) ToJSON

func (uia *UserInfoArray) ToJSON() string

type UserMeetingProgressInfo

type UserMeetingProgressInfo struct {
	UserID             int
	MeetingID          int
	CoursewareProgress string
	VideoProgress      string
	MeetingProgress    int
	MeetingLog         string
	ExamAnswers        string
	ExamCorrect        int
	ExamTotal          int
	ReplayProgress     int
	Scores             []int
	UpdateTime         int
	UpdateIP           string
	Updater            int
}

func NewUserMeetingProgressInfoFromMap

func NewUserMeetingProgressInfoFromMap(m map[string]string, userID int, meetingID int) *UserMeetingProgressInfo

func (*UserMeetingProgressInfo) ToJSON

func (umpi *UserMeetingProgressInfo) ToJSON(withHead bool) string

type UserMeetingProgressInfoArray

type UserMeetingProgressInfoArray struct {
	Status *list.List
}

func (*UserMeetingProgressInfoArray) ToJSON

func (umpia *UserMeetingProgressInfoArray) ToJSON(withHead bool) string

type UserService

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

func NewUserService

func NewUserService(db *common.Database, cache *common.Cache, ss *SessionService) (*UserService, error)

func (*UserService) AddUser

func (us *UserService) AddUser(name string, pwd string, nickname string, groupID int, ip string, updater int) (int, error)

func (*UserService) ChangePassword

func (us *UserService) ChangePassword(userID int, oldPwd string, pwd string) error

func (*UserService) ChangeProfile

func (us *UserService) ChangeProfile(userID int, nickname string, mail string, phone string, qq string, weixin string, weibo string, session *Session) error

func (*UserService) Count

func (us *UserService) Count() (int, error)

func (*UserService) DeleteInvitationToken

func (us *UserService) DeleteInvitationToken(token string) error

func (*UserService) GenerateInvitationToken

func (us *UserService) GenerateInvitationToken(size int, groupID int) ([]string, error)

func (*UserService) GetOrAddGdStudent

func (us *UserService) GetOrAddGdStudent(gdStudentID int, ip string, addIfNotExist bool) (int, string, bool, error)

func (*UserService) Init

func (us *UserService) Init() error

func (*UserService) Login

func (us *UserService) Login(name string, pwd string, ip string) (*UserInfo, error)

func (*UserService) Preload

func (us *UserService) Preload() (int, error)

func (*UserService) QueryGdStudentID

func (us *UserService) QueryGdStudentID(userID int) (int, error)

func (*UserService) QueryInvitationToken

func (us *UserService) QueryInvitationToken() (map[string]string, error)

func (*UserService) QueryUserID

func (us *UserService) QueryUserID(gdStudentID int) (int, error)

func (*UserService) QueryUsersByNickname

func (us *UserService) QueryUsersByNickname(keywords string, groupID int, session *Session) (*UserInfoArray, error)

func (*UserService) RegisterViaInvitationToken

func (us *UserService) RegisterViaInvitationToken(name string, pwd string, token string, ip string) error

func (*UserService) Remark

func (us *UserService) Remark(userID int, name string, remark string, session *Session) error

func (*UserService) UseInvitationToken

func (us *UserService) UseInvitationToken(token string) (int, error)

type VideoAuthorizeInfo

type VideoAuthorizeInfo struct {
	ID       string
	AESKey   string
	AESIV    string
	Duration int
}

func NewVideoAuthorizeInfoFromMap

func NewVideoAuthorizeInfoFromMap(m map[string]string, id string) *VideoAuthorizeInfo

func (*VideoAuthorizeInfo) ToJSON

func (vai *VideoAuthorizeInfo) ToJSON() string

type VideoInfo

type VideoInfo struct {
	ID         string
	Title      string
	Duration   int
	Width      int
	Height     int
	Encryption int
	UpdateTime int
}

func (*VideoInfo) ToJSON

func (vi *VideoInfo) ToJSON() string

type VideoService

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

func NewVideoService

func NewVideoService(db *common.Database, cache *common.Cache, oss *common.ObjectStorage, lines []string, tlsLines []string, resolutions []string, authorizeAPI string) (*VideoService, error)

func (*VideoService) CheckInternalIP

func (vs *VideoService) CheckInternalIP(id string, ip string) bool

func (*VideoService) GetDowngradedM3U8

func (vs *VideoService) GetDowngradedM3U8(id string, resolution string, lineID int, isTLS bool, userID int, userToken string) (string, error)

func (*VideoService) GetVideoAuthorizeInfo

func (vs *VideoService) GetVideoAuthorizeInfo(id string) (*VideoAuthorizeInfo, error)

func (*VideoService) GetVideoKey

func (vs *VideoService) GetVideoKey(id string) ([]byte, error)

func (*VideoService) Init

func (vs *VideoService) Init() error

func (*VideoService) Preload

func (vs *VideoService) Preload() (int, int, error)

func (*VideoService) QueryVideo

func (vs *VideoService) QueryVideo(start int, groupID int, keywords []string, IDs []string, session *Session) (string, error)

Jump to

Keyboard shortcuts

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