Skip to content

Commit

Permalink
🛠️本次更新工学云添加getjobinfo接口对无工作账号跳过
Browse files Browse the repository at this point in the history
超星学习通 开发中 🚧
  • Loading branch information
mirai-MIC committed Dec 6, 2024
1 parent 2b73c37 commit 8edc80a
Show file tree
Hide file tree
Showing 9 changed files with 547 additions and 136 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ permissions:
env:
PROJECT_NAME: ${{ github.event.repository.name }}
BUILD_DATE: ${{ github.run_id }}
VERSION: 'v0.0.1-beta-3' # 固定版本号
VERSION: 'v0.0.1-beta.4' # 固定版本号
RELEASE_DIR: release

jobs:
Expand Down
1 change: 1 addition & 0 deletions internal/api/gongxueapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const (
CHECK = "/session/captcha/v1/check"
LoginAPI = "/session/user/v6/login"
GetPlanIDAPI = "/practice/plan/v3/getPlanByStu"
GetJobInfoAPI = "/practice/job/v4/infoByStu"
SignAPI = "/attendence/clock/v4/save"
GetWeekCountAPI = "/practice/paper/v2/listByStu"
GetWeeks = "/practice/paper/v3/getWeeks1"
Expand Down
18 changes: 4 additions & 14 deletions internal/service/Init.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ func NewAppService() *AppService {
}

func (svc *AppService) Init() {
// 加载用户数据
svc.loadUsers()

// 启动各模块服务
svc.StartGongxueYun()
//svc.StartTestCX()
Expand All @@ -34,6 +31,7 @@ func (svc *AppService) loadUsers() {
}
}
func (svc *AppService) StartGongxueYun() {
svc.loadUsers()
global.Log.Info("Starting Gongxueyun module...")
// 创建一个 Mutex 来保证每次只有一个 goroutine 执行相关操作
var mu sync.Mutex
Expand All @@ -54,16 +52,8 @@ func (svc *AppService) StartGongxueYun() {
}

func (svc *AppService) StartTestCX() {
global.Log.Info("Starting CX test module...")
logic := cx_service.CxLogic{
Phone: "1111111",
Password: "1111111",
}
if err := logic.Login(); err != nil {
global.Log.Error("CX login failed:", err)
return
}
logic.PullCourse()
cxLogic := cx_service.CxLogic{}
cxLogic.Run()
}

func (svc *AppService) createMoguDing(user entity.SignEntity) *gongxueyun_service.MoguDing {
Expand All @@ -72,7 +62,7 @@ func (svc *AppService) createMoguDing(user entity.SignEntity) *gongxueyun_servic
PhoneNumber: user.Username,
Password: user.Password,
Email: user.Email,
Sign: gongxueyun_service.SignStruct{
Sign: gongxueyun_service.SignInfo{
City: user.City,
Area: user.Area,
Address: user.Address,
Expand Down
16 changes: 13 additions & 3 deletions internal/service/cx_service/logic.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"BronyaBot/internal/service/cx_service/data"
"BronyaBot/utils"
"encoding/json"
"io/ioutil"
"io"
"net/http"
"net/url"
"strings"
Expand All @@ -18,7 +18,17 @@ type CxLogic struct {
Password string
}

func (cx *CxLogic) Run() {
global.Log.Info("Starting CX test module...")
if err := cx.Login(); err != nil {
global.Log.Error("CX login failed:", err)
return
}
cx.PullCourse()
}

func (c *CxLogic) Login() error {

global.Log.Info("=====开始登录=====")
phone, _ := utils.AESCBCEncrypt([]byte(c.Phone))
password, _ := utils.AESCBCEncrypt([]byte(c.Password))
Expand All @@ -38,7 +48,7 @@ func (c *CxLogic) Login() error {
}
defer postres.Body.Close()
var jsonContent map[string]interface{}
body, _ := ioutil.ReadAll(postres.Body)
body, _ := io.ReadAll(postres.Body)
json.Unmarshal(body, &jsonContent)
if jsonContent["status"] == false {
global.Log.Errorf("登录失败 %t", jsonContent["status"])
Expand Down Expand Up @@ -66,7 +76,7 @@ func (c *CxLogic) PullCourse() {
}
pull := data.Course{}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
body, err := io.ReadAll(res.Body)
if err != nil {
global.Log.Error(err.Error())
}
Expand Down
196 changes: 196 additions & 0 deletions internal/service/gongxueyun_service/data/JobInfo.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
package data

type JobInfoData struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data struct {
TotalCount int `json:"totalCount"`
PageSize int `json:"pageSize"`
TotalPage int `json:"totalPage"`
CurrPage int `json:"currPage"`
IsDeleted int `json:"isDeleted"`
CreateBy string `json:"createBy"`
ModifiedBy string `json:"modifiedBy"`
CreateTime string `json:"createTime"`
ModifiedTime string `json:"modifiedTime"`
CreateByName interface{} `json:"createByName"`
ModifiedByName interface{} `json:"modifiedByName"`
OrderBy string `json:"orderBy"`
Sort string `json:"sort"`
JobId string `json:"jobId"`
StudentId string `json:"studentId"`
PlanId string `json:"planId"`
CompanyId string `json:"companyId"`
CompTeaName string `json:"compTeaName"`
CompTeaMobile string `json:"compTeaMobile"`
JobName string `json:"jobName"`
JobContent string `json:"jobContent"`
JobAddress string `json:"jobAddress"`
Sector interface{} `json:"sector"`
Category string `json:"category"`
QuartersIntroduce string `json:"quartersIntroduce"`
StartTime string `json:"startTime"`
EndTime string `json:"endTime"`
IsMajorRight int `json:"isMajorRight"`
Salary string `json:"salary"`
State int `json:"state"`
ApplyState int `json:"applyState"`
ApplyTeacherId string `json:"applyTeacherId"`
Backup interface{} `json:"backup"`
IsAuto int `json:"isAuto"`
IsUpdate int `json:"isUpdate"`
IsApplyUpdate int `json:"isApplyUpdate"`
IsApplyEnd int `json:"isApplyEnd"`
IsApplyChange int `json:"isApplyChange"`
Office string `json:"office"`
Attachments interface{} `json:"attachments"`
IsChange int `json:"isChange"`
OldJobId interface{} `json:"oldJobId"`
OldIsCompanyAuthen interface{} `json:"oldIsCompanyAuthen"`
SnowFlakeId int `json:"snowFlakeId"`
HeadImg interface{} `json:"headImg"`
ApplyTime interface{} `json:"applyTime"`
StayType int `json:"stayType"`
StayAddress string `json:"stayAddress"`
StayProvince interface{} `json:"stayProvince"`
PracticeCompanyEntity struct {
TotalCount int `json:"totalCount"`
PageSize int `json:"pageSize"`
TotalPage int `json:"totalPage"`
CurrPage int `json:"currPage"`
IsDeleted int `json:"isDeleted"`
CreateBy string `json:"createBy"`
ModifiedBy string `json:"modifiedBy"`
CreateTime string `json:"createTime"`
ModifiedTime string `json:"modifiedTime"`
CreateByName interface{} `json:"createByName"`
ModifiedByName interface{} `json:"modifiedByName"`
OrderBy string `json:"orderBy"`
Sort string `json:"sort"`
PracticeCompanyId interface{} `json:"practiceCompanyId"`
CompanyName string `json:"companyName"`
CompanyCode string `json:"companyCode"`
Province string `json:"province"`
City string `json:"city"`
Area string `json:"area"`
Address string `json:"address"`
Zipcode interface{} `json:"zipcode"`
PeopleNum string `json:"peopleNum"`
CompanyType string `json:"companyType"`
Trade string `json:"trade"`
CompanScope interface{} `json:"companScope"`
CompanyEmail string `json:"companyEmail"`
State int `json:"state"`
SchComTabName interface{} `json:"schComTabName"`
ContactName string `json:"contactName"`
IsCompanyAuthen int `json:"isCompanyAuthen"`
ContactPhone string `json:"contactPhone"`
TradeValue string `json:"tradeValue"`
CompanyTypeValue string `json:"companyTypeValue"`
SchoolCompanyId interface{} `json:"schoolCompanyId"`
Source interface{} `json:"source"`
} `json:"practiceCompanyEntity"`
ProtocolState interface{} `json:"protocolState"`
JobAddrPoint interface{} `json:"jobAddrPoint"`
StuIds interface{} `json:"stuIds"`
SchoolId interface{} `json:"schoolId"`
DepId interface{} `json:"depId"`
DeptName interface{} `json:"deptName"`
TeaId interface{} `json:"teaId"`
MajorId interface{} `json:"majorId"`
ClassId interface{} `json:"classId"`
BindState int `json:"bindState"`
UserId interface{} `json:"userId"`
ApplyEndTime interface{} `json:"applyEndTime"`
Content interface{} `json:"content"`
IsWeb interface{} `json:"isWeb"`
Type interface{} `json:"type"`
IsWriteJob int `json:"isWriteJob"`
DepIds interface{} `json:"depIds"`
ClassIds interface{} `json:"classIds"`
MajorIds interface{} `json:"majorIds"`
BatchId interface{} `json:"batchId"`
Username interface{} `json:"username"`
StuNum interface{} `json:"stuNum"`
DepName interface{} `json:"depName"`
MajorName interface{} `json:"majorName"`
ClassName interface{} `json:"className"`
TeaName interface{} `json:"teaName"`
OldCompanyName interface{} `json:"oldCompanyName"`
OldJobName interface{} `json:"oldJobName"`
OldAddress interface{} `json:"oldAddress"`
CompanyName string `json:"companyName"`
CompanyCode string `json:"companyCode"`
Province string `json:"province"`
City string `json:"city"`
Area string `json:"area"`
Address string `json:"address"`
Zipcode interface{} `json:"zipcode"`
PeopleNum string `json:"peopleNum"`
CompanyType string `json:"companyType"`
Trade string `json:"trade"`
CompanScope interface{} `json:"companScope"`
CompanyEmail string `json:"companyEmail"`
IsCompanyAuthen int `json:"isCompanyAuthen"`
ContactPhone string `json:"contactPhone"`
ContactName string `json:"contactName"`
TeacherId interface{} `json:"teacherId"`
SchoolTea interface{} `json:"schoolTea"`
PlanTeacherStudentId interface{} `json:"planTeacherStudentId"`
TradeValue string `json:"tradeValue"`
CompanyTypeValue string `json:"companyTypeValue"`
CategoryValue string `json:"categoryValue"`
JobProvince string `json:"jobProvince"`
JobCity string `json:"jobCity"`
JobArea string `json:"jobArea"`
ClassTeacherName interface{} `json:"classTeacherName"`
ClassTeacherId interface{} `json:"classTeacherId"`
AboutType interface{} `json:"aboutType"`
IsShow interface{} `json:"isShow"`
PlanName interface{} `json:"planName"`
UpdateApplyState interface{} `json:"updateApplyState"`
OldCompany interface{} `json:"oldCompany"`
OldJob interface{} `json:"oldJob"`
TableName1 interface{} `json:"tableName1"`
TableName2 interface{} `json:"tableName2"`
TableName3 interface{} `json:"tableName3"`
StartIndex int `json:"startIndex"`
PlanType interface{} `json:"planType"`
SchoolName interface{} `json:"schoolName"`
IsReport interface{} `json:"isReport"`
IsCredential interface{} `json:"isCredential"`
IsUpc interface{} `json:"isUpc"`
Source interface{} `json:"source"`
IsSeeEnd interface{} `json:"isSeeEnd"`
IsHaveDinner int `json:"isHaveDinner"`
IsSpecialMajor int `json:"isSpecialMajor"`
SpecialMajor string `json:"specialMajor"`
IsSecurity interface{} `json:"isSecurity"`
IsHolidayPractice interface{} `json:"isHolidayPractice"`
IsNightWord interface{} `json:"isNightWord"`
IsEasyJob interface{} `json:"isEasyJob"`
IsSpecialJob interface{} `json:"isSpecialJob"`
SelectState interface{} `json:"selectState"`
ApplyLevelJson string `json:"applyLevelJson"`
LevelEntity []interface{} `json:"levelEntity"`
ApplyCursor int `json:"applyCursor"`
JobIds interface{} `json:"jobIds"`
IsSameProvince interface{} `json:"isSameProvince"`
SchoolProvince interface{} `json:"schoolProvince"`
JobStartTime interface{} `json:"jobStartTime"`
JobEndTime interface{} `json:"jobEndTime"`
PlanStartTime interface{} `json:"planStartTime"`
PlanEndTime interface{} `json:"planEndTime"`
ApplyCursorDesc interface{} `json:"applyCursorDesc"`
AcademeName interface{} `json:"academeName"`
AcademeId interface{} `json:"academeId"`
StudentNumber interface{} `json:"studentNumber"`
Gender interface{} `json:"gender"`
Grade interface{} `json:"grade"`
BatchName interface{} `json:"batchName"`
ParentImageList []interface{} `json:"parentImageList"`
CardNo interface{} `json:"cardNo"`
ParentImageJson interface{} `json:"parentImageJson"`
TradeValueList interface{} `json:"tradeValueList"`
} `json:"data"`
}
Loading

0 comments on commit 8edc80a

Please sign in to comment.