forked from Open-CT/openscore
Add all previous code
This commit is contained in:
parent
bd98896db7
commit
a47421b05b
File diff suppressed because it is too large
Load Diff
|
@ -16,9 +16,11 @@ package controllers
|
|||
|
||||
import (
|
||||
_ "embed"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/casdoor/casdoor-go-sdk/auth"
|
||||
auth "github.com/casdoor/casdoor-go-sdk/casdoorsdk"
|
||||
"github.com/open-ct/openscore/service/user"
|
||||
)
|
||||
|
||||
//go:embed token_jwt_key.pem
|
||||
|
@ -38,18 +40,53 @@ func InitAuthConfig() {
|
|||
auth.InitConfig(casdoorEndpoint, clientId, clientSecret, JwtPublicKey, casdoorOrganization, casdoorApplication)
|
||||
}
|
||||
|
||||
func (c *ApiController) Signin() {
|
||||
// UserLogin 用户登录
|
||||
func (c *ApiController) UserLogin() {
|
||||
var req LoginRequest
|
||||
|
||||
if err := json.Unmarshal(c.Ctx.Input.RequestBody, &req); err != nil {
|
||||
c.ResponseError("cannot unmarshal", err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
id, userType, err := user.Login(req.Account, req.Password)
|
||||
if err != nil {
|
||||
c.ResponseError("cannot login", err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
c.SetSession("userId", id)
|
||||
c.SetSession("userType", userType)
|
||||
|
||||
resp := struct {
|
||||
UserType int64 `json:"user_type"`
|
||||
}{userType}
|
||||
|
||||
c.ResponseOk(resp)
|
||||
}
|
||||
|
||||
/*
|
||||
// @Title Signin
|
||||
// @Description sign in as a member
|
||||
// @Param code QueryString string true "The code to sign in"
|
||||
// @Param state QueryString string true "The state"
|
||||
// @Success 200 {object} controllers.api_controller.Response The Response object
|
||||
// @router /signin [post]
|
||||
// @Tag Account API*/
|
||||
func (c *ApiController) SignIn() {
|
||||
code := c.Input().Get("code")
|
||||
state := c.Input().Get("state")
|
||||
|
||||
token, err := auth.GetOAuthToken(code, state)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
c.ResponseError(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
claims, err := auth.ParseJwtToken(token.AccessToken)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
c.ResponseError(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
claims.AccessToken = token.AccessToken
|
||||
|
@ -58,12 +95,24 @@ func (c *ApiController) Signin() {
|
|||
c.ResponseOk(claims)
|
||||
}
|
||||
|
||||
func (c *ApiController) Signout() {
|
||||
/*
|
||||
// @Title Signout
|
||||
// @Description sign out the current member
|
||||
// @Success 200 {object} controllers.api_controller.Response The Response object
|
||||
// @router /signout [post]
|
||||
// @Tag Account API*/
|
||||
func (c *ApiController) SignOut() {
|
||||
c.SetSessionClaims(nil)
|
||||
|
||||
c.ResponseOk()
|
||||
}
|
||||
|
||||
/*
|
||||
// @Title GetAccount
|
||||
// @Description Get current account
|
||||
// @Success 200 {object} controllers.api_controller.Response The Response object
|
||||
// @router /get-account [get]
|
||||
// @Tag Account API*/
|
||||
func (c *ApiController) GetAccount() {
|
||||
if c.RequireSignedIn() {
|
||||
return
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -16,9 +16,10 @@ package controllers
|
|||
|
||||
import (
|
||||
"encoding/gob"
|
||||
"errors"
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
"github.com/casdoor/casdoor-go-sdk/auth"
|
||||
auth "github.com/casdoor/casdoor-go-sdk/casdoorsdk"
|
||||
)
|
||||
|
||||
type ApiController struct {
|
||||
|
@ -86,3 +87,11 @@ func (c *ApiController) GetSessionUsername() string {
|
|||
|
||||
return GetUserName(user)
|
||||
}
|
||||
|
||||
func (c *ApiController) GetSessionUserId() (int64, error) {
|
||||
id, ok := c.Controller.GetSession("userId").(int64)
|
||||
if !ok {
|
||||
return 0, errors.New("not login")
|
||||
}
|
||||
return id, nil
|
||||
}
|
||||
|
|
|
@ -0,0 +1,147 @@
|
|||
package controllers
|
||||
|
||||
type UpdateSmallQuestionRequest struct {
|
||||
QuestionDetailId int64 `json:"question_detail_id"`
|
||||
QuestionDetailName string `json:"question_detail_name"`
|
||||
QuestionDetailScore int64 `json:"question_detail_score"`
|
||||
ScoreType string `json:"score_type"`
|
||||
}
|
||||
|
||||
type CreateSmallQuestionRequest struct {
|
||||
QuestionDetailName string `json:"question_detail_name"`
|
||||
QuestionId int64 `json:"question_id"`
|
||||
QuestionDetailScore int64 `json:"question_detail_score"`
|
||||
ScoreType string `json:"score_type"`
|
||||
}
|
||||
|
||||
type DeleteSmallQuestionRequest struct {
|
||||
QuestionDetailId int64 `json:"question_detail_id"`
|
||||
}
|
||||
|
||||
type DeleteQuestionRequest struct {
|
||||
QuestionId int64 `json:"question_id"`
|
||||
}
|
||||
|
||||
type UpdateQuestionRequest struct {
|
||||
QuestionId int64 `json:"question_id"`
|
||||
QuestionName string `json:"question_name"`
|
||||
StandardError int64 `json:"standard_error"`
|
||||
QuestionScore int64 `json:"question_score"`
|
||||
ScoreType int64 `json:"score_type"`
|
||||
}
|
||||
|
||||
type UpdateUserRequest struct {
|
||||
Account string `json:"account"`
|
||||
UserName string `json:"user_name"`
|
||||
Password string `json:"password"`
|
||||
SubjectName string `json:"subject_name"`
|
||||
UserType int64 `json:"user_type"`
|
||||
}
|
||||
|
||||
type DeleteUserRequest struct {
|
||||
Account string `json:"account"`
|
||||
}
|
||||
|
||||
type CreateUserRequest struct {
|
||||
UserName string `json:"user_name"`
|
||||
Password string `json:"password"`
|
||||
SubjectName string `json:"subject_name"`
|
||||
QuestionId int64 `json:"question_id"`
|
||||
UserType int64 `json:"user_type"`
|
||||
}
|
||||
|
||||
type WriteUserRequest struct {
|
||||
SubjectName string `json:"subject_name"`
|
||||
SupervisorNumber int `json:"supervisor_number"`
|
||||
List []QuestionAndNumber `json:"list"`
|
||||
}
|
||||
|
||||
type QuestionAndNumber struct {
|
||||
Id int64 `json:"id"`
|
||||
Num int `json:"num"`
|
||||
}
|
||||
|
||||
type LoginRequest struct {
|
||||
Account string `json:"account"`
|
||||
Password string `json:"password"`
|
||||
}
|
||||
|
||||
type AddTopic struct {
|
||||
TopicName string `json:"topicName"`
|
||||
ScoreType int64 `json:"scoreType"`
|
||||
Score int64 `json:"score"`
|
||||
Error int64 `json:"error"`
|
||||
SubjectName string `json:"subjectName"`
|
||||
TopicDetails []AddTopicDetail `json:"topicDetails"`
|
||||
SelfScoreRate int64 `json:"self_score_rate"`
|
||||
}
|
||||
|
||||
type AddTopicDetail struct {
|
||||
TopicDetailName string `json:"topicDetailName"`
|
||||
DetailScoreTypes string `json:"DetailScoreTypes"`
|
||||
DetailScore int64 `json:"detailScore"`
|
||||
}
|
||||
|
||||
type QuestionBySubList struct {
|
||||
SubjectName string `json:"subjectName"`
|
||||
}
|
||||
|
||||
type DistributionInfo struct {
|
||||
QuestionId int64 `json:"questionId"`
|
||||
}
|
||||
|
||||
type DeleteTest struct {
|
||||
QuestionId int64 `json:"questionId"`
|
||||
}
|
||||
|
||||
type Distribution struct {
|
||||
QuestionId int64 `json:"questionId"`
|
||||
TestNumber int `json:"testNumber"`
|
||||
UserNumber int `json:"userNumber"`
|
||||
}
|
||||
|
||||
type ReadFile struct {
|
||||
PicName string `json:"picName"`
|
||||
}
|
||||
|
||||
type DistributionRecord struct {
|
||||
SubjectName string `json:"subjectName"`
|
||||
}
|
||||
|
||||
type TestRequest struct {
|
||||
TestId int64 `json:"testId"`
|
||||
}
|
||||
|
||||
type TestPoint struct {
|
||||
Scores string `json:"scores"`
|
||||
TestId int64 `json:"testId"`
|
||||
TestDetailId string `json:"testDetailId"`
|
||||
}
|
||||
|
||||
type TestProblem struct {
|
||||
ProblemType int64 `json:"problemType"`
|
||||
TestId int64 `json:"testId"`
|
||||
ProblemMessage string `json:"problemMessage"`
|
||||
}
|
||||
|
||||
type ExampleDetail struct {
|
||||
ExampleTestId int64 `json:"exampleTestId"`
|
||||
}
|
||||
|
||||
type Question struct {
|
||||
QuestionId int64 `json:"questionId"`
|
||||
}
|
||||
|
||||
type SelfScore struct {
|
||||
ExaminerId int64 `json:"examinerId"`
|
||||
}
|
||||
|
||||
type SupervisorPoint struct {
|
||||
TestId int64 `json:"testId"`
|
||||
TestDetailIds string `json:"testDetailIds"`
|
||||
Scores string `json:"scores"`
|
||||
}
|
||||
|
||||
type ScoreProgress struct {
|
||||
Subject string `json:"subject"`
|
||||
}
|
|
@ -0,0 +1,257 @@
|
|||
package controllers
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/open-ct/openscore/model"
|
||||
)
|
||||
|
||||
type AddTopicVO struct {
|
||||
QuestionId int64
|
||||
QuestionDetailIds []AddTopicDetailVO
|
||||
}
|
||||
|
||||
type AddTopicDetailVO struct {
|
||||
QuestionDetailId int64
|
||||
}
|
||||
|
||||
type SubjectListVO struct {
|
||||
SubjectId int64
|
||||
SubjectName string
|
||||
}
|
||||
|
||||
type QuestionBySubListVO struct {
|
||||
QuestionId int64
|
||||
QuestionName string
|
||||
}
|
||||
|
||||
type DistributionInfoVO struct {
|
||||
ImportTestNumber int64
|
||||
LeftTestNumber int
|
||||
OnlineNumber int64
|
||||
ScoreType int64
|
||||
}
|
||||
|
||||
type TopicVO struct {
|
||||
TopicId int64
|
||||
SubjectName string
|
||||
TopicName string
|
||||
Score int64
|
||||
StandardError int64
|
||||
ScoreType int64
|
||||
ImportTime time.Time
|
||||
SubTopicVOList []SubTopicVO
|
||||
}
|
||||
|
||||
type SubTopicVO struct {
|
||||
SubTopicId int64
|
||||
SubTopicName string
|
||||
Score int64
|
||||
ScoreDistribution string
|
||||
}
|
||||
|
||||
type DistributionRecordVO struct {
|
||||
TopicId int64
|
||||
TopicName string
|
||||
ImportNumber int64
|
||||
DistributionTestNumber int64
|
||||
DistributionUserNumber int64
|
||||
}
|
||||
|
||||
type SubTopicPlus struct {
|
||||
model.SubTopic
|
||||
TestDetailId int64 `json:"test_detail_id"`
|
||||
}
|
||||
type TestPaperInfoPlus struct {
|
||||
model.TestPaperInfo
|
||||
PicCode string `json:"picCode"`
|
||||
}
|
||||
|
||||
type TestDisplayResponse struct {
|
||||
QuestionId int64 `json:"questionId"`
|
||||
QuestionName string `json:"questionName"`
|
||||
TestId int64 `json:"testId"`
|
||||
SubTopics []SubTopicPlus `json:"subTopic"`
|
||||
TestInfos []TestPaperInfoPlus `json:"testInfos"`
|
||||
}
|
||||
|
||||
type TestListResponse struct {
|
||||
TestIds []int64 `json:"TestIds"`
|
||||
}
|
||||
|
||||
type TestAnswerResponse struct {
|
||||
Pics []string `json:"Pics"`
|
||||
}
|
||||
|
||||
type ExampleListResponse struct {
|
||||
TestPapers []model.TestPaper `json:"exampleTestPapers"`
|
||||
}
|
||||
|
||||
type TestReviewResponse struct {
|
||||
TestId []int64 `json:"testId"`
|
||||
Score []int64 `json:"score"`
|
||||
ScoreTime []time.Time `json:"score_time"`
|
||||
}
|
||||
|
||||
type ExampleDetailResponse struct {
|
||||
QuestionName string `json:"questionName"`
|
||||
Test [][]model.TestPaperInfo `json:"test"`
|
||||
}
|
||||
|
||||
type QuestionListVO struct {
|
||||
QuestionId int64
|
||||
QuestionName string
|
||||
}
|
||||
|
||||
type UserInfoVO struct {
|
||||
UserName string
|
||||
SubjectName string
|
||||
}
|
||||
|
||||
type TeacherMonitoringVO struct {
|
||||
UserId int64
|
||||
UserName string
|
||||
TestDistributionNumber int64
|
||||
TestSuccessNumber int64
|
||||
TestRemainingNumber int64
|
||||
TestProblemNumber int64
|
||||
MarkingSpeed float64
|
||||
PredictTime float64
|
||||
AverageScore float64
|
||||
Validity float64
|
||||
StandardDeviation float64
|
||||
IsOnline bool
|
||||
}
|
||||
|
||||
type ScoreDistributionVO struct {
|
||||
Score int64
|
||||
Rate float64
|
||||
}
|
||||
|
||||
type TeacherVO struct {
|
||||
UserId int64
|
||||
UserName string
|
||||
}
|
||||
|
||||
type SelfScoreRecordVO struct {
|
||||
TestId int64
|
||||
Score int64
|
||||
SelfScore int64
|
||||
IsQualified int64
|
||||
Error float64
|
||||
StandardError int64
|
||||
}
|
||||
type ScoreAverageVO struct {
|
||||
UserId int64
|
||||
UserName string
|
||||
Average float64
|
||||
}
|
||||
type ProblemUnderCorrectedPaperVO struct {
|
||||
TestId int64
|
||||
ExaminerId int64
|
||||
ExaminerName string
|
||||
ProblemType int64
|
||||
ProblemMes string
|
||||
}
|
||||
type ProblemUnmarkListVO struct {
|
||||
TestId int64
|
||||
}
|
||||
type SelfUnmarkListVO struct {
|
||||
TestId int64
|
||||
}
|
||||
|
||||
type ArbitramentTestVO struct {
|
||||
TestId int64
|
||||
ExaminerFirstId int64
|
||||
ExaminerFirstName string
|
||||
ExaminerFirstScore int64
|
||||
ExaminerSecondId int64
|
||||
ExaminerSecondName string
|
||||
ExaminerSecondScore int64
|
||||
ExaminerThirdId int64
|
||||
ExaminerThirdName string
|
||||
ExaminerThirdScore int64
|
||||
PracticeError int64
|
||||
StandardError int64
|
||||
}
|
||||
|
||||
type ArbitramentUnmarkListVO struct {
|
||||
TestId int64
|
||||
}
|
||||
type SelfMarkListVO struct {
|
||||
TestId int64
|
||||
Score int64
|
||||
SelfScore int64
|
||||
Error float64
|
||||
StandardError int64
|
||||
Userid int64
|
||||
Name string
|
||||
}
|
||||
|
||||
type ScoreProgressVO struct {
|
||||
// 问题id 问题名 导入试卷数
|
||||
QuestionId int64
|
||||
QuestionName string
|
||||
ImportNumber int64
|
||||
|
||||
// 在线人数 ,分配人数 平均分 平均速度 在线预计时间 ,预计时间 ,自评指数
|
||||
OnlineUserNumber int64
|
||||
DistributionUserNumber int64
|
||||
|
||||
OnlineAverageScore float64
|
||||
AverageScore float64
|
||||
OnlineAverageSpeed float64
|
||||
AverageSpeed float64
|
||||
OnlinePredictTime float64
|
||||
PredictTime float64
|
||||
|
||||
SelfScoreRate int64
|
||||
|
||||
// 完成阅卷数 完成率 未完成数 未完成率 是否全部完成
|
||||
FinishNumber int64
|
||||
FinishRate float64
|
||||
UnfinishedNumber float64
|
||||
UnfinishedRate float64
|
||||
IsAllFinished string
|
||||
|
||||
FirstFinishedNumber int64
|
||||
FirstFinishedRate float64
|
||||
FirstUnfinishedNumber float64
|
||||
FirstUnfinishedRate float64
|
||||
IsFirstFinished string
|
||||
|
||||
SecondFinishedNumber int64
|
||||
SecondFinishedRate float64
|
||||
SecondUnfinishedNumber float64
|
||||
SecondUnfinishedRate float64
|
||||
IsSecondFinished string
|
||||
|
||||
ThirdFinishedNumber int64
|
||||
ThirdFinishedRate float64
|
||||
ThirdUnfinishedNumber float64
|
||||
ThirdUnfinishedRate float64
|
||||
IsThirdFinished string
|
||||
|
||||
// 仲裁卷生产数量 生产率 完成数,完成率 未完成数 未完成率 是否全部完成
|
||||
ArbitramentNumber int64
|
||||
ArbitramentRate float64
|
||||
ArbitramentFinishedNumber int64
|
||||
ArbitramentFinishedRate float64
|
||||
ArbitramentUnfinishedNumber int64
|
||||
ArbitramentUnfinishedRate float64
|
||||
IsArbitramentFinished string
|
||||
|
||||
ProblemNumber int64
|
||||
ProblemRate float64
|
||||
ProblemFinishedNumber int64
|
||||
ProblemFinishedRate float64
|
||||
ProblemUnfinishedNumber int64
|
||||
ProblemUnfinishedRate float64
|
||||
IsProblemFinished string
|
||||
}
|
||||
|
||||
type ScoreDeviationVO struct {
|
||||
UserId int64
|
||||
UserName string
|
||||
DeviationScore float64
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -14,6 +14,8 @@
|
|||
|
||||
package controllers
|
||||
|
||||
import "log"
|
||||
|
||||
type Response struct {
|
||||
Status string `json:"status"`
|
||||
Msg string `json:"msg"`
|
||||
|
@ -23,9 +25,6 @@ type Response struct {
|
|||
func (c *ApiController) ResponseOk(data ...interface{}) {
|
||||
resp := Response{Status: "ok"}
|
||||
switch len(data) {
|
||||
//case 2:
|
||||
// resp.Data2 = data[1]
|
||||
// fallthrough
|
||||
case 1:
|
||||
resp.Data = data[0]
|
||||
}
|
||||
|
@ -34,11 +33,9 @@ func (c *ApiController) ResponseOk(data ...interface{}) {
|
|||
}
|
||||
|
||||
func (c *ApiController) ResponseError(error string, data ...interface{}) {
|
||||
log.Println(error, data)
|
||||
resp := Response{Status: "error", Msg: error}
|
||||
switch len(data) {
|
||||
//case 2:
|
||||
// resp.Data2 = data[1]
|
||||
// fallthrough
|
||||
case 1:
|
||||
resp.Data = data[0]
|
||||
}
|
||||
|
|
4
go.mod
4
go.mod
|
@ -4,12 +4,14 @@ go 1.16
|
|||
|
||||
require (
|
||||
github.com/astaxie/beego v1.12.3
|
||||
github.com/casdoor/casdoor-go-sdk v0.3.3
|
||||
github.com/casdoor/casdoor-go-sdk v0.6.0
|
||||
github.com/go-sql-driver/mysql v1.6.0
|
||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
|
||||
github.com/smartystreets/goconvey v1.6.4
|
||||
github.com/xuri/excelize/v2 v2.4.1
|
||||
golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d
|
||||
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f // indirect
|
||||
golang.org/x/tools v0.0.0-20201211185031-d93e913c1a58 // indirect
|
||||
xorm.io/builder v0.3.9
|
||||
xorm.io/xorm v1.2.3
|
||||
)
|
||||
|
|
11
go.sum
11
go.sum
|
@ -69,8 +69,8 @@ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kB
|
|||
github.com/bradfitz/gomemcache v0.0.0-20180710155616-bc664df96737/go.mod h1:PmM6Mmwb0LSuEubjR8N7PtNe1KxZLtOUHtbeikc5h60=
|
||||
github.com/casbin/casbin v1.7.0/go.mod h1:c67qKN6Oum3UF5Q1+BByfFxkwKvhwW57ITjqwtzR1KE=
|
||||
github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
|
||||
github.com/casdoor/casdoor-go-sdk v0.3.3 h1:oyUNjpkC6zOEwBtY96qzqIQliQLsHZguOdrwItcGWnY=
|
||||
github.com/casdoor/casdoor-go-sdk v0.3.3/go.mod h1:MBed3ISHQfXTtoOCAk5T8l5lt4wFvsyynrw0awggydY=
|
||||
github.com/casdoor/casdoor-go-sdk v0.6.0 h1:uyNQ9Yt6ZdgFFMXu480EBXtLW8Gsmh0PusONE+16HnI=
|
||||
github.com/casdoor/casdoor-go-sdk v0.6.0/go.mod h1:MBed3ISHQfXTtoOCAk5T8l5lt4wFvsyynrw0awggydY=
|
||||
github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
|
||||
|
@ -206,6 +206,7 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4
|
|||
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
|
||||
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
|
||||
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||
|
@ -299,6 +300,7 @@ github.com/json-iterator/go v1.1.11 h1:uVUAXhF2To8cbw/3xN3pxj6kk7TYKs98NIrTqPlMW
|
|||
github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
|
||||
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
|
||||
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
|
||||
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
|
||||
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
||||
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
|
||||
|
@ -455,7 +457,9 @@ github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d/go.mod h1:AMEsy7v5z
|
|||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
|
||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
|
||||
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
|
||||
github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY=
|
||||
|
@ -735,8 +739,9 @@ golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roY
|
|||
golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
||||
golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78 h1:M8tBwCtWD/cZV9DZpFYRUgaymAYAr+aIUTWzDaM3uPs=
|
||||
golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/tools v0.0.0-20201211185031-d93e913c1a58 h1:1Bs6RVeBFtLZ8Yi1Hk07DiOqzvwLD/4hln4iahvFlag=
|
||||
golang.org/x/tools v0.0.0-20201211185031-d93e913c1a58/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
|
||||
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
|
|
6
main.go
6
main.go
|
@ -18,12 +18,12 @@ import (
|
|||
"github.com/astaxie/beego"
|
||||
"github.com/astaxie/beego/plugins/cors"
|
||||
_ "github.com/astaxie/beego/session/redis"
|
||||
"github.com/open-ct/openscore/models"
|
||||
routers "github.com/open-ct/openscore/routers"
|
||||
"github.com/open-ct/openscore/model"
|
||||
"github.com/open-ct/openscore/routers"
|
||||
)
|
||||
|
||||
func main() {
|
||||
models.InitAdapter()
|
||||
model.InitAdapter()
|
||||
|
||||
beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{
|
||||
AllowOrigins: []string{"*"},
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package models
|
||||
package model
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
@ -132,14 +132,6 @@ func (a *Adapter) createTable() {
|
|||
panic(err)
|
||||
}
|
||||
|
||||
err = a.engine.Sync2(new(PaperDistribution))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
err = a.engine.Sync2(new(Subject))
|
||||
if err != nil {
|
||||
panic(err)
|
|
@ -1,4 +1,4 @@
|
|||
package models
|
||||
package model
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
@ -8,15 +8,15 @@ import (
|
|||
)
|
||||
|
||||
type ScoreRecord struct {
|
||||
Record_id int64 `json:"record_id" xorm:"pk autoincr"`
|
||||
Question_id int64 `json:"question_id"`
|
||||
Test_id int64 `json:"test_id"`
|
||||
User_id string `json:"user_id"`
|
||||
Score_time time.Time `json:"score_time"`
|
||||
RecordId int64 `json:"record_id" xorm:"pk autoincr"`
|
||||
QuestionId int64 `json:"question_id"`
|
||||
TestId int64 `json:"test_id"`
|
||||
UserId int64 `json:"user_id"`
|
||||
ScoreTime time.Time `json:"score_time"`
|
||||
Score int64 `json:"score"`
|
||||
Test_record_type int64 `json:"test_record_type"`
|
||||
Problem_type int64 `json:"problem_type" xorm:"default(-1)"`
|
||||
Test_finish int64 `json:"testFinish"`
|
||||
TestRecordType int64 `json:"test_record_type"`
|
||||
ProblemType int64 `json:"problem_type" xorm:"default(-1)"`
|
||||
TestFinish int64 `json:"test_finish"`
|
||||
}
|
||||
|
||||
func (s *ScoreRecord) GetTopic(id int64) error {
|
||||
|
@ -26,22 +26,24 @@ func (s *ScoreRecord) GetTopic(id int64) error {
|
|||
}
|
||||
return err
|
||||
}
|
||||
func (s *ScoreRecord) GetRecordByTestId(testId int64, userId string) error {
|
||||
|
||||
func (s *ScoreRecord) GetRecordByTestId(testId int64, userId int64) error {
|
||||
has, err := adapter.engine.Where(builder.Eq{"test_id": testId}).Where("user_id=?", userId).Where("test_record_type !=0").Get(s)
|
||||
if !has || err != nil {
|
||||
log.Println("could not find user")
|
||||
}
|
||||
return err
|
||||
}
|
||||
func (r *ScoreRecord) Save() error {
|
||||
code, err := adapter.engine.Insert(r)
|
||||
|
||||
func (s *ScoreRecord) Save() error {
|
||||
code, err := adapter.engine.Insert(s)
|
||||
if code == 0 || err != nil {
|
||||
log.Println("insert record fail")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func GetLatestRecords(userId string, records *[]ScoreRecord) error {
|
||||
func GetLatestRecords(userId int64, records *[]ScoreRecord) error {
|
||||
err := adapter.engine.Limit(10).Table("score_record").Select("test_id, score, score_time").Where(builder.Eq{"user_id": userId}).Where("test_record_type=1 or test_record_type=2 or test_record_type=3").Desc("record_id").Find(records)
|
||||
if err != nil {
|
||||
log.Panic(err)
|
||||
|
@ -50,6 +52,7 @@ func GetLatestRecords(userId string, records *[]ScoreRecord) error {
|
|||
|
||||
return err
|
||||
}
|
||||
|
||||
func CountProblemFinishNumberByQuestionId(questionId int64) (count int64, err error) {
|
||||
record := new(ScoreRecord)
|
||||
count, err1 := adapter.engine.Where("question_id = ?", questionId).Where("test_record_type=?", 6).Count(record)
|
||||
|
@ -58,7 +61,8 @@ func CountProblemFinishNumberByQuestionId(questionId int64) (count int64, err er
|
|||
}
|
||||
return count, err1
|
||||
}
|
||||
func CountSelfScore(userId string, questionId int64) (count int64, err error) {
|
||||
|
||||
func CountSelfScore(userId int64, questionId int64) (count int64, err error) {
|
||||
record := new(ScoreRecord)
|
||||
count, err1 := adapter.engine.Where("question_id = ?", questionId).Where("test_record_type=0").Where("user_id=?", userId).Count(record)
|
||||
if err != nil {
|
||||
|
@ -67,7 +71,7 @@ func CountSelfScore(userId string, questionId int64) (count int64, err error) {
|
|||
return count, err1
|
||||
}
|
||||
|
||||
//func CountFailTestNumberByUserId(userId string,questionId int64)(count int64,err error) {
|
||||
// func CountFailTestNumberByUserId(userId int64,questionId int64)(count int64,err error) {
|
||||
// record :=new (ScoreRecord)
|
||||
// count, err1 := adapter.engine.Where("question_id = ?", questionId).Where("test_record_type=5").Where("user_id=?", userId).Count(record)
|
||||
// if err!=nil {
|
||||
|
@ -75,6 +79,7 @@ func CountSelfScore(userId string, questionId int64) (count int64, err error) {
|
|||
// }
|
||||
// return count,err1
|
||||
// }
|
||||
|
||||
func CountProblemNumberByQuestionId(questionId int64) (count int64) {
|
||||
record := new(ScoreRecord)
|
||||
count, err := adapter.engine.Where("question_id = ?", questionId).Where("test_record_type=?", 5).Count(record)
|
||||
|
@ -83,6 +88,7 @@ func CountProblemNumberByQuestionId(questionId int64) (count int64) {
|
|||
}
|
||||
return count
|
||||
}
|
||||
|
||||
func CountArbitramentFinishNumberByQuestionId(questionId int64) (count int64, err error) {
|
||||
record := new(ScoreRecord)
|
||||
count, err1 := adapter.engine.Where("question_id = ?", questionId).Where("test_record_type=?", 4).Count(record)
|
||||
|
@ -92,7 +98,7 @@ func CountArbitramentFinishNumberByQuestionId(questionId int64) (count int64, er
|
|||
return count, err1
|
||||
}
|
||||
|
||||
//func CountFinishScoreNumberByUserId(userId string,questionId int64)(count int64 ,err error) {
|
||||
// func CountFinishScoreNumberByUserId(userId int64,questionId int64)(count int64 ,err error) {
|
||||
// record :=new (ScoreRecord)
|
||||
// count, err1 := adapter.engine.Where("question_id = ?", questionId).Where("user_id =?",userId).Where("test_finish=1").Count(record)
|
||||
// if err1!=nil {
|
||||
|
@ -109,6 +115,7 @@ func CountFinishScoreNumberByQuestionId(questionId int64) (count int64, err erro
|
|||
}
|
||||
return count, err1
|
||||
}
|
||||
|
||||
func FindFinishScoreByQuestionId(finishScores *[]ScoreRecord, questionId int64) error {
|
||||
err := adapter.engine.Where("question_id = ?", questionId).Where("test_finish=1").Find(*finishScores)
|
||||
if err != nil {
|
||||
|
@ -116,22 +123,24 @@ func FindFinishScoreByQuestionId(finishScores *[]ScoreRecord, questionId int64)
|
|||
}
|
||||
return err
|
||||
}
|
||||
func FindFinishTestByUserId(scoreRecord *[]ScoreRecord, userId string, questionId int64) (err error) {
|
||||
err1 := adapter.engine.Where("question_id = ?", questionId).Where("user_id=?", userId).Where("test_record_type =1 or test_record_type =2 ").Where("test_finish=1").Find(scoreRecord)
|
||||
|
||||
func FindFinishTestByUserId(scoreRecord *[]ScoreRecord, userId int64, questionId int64) error {
|
||||
err := adapter.engine.Where("question_id = ?", questionId).Where("user_id=?", userId).Where("test_record_type =1 or test_record_type =2 ").Where("test_finish=1").Find(scoreRecord)
|
||||
if err != nil {
|
||||
log.Println("FindFinishTestNumberByUserId err ")
|
||||
}
|
||||
return err1
|
||||
return err
|
||||
}
|
||||
|
||||
func CountFirstScoreNumberByQuestionId(questionId int64) (count int64, err error) {
|
||||
func CountFirstScoreNumberByQuestionId(questionId int64) (int64, error) {
|
||||
record := new(ScoreRecord)
|
||||
count, err1 := adapter.engine.Where("question_id = ?", questionId).Where("test_record_type=1 or test_record_type=2 ").Where("test_finish=1").Count(record)
|
||||
count, err := adapter.engine.Where("question_id = ?", questionId).Where("test_record_type=1 or test_record_type=2 ").Where("test_finish=1").Count(record)
|
||||
if err != nil {
|
||||
log.Println("CountFirstScoreNumberByQuestionId err ")
|
||||
}
|
||||
return count, err1
|
||||
return count, err
|
||||
}
|
||||
|
||||
func CountSecondScoreNumberByQuestionId(questionId int64) (count int64, err error) {
|
||||
record := new(ScoreRecord)
|
||||
count, err1 := adapter.engine.Where("question_id = ?", questionId).Where("test_record_type=1 or test_record_type=2 ").Where("test_finish=1").Count(record)
|
||||
|
@ -140,6 +149,7 @@ func CountSecondScoreNumberByQuestionId(questionId int64) (count int64, err erro
|
|||
}
|
||||
return count, err1
|
||||
}
|
||||
|
||||
func CountThirdScoreNumberByQuestionId(questionId int64) (count int64, err error) {
|
||||
record := new(ScoreRecord)
|
||||
count, err1 := adapter.engine.Where("question_id = ?", questionId).Where("test_record_type=1 or test_record_type=2 ").Where("test_finish=1").Count(record)
|
||||
|
@ -149,7 +159,7 @@ func CountThirdScoreNumberByQuestionId(questionId int64) (count int64, err error
|
|||
return count, err1
|
||||
}
|
||||
|
||||
func CountTestScoreNumberByUserId(userId string, questionId int64) (count int64, err1 error) {
|
||||
func CountTestScoreNumberByUserId(userId int64, questionId int64) (count int64, err1 error) {
|
||||
record := new(ScoreRecord)
|
||||
count, err := adapter.engine.Where("question_id = ?", questionId).Where("test_record_type=1 or test_record_type=2 ").Where("user_id=?", userId).Count(record)
|
||||
if err != nil {
|
||||
|
@ -157,7 +167,8 @@ func CountTestScoreNumberByUserId(userId string, questionId int64) (count int64,
|
|||
}
|
||||
return count, err
|
||||
}
|
||||
func SumFinishScore(userId string, questionId int64) (sum float64, err1 error) {
|
||||
|
||||
func SumFinishScore(userId int64, questionId int64) (sum float64, err1 error) {
|
||||
record := new(ScoreRecord)
|
||||
sum, err := adapter.engine.Where("question_id = ?", questionId).Where("test_record_type=1 or test_record_type=2 ").Where("user_id=?", userId).Sum(record, "score")
|
||||
if err != nil {
|
||||
|
@ -165,6 +176,21 @@ func SumFinishScore(userId string, questionId int64) (sum float64, err1 error) {
|
|||
}
|
||||
return sum, err
|
||||
}
|
||||
|
||||
func AverageFinishScore(userId int64) (float64, error) {
|
||||
record := new(ScoreRecord)
|
||||
sum, err := adapter.engine.Where("test_record_type=1 or test_record_type=2 ").Where("user_id = ?", userId).Sum(record, "score")
|
||||
if err != nil {
|
||||
log.Println("SumFinishScore err ")
|
||||
}
|
||||
num, err := adapter.engine.Where("test_record_type=1 or test_record_type=2 ").Where("user_id = ?", userId).Count(record)
|
||||
|
||||
if num == 0 {
|
||||
return 0, err
|
||||
}
|
||||
return sum / float64(num), err
|
||||
}
|
||||
|
||||
func FindFinishScoreRecordListByQuestionId(scoreRecordList *[]ScoreRecord, questionId int64) error {
|
||||
err := adapter.engine.Where("question_id = ?", questionId).Where("test_record_type=1 or test_record_type=2 ").Find(scoreRecordList)
|
||||
if err != nil {
|
||||
|
@ -173,15 +199,15 @@ func FindFinishScoreRecordListByQuestionId(scoreRecordList *[]ScoreRecord, quest
|
|||
return err
|
||||
}
|
||||
|
||||
func FindSelfScoreRecordByUserId(selfScoreRecord *[]ScoreRecord, examinerId string) error {
|
||||
func FindSelfScoreRecordByUserId(selfScoreRecord *[]ScoreRecord, examinerId int64) error {
|
||||
|
||||
err := adapter.engine.Where("user_id=?", examinerId).Where("test_record_type =?", 0).Find(selfScoreRecord)
|
||||
if err != nil {
|
||||
log.Println("FindSelfScoreRecordByUserId err ")
|
||||
}
|
||||
return err
|
||||
|
||||
}
|
||||
|
||||
func GetTestScoreRecordByTestIdAndUserId(testScoreRecord *ScoreRecord, testId int64, examinerId string) error {
|
||||
|
||||
_, err := adapter.engine.Where("user_id=?", examinerId).Where("test_id =?", testId).Where(" test_score_type !=?", 0).Get(testScoreRecord)
|
||||
|
@ -190,6 +216,7 @@ func GetTestScoreRecordByTestIdAndUserId(testScoreRecord *ScoreRecord, testId in
|
|||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func CountTestByScore(question int64, score int64) (count int64, err1 error) {
|
||||
scoreRecord := new(ScoreRecord)
|
||||
count, err := adapter.engine.Where("score = ?", score).Where("test_record_type=1 or test_record_type=2 ").Where("question_id=?", question).Count(scoreRecord)
|
||||
|
@ -200,10 +227,16 @@ func CountTestByScore(question int64, score int64) (count int64, err1 error) {
|
|||
}
|
||||
|
||||
func (s *ScoreRecord) Update() error {
|
||||
code, err := adapter.engine.Where(builder.Eq{"test_id": s.Test_id}).Update(s)
|
||||
code, err := adapter.engine.Where(builder.Eq{"test_id": s.TestId}).Update(s)
|
||||
if code == 0 || err != nil {
|
||||
log.Println("update ScoreRecord fail")
|
||||
log.Printf("%+v", err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func ListScoreRecordByUserId(userId int64) ([]ScoreRecord, error) {
|
||||
var records []ScoreRecord
|
||||
err := adapter.engine.Where(builder.Eq{"user_id": userId}).Find(&records)
|
||||
return records, err
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
package model
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"xorm.io/builder"
|
||||
)
|
||||
|
||||
type SubTopic struct {
|
||||
QuestionDetailId int64 `json:"question_detail_id" xorm:"pk autoincr"`
|
||||
QuestionDetailName string `json:"question_detail_name"`
|
||||
QuestionId int64 `json:"question_id"`
|
||||
QuestionDetailScore int64 `json:"question_detail_score"`
|
||||
ScoreType string `json:"score_type"`
|
||||
}
|
||||
|
||||
func FindSubTopicsByQuestionId(id int64, st *[]SubTopic) error {
|
||||
err := adapter.engine.Where("question_id = ?", id).Find(st)
|
||||
if err != nil {
|
||||
log.Println("could not find any SubTopic")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func GetSubTopicsByTestId(id int64, st *[]SubTopic) error {
|
||||
err := adapter.engine.Where(builder.Eq{"question_id": id}).Find(st)
|
||||
if err != nil {
|
||||
log.Println("could not find any SubTopic")
|
||||
log.Println(err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *SubTopic) GetSubTopic(id int64) error {
|
||||
has, err := adapter.engine.Where(builder.Eq{"question_detail_id": id}).Get(s)
|
||||
if !has || err != nil {
|
||||
log.Println("could not find SubTopic")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func InsertSubTopic(subTopic *SubTopic) error {
|
||||
_, err := adapter.engine.Insert(subTopic)
|
||||
if err != nil {
|
||||
log.Println("GetTopicList err ")
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *SubTopic) Delete() error {
|
||||
_, err := adapter.engine.Where("question_detail_id = ?", s.QuestionDetailId).Delete(s)
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *SubTopic) Update() error {
|
||||
code, err := adapter.engine.Where(builder.Eq{"question_detail_id": s.QuestionDetailId}).Update(s)
|
||||
if code == 0 || err != nil {
|
||||
log.Println("update subTopic fail")
|
||||
log.Printf("%+v", err)
|
||||
}
|
||||
return err
|
||||
}
|
|
@ -1,11 +1,9 @@
|
|||
package models
|
||||
package model
|
||||
|
||||
import (
|
||||
"log"
|
||||
)
|
||||
import "log"
|
||||
|
||||
type Subject struct {
|
||||
SubjectId int64 `json:"subjectId" xorm:"pk autoincr"`
|
||||
SubjectId int64 `json:"subject_id" xorm:"pk autoincr"`
|
||||
SubjectName string `json:"subject_name"`
|
||||
}
|
||||
|
||||
|
@ -25,6 +23,7 @@ func InsertSubject(subject *Subject) (err1 error, questionId int64) {
|
|||
|
||||
return err, subject.SubjectId
|
||||
}
|
||||
|
||||
func GetSubjectBySubjectName(subject *Subject, subjectName string) (bool, error) {
|
||||
get, err := adapter.engine.Where("subject_name=?", subjectName).Get(subject)
|
||||
if err != nil {
|
||||
|
@ -32,3 +31,13 @@ func GetSubjectBySubjectName(subject *Subject, subjectName string) (bool, error)
|
|||
}
|
||||
return get, err
|
||||
}
|
||||
|
||||
func GetSubjectById(id int64) (string, error) {
|
||||
subject := &Subject{}
|
||||
ok, err := adapter.engine.Where("subject_id = ?", id).Get(subject)
|
||||
if err != nil || !ok {
|
||||
log.Println("GetSubjectById err")
|
||||
}
|
||||
|
||||
return subject.SubjectName, err
|
||||
}
|
|
@ -0,0 +1,146 @@
|
|||
package model
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"xorm.io/builder"
|
||||
)
|
||||
|
||||
type TestPaper struct {
|
||||
TestId int64 `json:"test_id" xorm:"pk autoincr"`
|
||||
QuestionId int64 `json:"question_id"`
|
||||
Candidate string `json:"candidate"`
|
||||
QuestionStatus int64 `json:"question_status"`
|
||||
ExaminerFirstId int64 `json:"examiner_first_id" xorm:"default(-1)"`
|
||||
ExaminerFirstScore int64 `json:"examiner_first_score" xorm:"default(-1)"`
|
||||
ExaminerFirstSelfScore int64 `json:"examiner_first_self_score" xorm:"default(-1)"`
|
||||
ExaminerSecondId int64 `json:"examiner_second_id" xorm:"default(-1)"`
|
||||
ExaminerSecondScore int64 `json:"examiner_second_score" xorm:"default(-1)"`
|
||||
ExaminerSecondSelfScore int64 `json:"examiner_second_self_score" xorm:"default(-1)"`
|
||||
ExaminerThirdId int64 `json:"examiner_third_id" xorm:"default(-1)"`
|
||||
ExaminerThirdScore int64 `json:"examiner_third_score" xorm:"default(-1)"`
|
||||
ExaminerThirdSelfScore int64 `json:"examiner_third_self_score" xorm:"default(-1)"`
|
||||
LeaderId int64 `json:"leader_id" xorm:"default(-1)"`
|
||||
LeaderScore int64 `json:"leader_score" xorm:"default(-1)"`
|
||||
FinalScore int64 `json:"final_score" xorm:"default(-1)" `
|
||||
FinalScoreId int64 `json:"finale_score_id"`
|
||||
PracticeError int64 `json:"practice_error"`
|
||||
CorrectingNumber int64 `json:"correcting_number"`
|
||||
Mobile string `json:"mobile"`
|
||||
IsParent int64 `json:"is_parent"`
|
||||
ClientIp string `json:"client_ip"`
|
||||
Tag string `json:"tag"`
|
||||
School string `json:"school"`
|
||||
TicketId string `json:"ticket_id"`
|
||||
}
|
||||
|
||||
func (t *TestPaper) GetTestPaperByQuestionIdAndQuestionStatus(questionId int64, questionStatue int64) error {
|
||||
has, err := adapter.engine.Where("question_id = ? and question_status = ?", questionId, questionStatue).Get(t)
|
||||
if !has || err != nil {
|
||||
log.Println("could not specific test")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (t *TestPaper) GetTestPaperByTestId(testId int64) error {
|
||||
has, err := adapter.engine.Where("test_id = ?", testId).Get(t)
|
||||
if !has || err != nil {
|
||||
log.Println("could not GetTestPaperByTestId")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func GetTestPaperListByQuestionIdAndQuestionStatus(questionId int64, questionStatue int64, tl *[]TestPaper) error {
|
||||
err := adapter.engine.Where("question_id = ? and question_status = ?", questionId, questionStatue).Find(tl)
|
||||
if err != nil {
|
||||
log.Println("could not specific test")
|
||||
log.Println(err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (t *TestPaper) GetTestPaper(id int64) (bool, error) {
|
||||
has, err := adapter.engine.Where(builder.Eq{"test_id": id}).Get(t)
|
||||
if !has || err != nil {
|
||||
log.Println("could not find test paper")
|
||||
}
|
||||
return has, err
|
||||
}
|
||||
|
||||
func (t *TestPaper) Update() error {
|
||||
code, err := adapter.engine.Where(builder.Eq{"test_id": t.TestId}).Update(t)
|
||||
if code == 0 || err != nil {
|
||||
log.Println("update test paper fail")
|
||||
log.Printf("%+v", err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (t *TestPaper) Insert() (int64, error) {
|
||||
code, err := adapter.engine.Insert(t)
|
||||
if code == 0 || err != nil {
|
||||
log.Println("insert test paper fail")
|
||||
log.Printf("%+v", err)
|
||||
}
|
||||
return t.TestId, err
|
||||
}
|
||||
|
||||
func FindTestPaperByQuestionId(questionId int64, t *[]TestPaper) error {
|
||||
err := adapter.engine.Where("question_id = ?", questionId).Find(t)
|
||||
if err != nil {
|
||||
log.Println("could not FindTestPaperByQuestionId ")
|
||||
log.Println(err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
func FindTestPapersByTestId(testId, t *[]TestPaper) error {
|
||||
err := adapter.engine.Where("question_id = ?", testId).Find(t)
|
||||
if err != nil {
|
||||
log.Println("could not FindTestPaperByQuestionId ")
|
||||
log.Println(err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func FindUnDistributeTestLimit1(id int64) ([]TestPaper, error) {
|
||||
var papers []TestPaper
|
||||
err := adapter.engine.Where("correcting_number = 0 AND question_id = ?", id).Find(&papers)
|
||||
if err != nil {
|
||||
log.Println("could not GetUnDistributeTest")
|
||||
}
|
||||
return papers, err
|
||||
}
|
||||
|
||||
func FindUnDistributeTestLimit2(id int64) ([]TestPaper, error) {
|
||||
var papers []TestPaper
|
||||
err := adapter.engine.Where("(correcting_number = 0 OR correcting_number = 1) AND question_id = ?", id).Find(&papers)
|
||||
if err != nil {
|
||||
log.Println("could not GetUnDistributeTest")
|
||||
}
|
||||
return papers, err
|
||||
}
|
||||
|
||||
func CountFailTestNumberByUserId(userId int64, questionId int64) (count int64, err error) {
|
||||
testPaper := new(TestPaper)
|
||||
count, err1 := adapter.engine.Where("question_id = ?", questionId).Where("examiner_first_id=? or examiner_second_id=?", userId, userId).Where("question_status=2 or question_status=3 ").Count(testPaper)
|
||||
if err != nil {
|
||||
log.Println("CountFailTestNumberByUserId err ")
|
||||
}
|
||||
return count, err1
|
||||
}
|
||||
|
||||
func DeleteAllTest(questionId int64) error {
|
||||
_, err := adapter.engine.Delete(&TestPaper{QuestionId: questionId})
|
||||
if err != nil {
|
||||
log.Println("delete fail")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (t *TestPaper) UpdateCols(columns ...string) error {
|
||||
_, err := adapter.engine.ID(t.TestId).Cols(columns...).Update(t)
|
||||
if err != nil {
|
||||
log.Println("could not Update TestPaper")
|
||||
}
|
||||
return err
|
||||
}
|
|
@ -1,29 +1,31 @@
|
|||
package models
|
||||
package model
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"xorm.io/builder"
|
||||
)
|
||||
|
||||
type TestPaperInfo struct {
|
||||
Test_detail_id int64 `json:"test_detail_id" xorm:"pk autoincr"`
|
||||
Question_detail_id int64 `json:"question_detail_id"`
|
||||
Test_id int64 `json:"test_id"`
|
||||
Pic_src string `json:"pic_src"`
|
||||
Examiner_first_id string `json:"examiner_first_id" xorm:"default('-1')"`
|
||||
Examiner_first_score int64 `json:"examiner_first_score" xorm:"default(-1)"`
|
||||
Examiner_first_self_score int64 `json:"examiner_first_self_score" xorm:"default(-1)"`
|
||||
Examiner_second_id string `json:"examiner_second_id" xorm:"default('-1')"`
|
||||
Examiner_second_score int64 `json:"examiner_second_score" xorm:"default(-1)"`
|
||||
Examiner_second_self_score int64 `json:"examiner_second_self_score" xorm:"default(-1)"`
|
||||
Examiner_third_id string `json:"examiner_third_id" xorm:"default('-1')"`
|
||||
Examiner_third_score int64 `json:"examiner_third_score" xorm:"default(-1)"`
|
||||
Examiner_third_self_score int64 `json:"examiner_third_self_score" xorm:"default(-1)"`
|
||||
Leader_id string `json:"leader_id" xorm:"default('-1')"`
|
||||
Leader_score int64 `json:"leader_score" xorm:"default(-1)"`
|
||||
Final_score int64 `json:"finale_score" xorm:"default(-1)"`
|
||||
Final_score_id string `json:"final_score_id" xorm:"default('-1')"`
|
||||
TestDetailId int64 `json:"test_detail_id" xorm:"pk autoincr"`
|
||||
QuestionDetailId int64 `json:"question_detail_id"`
|
||||
TestId int64 `json:"test_id"`
|
||||
PicSrc string `json:"pic_src"`
|
||||
ExaminerFirstId int64 `json:"examiner_first_id" xorm:"default(-1)"`
|
||||
ExaminerFirstScore int64 `json:"examiner_first_score" xorm:"default(-1)"`
|
||||
ExaminerFirstSelfScore int64 `json:"examiner_first_self_score" xorm:"default(-1)"`
|
||||
ExaminerSecondId int64 `json:"examiner_second_id" xorm:"default(-1)"`
|
||||
ExaminerSecondScore int64 `json:"examiner_second_score" xorm:"default(-1)"`
|
||||
ExaminerSecondSelfScore int64 `json:"examiner_second_self_score" xorm:"default(-1)"`
|
||||
ExaminerThirdId int64 `json:"examiner_third_id" xorm:"default(-1)"`
|
||||
ExaminerThirdScore int64 `json:"examiner_third_score" xorm:"default(-1)"`
|
||||
ExaminerThirdSelfScore int64 `json:"examiner_third_self_score" xorm:"default(-1)"`
|
||||
LeaderId int64 `json:"leader_id" xorm:"default(-1)"`
|
||||
LeaderScore int64 `json:"leader_score" xorm:"default(-1)"`
|
||||
FinalScore int64 `json:"finale_score" xorm:"default(-1)"`
|
||||
FinalScoreId int64 `json:"final_score_id" xorm:"default(-1)"`
|
||||
TicketId string `json:"ticket_id"`
|
||||
}
|
||||
|
||||
func (t *TestPaperInfo) GetTestPaperInfoByTestIdAndQuestionDetailId(testId int64, questionDetailId int64) error {
|
||||
|
@ -44,7 +46,7 @@ func (t *TestPaperInfo) GetTestPaperInfo(id int64) error {
|
|||
}
|
||||
|
||||
func (t *TestPaperInfo) Update() error {
|
||||
code, err := adapter.engine.Where(builder.Eq{"test_detail_id": t.Test_detail_id}).AllCols().Update(t)
|
||||
code, err := adapter.engine.Where(builder.Eq{"test_detail_id": t.TestDetailId}).AllCols().Update(t)
|
||||
if code == 0 && err != nil {
|
||||
log.Println("update test paper info fail")
|
||||
log.Println(err)
|
||||
|
@ -84,8 +86,20 @@ func FindTestPaperInfoByQuestionDetailId(questionDetailId int64, t *[]TestPaperI
|
|||
}
|
||||
return err
|
||||
}
|
||||
func (u *TestPaperInfo) Delete() error {
|
||||
_, err := adapter.engine.Where(builder.Eq{"test_id": u.Test_id}).Delete(u)
|
||||
|
||||
func FindTestPaperInfoByTicketId(ticketId string) ([]*TestPaperInfo, error) {
|
||||
var infos []*TestPaperInfo
|
||||
err := adapter.engine.Where("ticket_id = ?", ticketId).Find(&infos)
|
||||
fmt.Println("ticketId: ", ticketId, len(infos))
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return infos, nil
|
||||
}
|
||||
|
||||
func (t *TestPaperInfo) Delete() error {
|
||||
_, err := adapter.engine.Where(builder.Eq{"test_id": t.TestId}).Delete(t)
|
||||
if err != nil {
|
||||
log.Println("delete fail")
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package models
|
||||
package model
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
@ -11,15 +11,15 @@ import (
|
|||
// struct : Topic(大题)
|
||||
// comment: must capitalize the first letter of the field in Topic
|
||||
type Topic struct {
|
||||
Question_id int64 `json:"question_id" xorm:"pk autoincr"`
|
||||
Question_name string `json:"question_name" xorm:"varchar(50)"`
|
||||
Subject_name string `json:"subject_name" xorm:"varchar(50)"`
|
||||
Standard_error int64 `json:"standard_error"`
|
||||
Question_score int64 `json:"quetsion_score"`
|
||||
Score_type int64 `json:"score_type"`
|
||||
Import_number int64 `json:"import_number"`
|
||||
Import_time time.Time `json:"import_time"`
|
||||
Subject_Id int64 `json:"subject_id"`
|
||||
QuestionId int64 `json:"question_id" xorm:"pk autoincr"`
|
||||
QuestionName string `json:"question_name" xorm:"varchar(50)"`
|
||||
SubjectName string `json:"subject_name" xorm:"varchar(50)"`
|
||||
StandardError int64 `json:"standard_error"`
|
||||
QuestionScore int64 `json:"question_score"`
|
||||
ScoreType int64 `json:"score_type"`
|
||||
ImportNumber int64 `json:"import_number"`
|
||||
ImportTime time.Time `json:"import_time"`
|
||||
SubjectId int64 `json:"subject_id"`
|
||||
SelfScoreRate int64 `json:"self_score_rate"`
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,7 @@ func GetTopicList(topics *[]Topic) error {
|
|||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func FindTopicBySubNameList(topics *[]Topic, subjectName string) error {
|
||||
err := adapter.engine.Where("subject_name=?", subjectName).Find(topics)
|
||||
if err != nil {
|
||||
|
@ -45,6 +46,7 @@ func FindTopicBySubNameList(topics *[]Topic, subjectName string) error {
|
|||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func FindTopicList(topics *[]Topic) error {
|
||||
err := adapter.engine.Find(topics)
|
||||
if err != nil {
|
||||
|
@ -58,7 +60,7 @@ func InsertTopic(topic *Topic) (err1 error, questionId int64) {
|
|||
log.Println("GetTopicList err ")
|
||||
}
|
||||
|
||||
return err, topic.Question_id
|
||||
return err, topic.QuestionId
|
||||
}
|
||||
|
||||
// func Update ( topic *Topic,questionId int64)error {
|
||||
|
@ -70,10 +72,15 @@ func InsertTopic(topic *Topic) (err1 error, questionId int64) {
|
|||
// return err
|
||||
// }
|
||||
func (t *Topic) Update() error {
|
||||
code, err := adapter.engine.Where(builder.Eq{"question_id": t.Question_id}).Update(t)
|
||||
code, err := adapter.engine.Where(builder.Eq{"question_id": t.QuestionId}).Update(t)
|
||||
if code == 0 || err != nil {
|
||||
log.Println("update Topic paper fail")
|
||||
log.Println("update Topic fail")
|
||||
log.Printf("%+v", err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (t *Topic) Delete() error {
|
||||
_, err := adapter.engine.Where("question_id = ?", t.QuestionId).Delete(t)
|
||||
return err
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package models
|
||||
package model
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
@ -7,17 +7,17 @@ import (
|
|||
)
|
||||
|
||||
type UnderCorrectedPaper struct {
|
||||
UnderCorrected_id int64 `json:"underCorrected_id" xorm:"pk autoincr"`
|
||||
User_id string `json:"user_id"`
|
||||
Test_id int64 `json:"test_id"`
|
||||
Question_id int64 `json:"question_id"`
|
||||
Test_question_type int64 `json:"test_question_type"`
|
||||
Problem_type int64 `json:"problem_type" xorm:"default(-1)"`
|
||||
Problem_message string `json:"test_message"`
|
||||
Self_score_id string `json:"self_score_id"`
|
||||
UnderCorrectedId int64 `json:"under_corrected_id" xorm:"pk autoincr"`
|
||||
UserId int64 `json:"user_id"`
|
||||
TestId int64 `json:"test_id"`
|
||||
QuestionId int64 `json:"question_id"`
|
||||
TestQuestionType int64 `json:"test_question_type"`
|
||||
ProblemType int64 `json:"problem_type" xorm:"default(-1)"`
|
||||
ProblemMessage string `json:"test_message"`
|
||||
SelfScoreId int64 `json:"self_score_id"`
|
||||
}
|
||||
|
||||
func (u *UnderCorrectedPaper) GetUnderCorrectedPaper(userId string, testId int64) error {
|
||||
func (u *UnderCorrectedPaper) GetUnderCorrectedPaper(userId int64, testId int64) error {
|
||||
has, err := adapter.engine.Where("test_id=?", testId).Where("user_id =?", userId).Get(u)
|
||||
if !has || err != nil {
|
||||
log.Println("could not find under corrected paper")
|
||||
|
@ -27,21 +27,28 @@ func (u *UnderCorrectedPaper) GetUnderCorrectedPaper(userId string, testId int64
|
|||
}
|
||||
|
||||
func (u *UnderCorrectedPaper) Delete() error {
|
||||
code, err := adapter.engine.Where(builder.Eq{"test_id": u.Test_id, "user_id": u.User_id}).Delete(u)
|
||||
code, err := adapter.engine.Where(builder.Eq{"test_id": u.TestId, "user_id": u.UserId}).Delete(u)
|
||||
if code == 0 || err != nil {
|
||||
log.Println("delete fail")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func DeleteUnderCorrectedPaperByUserId(userId int64) error {
|
||||
_, err := adapter.engine.Delete(&UnderCorrectedPaper{UserId: userId})
|
||||
return err
|
||||
}
|
||||
|
||||
func (u *UnderCorrectedPaper) SupervisorDelete() error {
|
||||
code, err := adapter.engine.Where(builder.Eq{"test_id": u.Test_id}).Where(" test_question_type =4 or test_question_type =6 or test_question_type =7").Delete(u)
|
||||
code, err := adapter.engine.Where(builder.Eq{"test_id": u.TestId}).Where(" test_question_type =4 or test_question_type =6 or test_question_type =7").Delete(u)
|
||||
if code == 0 || err != nil {
|
||||
log.Println("delete fail")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (u *UnderCorrectedPaper) SelfMarkDelete() error {
|
||||
code, err := adapter.engine.Where(builder.Eq{"test_id": u.Test_id}).Where(" test_question_type =0 ").Delete(u)
|
||||
code, err := adapter.engine.Where(builder.Eq{"test_id": u.TestId}).Where(" test_question_type =0 ").Delete(u)
|
||||
if code == 0 || err != nil {
|
||||
log.Println("delete fail")
|
||||
}
|
||||
|
@ -59,7 +66,7 @@ func (u *UnderCorrectedPaper) Save() error {
|
|||
|
||||
func (u *UnderCorrectedPaper) IsDuplicate() (bool, error) {
|
||||
var temp UnderCorrectedPaper
|
||||
has, err := adapter.engine.Where(builder.Eq{"test_id": u.Test_id, "problem_type": u.Problem_type}).Get(&temp)
|
||||
has, err := adapter.engine.Where(builder.Eq{"test_id": u.TestId, "problem_type": u.ProblemType}).Get(&temp)
|
||||
if !has || err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
|
@ -73,7 +80,8 @@ func GetDistributedPaperByUserId(id string, up *[]UnderCorrectedPaper) error {
|
|||
}
|
||||
return err
|
||||
}
|
||||
func CountRemainingTestNumberByUserId(questionId int64, userId string) (count int64, err error) {
|
||||
|
||||
func CountRemainingTestNumberByUserId(questionId int64, userId int64) (count int64, err error) {
|
||||
underCorrectedPaper := new(UnderCorrectedPaper)
|
||||
count, err1 := adapter.engine.Where("question_id = ?", questionId).Where("user_id=?", userId).Where("test_question_type=1 or test_question_type=2").Count(underCorrectedPaper)
|
||||
if err != nil {
|
||||
|
@ -81,6 +89,7 @@ func CountRemainingTestNumberByUserId(questionId int64, userId string) (count in
|
|||
}
|
||||
return count, err1
|
||||
}
|
||||
|
||||
func CountArbitramentUnFinishNumberByQuestionId(questionId int64) (count int64, err error) {
|
||||
underCorrectedPaper := new(UnderCorrectedPaper)
|
||||
count, err1 := adapter.engine.Where("question_id = ?", questionId).Where("test_question_type=4").Count(underCorrectedPaper)
|
||||
|
@ -89,6 +98,7 @@ func CountArbitramentUnFinishNumberByQuestionId(questionId int64) (count int64,
|
|||
}
|
||||
return count, err1
|
||||
}
|
||||
|
||||
func CountProblemUnFinishNumberByQuestionId(questionId int64) (count int64, err error) {
|
||||
underCorrectedPaper := new(UnderCorrectedPaper)
|
||||
count, err1 := adapter.engine.Where("question_id = ?", questionId).Where("test_question_type=6").Count(underCorrectedPaper)
|
||||
|
@ -97,6 +107,7 @@ func CountProblemUnFinishNumberByQuestionId(questionId int64) (count int64, err
|
|||
}
|
||||
return count, err1
|
||||
}
|
||||
|
||||
func CountUnScoreTestNumberByQuestionId(questionId int64) (count int64, err error) {
|
||||
underCorrectedPaper := new(UnderCorrectedPaper)
|
||||
count, err1 := adapter.engine.Where("question_id = ?", questionId).Count(underCorrectedPaper)
|
||||
|
@ -106,24 +117,23 @@ func CountUnScoreTestNumberByQuestionId(questionId int64) (count int64, err erro
|
|||
return count, err1
|
||||
}
|
||||
|
||||
func GetUnderCorrectedPaperByUserIdAndTestId(underCorrectedPaper *UnderCorrectedPaper, userId string, testId int64) error {
|
||||
|
||||
func GetUnderCorrectedPaperByUserIdAndTestId(underCorrectedPaper *UnderCorrectedPaper, userId int64, testId int64) error {
|
||||
_, err := adapter.engine.Where("user_id=?", userId).Where("test_id =?", testId).Where(" test_question_type !=?", 0).Get(underCorrectedPaper)
|
||||
if err != nil {
|
||||
log.Println("GetUnderCorrectedPaperByUserIdAndTestId err ")
|
||||
}
|
||||
return err
|
||||
}
|
||||
func GetUnderCorrectedSupervisorPaperByTestQuestionTypeAndTestId(underCorrectedPaper *UnderCorrectedPaper, testId int64) error {
|
||||
|
||||
func GetUnderCorrectedSupervisorPaperByTestQuestionTypeAndTestId(underCorrectedPaper *UnderCorrectedPaper, testId int64) error {
|
||||
_, err := adapter.engine.Where("test_id =?", testId).Where(" test_question_type =4 or test_question_type =6 or test_question_type =7").Get(underCorrectedPaper)
|
||||
if err != nil {
|
||||
log.Println("GetUnderCorrectedPaperByUserIdAndTestId err ")
|
||||
}
|
||||
return err
|
||||
}
|
||||
func GetSelfScorePaperByTestQuestionTypeAndTestId(underCorrectedPaper *UnderCorrectedPaper, testId int64, userId string) error {
|
||||
|
||||
func GetSelfScorePaperByTestQuestionTypeAndTestId(underCorrectedPaper *UnderCorrectedPaper, testId int64, userId int64) error {
|
||||
_, err := adapter.engine.Where("test_id =?", testId).Where(" test_question_type =0").Where("user_Id = ?", userId).Get(underCorrectedPaper)
|
||||
if err != nil {
|
||||
log.Println("GetSelfScorePaperByTestQuestionTypeAndTestId err ")
|
||||
|
@ -132,15 +142,14 @@ func GetSelfScorePaperByTestQuestionTypeAndTestId(underCorrectedPaper *UnderCorr
|
|||
}
|
||||
|
||||
func FindArbitramentUnderCorrectedPaperByQuestionId(arbitramentUnderCorrectedPaper *[]UnderCorrectedPaper, questionId int64) error {
|
||||
|
||||
err := adapter.engine.Where("question_id=?", questionId).Where(" test_question_type =?", 4).Find(arbitramentUnderCorrectedPaper)
|
||||
if err != nil {
|
||||
log.Println("FindArbitramentUnderCorrectedPaperByQuestionId err ")
|
||||
}
|
||||
return err
|
||||
}
|
||||
func FindAllArbitramentUnderCorrectedPaper(arbitramentUnderCorrectedPaper *[]UnderCorrectedPaper, questionId int64) error {
|
||||
|
||||
func FindAllArbitramentUnderCorrectedPaper(arbitramentUnderCorrectedPaper *[]UnderCorrectedPaper, questionId int64) error {
|
||||
err := adapter.engine.Where(" test_question_type =?", 4).Where("question_id= ?", questionId).Find(arbitramentUnderCorrectedPaper)
|
||||
if err != nil {
|
||||
log.Println("FindAllArbitramentUnderCorrectedPaper err ")
|
||||
|
@ -149,38 +158,38 @@ func FindAllArbitramentUnderCorrectedPaper(arbitramentUnderCorrectedPaper *[]Und
|
|||
}
|
||||
|
||||
func FindProblemUnderCorrectedPaperByQuestionId(problemUnderCorrectedPaper *[]UnderCorrectedPaper, questionId int64) error {
|
||||
|
||||
err := adapter.engine.Where("question_id=?", questionId).Where(" test_question_type =?", 6).Find(problemUnderCorrectedPaper)
|
||||
if err != nil {
|
||||
log.Println("FindProblemUnderCorrectedPaperByQuestionId err ")
|
||||
}
|
||||
return err
|
||||
}
|
||||
func FindSelfUnderCorrectedPaperByQuestionId(selfUnderCorrectedPaper *[]UnderCorrectedPaper, questionId int64) error {
|
||||
|
||||
func FindSelfUnderCorrectedPaperByQuestionId(selfUnderCorrectedPaper *[]UnderCorrectedPaper, questionId int64) error {
|
||||
err := adapter.engine.Where("question_id=?", questionId).Where(" test_question_type =?", 7).Find(selfUnderCorrectedPaper)
|
||||
if err != nil {
|
||||
log.Println("FindSelfUnderCorrectedPaperByQuestionId err ")
|
||||
}
|
||||
return err
|
||||
}
|
||||
func FindSelfMarkPaperByQuestionId(selfMarkUnderCorrectedPaper *[]UnderCorrectedPaper, questionId int64) error {
|
||||
|
||||
func FindSelfMarkPaperByQuestionId(selfMarkUnderCorrectedPaper *[]UnderCorrectedPaper, questionId int64) error {
|
||||
err := adapter.engine.Where("question_id=?", questionId).Where(" test_question_type =?", 7).Find(selfMarkUnderCorrectedPaper)
|
||||
if err != nil {
|
||||
log.Println("FindSelfMarkPaperByQuestionId err ")
|
||||
}
|
||||
return err
|
||||
}
|
||||
func FindProblemUnderCorrectedList(problemUnderCorrectedPaper *[]UnderCorrectedPaper) error {
|
||||
|
||||
func FindProblemUnderCorrectedList(problemUnderCorrectedPaper *[]UnderCorrectedPaper) error {
|
||||
err := adapter.engine.Where(" test_question_type =?", 6).Find(problemUnderCorrectedPaper)
|
||||
if err != nil {
|
||||
log.Println("FindProblemUnderCorrectedList err ")
|
||||
}
|
||||
return err
|
||||
}
|
||||
func GetDistributedTestIdPaperByUserId(id string, up *[]int64) error {
|
||||
|
||||
func GetDistributedTestIdPaperByUserId(id int64, up *[]int64) error {
|
||||
err := adapter.engine.Table("under_corrected_paper").Select("test_id").Where("user_id = ?", id).Where(" test_question_type=0 or test_question_type=1 or test_question_type=2 or test_question_type=3").Find(up)
|
||||
if err != nil {
|
||||
log.Panic(err)
|
||||
|
@ -188,7 +197,8 @@ func GetDistributedTestIdPaperByUserId(id string, up *[]int64) error {
|
|||
}
|
||||
return err
|
||||
}
|
||||
func GetUnMarkSelfTestIdPaperByUserId(id string, up *[]int64) error {
|
||||
|
||||
func GetUnMarkSelfTestIdPaperByUserId(id int64, up *[]int64) error {
|
||||
err := adapter.engine.Table("under_corrected_paper").Select("test_id").Where("user_id = ?", id).Where(" test_question_type=0 ").Find(up)
|
||||
if err != nil {
|
||||
log.Panic(err)
|
|
@ -0,0 +1,128 @@
|
|||
package model
|
||||
|
||||
import (
|
||||
"log"
|
||||
"math/rand"
|
||||
|
||||
"xorm.io/builder"
|
||||
)
|
||||
|
||||
type User struct {
|
||||
UserId int64 `json:"user_id" xorm:"pk autoincr"`
|
||||
Account string `json:"account" xorm:"unique"`
|
||||
UserName string `json:"user_name"`
|
||||
Password string `json:"password"`
|
||||
LoginTime string `json:"login_time"`
|
||||
ExistTime string `json:"exist_time"`
|
||||
OnlineTime int64 `json:"online_time"`
|
||||
SubjectName string `json:"subject_name"`
|
||||
IsOnlineStatus bool `json:"is_online_status"`
|
||||
QuestionId int64 `json:"question_id"`
|
||||
UserType int64 `json:"user_type"`
|
||||
}
|
||||
|
||||
func (u *User) Insert() error {
|
||||
code, err := adapter.engine.Insert(u)
|
||||
if code == 0 || err != nil {
|
||||
log.Println("insert user fail")
|
||||
log.Printf("%+v", err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (u *User) Delete() error {
|
||||
_, err := adapter.engine.Where("account = ?", u.Account).Delete(u)
|
||||
return err
|
||||
}
|
||||
|
||||
func (u *User) GetUser(id int64) error {
|
||||
has, err := adapter.engine.Where(builder.Eq{"user_id": id}).Get(u)
|
||||
if !has || err != nil {
|
||||
log.Println("could not found user")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func GetUserByAccount(account string) (*User, error) {
|
||||
u := &User{}
|
||||
has, err := adapter.engine.Where(builder.Eq{"account": account}).Get(u)
|
||||
if !has || err != nil {
|
||||
log.Println("could not found user by account")
|
||||
return nil, nil
|
||||
}
|
||||
return u, nil
|
||||
}
|
||||
|
||||
func (u *User) UpdateCols(columns ...string) error {
|
||||
_, err := adapter.engine.ID(u.UserId).Cols(columns...).Update(u)
|
||||
if err != nil {
|
||||
log.Println("could not Update user")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (u *User) Update() error {
|
||||
_, err := adapter.engine.Update(u)
|
||||
if err != nil {
|
||||
log.Println("could not Update user")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// func CountOnlineUserNumberByQuestionId(questionId int64) (int64, error) {
|
||||
// user := new(User)
|
||||
// count, err := adapter.engine.Where("is_online_status = 1").Where(" user_type = ?", 1).Where("is_distribute = ?", 1).Where("question_id=?", questionId).Count(user)
|
||||
// if err != nil {
|
||||
// log.Println("CountOnlineNumber err ")
|
||||
// }
|
||||
// return count, err
|
||||
// }
|
||||
//
|
||||
// func FindOnlineUserNumberByQuestionId(users *[]User, questionId int64) error {
|
||||
// return adapter.engine.Where("is_online_status = ? ", 1).Where(" user_type=?", 1).Where("is_distribute = ?", 1).Where("question_id=?", questionId).Find(users)
|
||||
// }
|
||||
|
||||
func FindUserNumberByQuestionId(users *[]User, questionId int64) error {
|
||||
return adapter.engine.Where(" user_type=?", 2).Where("question_id=?", questionId).Find(users)
|
||||
}
|
||||
|
||||
func FindNewUserId(id1 int64, id2 int64, questionId int64) (newId int64) {
|
||||
var Ids []int64
|
||||
err := adapter.engine.Table("user").Where("user_id !=?", id1).Where("user_id !=?", id2).Where("question_id=?", questionId).Where("is_online_status=?", 1).Select("user_id").Find(&Ids)
|
||||
if err != nil {
|
||||
log.Println("FindNewUserId err")
|
||||
log.Println(err)
|
||||
}
|
||||
k := rand.Intn(len(Ids) - 1)
|
||||
newId = Ids[k]
|
||||
return newId
|
||||
}
|
||||
|
||||
func (u *User) UpdateOnlineStatus(isOnline bool, time string) error {
|
||||
u.IsOnlineStatus = isOnline
|
||||
u.LoginTime = time
|
||||
|
||||
return u.UpdateCols("is_online_status", "login_time")
|
||||
}
|
||||
|
||||
func ListUsers() ([]*User, error) {
|
||||
var users []*User
|
||||
err := adapter.engine.Find(&users)
|
||||
return users, err
|
||||
}
|
||||
|
||||
func GetLastUserBySubject(subject string) *User {
|
||||
u := &User{}
|
||||
has, err := adapter.engine.Where(builder.Eq{"subject_name": subject}).Desc("user_id").Get(u)
|
||||
|
||||
if !has || err != nil {
|
||||
return nil
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func ListNormalUserByQuestionId(questionId int64) ([]User, error) {
|
||||
var users []User
|
||||
err := adapter.engine.Where("user_type = 2 AND question_id = ?", questionId).Find(&users)
|
||||
return users, err
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"xorm.io/builder"
|
||||
)
|
||||
|
||||
type PaperDistribution struct {
|
||||
Distribution_id int64 `json:"distribution_id" xorm:"pk autoincr"`
|
||||
User_id string `json:"user_id"`
|
||||
Question_id int64 `json:"question_id"`
|
||||
Test_distribution_number int64 `json:"test_distribution_number"`
|
||||
PaperType int64 `json:"paperType"`
|
||||
}
|
||||
|
||||
func (u *PaperDistribution) GetPaperDistribution(id string) error {
|
||||
has, err := adapter.engine.Where(builder.Eq{"user_id": id}).Get(u)
|
||||
if !has || err != nil {
|
||||
log.Println("could not find paper distribution")
|
||||
}
|
||||
return err
|
||||
}
|
||||
func FindPaperDistributionByQuestionId(paperDistributions *[]PaperDistribution, questionId int64) error {
|
||||
err := adapter.engine.Where("question_id = ?", questionId).Find(paperDistributions)
|
||||
if err != nil {
|
||||
log.Println("FindPaperDistributionByQuestionId err ")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (u *PaperDistribution) Save() error {
|
||||
code, err := adapter.engine.Insert(u)
|
||||
if code == 0 || err != nil {
|
||||
log.Println("insert PaperDistribution fail")
|
||||
log.Println(err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
func CountUserDistributionNumberByQuestionId(questionId int64) (count int64, err error) {
|
||||
paperDistribution := new(PaperDistribution)
|
||||
count, err1 := adapter.engine.Where("question_id = ?", questionId).Count(paperDistribution)
|
||||
if err != nil {
|
||||
log.Println("countUserDistributionNumberByQuestionId err ")
|
||||
}
|
||||
return count, err1
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"xorm.io/builder"
|
||||
)
|
||||
|
||||
type SubTopic struct {
|
||||
Question_detail_id int64 `json:"question_detail_id" xorm:"pk autoincr"`
|
||||
Question_detail_name string `json:"question_detail_name"`
|
||||
Question_id int64 `json:"question_id"`
|
||||
Question_detail_score int64 `json:"question_detail_score"`
|
||||
Score_type string `json:"score_type"`
|
||||
}
|
||||
|
||||
func FindSubTopicsByQuestionId(id int64, st *[]SubTopic) error {
|
||||
err := adapter.engine.Where("question_id = ?", id).Find(st)
|
||||
if err != nil {
|
||||
log.Println("could not find any SubTopic")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func GetSubTopicsByTestId(id int64, st *[]SubTopic) error {
|
||||
err := adapter.engine.Where(builder.Eq{"question_id": id}).Find(st)
|
||||
if err != nil {
|
||||
log.Println("could not find any SubTopic")
|
||||
log.Println(err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (st *SubTopic) GetSubTopic(id int64) error {
|
||||
has, err := adapter.engine.Where(builder.Eq{"question_detail_id": id}).Get(st)
|
||||
if !has || err != nil {
|
||||
log.Println("could not find SubTopic")
|
||||
}
|
||||
return err
|
||||
}
|
||||
func InsertSubTopic(subTopic *SubTopic) (err1 error, questionDetailId int64) {
|
||||
_, err := adapter.engine.Insert(subTopic)
|
||||
if err != nil {
|
||||
log.Println("GetTopicList err ")
|
||||
}
|
||||
|
||||
return err,subTopic.Question_detail_id
|
||||
}
|
|
@ -1,127 +0,0 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"xorm.io/builder"
|
||||
)
|
||||
|
||||
type TestPaper struct {
|
||||
Test_id int64 `json:"test_id" xorm:"pk autoincr"`
|
||||
Question_id int64 `json:"question_id"`
|
||||
Candidate string `json:"candidate"`
|
||||
Question_status int64 `json:"question_status"`
|
||||
Examiner_first_id string `json:"examiner_first_id" xorm:"default('-1')"`
|
||||
Examiner_first_score int64 `json:"examiner_first_score" xorm:"default(-1)"`
|
||||
Examiner_first_self_score int64 `json:"examiner_first_self_score" xorm:"default(-1)"`
|
||||
Examiner_second_id string `json:"examiner_second_id" xorm:"default('-1')"`
|
||||
Examiner_second_score int64 `json:"examiner_second_score" xorm:"default(-1)"`
|
||||
Examiner_second_self_score int64 `json:"examiner_seconde_self_score" xorm:"default(-1)"`
|
||||
Examiner_third_id string `json:"examiner_third_id" xorm:"default('-1')"`
|
||||
Examiner_third_score int64 `json:"examiner_third_score" xorm:"default(-1)"`
|
||||
Examiner_third_self_score int64 `json:"examiner_third_self_score" xorm:"default(-1)"`
|
||||
Leader_id string `json:"leader_id" xorm:"default('-1')"`
|
||||
Leader_score int64 `json:"leader_score" xorm:"default(-1)"`
|
||||
Final_score int64 `json:"final_score" xorm:"default(-1)" `
|
||||
Final_score_id string `json:"finale_score_id"`
|
||||
Pratice_error int64 `json:"pratice_error"`
|
||||
Correcting_status int64 `json:"correcting_status"`
|
||||
}
|
||||
|
||||
func (t *TestPaper) GetTestPaperByQuestionIdAndQuestionStatus(question_id int64, question_statue int64) error {
|
||||
has, err := adapter.engine.Where("question_id = ? and question_status = ?", question_id, question_statue).Get(t)
|
||||
if !has || err != nil {
|
||||
log.Println("could not specific test")
|
||||
}
|
||||
return err
|
||||
}
|
||||
func (t *TestPaper) GetTestPaperByTestId(testId int64) error {
|
||||
has, err := adapter.engine.Where("test_id = ?", testId).Get(t)
|
||||
if !has || err != nil {
|
||||
log.Println("could not GetTestPaperByTestId")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func GetTestPaperListByQuestionIdAndQuestionStatus(question_id int64, question_statue int64, tl *[]TestPaper) error {
|
||||
err := adapter.engine.Where("question_id = ? and question_status = ?", question_id, question_statue).Find(tl)
|
||||
if err != nil {
|
||||
log.Println("could not specific test")
|
||||
log.Println(err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (t *TestPaper) GetTestPaper(id int64) (bool, error) {
|
||||
has, err := adapter.engine.Where(builder.Eq{"test_id": id}).Get(t)
|
||||
if !has || err != nil {
|
||||
log.Println("could not find test paper")
|
||||
}
|
||||
return has, err
|
||||
}
|
||||
|
||||
func (t *TestPaper) Update() error {
|
||||
code, err := adapter.engine.Where(builder.Eq{"test_id": t.Test_id}).Update(t)
|
||||
if code == 0 || err != nil {
|
||||
log.Println("update test paper fail")
|
||||
log.Printf("%+v", err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
func (t *TestPaper) Insert() error {
|
||||
code, err := adapter.engine.Insert(t)
|
||||
if code == 0 || err != nil {
|
||||
log.Println("insert test paper fail")
|
||||
log.Printf("%+v", err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func FindTestPaperByQuestionId(question_id int64, t *[]TestPaper) error {
|
||||
err := adapter.engine.Where("question_id = ?", question_id).Find(t)
|
||||
if err != nil {
|
||||
log.Println("could not FindTestPaperByQuestionId ")
|
||||
log.Println(err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
func FindTestPapersByTestId(testId, t *[]TestPaper) error {
|
||||
err := adapter.engine.Where("question_id = ?", testId).Find(t)
|
||||
if err != nil {
|
||||
log.Println("could not FindTestPaperByQuestionId ")
|
||||
log.Println(err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
func FindUnDistributeTest(id int64, t *[]TestPaper) error {
|
||||
err := adapter.engine.Where("question_id=?", id).Where("correcting_status=?", 0).Find(t)
|
||||
if err != nil {
|
||||
log.Println("could not GetUnDistributeTest")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func CountTestDistributionNumberByQuestionId(questionId int64) (count int64, err error) {
|
||||
testPaper := new(TestPaper)
|
||||
count, err1 := adapter.engine.Where("question_id = ?", questionId).Where("correcting_status=?", 1).Count(testPaper)
|
||||
if err != nil {
|
||||
log.Println("CountTestDistributionNumberByQuestionId err ")
|
||||
}
|
||||
return count, err1
|
||||
}
|
||||
func CountFailTestNumberByUserId(userId string, questionId int64) (count int64, err error) {
|
||||
testPaper := new(TestPaper)
|
||||
count, err1 := adapter.engine.Where("question_id = ?", questionId).Where("examiner_first_id=? or examiner_second_id=?", userId, userId).Where("question_status=2 or question_status=3 ").Count(testPaper)
|
||||
if err != nil {
|
||||
log.Println("CountFailTestNumberByUserId err ")
|
||||
}
|
||||
return count, err1
|
||||
}
|
||||
|
||||
func DeleteAllTest(questionId int64) error {
|
||||
_, err := adapter.engine.Delete(&TestPaper{Question_id:questionId})
|
||||
if err != nil {
|
||||
log.Println("delete fail")
|
||||
}
|
||||
return err
|
||||
}
|
|
@ -1,96 +0,0 @@
|
|||
package models
|
||||
|
||||
import (
|
||||
"log"
|
||||
"math/rand"
|
||||
"time"
|
||||
|
||||
"xorm.io/builder"
|
||||
)
|
||||
|
||||
type User struct {
|
||||
User_id string `json:"user_id" xorm:"pk"`
|
||||
User_name string `json:"user_name"`
|
||||
Examiner_count string `json:"examiner_count"`
|
||||
Password string `json:"password"`
|
||||
Id_card string `json:"id_card"`
|
||||
Address string `json:"address"`
|
||||
Tel string `json:"tel"`
|
||||
Email string `json:"email"`
|
||||
Login_time time.Time `json:"login_time"`
|
||||
Exist_time time.Time `json:"exist_time"`
|
||||
Online_time int64 `json:"online_time"`
|
||||
Subject_name string `json:"subject_name"`
|
||||
Status int64 `json:"status"`
|
||||
UserType int64 `json:"userType"`
|
||||
IsDistribute int64 `json:"isDistribute"`
|
||||
|
||||
QuestionId int64 `json:"question_id"`
|
||||
}
|
||||
|
||||
func (u *User) GetUser(id string) error {
|
||||
has, err := adapter.engine.Where(builder.Eq{"user_id": id}).Get(u)
|
||||
if !has || err != nil {
|
||||
log.Println("could not found user")
|
||||
}
|
||||
return err
|
||||
}
|
||||
func (u *User) Update() error {
|
||||
_, err := adapter.engine.Update(u)
|
||||
if err != nil {
|
||||
log.Println("could not Update user")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func CountOnlineNumberUnDistribute() (count int64, err error) {
|
||||
user := new(User)
|
||||
count, err1 := adapter.engine.Where("status = ? ", 1).Where(" user_type=?", 1).Where("is_distribute = ?", 0).Count(user)
|
||||
if err != nil {
|
||||
log.Println("CountOnlineNumber err ")
|
||||
}
|
||||
return count, err1
|
||||
}
|
||||
func CountOnlineUserNumberByQuestionId(questionId int64) (count int64, err error) {
|
||||
user := new(User)
|
||||
count, err1 := adapter.engine.Where("status = ? ", 1).Where(" user_type=?", 1).Where("is_distribute = ?", 1).Where("question_id=?", questionId).Count(user)
|
||||
if err != nil {
|
||||
log.Println("CountOnlineNumber err ")
|
||||
}
|
||||
return count, err1
|
||||
}
|
||||
func FindOnlineUserNumberByQuestionId(users *[]User, questionId int64) error {
|
||||
err := adapter.engine.Where("status = ? ", 1).Where(" user_type=?", 1).Where("is_distribute = ?", 1).Where("question_id=?", questionId).Find(users)
|
||||
if err != nil {
|
||||
log.Println("FindOnlineUserNumberByQuestionId err ")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func FindUserNumberByQuestionId(users *[]User, questionId int64) error {
|
||||
err := adapter.engine.Where(" user_type=?", 1).Where("is_distribute = ?", 1).Where("question_id=?", questionId).Find(users)
|
||||
if err != nil {
|
||||
log.Println("FindOnlineUserNumberByQuestionId err ")
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func FindUsers(u *[]User) error {
|
||||
err := adapter.engine.Where("status = ? ", 1).Where(" user_type=?", 1).Where("is_distribute = ?", 0).Find(u)
|
||||
if err != nil {
|
||||
log.Println("could not FindUsers ")
|
||||
log.Println(err)
|
||||
}
|
||||
return err
|
||||
}
|
||||
func FindNewUserId(id1 string, id2 string, questionId int64) (newId string) {
|
||||
var Ids []string
|
||||
err := adapter.engine.Table("user").Where("user_id !=?", id1).Where("user_id !=?", id2).Where("question_id=?", questionId).Where("status=?", 1).Select("user_id").Find(&Ids)
|
||||
if err != nil {
|
||||
log.Println("FindNewUserId err")
|
||||
log.Println(err)
|
||||
}
|
||||
k:=rand.Intn(len(Ids)-1)
|
||||
newId=Ids[k]
|
||||
return newId
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
package requests
|
||||
|
||||
type AddTopic struct {
|
||||
AdminId string `json:"adminId"`
|
||||
TopicName string `json:"topicName"`
|
||||
ScoreType int64 `json:"scoreType"`
|
||||
Score int64 `json:"score"`
|
||||
Error int64 `json:"error"`
|
||||
SubjectName string `json:"subjectName"`
|
||||
TopicDetails []AddTopicDetail `json:"topicDetails"`
|
||||
SelfScoreRate int64 `json:"self_score_rate"`
|
||||
}
|
||||
type AddTopicDetail struct {
|
||||
TopicDetailName string `json:"topicDetailName"`
|
||||
DetailScoreTypes string `json:"DetailScoreTypes"`
|
||||
DetailScore int64 `json:"detailScore"`
|
||||
}
|
||||
|
||||
type SubjectList struct {
|
||||
AdminId string `json:"adminId"`
|
||||
}
|
||||
|
||||
type QuestionBySubList struct {
|
||||
AdminId string `json:"adminId"`
|
||||
SubjectName string `json:"subjectName"`
|
||||
}
|
||||
type DistributionInfo struct {
|
||||
AdminId string `json:"adminId"`
|
||||
QuestionId int64 `json:"questionId"`
|
||||
}
|
||||
type DeleteTest struct {
|
||||
AdminId string `json:"adminId"`
|
||||
QuestionId int64 `json:"questionId"`
|
||||
}
|
||||
|
||||
type Distribution struct {
|
||||
AdminId string `json:"adminId"`
|
||||
QuestionId int64 `json:"questionId"`
|
||||
TestNumber int `json:"testNumber"`
|
||||
UserNumber int `json:"userNumber"`
|
||||
|
||||
}
|
||||
|
||||
type ReadFile struct {
|
||||
PicName string `json:"picName"`
|
||||
}
|
||||
|
||||
type TopicList struct {
|
||||
AdminId string `json:"adminId"`
|
||||
}
|
||||
|
||||
type DistributionRecord struct {
|
||||
AdminId string `json:"adminId"`
|
||||
SubjectName string `json:"subjectName"`
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
package requests
|
||||
//type QuestionList struct {
|
||||
// SupervisorId string `joson:"supervisorId"`
|
||||
//}
|
||||
type UserInfo struct {
|
||||
SupervisorId string `joson:"supervisorId"`
|
||||
}
|
||||
type ScoreDistribution struct {
|
||||
SupervisorId string `joson:"supervisorId"`
|
||||
QuestionId int64 `joson:"questionId"`
|
||||
}
|
||||
type TeachersByQuestion struct {
|
||||
SupervisorId string `joson:"supervisorId"`
|
||||
QuestionId int64 `joson:"questionId"`
|
||||
}
|
||||
type SelfScore struct {
|
||||
SupervisorId string `joson:"supervisorId"`
|
||||
ExaminerId string `joson:"examinerId"`
|
||||
}
|
||||
type AverageScore struct {
|
||||
SupervisorId string `joson:"supervisorId"`
|
||||
QuestionId int64 `joson:"questionId"`
|
||||
}
|
||||
type ProblemTest struct {
|
||||
SupervisorId string `joson:"supervisorId"`
|
||||
QuestionId int64 `joson:"questionId"`
|
||||
}
|
||||
type ArbitramentTest struct {
|
||||
SupervisorId string `joson:"supervisorId"`
|
||||
QuestionId int64 `joson:"questionId"`
|
||||
}
|
||||
type TeacherMonitoring struct {
|
||||
SupervisorId string `joson:"supervisorId"`
|
||||
|
||||
QuestionId int64 `joson:"questionId"`
|
||||
}
|
||||
type SupervisorPoint struct {
|
||||
SupervisorId string `joson:"supervisorId"`
|
||||
TestId int64 `joson:"testId"`
|
||||
TestDetailIds string `joson:"testDetailIds"`
|
||||
Scores string `joson:"scores"`
|
||||
|
||||
}
|
||||
|
||||
type ScoreProgress struct {
|
||||
SupervisorId string `joson:"supervisorId"`
|
||||
Subject string `json:"subject"`
|
||||
}
|
||||
type ArbitramentUnmarkList struct {
|
||||
SupervisorId string `joson:"supervisorId"`
|
||||
QuestionId int64 `json:"questionId"`
|
||||
}
|
||||
type SelfMarkList struct {
|
||||
SupervisorId string `joson:"supervisorId"`
|
||||
QuestionId int64 `json:"questionId"`
|
||||
}
|
||||
type ProblemUnmarkList struct {
|
||||
SupervisorId string `joson:"supervisorId"`
|
||||
QuestionId int64 `json:"questionId"`
|
||||
}
|
||||
type SelfUnmarkList struct {
|
||||
SupervisorId string `joson:"supervisorId"`
|
||||
QuestionId int64 `json:"questionId"`
|
||||
}
|
||||
type ScoreDeviation struct {
|
||||
SupervisorId string `joson:"supervisorId"`
|
||||
QuestionId int64 `joson:"questionId"`
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
package requests
|
||||
|
||||
type TestDisplay struct {
|
||||
UserId string `json:"userId"`
|
||||
TestId int64 `json:"testId"`
|
||||
}
|
||||
|
||||
type TestList struct {
|
||||
UserId string `json:"userId"`
|
||||
}
|
||||
|
||||
type TeacherSelfMarkList struct {
|
||||
UserId string `json:"userId"`
|
||||
}
|
||||
|
||||
type TestPoint struct {
|
||||
UserId string `json:"userId"`
|
||||
Scores string `json:"scores"`
|
||||
TestId int64 `json:"testId"`
|
||||
TestDetailId string `json:"testDetailId"`
|
||||
}
|
||||
|
||||
type TestProblem struct {
|
||||
UserId string `json:"userId"`
|
||||
ProblemType int64 `json:"problemType"`
|
||||
TestId int64 `json:"testId"`
|
||||
ProblemMessage string `json:"problemMessage"`
|
||||
}
|
||||
|
||||
type TestAnswer struct {
|
||||
UserId string `json:"userId"`
|
||||
TestId int64 `json:"testId"`
|
||||
}
|
||||
|
||||
type ExampleDetail struct {
|
||||
UserId string `json:"userId"`
|
||||
ExampleTestId int64 `json:"exampleTestId"`
|
||||
}
|
||||
|
||||
type ExampleList struct {
|
||||
UserId string `json:"userId"`
|
||||
TestId int64 `json:"TestId"`
|
||||
}
|
||||
|
||||
type TestReview struct {
|
||||
UserId string `json:"userId"`
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
package responses
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type AddTopicVO struct {
|
||||
QuestionId int64
|
||||
QuestionDetailIds []AddTopicDetailVO
|
||||
}
|
||||
type AddTopicDetailVO struct {
|
||||
QuestionDetailId int64
|
||||
}
|
||||
|
||||
type SubjectListVO struct {
|
||||
SubjectId int64
|
||||
SubjectName string
|
||||
}
|
||||
type QuestionBySubListVO struct {
|
||||
QuestionId int64
|
||||
QuestionName string
|
||||
}
|
||||
type DistributionInfoVO struct {
|
||||
ImportTestNumber int64
|
||||
LeftTestNumber int
|
||||
OnlineNumber int64
|
||||
ScoreType int64
|
||||
}
|
||||
type TopicVO struct {
|
||||
TopicId int64
|
||||
SubjectName string
|
||||
TopicName string
|
||||
Score int64
|
||||
StandardError int64
|
||||
ScoreType int64
|
||||
ImportTime time.Time
|
||||
SubTopicVOList []SubTopicVO
|
||||
}
|
||||
type SubTopicVO struct {
|
||||
SubTopicId int64
|
||||
SubTopicName string
|
||||
Score int64
|
||||
ScoreDistribution string
|
||||
}
|
||||
type DistributionRecordVO struct {
|
||||
TopicId int64
|
||||
TopicName string
|
||||
ImportNumber int64
|
||||
DistributionTestNumber int64
|
||||
DistributionUserNumber int64
|
||||
}
|
|
@ -1,168 +0,0 @@
|
|||
package responses
|
||||
|
||||
type QuestionListVO struct {
|
||||
QuestionId int64
|
||||
QuestionName string
|
||||
}
|
||||
|
||||
|
||||
type UserInfoVO struct {
|
||||
UserName string
|
||||
SubjectName string
|
||||
}
|
||||
|
||||
type TeacherMonitoringVO struct {
|
||||
UserId string
|
||||
UserName string
|
||||
TestDistributionNumber int64
|
||||
TestSuccessNumber float64
|
||||
TestRemainingNumber int64
|
||||
TestProblemNumber int64
|
||||
MarkingSpeed float64
|
||||
PredictTime float64
|
||||
AverageScore float64
|
||||
Validity float64
|
||||
StandardDeviation float64
|
||||
IsOnline int64
|
||||
}
|
||||
|
||||
type ScoreDistributionVO struct {
|
||||
Score int64
|
||||
Rate float64
|
||||
}
|
||||
|
||||
type TeacherVO struct {
|
||||
UserId string
|
||||
UserName string
|
||||
}
|
||||
|
||||
type SelfScoreRecordVO struct {
|
||||
TestId int64
|
||||
Score int64
|
||||
SelfScore int64
|
||||
IsQualified int64
|
||||
Error float64
|
||||
StandardError int64
|
||||
|
||||
}
|
||||
type ScoreAverageVO struct {
|
||||
UserId string
|
||||
UserName string
|
||||
Average float64
|
||||
|
||||
|
||||
}
|
||||
type ProblemUnderCorrectedPaperVO struct {
|
||||
|
||||
TestId int64
|
||||
ExaminerId string
|
||||
ExaminerName string
|
||||
ProblemType int64
|
||||
ProblemMes string
|
||||
}
|
||||
type ProblemUnmarkListVO struct {
|
||||
TestId int64
|
||||
}
|
||||
type SelfUnmarkListVO struct {
|
||||
TestId int64
|
||||
}
|
||||
|
||||
type ArbitramentTestVO struct {
|
||||
TestId int64
|
||||
ExaminerFirstId string
|
||||
ExaminerFirstName string
|
||||
ExaminerFirstScore int64
|
||||
ExaminerSecondId string
|
||||
ExaminerSecondName string
|
||||
ExaminerSecondScore int64
|
||||
ExaminerThirdId string
|
||||
ExaminerThirdName string
|
||||
ExaminerThirdScore int64
|
||||
PracticeError int64
|
||||
StandardError int64
|
||||
|
||||
}
|
||||
|
||||
type ArbitramentUnmarkListVO struct {
|
||||
TestId int64
|
||||
}
|
||||
type SelfMarkListVO struct {
|
||||
TestId int64
|
||||
Score int64
|
||||
SelfScore int64
|
||||
Error float64
|
||||
StandardError int64
|
||||
Userid string
|
||||
Name string
|
||||
}
|
||||
|
||||
type ScoreProgressVO struct {
|
||||
//问题id 问题名 导入试卷数
|
||||
QuestionId int64
|
||||
QuestionName string
|
||||
ImportNumber int64
|
||||
|
||||
//在线人数 ,分配人数 平均分 平均速度 在线预计时间 ,预计时间 ,自评指数
|
||||
OnlineUserNumber int64
|
||||
DistributionUserNumber int64
|
||||
|
||||
OnlineAverageScore float64
|
||||
AverageScore float64
|
||||
OnlineAverageSpeed float64
|
||||
AverageSpeed float64
|
||||
OnlinePredictTime float64
|
||||
PredictTime float64
|
||||
|
||||
SelfScoreRate int64
|
||||
|
||||
//完成阅卷数 完成率 未完成数 未完成率 是否全部完成
|
||||
FinishNumber int64
|
||||
FinishRate float64
|
||||
UnfinishedNumber float64
|
||||
UnfinishedRate float64
|
||||
IsAllFinished string
|
||||
|
||||
|
||||
FirstFinishedNumber int64
|
||||
FirstFinishedRate float64
|
||||
FirstUnfinishedNumber float64
|
||||
FirstUnfinishedRate float64
|
||||
IsFirstFinished string
|
||||
|
||||
SecondFinishedNumber int64
|
||||
SecondFinishedRate float64
|
||||
SecondUnfinishedNumber float64
|
||||
SecondUnfinishedRate float64
|
||||
IsSecondFinished string
|
||||
|
||||
ThirdFinishedNumber int64
|
||||
ThirdFinishedRate float64
|
||||
ThirdUnfinishedNumber float64
|
||||
ThirdUnfinishedRate float64
|
||||
IsThirdFinished string
|
||||
|
||||
//仲裁卷生产数量 生产率 完成数,完成率 未完成数 未完成率 是否全部完成
|
||||
ArbitramentNumber int64
|
||||
ArbitramentRate float64
|
||||
ArbitramentFinishedNumber int64
|
||||
ArbitramentFinishedRate float64
|
||||
ArbitramentUnfinishedNumber int64
|
||||
ArbitramentUnfinishedRate float64
|
||||
IsArbitramentFinished string
|
||||
|
||||
|
||||
ProblemNumber int64
|
||||
ProblemRate float64
|
||||
ProblemFinishedNumber int64
|
||||
ProblemFinishedRate float64
|
||||
ProblemUnfinishedNumber int64
|
||||
ProblemUnfinishedRate float64
|
||||
IsProblemFinished string
|
||||
}
|
||||
|
||||
type ScoreDeviationVO struct {
|
||||
UserId string
|
||||
UserName string
|
||||
DeviationScore float64
|
||||
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
package responses
|
||||
|
||||
import (
|
||||
"github.com/open-ct/openscore/models"
|
||||
"time"
|
||||
)
|
||||
|
||||
type SubTopicPlus struct {
|
||||
models.SubTopic
|
||||
Test_detail_id int64 `json:"test_detail_id"`
|
||||
}
|
||||
type TestPaperInfoPlus struct {
|
||||
models.TestPaperInfo
|
||||
PicCode string `json:"picCode"`
|
||||
}
|
||||
|
||||
type TestDisplay struct {
|
||||
QuestionId int64 `json:"questionId"`
|
||||
QuestionName string `json:"questionName"`
|
||||
TestId int64 `json:"testId"`
|
||||
SubTopics []SubTopicPlus `json:"subTopic"`
|
||||
TestInfos []TestPaperInfoPlus `json:"testInfos"`
|
||||
}
|
||||
|
||||
type TestList struct {
|
||||
TestId []int64 `json:"TestIds"`
|
||||
}
|
||||
|
||||
type TestAnswer struct {
|
||||
Pics []string `json:"Pics"`
|
||||
}
|
||||
|
||||
type ExampleList struct {
|
||||
TestPapers []models.TestPaper `json:"exampleTestPapers"`
|
||||
}
|
||||
|
||||
type TestReview struct {
|
||||
TestId []int64 `json:"testId"`
|
||||
Score []int64 `json:"score"`
|
||||
ScoreTime []time.Time `json:"score_time"`
|
||||
}
|
||||
|
||||
type ExampleDetail struct {
|
||||
QuestionName string `json:"questionName"`
|
||||
Test [][]models.TestPaperInfo `json:"test"`
|
||||
}
|
|
@ -28,6 +28,10 @@ func TransparentStatic(ctx *context.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
if strings.HasPrefix(urlPath, "/openct/") {
|
||||
return
|
||||
}
|
||||
|
||||
path := "web/build"
|
||||
if urlPath == "/" {
|
||||
path += "/index.html"
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package filter
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/astaxie/beego/context"
|
||||
)
|
||||
|
||||
func AuthScore(ctx *context.Context) {
|
||||
ctx.ResponseWriter.Header().Set("Access-Control-Allow-Origin", ctx.Request.Header.Get("Origin"))
|
||||
|
||||
typeId := ctx.Input.Session("userType").(int64)
|
||||
|
||||
if typeId != 2 && typeId != 1 {
|
||||
ctx.Output.JSON("typeId can't match :"+strconv.Itoa(int(typeId)), true, true)
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func AuthSupervisor(ctx *context.Context) {
|
||||
ctx.ResponseWriter.Header().Set("Access-Control-Allow-Origin", ctx.Request.Header.Get("Origin"))
|
||||
|
||||
typeId := ctx.Input.Session("userType").(int64)
|
||||
|
||||
if typeId != 1 {
|
||||
ctx.Output.JSON("typeId can't match:"+strconv.Itoa(int(typeId)), true, true)
|
||||
return
|
||||
}
|
||||
}
|
|
@ -20,61 +20,89 @@ import (
|
|||
)
|
||||
|
||||
func init() {
|
||||
beego.Router("/api/signin", &controllers.ApiController{}, "POST:Signin")
|
||||
beego.Router("/api/signout", &controllers.ApiController{}, "POST:Signout")
|
||||
beego.Router("/api/get-account", &controllers.ApiController{}, "GET:GetAccount")
|
||||
|
||||
beego.Router("/openct/marking/score/test/display", &controllers.ApiController{}, "post:Display")
|
||||
beego.Router("/openct/marking/score/test/list", &controllers.ApiController{}, "post:List")
|
||||
beego.Router("/openct/marking/score/self/list", &controllers.ApiController{}, "post:SelfScoreList")
|
||||
//beego.Router("/openct/marking/score/self/point", &controllers.ApiController{}, "post:SelfMarkPoint")
|
||||
beego.Router("/openct/marking/score/test/point", &controllers.ApiController{}, "post:Point")
|
||||
beego.Router("/openct/marking/score/test/problem", &controllers.ApiController{}, "post:Problem")
|
||||
beego.Router("/openct/marking/score/test/answer", &controllers.ApiController{}, "post:Answer")
|
||||
beego.Router("/openct/marking/score/test/example/detail", &controllers.ApiController{}, "post:ExampleDetail")
|
||||
beego.Router("/openct/marking/score/test/example/list", &controllers.ApiController{}, "post:ExampleList")
|
||||
beego.Router("/openct/marking/score/test/review", &controllers.ApiController{}, "post:Review")
|
||||
beego.Router("/openct/marking/score/test/review/point", &controllers.ApiController{}, "post:ReviewPoint")
|
||||
// beego.Router("/api/get-users", &controllers.ApiController{}, "GET:GetUsers")
|
||||
api := new(controllers.ApiController)
|
||||
beego.Router("/", api)
|
||||
beego.Router("/api/login", api, "post:SignIn")
|
||||
beego.Router("/api/logout", api, "post:SignOut")
|
||||
beego.Router("/api/get-account", api, "get:GetAccount")
|
||||
|
||||
beego.Router("/openct/login", api, "post:UserLogin")
|
||||
|
||||
// beego.InsertFilter("/openct/marking/score/*", beego.BeforeRouter, filter.AuthScore)
|
||||
// beego.InsertFilter("/openct/marking/supervisor/*", beego.BeforeRouter, filter.AuthSupervisor)
|
||||
// TODO admin Filter
|
||||
|
||||
testNs := beego.NewNamespace("/openct/marking/score",
|
||||
beego.NSNamespace("/test",
|
||||
beego.NSRouter("/display", api, "post:Display"),
|
||||
beego.NSRouter("/list", api, "post:List"),
|
||||
// beego.NSRouter("/point", api, "post:SelfMarkPoint"),
|
||||
beego.NSRouter("/point", api, "post:Point"),
|
||||
beego.NSRouter("/problem", api, "post:Problem"),
|
||||
beego.NSRouter("/answer", api, "post:Answer"),
|
||||
beego.NSRouter("/example/detail", api, "post:ExampleDetail"),
|
||||
beego.NSRouter("/example/list", api, "post:ExampleList"),
|
||||
beego.NSRouter("/review", api, "post:Review"),
|
||||
beego.NSRouter("/review/point", api, "post:ReviewPoint"),
|
||||
),
|
||||
beego.NSRouter("/self/list", api, "post:SelfScoreList"),
|
||||
)
|
||||
beego.AddNamespace(testNs)
|
||||
|
||||
/**
|
||||
chen :阅卷组长端
|
||||
*/
|
||||
//beego.Router("/openct/marking/supervisor/question/list", &controllers.ApiController{}, "post:QuestionList")
|
||||
beego.Router("/openct/marking/supervisor/user/info", &controllers.ApiController{}, "post:UserInfo")
|
||||
beego.Router("/openct/marking/supervisor/teacher/monitoring", &controllers.ApiController{}, "post:TeacherMonitoring")
|
||||
beego.Router("/openct/marking/supervisor/score/distribution", &controllers.ApiController{}, "post:ScoreDistribution")
|
||||
beego.Router("/openct/marking/supervisor/question/teacher/list", &controllers.ApiController{}, "post:TeachersByQuestion")
|
||||
beego.Router("/openct/marking/supervisor/self/score", &controllers.ApiController{}, "post:SelfScore")
|
||||
beego.Router("/openct/marking/supervisor/average/score", &controllers.ApiController{}, "post:AverageScore")
|
||||
beego.Router("/openct/marking/supervisor/problem/list", &controllers.ApiController{}, "post:ProblemTest")
|
||||
beego.Router("/openct/marking/supervisor/arbitrament/list", &controllers.ApiController{}, "post:ArbitramentTest")
|
||||
beego.Router("/openct/marking/supervisor/score/progress", &controllers.ApiController{}, "post:ScoreProgress")
|
||||
beego.Router("/openct/marking/supervisor/point", &controllers.ApiController{}, "post:SupervisorPoint")
|
||||
beego.Router("/openct/marking/supervisor/arbitrament/unmark/list", &controllers.ApiController{}, "post:ArbitramentUnmarkList")
|
||||
beego.Router("/openct/marking/supervisor/selfMark/list", &controllers.ApiController{}, "post:SelfMarkList")
|
||||
beego.Router("/openct/marking/supervisor/selfMark/unmark/list", &controllers.ApiController{}, "post:SelfUnmarkList")
|
||||
beego.Router("/openct/marking/supervisor/problem/unmark/list", &controllers.ApiController{}, "post:ProblemUnmarkList")
|
||||
beego.Router("/openct/marking/supervisor/score/deviation", &controllers.ApiController{}, "post:ScoreDeviation")
|
||||
superNs := beego.NewNamespace("/openct/marking/supervisor",
|
||||
beego.NSRouter("/list", api, "post:SuperVisorList"),
|
||||
beego.NSRouter("/user/info", api, "post:UserInfo"),
|
||||
beego.NSRouter("/teacher/monitoring", api, "post:TeacherMonitoring"),
|
||||
// beego.NSRouter("/question/list", api, "post:QuestionList"),
|
||||
beego.NSRouter("/score/distribution", api, "post:ScoreDistribution"),
|
||||
beego.NSRouter("/question/teacher/list", api, "post:TeachersByQuestion"),
|
||||
beego.NSRouter("/self/score", api, "post:SelfScore"),
|
||||
beego.NSRouter("/average/score", api, "post:AverageScore"),
|
||||
beego.NSRouter("/problem/list", api, "post:ProblemTest"),
|
||||
beego.NSRouter("/arbitrament/list", api, "post:ArbitramentTest"),
|
||||
beego.NSRouter("/score/progress", api, "post:ScoreProgress"),
|
||||
beego.NSRouter("/point", api, "post:SupervisorPoint"),
|
||||
beego.NSRouter("/arbitrament/unmark/list", api, "post:ArbitramentUnmarkList"),
|
||||
beego.NSRouter("/selfMark/list", api, "post:SelfMarkList"),
|
||||
beego.NSRouter("/selfMark/unmark/list", api, "post:SelfUnmarkList"),
|
||||
beego.NSRouter("/problem/unmark/list", api, "post:ProblemUnmarkList"),
|
||||
beego.NSRouter("/score/deviation", api, "post:ScoreDeviation"),
|
||||
beego.NSRouter("/writeScoreExcel", api, "post:WriteScoreExcel"),
|
||||
)
|
||||
beego.AddNamespace(superNs)
|
||||
|
||||
/**
|
||||
chen :管理员端
|
||||
*/
|
||||
//beego.Router("/openct/marking/admin/uploadPic",&controllers.ApiController{},"post:UploadPic")
|
||||
beego.Router("/openct/marking/admin/readExcel", &controllers.ApiController{}, "post:ReadExcel")
|
||||
beego.Router("/openct/marking/admin/readExcel", &controllers.ApiController{}, "OPTIONS:ReadExcel")
|
||||
beego.Router("/openct/marking/admin/readExampleExcel", &controllers.ApiController{}, "post:ReadExampleExcel")
|
||||
beego.Router("/openct/marking/admin/readExampleExcel", &controllers.ApiController{}, "OPTIONS:ReadExampleExcel")
|
||||
beego.Router("/openct/marking/admin/readAnswerExcel", &controllers.ApiController{}, "post:ReadAnswerExcel")
|
||||
beego.Router("/openct/marking/admin/readAnswerExcel", &controllers.ApiController{}, "OPTIONS:ReadAnswerExcel")
|
||||
beego.Router("/openct/marking/admin/distribution", &controllers.ApiController{}, "post:Distribution")
|
||||
beego.Router("/openct/marking/admin/distribution/info", &controllers.ApiController{}, "post:DistributionInfo")
|
||||
beego.Router("/openct/marking/admin/questionBySubList", &controllers.ApiController{}, "post:QuestionBySubList")
|
||||
beego.Router("/openct/marking/admin/insertTopic", &controllers.ApiController{}, "post:InsertTopic")
|
||||
beego.Router("/openct/marking/admin/subjectList", &controllers.ApiController{}, "post:SubjectList")
|
||||
beego.Router("/openct/marking/admin/topicList", &controllers.ApiController{}, "post:TopicList")
|
||||
beego.Router("/openct/marking/admin/DistributionRecord", &controllers.ApiController{}, "post:DistributionRecord")
|
||||
|
||||
beego.Router("/openct/marking/admin/img", &controllers.ApiController{}, "post:Pic")
|
||||
|
||||
adminNs := beego.NewNamespace("/openct/marking/admin",
|
||||
beego.NSRouter("/readExcel", api, "post:ReadExcel"),
|
||||
beego.NSRouter("/readExcel", api, "OPTIONS:ReadExcel"),
|
||||
beego.NSRouter("/writeUserExcel", api, "post:WriteUserExcel"),
|
||||
beego.NSRouter("/readExampleExcel", api, "post:ReadExampleExcel"),
|
||||
beego.NSRouter("/readExampleExcel", api, "OPTIONS:ReadExampleExcel"),
|
||||
beego.NSRouter("/readAnswerExcel", api, "post:ReadAnswerExcel"),
|
||||
beego.NSRouter("/readAnswerExcel", api, "OPTIONS:ReadAnswerExcel"),
|
||||
// beego.NSRouter("/distribution", api, "post:Distribution"), // Deprecated
|
||||
// beego.NSRouter("/distribution/info", api, "post:DistributionInfo"), // Deprecated
|
||||
beego.NSRouter("/questionBySubList", api, "post:QuestionBySubList"),
|
||||
beego.NSRouter("/insertTopic", api, "post:InsertTopic"),
|
||||
beego.NSRouter("/subjectList", api, "post:SubjectList"),
|
||||
beego.NSRouter("/topicList", api, "post:TopicList"),
|
||||
// beego.NSRouter("/distributionRecord", api, "post:DistributionRecord"), // Deprecated
|
||||
beego.NSRouter("/img", api, "post:Pic"),
|
||||
beego.NSRouter("/createUser", api, "post:CreateUser"),
|
||||
beego.NSRouter("/deleteUser", api, "post:DeleteUser"),
|
||||
beego.NSRouter("/updateUser", api, "post:UpdateUser"),
|
||||
beego.NSRouter("/listUsers", api, "post:ListUsers"),
|
||||
beego.NSRouter("/createSmallQuestion", api, "post:CreateSmallQuestion"),
|
||||
beego.NSRouter("/deleteSmallQuestion", api, "post:DeleteSmallQuestion"),
|
||||
beego.NSRouter("/updateSmallQuestion", api, "post:UpdateSmallQuestion"),
|
||||
beego.NSRouter("/deleteQuestion", api, "post:DeleteQuestion"),
|
||||
beego.NSRouter("/updateQuestion", api, "post:UpdateQuestion"),
|
||||
)
|
||||
beego.AddNamespace(adminNs)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package paper
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"log"
|
||||
|
||||
"github.com/open-ct/openscore/model"
|
||||
)
|
||||
|
||||
func FindUnDistributeTest(questionId int64) ([]model.TestPaper, error) {
|
||||
// 是否需要二次阅卷
|
||||
var topic model.Topic
|
||||
topic.QuestionId = questionId
|
||||
if err := topic.GetTopic(questionId); err != nil {
|
||||
log.Println("试卷分配异常,无法获取试卷批改次数 ", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if topic.ScoreType == 1 {
|
||||
return model.FindUnDistributeTestLimit1(questionId)
|
||||
}
|
||||
|
||||
if topic.ScoreType == 2 {
|
||||
return model.FindUnDistributeTestLimit2(questionId)
|
||||
}
|
||||
return nil, errors.New("wrong ScoreType")
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package user
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/open-ct/openscore/model"
|
||||
)
|
||||
|
||||
func Login(account string, pwd string) (int64, int64, error) {
|
||||
u, err := model.GetUserByAccount(account)
|
||||
if err != nil {
|
||||
return 0, 0, err
|
||||
}
|
||||
if u == nil {
|
||||
return 0, 0, errors.New("user not found")
|
||||
}
|
||||
|
||||
if u.Password != pwd {
|
||||
return 0, 0, errors.New("pwd not correct")
|
||||
}
|
||||
|
||||
// if err := u.UpdateOnlineStatus(true, util.GetCurrentTime()); err != nil {
|
||||
// return token, 0, err
|
||||
// }
|
||||
|
||||
return u.UserId, u.UserType, nil
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package test
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"testing"
|
||||
|
||||
"github.com/astaxie/beego"
|
||||
_ "github.com/open-ct/openscore/routers"
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
)
|
||||
|
||||
func init() {
|
||||
_, file, _, _ := runtime.Caller(0)
|
||||
apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".."+string(filepath.Separator))))
|
||||
beego.TestBeegoInit(apppath)
|
||||
}
|
||||
|
||||
// TestBeego is a sample to run an endpoint test
|
||||
func TestBeego(t *testing.T) {
|
||||
r, _ := http.NewRequest("GET", "/", nil)
|
||||
w := httptest.NewRecorder()
|
||||
beego.BeeApp.Handlers.ServeHTTP(w, r)
|
||||
|
||||
// beego.Trace("testing", "TestBeego", "Code[%d]\n%s", w.Code, w.Body.String())
|
||||
|
||||
Convey("Subject: Test Station Endpoint\n", t, func() {
|
||||
Convey("Status Code Should Be 200", func() {
|
||||
So(w.Code, ShouldEqual, 200)
|
||||
})
|
||||
Convey("The Result Should Not Be Empty", func() {
|
||||
So(w.Body.Len(), ShouldBeGreaterThan, 0)
|
||||
})
|
||||
})
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
package util
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"flag"
|
||||
"fmt"
|
||||
"image"
|
||||
"image/color"
|
||||
"image/draw"
|
||||
"image/png"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/golang/freetype"
|
||||
"github.com/golang/freetype/truetype"
|
||||
"golang.org/x/image/font"
|
||||
"golang.org/x/image/math/fixed"
|
||||
)
|
||||
|
||||
var (
|
||||
dpi = flag.Float64("dpi", 200, "screen resolution in Dots Per Inch")
|
||||
fontfile = flag.String("fontfile", "./simhei.ttf", "filename of the ttf font")
|
||||
size = flag.Float64("size", 20, "font size in points")
|
||||
spacing = flag.Float64("spacing", 1.5, "line spacing (e.g. 2 means double spaced)")
|
||||
width = 1024
|
||||
)
|
||||
|
||||
/**
|
||||
生成图片
|
||||
*/
|
||||
|
||||
func UploadPic(name string, text string) (src string) {
|
||||
|
||||
flag.Parse()
|
||||
|
||||
// Read the font data.
|
||||
fontBytes, err := ioutil.ReadFile(*fontfile)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
f, err := freetype.ParseFont(fontBytes)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
// Initialize the context.
|
||||
fg, bg := image.Black, image.White
|
||||
ruler := color.RGBA{0xdd, 0xdd, 0xdd, 0xff}
|
||||
rgba := image.NewRGBA(image.Rect(0, 0, width, width))
|
||||
draw.Draw(rgba, rgba.Bounds(), bg, image.ZP, draw.Src)
|
||||
c := freetype.NewContext()
|
||||
c.SetDPI(*dpi)
|
||||
c.SetFont(f)
|
||||
c.SetFontSize(*size)
|
||||
c.SetClip(rgba.Bounds())
|
||||
c.SetDst(rgba)
|
||||
c.SetSrc(fg)
|
||||
c.SetHinting(font.HintingNone)
|
||||
|
||||
// Draw the guidelines.
|
||||
for i := 0; i < width; i++ {
|
||||
rgba.Set(10, 10+i, ruler)
|
||||
rgba.Set(width-10, 10+i, ruler)
|
||||
rgba.Set(10+i, 10, ruler)
|
||||
rgba.Set(10+i, width-10, ruler)
|
||||
}
|
||||
|
||||
// Draw the text.
|
||||
pt := freetype.Pt(20, 20+int(c.PointToFixed(*size)>>6))
|
||||
|
||||
opts := truetype.Options{}
|
||||
opts.Size = *size
|
||||
opts.DPI = *dpi
|
||||
face := truetype.NewFace(f, &opts)
|
||||
|
||||
for _, x := range []rune(text) {
|
||||
w, _ := face.GlyphAdvance(x)
|
||||
if pt.X.Round()+w.Round() > width-10 {
|
||||
|
||||
pt.X = fixed.Int26_6(5) << 6
|
||||
pt.Y += c.PointToFixed(*size * *spacing)
|
||||
}
|
||||
pt, err = c.DrawString(string(x), pt)
|
||||
}
|
||||
|
||||
// Save that RGBA image to disk.
|
||||
name = name + ".png"
|
||||
newPath := "./img/" + name
|
||||
|
||||
outFile, err := os.Create(newPath)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
defer outFile.Close()
|
||||
b := bufio.NewWriter(outFile)
|
||||
err = png.Encode(b, rgba)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
err = b.Flush()
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
fmt.Println("Wrote out.png OK.")
|
||||
return name
|
||||
}
|
24
util/log.go
24
util/log.go
|
@ -1,24 +0,0 @@
|
|||
// Copyright 2020 The casbin Authors. All Rights Reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package util
|
||||
|
||||
import (
|
||||
"github.com/astaxie/beego/context"
|
||||
"github.com/astaxie/beego/logs"
|
||||
)
|
||||
|
||||
func LogInfo(ctx *context.Context, f string, v ...interface{}) {
|
||||
logs.Info(f, v...)
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
package requests
|
||||
type QuestionList struct {
|
||||
SupervisorId string `joson:"supervisorId"`
|
||||
}
|
||||
type UserInfo struct {
|
||||
SupervisorId string `joson:"supervisorId"`
|
||||
}
|
||||
type ScoreDistribution struct {
|
||||
SupervisorId string `joson:"supervisorId"`
|
||||
QuestionId int64 `joson:"questionId"`
|
||||
}
|
||||
type TeachersByQuestion struct {
|
||||
SupervisorId string `joson:"supervisorId"`
|
||||
QuestionId int64 `joson:"questionId"`
|
||||
}
|
||||
type SelfScore struct {
|
||||
SupervisorId string `joson:"supervisorId"`
|
||||
ExaminerId string `joson:"examinerId"`
|
||||
}
|
||||
type AverageScore struct {
|
||||
SupervisorId string `joson:"supervisorId"`
|
||||
QuestionId int64 `joson:"questionId"`
|
||||
}
|
||||
type ProblemTest struct {
|
||||
SupervisorId string `joson:"supervisorId"`
|
||||
QuestionId int64 `joson:"questionId"`
|
||||
}
|
||||
type ArbitramentTest struct {
|
||||
SupervisorId string `joson:"supervisorId"`
|
||||
QuestionId int64 `joson:"questionId"`
|
||||
}
|
||||
type TeacherMonitoring struct {
|
||||
SupervisorId string `joson:"supervisorId"`
|
||||
|
||||
QuestionId int64 `joson:"questionId"`
|
||||
}
|
||||
type SupervisorPoint struct {
|
||||
SupervisorId string `joson:"supervisorId"`
|
||||
TestId int64 `joson:"testId"`
|
||||
TestDetailIds string `joson:"testDetailIds"`
|
||||
Scores string `joson:"scores"`
|
||||
|
||||
}
|
||||
|
||||
type ScoreProgress struct {
|
||||
SupervisorId string `joson:"supervisorId"`
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
package requests
|
||||
|
||||
type TestDisplay struct {
|
||||
UserId string `json:"userId"`
|
||||
TestId int64 `json:"testId"`
|
||||
}
|
||||
|
||||
type TetsList struct {
|
||||
UserId string `json:"userId"`
|
||||
}
|
||||
|
||||
type TestPoint struct {
|
||||
UserId string `json:"userId"`
|
||||
Scores string `json:"scores"`
|
||||
TestId int64 `json:"testId"`
|
||||
TestDetailId string `json:"testDetailId"`
|
||||
}
|
||||
|
||||
type TestProblem struct {
|
||||
UserId string `json:"userId"`
|
||||
ProblemType int64 `json:"problemType"`
|
||||
TestId int64 `json:"testId"`
|
||||
}
|
||||
|
||||
type TestAnswer struct {
|
||||
UserId string `json:"userId"`
|
||||
TestId int64 `json:"testId"`
|
||||
}
|
||||
|
||||
type ExampleDetail struct {
|
||||
UserId string `json:"userId"`
|
||||
ExampleTestId int64 `json:"exampleTestId"`
|
||||
}
|
||||
|
||||
type ExampleList struct {
|
||||
UserId string `json:"userId"`
|
||||
TestId int64 `json:"TestId"`
|
||||
}
|
||||
|
||||
type TestReview struct {
|
||||
UserId string `json:"userId"`
|
||||
}
|
|
@ -1,120 +0,0 @@
|
|||
package responses
|
||||
|
||||
type QuestionListVO struct {
|
||||
QuestionId int64
|
||||
QuestionName string
|
||||
}
|
||||
|
||||
type UserInfoVO struct {
|
||||
UserName string
|
||||
SubjectName string
|
||||
}
|
||||
|
||||
type TeacherMonitoringVO struct {
|
||||
UserId string
|
||||
UserName string
|
||||
TestDistributionNumber int64
|
||||
TestSuccessNumber int64
|
||||
TestRemainingNumber int64
|
||||
TestProblemNumber int64
|
||||
MarkingSpeed float64
|
||||
AverageScore float64
|
||||
Validity float64
|
||||
StandardDeviation float64
|
||||
EvaluationIndex float64
|
||||
OnlineTime float64
|
||||
}
|
||||
|
||||
type ScoreDistributionVO struct {
|
||||
Score int64
|
||||
Rate float64
|
||||
}
|
||||
|
||||
type TeacherVO struct {
|
||||
UserId string
|
||||
UserName string
|
||||
}
|
||||
|
||||
type SelfScoreRecordVO struct {
|
||||
TestId int64
|
||||
Score int64
|
||||
SelfScore int64
|
||||
|
||||
}
|
||||
type ScoreAverageVO struct {
|
||||
UserId string
|
||||
UserName string
|
||||
Average float64
|
||||
|
||||
}
|
||||
type ProblemUnderCorrectedPaperVO struct {
|
||||
|
||||
TestId int64
|
||||
ExaminerId string
|
||||
ExaminerName string
|
||||
ProblemType int64
|
||||
ProblemMes string
|
||||
}
|
||||
|
||||
type ArbitramentTestVO struct {
|
||||
TestId int64
|
||||
ExaminerFirstId string
|
||||
ExaminerFirstName string
|
||||
ExaminerFirstScore int64
|
||||
ExaminerSecondId string
|
||||
ExaminerSecondName string
|
||||
ExaminerSecondScore int64
|
||||
PracticeError int64
|
||||
StandardError int64
|
||||
|
||||
}
|
||||
|
||||
type ScoreProgressVO struct {
|
||||
QuestionId int64
|
||||
QuestionName string
|
||||
SubjectName string
|
||||
ImportNumber int64
|
||||
AverageScore float64
|
||||
|
||||
FinishNumber int64
|
||||
FinishRate float64
|
||||
UnfinishedNumber float64
|
||||
UnfinishedRate float64
|
||||
IsAllFinished int64
|
||||
//AverageSpeed float64
|
||||
FirstFinishedNumber int64
|
||||
FirstFinishedRate float64
|
||||
FirstUnfinishedNumber float64
|
||||
FirstUnfinishedRate float64
|
||||
IsFirstFinished int64
|
||||
|
||||
SecondFinishedNumber int64
|
||||
SecondFinishedRate float64
|
||||
SecondUnfinishedNumber float64
|
||||
SecondUnfinishedRate float64
|
||||
IsSecondFinished int64
|
||||
|
||||
ThirdFinishedNumber int64
|
||||
ThirdFinishedRate float64
|
||||
ThirdUnfinishedNumber float64
|
||||
ThirdUnfinishedRate float64
|
||||
IsThirdFinished int64
|
||||
|
||||
ArbitramentNumber int64
|
||||
ArbitramentRate float64
|
||||
ArbitramentFinishedNumber int64
|
||||
ArbitramentFinishedRate float64
|
||||
ArbitramentUnfinishedNumber int64
|
||||
ArbitramentUnfinishedRate float64
|
||||
IsArbitramentFinished int64
|
||||
|
||||
|
||||
ProblemNumber int64
|
||||
ProblemRate float64
|
||||
ProblemFinishedNumber int64
|
||||
ProblemFinishedRate float64
|
||||
ProblemUnfinishedNumber int64
|
||||
ProblemUnfinishedRate float64
|
||||
IsProblemFinished int64
|
||||
}
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
package responses
|
||||
|
||||
import (
|
||||
"github.com/open-ct/openscore/models"
|
||||
"time"
|
||||
)
|
||||
|
||||
type SubTopicPlus struct {
|
||||
models.SubTopic
|
||||
Test_detail_id int64 `json:"test_detail_id"`
|
||||
}
|
||||
|
||||
type TestDisplay struct {
|
||||
QuestionId int64 `json:"questionId"`
|
||||
QuestionName string `json:"questionName"`
|
||||
TestId int64 `json:"testId"`
|
||||
SubTopics []SubTopicPlus `json:"subTopic"`
|
||||
TestInfos []models.TestPaperInfo `json:"testInfos"`
|
||||
}
|
||||
|
||||
type TestList struct {
|
||||
TestId []int64 `json:"papers"`
|
||||
}
|
||||
|
||||
type TestAnswer struct {
|
||||
Pic_src []string `json:"keyTest"`
|
||||
}
|
||||
|
||||
type ExampleList struct {
|
||||
TestPapers []models.TestPaper `json:"exampleTestPapers"`
|
||||
}
|
||||
|
||||
type TestReview struct {
|
||||
TestId []int64 `json:"testId"`
|
||||
Score []int64 `json:"score"`
|
||||
ScoreTime []time.Time `json:"score_time"`
|
||||
}
|
||||
|
||||
type ExampleDeatil struct {
|
||||
QuestionName string `json:"quetsionName"`
|
||||
Test [][]models.TestPaperInfo `json:"test"`
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
package util
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
func String2Time(value string) (time.Time, error) {
|
||||
return time.Parse(time.RFC3339, value)
|
||||
}
|
||||
|
||||
func GetCurrentTime() string {
|
||||
timestamp := time.Now().Unix()
|
||||
tm := time.Unix(timestamp, 0)
|
||||
return tm.Format(time.RFC3339)
|
||||
}
|
||||
|
||||
func GetTimeFromTimestamp(stamp int64) string {
|
||||
t := time.Unix(stamp, 0)
|
||||
return t.Format(time.RFC3339)
|
||||
}
|
||||
|
||||
func Time2String(t time.Time) string {
|
||||
// https://stackoverflow.com/questions/55409774/the-result-of-time-formatting-of-rfc3339-in-go-on-linux-and-macos-are-different
|
||||
lo, _ := time.LoadLocation("Local")
|
||||
return t.In(lo).Format(time.RFC3339)
|
||||
}
|
||||
|
||||
// GetTimeMonth returns the time after the specified duration(month).
|
||||
func GetTimeMonth(month int) string {
|
||||
currentTime := time.Now()
|
||||
res := currentTime.AddDate(0, month, 0)
|
||||
return res.Format(time.RFC3339)
|
||||
}
|
||||
|
||||
// GetTimeDay returns the time after the specified duration(day).
|
||||
func GetTimeDay(day int) string {
|
||||
currentTime := time.Now()
|
||||
res := currentTime.AddDate(0, 0, day)
|
||||
return res.Format(time.RFC3339)
|
||||
}
|
||||
|
||||
// GetTimeMinute returns the time after the specified duration(minute).
|
||||
func GetTimeMinute(minute int) string {
|
||||
currentTime := time.Now()
|
||||
m, _ := time.ParseDuration(strconv.Itoa(minute) + "m")
|
||||
res := currentTime.Add(m)
|
||||
return res.Format(time.RFC3339)
|
||||
}
|
||||
|
||||
// GetTimeHour returns the time after the specified duration(hour).
|
||||
func GetTimeHour(hour int) string {
|
||||
currentTime := time.Now()
|
||||
h, _ := time.ParseDuration(strconv.Itoa(hour) + "h")
|
||||
res := currentTime.Add(h)
|
||||
return res.Format(time.RFC3339)
|
||||
}
|
||||
|
||||
// GetTimeYear returns the time after the specified duration(year).
|
||||
func GetTimeYear(year int) string {
|
||||
currentTime := time.Now()
|
||||
res := currentTime.AddDate(year, 0, 0)
|
||||
return res.Format(time.RFC3339)
|
||||
}
|
||||
|
||||
// GetDateStr returns formatted current time with the year, month and day.
|
||||
func GetDateStr() string {
|
||||
return time.Now().Format("20060102")
|
||||
}
|
Loading…
Reference in New Issue