Merge pull request !1 from David/frontend-modify
This commit is contained in:
Ontheway123 2021-08-16 11:03:27 +00:00 committed by Gitee
commit 0fd93cec79
23 changed files with 813 additions and 493 deletions

View File

@ -5,8 +5,10 @@ autorender = false
copyrequestbody = true
sessionon = true
casdoorEndpoint = http://localhost:8000
clientId = 9162cb3914b3f1559e9e
clientSecret = 470d86682d57a75486ed9ae74e748cfbfa6c8774
# clientId = 70e1935bf72eb360d0fa
clientId = 1e1b5a3bd4a6a284553a
clientSecret = 4a350afb057ac3fea619c89bfcd316f51f788149
# clientSecret = 636ab7ccf862b7e0fb4192c9989dc6e732756c5c
jwtSecret = CasdoorSecret
casdoorOrganization = "built-in"
include "mysql.conf"

View File

@ -1,4 +1,11 @@
[mysql]
# MYSQL_HOST=127.0.0.1
# MYSQL_PORT=3306
# MYSQL_USER=root
# MYSQL_PASSWORD=cappuccino
# MYSQL_DATABASE=openct
MYSQL_HOST=101.34.69.185
MYSQL_PORT=3308
MYSQL_USER=root

View File

@ -23,6 +23,7 @@
package controllers
import (
"log"
"openscore/auth"
"openscore/util"
@ -43,6 +44,7 @@ func (c *ApiController) GetSessionUser() *auth.Claims {
if s == nil {
return nil
}
log.Println(s)
claims := &auth.Claims{}
err := util.JsonToStruct(s.(string), claims)

View File

@ -9,6 +9,7 @@ package controllers
import (
"fmt"
"log"
"openscore/auth"
"openscore/models"
@ -57,6 +58,7 @@ func (c *ApiController) Login() {
if err != nil {
panic(err)
}
log.Println(claims)
claims.AccessToken = token.AccessToken
c.SetSessionUser(claims)

View File

@ -5,6 +5,8 @@ import (
"log"
"math"
"openscore/models"
"openscore/requests"
"openscore/responses"
"strconv"
"strings"
"time"
@ -12,83 +14,107 @@ import (
func (c *TestPaperApiController) Display() {
defer c.ServeJSON()
var requestBody map[string]interface{}
json.Unmarshal(c.Ctx.Input.RequestBody, &requestBody)
log.Println(requestBody["testId"])
testIdstr := requestBody["testId"].(string)
testId, err := strconv.ParseInt(testIdstr, 10, 64)
var requestBody requests.TestDisplay
err := json.Unmarshal(c.Ctx.Input.RequestBody, &requestBody)
if err != nil {
log.Println("parse questionId fail")
resp := Response{"10001", "cannot unmarshal", err}
c.Data["json"] = resp
return
}
testId := requestBody.TestId
var testPaper models.TestPaper
var topic models.Topic
var subTopic []models.SubTopic
testPaper.GetTestPaper(testId)
topic.GetTopic(testPaper.Question_id)
models.GetSubTopicsByTestId(testPaper.Question_id, &subTopic)
type subTopicRes struct {
Question_detail_id int64
Question_detail_name string
Question_id int64
Question_detail_score int64
Test_detail_id int64
var response responses.TestDisplay
err = testPaper.GetTestPaper(testId)
if err != nil {
resp := Response{"10002", "get test paper fail", err}
c.Data["json"] = resp
return
}
var testInfoList []models.TestPaperInfo
var subTopics []subTopicRes
err = topic.GetTopic(testPaper.Question_id)
if err != nil {
resp := Response{"10003", "get topic fail", err}
c.Data["json"] = resp
return
}
err = models.GetSubTopicsByTestId(testPaper.Question_id, &subTopic)
if err != nil {
resp := Response{"10004", "get subtopic fail", err}
c.Data["json"] = resp
return
}
for i := 0; i < len(subTopic); i++ {
var testPaperInfo models.TestPaperInfo
testPaperInfo.GetTestPaperInfoByTestIdAndQuestionDetailId(testId, subTopic[i].Question_detail_id)
tempTopic := subTopicRes{subTopic[i].Question_detail_id, subTopic[i].Question_detail_name, subTopic[i].Question_id, subTopic[i].Question_detail_score, (testPaperInfo.Test_detail_id)}
subTopics = append(subTopics, tempTopic)
log.Println(subTopics)
testInfoList = append(testInfoList, testPaperInfo)
}
data := make(map[string]interface{})
data["questionId"] = testPaper.Question_id
err = testPaperInfo.GetTestPaperInfoByTestIdAndQuestionDetailId(testId, subTopic[i].Question_detail_id)
if err != nil {
resp := Response{"10005", "get testPaperInfo fail", err}
c.Data["json"] = resp
return
}
tempSubTopic := responses.SubTopicPlus{SubTopic: subTopic[i], Test_detail_id: testPaperInfo.Test_detail_id}
data["questionName"] = topic.Question_name
data["subTopic"] = subTopics
data["picSrcs"] = testInfoList
resp := Response{"10000", "OK", data}
response.SubTopics = append(response.SubTopics, tempSubTopic)
response.TestInfos = append(response.TestInfos, testPaperInfo)
}
response.QuestionId = topic.Question_id
response.QuestionName = topic.Question_name
response.TestId = testId
resp := Response{"10000", "OK", response}
c.Data["json"] = resp
}
func (c *TestPaperApiController) List() {
defer c.ServeJSON()
var requestBody map[string]interface{}
json.Unmarshal(c.Ctx.Input.RequestBody, &requestBody)
userIdstr := requestBody["userId"].(string)
userId, err := strconv.ParseInt(userIdstr, 10, 64)
var requestBody requests.TetsList
err := json.Unmarshal(c.Ctx.Input.RequestBody, &requestBody)
if err != nil {
log.Println("parse userId fail")
resp := Response{"10001", "cannot unmarshal", err}
c.Data["json"] = resp
return
}
var papers []models.UnderCorrectedPaper
models.GetDistributedPaperByUserId(userId, &papers)
data := make(map[string]interface{})
data["papers"] = papers
resp := Response{"10000", "OK", data}
log.Println(requestBody)
userId := requestBody.UserId
var response responses.TestList
err = models.GetDistributedTestIdPaperByUserId(userId, &response.TestId)
if err != nil {
resp := Response{"10002", "get distribution fail", err}
c.Data["json"] = resp
return
}
if len(response.TestId) == 0 {
resp := Response{"10003", "there is no paper to correct", err}
c.Data["json"] = resp
return
}
log.Println(response)
resp := Response{"10000", "OK", response}
c.Data["json"] = resp
}
func (c *TestPaperApiController) Point() {
defer c.ServeJSON()
var requestBody map[string]interface{}
json.Unmarshal(c.Ctx.Input.RequestBody, &requestBody)
userIdstr := requestBody["userId"].(string)
scoresstr := requestBody["scores"].(string)
testIdstr := requestBody["testId"].(string)
testDetailIdstr := requestBody["testDetailId"].(string)
// userId, _ := strconv.ParseInt(userIdstr, 10, 64)
userId := userIdstr
var requestBody requests.TestPoint
err := json.Unmarshal(c.Ctx.Input.RequestBody, &requestBody)
if err != nil {
resp := Response{"10001", "cannot unmarshal", err}
c.Data["json"] = resp
return
}
log.Println(requestBody)
userId := requestBody.UserId
scoresstr := requestBody.Scores
testId := requestBody.TestId
testDetailIdstr := requestBody.TestDetailId
scores := strings.Split(scoresstr, "-")
testDetailIds := strings.Split(testDetailIdstr, "-")
testId, _ := strconv.ParseInt(testIdstr, 10, 64)
var scoreArr []int64
var sum int64 = 0
for _, i := range scores {
@ -102,14 +128,26 @@ func (c *TestPaperApiController) Point() {
var test models.TestPaper
var topic models.Topic
test.GetTestPaper(testId)
topic.GetTopic(test.Question_id)
// var testInfos []models.TestPaperInfo
// models.GetTestInfoListByTestId(testId, &testInfos)
err = test.GetTestPaper(testId)
if err != nil || test.Test_id == 0 {
resp := Response{"10002", "get test paper fail", err}
c.Data["json"] = resp
return
}
err = topic.GetTopic(test.Question_id)
if err != nil || topic.Question_id == 0 {
resp := Response{"10003", "get topic fail", err}
c.Data["json"] = resp
return
}
var underTest models.UnderCorrectedPaper
underTest.GetUnderCorrectedPaper(userId, testId)
// underTest.Delete()
err = underTest.GetUnderCorrectedPaper(userId, testId)
if err != nil || underTest.Question_id == 0 {
resp := Response{"10004", "get underCorrected fail", err}
c.Data["json"] = resp
return
}
final := false
@ -126,7 +164,6 @@ func (c *TestPaperApiController) Point() {
if math.Abs(float64(test.Examiner_second_score)-float64(test.Examiner_first_score)) <= float64(topic.Standard_error) {
log.Println(math.Abs(float64(test.Examiner_second_score) - float64(test.Examiner_first_score)))
sum = int64(math.Abs(float64(test.Examiner_second_score+test.Examiner_first_score)) / 2)
log.Println("hello world")
final = true
} else {
newUnderTest := models.UnderCorrectedPaper{}
@ -134,7 +171,12 @@ func (c *TestPaperApiController) Point() {
newUnderTest.Test_question_type = 3
newUnderTest.Test_id = underTest.Test_id
newUnderTest.Question_id = underTest.Question_id
newUnderTest.Save()
err = newUnderTest.Save()
if err != nil {
resp := Response{"10005", "insert undertest fail", err}
c.Data["json"] = resp
return
}
}
}
if underTest.Test_question_type == 4 || underTest.Test_question_type == 5 {
@ -155,7 +197,6 @@ func (c *TestPaperApiController) Point() {
sum = (test.Examiner_third_score + test.Examiner_second_score) / 2
}
if small <= float64(topic.Standard_error) {
// test.Final_score = sum
final = true
} else {
test.Question_status = 2
@ -165,29 +206,40 @@ func (c *TestPaperApiController) Point() {
newUnderTest.Test_question_type = 4
newUnderTest.Test_id = underTest.Test_id
newUnderTest.Question_id = underTest.Question_id
newUnderTest.Save()
err = newUnderTest.Save()
if err != nil {
resp := Response{"10006", "insert undertest fail", err}
c.Data["json"] = resp
return
}
}
//??
}
if final {
//???
test.Final_score = sum
}
// else {
// newUnderTest := underTest
// newUnderTest.User_id = 10000
// // newUnderTest.Test_question_type += 1
// newUnderTest.Save()
// }
underTest.Delete()
test.Update()
err = underTest.Delete()
if err != nil {
resp := Response{"10006", "delete undertest fail", err}
c.Data["json"] = resp
return
}
err = test.Update()
if err != nil {
resp := Response{"10007", "update test fail", err}
c.Data["json"] = resp
return
}
for i := 0; i < len(scores); i++ {
score := scoreArr[i]
var tempTest models.TestPaperInfo
id, _ := strconv.ParseInt(testDetailIds[i], 10, 64)
log.Println(id)
tempTest.GetTestPaperInfo(id)
err = tempTest.GetTestPaperInfo(id)
if err != nil {
resp := Response{"10008", "get testPaper fail", err}
c.Data["json"] = resp
return
}
if topic.Score_type == 1 {
tempTest.Examiner_first_id = userId
tempTest.Examiner_first_score = score
@ -197,9 +249,6 @@ func (c *TestPaperApiController) Point() {
} else if topic.Score_type == 2 && tempTest.Examiner_second_id == "-1" {
tempTest.Examiner_second_id = userId
tempTest.Examiner_second_score = score
// if final{
// score = int64(math.Abs(float64(tempTest.Examiner_second_score+tempTest.Examiner_first_score)) / 2)
// }
}
if underTest.Test_question_type == 4 || underTest.Test_question_type == 5 {
tempTest.Leader_id = userId
@ -211,7 +260,12 @@ func (c *TestPaperApiController) Point() {
if final {
tempTest.Final_score = score
}
tempTest.Update()
err = tempTest.Update()
if err != nil {
resp := Response{"10009", "update testPaper fail", err}
c.Data["json"] = resp
return
}
}
var record models.ScoreRecord
@ -221,37 +275,72 @@ func (c *TestPaperApiController) Point() {
record.Test_record_type = underTest.Test_question_type
record.User_id = userId
record.Score_time = time.Now()
record.Save()
err = record.Save()
if err != nil {
resp := Response{"10010", "insert record fail", err}
c.Data["json"] = resp
return
}
resp := Response{"10000", "ok", err}
c.Data["json"] = resp
}
func (c *TestPaperApiController) Problem() {
defer c.ServeJSON()
var requestBody map[string]interface{}
json.Unmarshal(c.Ctx.Input.RequestBody, &requestBody)
userIdstr := requestBody["userId"].(string)
problemTypestr := requestBody["problemType"].(string)
testIdstr := requestBody["testId"].(string)
// userId, _ := strconv.ParseInt(userIdstr, 10, 64)
userId := userIdstr
testId, _ := strconv.ParseInt(testIdstr, 10, 64)
problemType, _ := strconv.ParseInt(problemTypestr, 10, 64)
// var requestBody map[string]interface{}
var requestBody requests.TestProblem
err := json.Unmarshal(c.Ctx.Input.RequestBody, &requestBody)
if err != nil {
resp := Response{"10001", "cannot unmarshal", err}
c.Data["json"] = resp
return
}
userId := requestBody.UserId
problemType := requestBody.ProblemType
testId := requestBody.TestId
var underTest models.UnderCorrectedPaper
var record models.ScoreRecord
var test models.TestPaper
underTest.GetUnderCorrectedPaper(userId, testId)
err = underTest.GetUnderCorrectedPaper(userId, testId)
if err != nil {
resp := Response{"10002", "get underCorrected fail", err}
c.Data["json"] = resp
return
}
var newUnderTest = underTest
underTest.Delete()
err = underTest.Delete()
if err != nil {
resp := Response{"10002", "delete underTest fail", err}
c.Data["json"] = resp
return
}
newUnderTest.User_id = "10000"
newUnderTest.Test_question_type = 6
newUnderTest.Problem_type = problemType
has, _ := newUnderTest.IsDuplicate()
if !has {
log.Println("dup")
newUnderTest.Save()
test.GetTestPaper(testId)
err = newUnderTest.Save()
if err != nil {
resp := Response{"10003", "update underTest fail", err}
c.Data["json"] = resp
return
}
err = test.GetTestPaper(testId)
if err != nil {
resp := Response{"10004", "get testPaper fail", err}
c.Data["json"] = resp
return
}
test.Question_status = 3
test.Update()
err = test.Update()
if err != nil {
resp := Response{"10005", "update testPaper fail", err}
c.Data["json"] = resp
return
}
}
record.Test_record_type = 5
@ -259,88 +348,161 @@ func (c *TestPaperApiController) Problem() {
record.User_id = userId
record.Question_id = test.Question_id
record.Test_record_type = 5
record.Save()
err = record.Save()
if err != nil {
resp := Response{"10006", "insert record fail", err}
c.Data["json"] = resp
return
}
resp := Response{"10000", "ok", err}
c.Data["json"] = resp
}
func (c *TestPaperApiController) Answer() {
defer c.ServeJSON()
var requestBody map[string]interface{}
json.Unmarshal(c.Ctx.Input.RequestBody, &requestBody)
// userIdstr := requestBody["userId"].(string)
testIdstr := requestBody["testId"].(string)
testId, _ := strconv.ParseInt(testIdstr, 10, 64)
var requestBody requests.TestAnswer
err := json.Unmarshal(c.Ctx.Input.RequestBody, &requestBody)
if err != nil {
resp := Response{"10001", "cannot unmarshal", err}
c.Data["json"] = resp
return
}
testId := requestBody.TestId
var test models.TestPaper
test.GetTestPaper(testId)
err = test.GetTestPaper(testId)
if err != nil {
resp := Response{"10002", "get testPaper fail", err}
c.Data["json"] = resp
return
}
var answerTest models.TestPaper
answerTest.GetTestPaperByQuestionIdAndQuestionStatus(test.Question_id, 5)
err = answerTest.GetTestPaperByQuestionIdAndQuestionStatus(test.Question_id, 5)
if err != nil {
resp := Response{"10003", "get testPaper fail", err}
c.Data["json"] = resp
return
}
var as []models.TestPaperInfo
models.GetTestInfoListByTestId(answerTest.Test_id, &as)
data := make(map[string]interface{})
data["keyTest"] = as
resp := Response{"10000", "ok", data}
var as responses.TestAnswer
err = models.GetTestInfoPicListByTestId(answerTest.Test_id, &as.Pic_src)
if err != nil {
resp := Response{"10004", "get testPaperInfo fail", err}
c.Data["json"] = resp
return
}
resp := Response{"10000", "ok", as}
c.Data["json"] = resp
}
func (c *TestPaperApiController) ExampleDeatil() {
defer c.ServeJSON()
var requestBody map[string]interface{}
json.Unmarshal(c.Ctx.Input.RequestBody, &requestBody)
// userIdstr := requestBody["userId"].(string)
testIdstr := requestBody["exampleTestId"].(string)
testId, _ := strconv.ParseInt(testIdstr, 10, 64)
var requestBody requests.ExampleDetail
err := json.Unmarshal(c.Ctx.Input.RequestBody, &requestBody)
if err != nil {
resp := Response{"10001", "cannot unmarshal", err}
c.Data["json"] = resp
return
}
testId := requestBody.ExampleTestId
log.Println(testId)
var test models.TestPaper
test.GetTestPaper(testId)
err = test.GetTestPaper(testId)
if err != nil {
resp := Response{"10002", "get testPaper fail", err}
c.Data["json"] = resp
return
}
var exampleTest []models.TestPaper
//??
models.GetTestPaperListByQuestionIdAndQuestionStatus(test.Question_id, 6, &exampleTest)
err = models.GetTestPaperListByQuestionIdAndQuestionStatus(test.Question_id, 6, &exampleTest)
if err != nil {
resp := Response{"10003", "get testPaper fail", err}
c.Data["json"] = resp
return
}
if len(exampleTest) == 0 {
resp := Response{"10004", "there is no exampleTest", err}
c.Data["json"] = resp
return
}
var topic models.Topic
topic.GetTopic(exampleTest[0].Question_id)
var tests [][]models.TestPaperInfo
err = topic.GetTopic(exampleTest[0].Question_id)
if err != nil {
resp := Response{"10005", "get topic fail", err}
c.Data["json"] = resp
return
}
var response responses.ExampleDeatil
response.QuestionName = topic.Question_name
for i := 0; i < len(exampleTest); i++ {
var temp []models.TestPaperInfo
models.GetTestInfoListByTestId(exampleTest[i].Test_id, &temp)
tests = append(tests, temp)
err = models.GetTestInfoListByTestId(exampleTest[i].Test_id, &temp)
if err != nil {
resp := Response{"10006", "get testPaperInfo fail", err}
c.Data["json"] = resp
return
}
response.Test = append(response.Test, temp)
}
data := make(map[string]interface{})
data["questionName"] = topic.Question_name
data["test"] = tests
resp := Response{"10000", "ok", data}
resp := Response{"10000", "ok", response}
c.Data["json"] = resp
}
func (c *TestPaperApiController) ExampleList() {
defer c.ServeJSON()
var requestBody map[string]interface{}
json.Unmarshal(c.Ctx.Input.RequestBody, &requestBody)
// userIdstr := requestBody["userId"].(string)
testIdstr := requestBody["testId"].(string)
testId, _ := strconv.ParseInt(testIdstr, 10, 64)
var requestBody requests.ExampleList
err := json.Unmarshal(c.Ctx.Input.RequestBody, &requestBody)
if err != nil {
resp := Response{"10001", "cannot unmarshal", err}
c.Data["json"] = resp
return
}
testId := requestBody.TestId
var testPaper models.TestPaper
testPaper.GetTestPaper(testId)
var exampleTest []models.TestPaper
//??
models.GetTestPaperListByQuestionIdAndQuestionStatus(testPaper.Question_id, 6, &exampleTest)
data := make(map[string]interface{})
data["exampleTestId"] = exampleTest
resp := Response{"10000", "ok", data}
err = testPaper.GetTestPaper(testId)
if err != nil {
resp := Response{"10002", "get testPaper fail", err}
c.Data["json"] = resp
return
}
var response responses.ExampleList
err = models.GetTestPaperListByQuestionIdAndQuestionStatus(testPaper.Question_id, 6, &response.TestPapers)
if err != nil {
resp := Response{"10003", "get testPaper fail", err}
c.Data["json"] = resp
return
}
resp := Response{"10000", "ok", response}
c.Data["json"] = resp
}
func (c *TestPaperApiController) Review() {
defer c.ServeJSON()
var requestBody map[string]interface{}
json.Unmarshal(c.Ctx.Input.RequestBody, &requestBody)
userIdstr := requestBody["userId"].(string)
// userId, _ := strconv.ParseInt(userIdstr, 10, 64)
userId := userIdstr
var requestBody requests.TestReview
err := json.Unmarshal(c.Ctx.Input.RequestBody, &requestBody)
if err != nil {
resp := Response{"10001", "cannot unmarshal", err}
c.Data["json"] = resp
return
}
userId := requestBody.UserId
var records []models.ScoreRecord
models.GetLatestRecores(userId, &records)
data := make(map[string]interface{})
data["records"] = records
resp := Response{"10000", "ok", data}
var response responses.TestReview
err = models.GetLatestRecords(userId, &records)
if err != nil {
resp := Response{"10002", "get record fail", err}
c.Data["json"] = resp
return
}
for i := 0; i < len(records); i++ {
response.TestId = append(response.TestId, records[i].Test_id)
response.Score = append(response.Score, records[i].Score)
response.ScoreTime = append(response.ScoreTime, records[i].Score_time)
}
resp := Response{"10000", "ok", response}
c.Data["json"] = resp
}

View File

@ -16,6 +16,7 @@ export default class index extends Component {
getAllPaper = () => {
Marking.testList({ userId: this.userId })
.then((res) => {
console.log(res)
if (res.data.status == "10000") {
let papers = [...res.data.data.papers]
this.setState(
@ -33,8 +34,9 @@ export default class index extends Component {
}
getAnswer = () => {
Marking.testAnswer({ userId: this.userId, testId: "1" })
Marking.testAnswer({ userId: this.userId, testId: 1 })
.then((res) => {
console.log(res)
if (res.data.status == "10000") {
this.setState({
keyTest: res.data.data.keyTest
@ -55,7 +57,7 @@ export default class index extends Component {
let testPaper = null;
if (this.state.keyTest != undefined || this.state.keyTest != null) {
testPaper = this.state.keyTest.map((item) => {
return <img src={item.Pic_src} alt="加载失败" className="test-question-img"/>
return <img src={item} alt="加载失败" className="test-question-img"/>
})
}

View File

@ -59,7 +59,7 @@ export default class index extends Component {
}
//
getCurrentPaper = () => {
Marking.testDisplay({ userId: this.userId, testId: this.state.papers[0].Test_id.toString() })
Marking.testDisplay({ userId: this.userId, testId: this.state.papers[0] })
.then((res) => {
if (res.data.status == "10000") {
let currentPaper = JSON.parse(JSON.stringify(res.data.data))
@ -75,9 +75,9 @@ export default class index extends Component {
//
showTest = () => {
let testPaper = null;
if (this.state.currentPaper.picSrcs != undefined) {
testPaper = this.state.currentPaper.picSrcs.map((item) => {
return <img src={item.Pic_src} alt="加载失败" className="test-question-img"/>
if (this.state.currentPaper.testInfos != undefined) {
testPaper = this.state.currentPaper.testInfos.map((item) => {
return <img src={item.pic_src} alt="加载失败" className="test-question-img"/>
})
}
@ -118,12 +118,12 @@ export default class index extends Component {
}
showSelect = () => {
let scoreSelect = null;
if (this.state.currentPaper.picSrcs != undefined) {
if (this.state.currentPaper.testInfos != undefined) {
scoreSelect = this.state.currentPaper.subTopic.map((item,index) => {
return <div className="score-select">
{item.Question_detail_name}<Select key={index} placeholder="请选择分数" style={{ width: 120 }} onSelect={this.select.bind(this,item.Question_detail_id)}>
{item.question_detail_name}<Select key={index} placeholder="请选择分数" style={{ width: 120 }} onSelect={this.select.bind(this,item.test_detail_id)}>
{
this.selectBox(item.Question_detail_score)
this.selectBox(item.question_detail_score)
}
</Select>
</div>
@ -193,11 +193,10 @@ export default class index extends Component {
onOk: () => {
let Qustion_detail_id = Util.getTextByJs(this.state.selectId);
let Question_detail_score = Util.getTextByJs(this.state.selectScore);
console.log()
if (value == 1) {
Marking.testPoint({
userId: this.userId,
testId: this.state.papers[0].Test_id.toString(),
testId: this.state.currentPaper.testId,
scores: Question_detail_score,
testDetailId: Qustion_detail_id
})
@ -226,8 +225,8 @@ export default class index extends Component {
handleOk = () => {
Marking.testProblem({
userId: this.userId,
testId: this.state.papers[0].Test_id.toString(),
problemType: this.state.problemValue.toString()
testId: this.state.currentPaper.testId,
problemType: this.state.problemValue
})
.then((res) => {
this.setState({

View File

@ -19,11 +19,11 @@ export default class index extends Component {
.then((res) => {
if (res.data.status == "10000") {
let reviewList = []
for (let i = 0; i < res.data.data.records.length; i++) {
for (let i = 0; i < res.data.data.testId.length; i++) {
reviewList.push({
order: i+1,
test_id: res.data.data.records[i].Test_id,
score: res.data.data.records[i].Score
test_id: res.data.data.testId[i],
score: res.data.data.score[i]
})
}
this.setState({

View File

@ -39,16 +39,16 @@ export default class index extends Component {
})
}
getSampleList = () => {
Marking.testExampleList({ userId: this.userId, testId: "1" })
Marking.testExampleList({ userId: this.userId, testId: 1 })
.then((res) => {
if (res.data.status == "10000") {
let sampleList = []
for (let i = 0; i< res.data.data.exampleTestId.length; i++) {
for (let i = 0; i< res.data.data.exampleTestPapers.length; i++) {
sampleList.push({
order: i,
question_id: res.data.data.exampleTestId[i].Test_id,
question_name: res.data.data.exampleTestId[i].Candidate,
score: res.data.data.exampleTestId[i].Final_score,
question_id: res.data.data.exampleTestPapers[i].test_id,
question_name: res.data.data.exampleTestPapers[i].candidate,
score: res.data.data.exampleTestPapers[i].final_score,
})
}
this.setState({
@ -89,7 +89,7 @@ export default class index extends Component {
let testPaper = null;
if (this.state.samplePaper != undefined || this.state.samplePaper != null) {
testPaper = this.state.samplePaper.map((item) => {
return <img src={item.Pic_src} alt="加载失败" className="test-question-img"/>
return <img src={item.pic_src} alt="加载失败" className="test-question-img"/>
})
}
@ -131,7 +131,7 @@ export default class index extends Component {
}
selectRow = (record) => {
console.log(record.order)
Marking.testDetail({ userId: this.userId, exampleTestId: record.question_id.toString() })
Marking.testDetail({ userId: this.userId, exampleTestId: record.question_id })
.then((res) => {
if (res.data.status == "10000") {
this.setState({

View File

@ -1 +1 @@
{"C:\\Users\\yang\\Desktop\\阅卷系统\\controllers":1628843948956323100}
{"C:\\Users\\dav1d\\code\\OpenCt\\openscore\\controllers":1629108173778123900}

View File

@ -2,6 +2,7 @@ package models
import (
"fmt"
"log"
beego "github.com/beego/beego/v2/server/web"
_ "github.com/go-sql-driver/mysql"
@ -29,3 +30,17 @@ func init() {
initUserModels()
}
func initMarkingModels() {
err := x.Sync2(new(Topic), new(SubTopic), new(TestPaper), new(TestPaperInfo), new(ScoreRecord), new(UnderCorrectedPaper), new(PaperDistribution))
if err != nil {
log.Println(err)
}
}
func initUserModels() {
err := x.Sync2(new(User))
if err != nil {
log.Println(err)
}
}

View File

@ -1,285 +0,0 @@
package models
import (
"log"
"time"
"xorm.io/builder"
)
// Author: Junlang
// struct : Topic(大题)
// comment: must capitalize the first letter of the field in Topic
type Topic struct {
Question_id int64 `xorm:"pk autoincr"`
Question_name string `xorm:"varchar(50)"`
Subject_name string `xorm:"varchar(50)"`
Standard_error int64
Question_score int64
Score_type int64
Import_number int64
Import_time time.Time `xorm:updated`
}
type SubTopic struct {
Question_detail_id int64 `xorm:"pk autoincr" `
Question_detail_name string
Question_id int64
Question_detail_score int64
}
type TestPaper struct {
Test_id int64 `xorm:"pk autoincr"`
Question_id int64
Candidate string
Question_status int64
Examiner_first_id string `xorm:"default('-1')"`
Examiner_first_score int64
Examiner_first_self_score int64
Examiner_second_id string `xorm:"default('-1')"`
Examiner_second_score int64
Examiner_second_self_score int64
Examiner_third_id string `xorm:"default('-1')"`
Examiner_third_score int64
Examiner_third_self_score int64
Leader_id string `xorm:"default('-1')"`
Leader_score int64
Final_score int64
Final_score_id string
Pratice_error int64
Answer_test_id int64
Example_test_id int64
}
type TestPaperInfo struct {
Test_detail_id int64 `xorm:"pk autoincr"`
Question_detail_id int64
Test_id int64
Pic_src string
Examiner_first_id string `xorm:"default('-1')"`
Examiner_first_score int64
Examiner_first_self_score int64
Examiner_second_id string `xorm:"default('-1')"`
Examiner_second_score int64
Examiner_second_self_score int64
Examiner_third_id string `xorm:"default('-1')"`
Examiner_third_score int64
Examiner_third_self_score int64
Leader_id string `xorm:"default('-1')"`
Leader_score int64
Final_score int64
Final_score_id string `xorm:"default('-1')"`
}
type UnderCorrectedPaper struct {
UnderCorrected_id int64 `xorm:"pk autoincr"`
User_id string
Test_id int64
Question_id int64
Test_question_type int64
Problem_type int64 `xorm:"default(-1)"`
}
type ScoreRecord struct {
Record_id int64 `xorm:"pk autoincr"`
Question_id int64
Test_id int64
User_id string
Score_time time.Time
Score int64
Test_record_type int64
Problem_type int64 `xorm:"default(-1)"`
}
type PaperDistribution struct {
Distribution_id int64 `xorm:"pk autoincr"`
User_id string
Question_id int64
Test_distribution_number int64
PaperType int64
}
func initMarkingModels() {
err := x.Sync2(new(Topic), new(SubTopic), new(TestPaper), new(TestPaperInfo), new(ScoreRecord), new(UnderCorrectedPaper), new(PaperDistribution))
if err != nil {
log.Println(err)
}
}
func (t *Topic) GetTopic(id int64) error {
has, err := x.Where(builder.Eq{"question_id": id}).Get(t)
if !has || err != nil {
log.Println("could not find topic")
}
return err
}
func GetSubTopicsByQuestionId(id int64, st *[]SubTopic) error {
err := x.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 := x.Where(builder.Eq{"question_id": id}).Find(st)
if err != nil {
log.Println("could not find any SubTopic")
log.Println(err)
}
return err
}
func GetDistributedPaperByUserId(id int64, up *[]UnderCorrectedPaper) error {
err := x.Where("user_id = ?", id).Find(up)
if err != nil {
log.Println("could not find any paper")
}
return err
}
func GetTestInfoListByTestId(id int64, as *[]TestPaperInfo) error {
err := x.Where("test_id = ?", id).Find(as)
if err != nil {
log.Println("could not find any paper")
}
return err
}
func (t *TestPaper) GetTestPaperByQuestionIdAndQuestionStatus(question_id int64, question_statue int64) error {
has, err := x.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 GetTestPaperListByQuestionIdAndQuestionStatus(question_id int64, question_statue int64, tl *[]TestPaper) error {
err := x.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 *TestPaperInfo) GetTestPaperInfoByTestIdAndQuestionDetailId(testId int64, questionDetailId int64) error {
has, err := x.Where("question_detail_id = ? and test_id = ?", questionDetailId, testId).Get(t)
if !has || err != nil {
log.Println("could not specific info")
}
return err
}
func (st *SubTopic) GetSubTopic(id int64) error {
has, err := x.Where(builder.Eq{"question_detail_id": id}).Get(st)
if !has || err != nil {
log.Println("could not find SubTopic")
}
return err
}
func (t *TestPaper) GetTestPaper(id int64) error {
has, err := x.Where(builder.Eq{"test_id": id}).Get(t)
if !has || err != nil {
log.Println("could not find test paper")
}
return err
}
func (t *TestPaperInfo) GetTestPaperInfo(id int64) error {
has, err := x.Where(builder.Eq{"test_detail_id": id}).Get(t)
if !has || err != nil {
log.Println("could not find test paper info")
log.Println(err)
}
return err
}
func (u *UnderCorrectedPaper) GetUnderCorrectedPaper(userId string, testId int64) error {
has, err := x.Where(builder.Eq{"test_id": testId, "user_id": userId}).Get(u)
if !has || err != nil {
log.Println("could not find under corrected paper")
log.Println(err)
}
return err
}
func (u *UnderCorrectedPaper) Delete() error {
code, err := x.Where(builder.Eq{"test_id": u.Test_id, "user_id": u.User_id}).Delete(u)
if code == 0 || err != nil {
log.Println("delete fail")
}
return err
}
func (u *PaperDistribution) GetPaperDistribution(id string) error {
has, err := x.Where(builder.Eq{"user_id": id}).Get(u)
if !has || err != nil {
log.Println("could not find paper distribution")
}
return err
}
func (s *ScoreRecord) GetTopic(id int64) error {
has, err := x.Where(builder.Eq{"Question_id": id}).Get(s)
if !has || err != nil {
log.Println("could not find user")
}
return err
}
func (t *TestPaperInfo) Update() error {
code, err := x.Where(builder.Eq{"test_detail_id": t.Test_detail_id}).Update(t)
if code == 0 || err != nil {
log.Println("update test paper info fail")
log.Println(err)
}
return err
}
func (t *TestPaper) Update() error {
code, err := x.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 (r *ScoreRecord) Save() error {
code, err := x.Insert(r)
if code == 0 || err != nil {
log.Println("insert record fail")
}
return err
}
func (u *UnderCorrectedPaper) Save() error {
code, err := x.Insert(u)
if code == 0 || err != nil {
log.Println("insert paper fail")
log.Println(err)
}
return err
}
func (u *UnderCorrectedPaper) IsDuplicate() (bool, error) {
var temp UnderCorrectedPaper
has, err := x.Where(builder.Eq{"test_id": u.Test_id, "problem_type": u.Problem_type}).Get(&temp)
if !has || err != nil {
log.Println(err)
}
return has, err
}
func GetLatestRecores(userId string, records *[]ScoreRecord) error {
// x.QueryString("select top 10 * from scoreRecord where user_id = " + strconv.FormatInt(userId, 10) + " order by record_id desc")
err := x.Limit(10).Where(builder.Eq{"user_id": userId}).Desc("record_id").Find(records)
if err != nil {
log.Println("could not find any paper")
}
return err
}

View File

@ -0,0 +1,23 @@
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 := x.Where(builder.Eq{"user_id": id}).Get(u)
if !has || err != nil {
log.Println("could not find paper distribution")
}
return err
}

45
models/scoreRecord.go Normal file
View File

@ -0,0 +1,45 @@
package models
import (
"log"
"time"
"xorm.io/builder"
)
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"`
Score int64 `json:"score"`
Test_record_type int64 `json:"test_record_type"`
Problem_type int64 `json:"problem_type" xorm:"default(-1)"`
}
func (s *ScoreRecord) GetTopic(id int64) error {
has, err := x.Where(builder.Eq{"Question_id": id}).Get(s)
if !has || err != nil {
log.Println("could not find user")
}
return err
}
func (r *ScoreRecord) Save() error {
code, err := x.Insert(r)
if code == 0 || err != nil {
log.Println("insert record fail")
}
return err
}
func GetLatestRecords(userId string, records *[]ScoreRecord) error {
err := x.Limit(10).Table("score_record").Select("test_id, score, score_time").Where(builder.Eq{"user_id": userId}).Desc("record_id").Find(records)
if err != nil {
log.Panic(err)
log.Println("could not find any paper")
}
return err
}

40
models/subTopic.go Normal file
View File

@ -0,0 +1,40 @@
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 GetSubTopicsByQuestionId(id int64, st *[]SubTopic) error {
err := x.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 := x.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 := x.Where(builder.Eq{"question_detail_id": id}).Get(st)
if !has || err != nil {
log.Println("could not find SubTopic")
}
return err
}

62
models/testPaper.go Normal file
View File

@ -0,0 +1,62 @@
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"`
Examiner_first_self_score int64 `json:"examiner_first_self_score"`
Examiner_second_id string `json:"examiner_second_id" xorm:"default('-1')"`
Examiner_second_score int64 `json:"examiner_second_score"`
Examiner_second_self_score int64 `json:"examiner_seconde_self_score"`
Examiner_third_id string `json:"examiner_third_id" xorm:"default('-1')"`
Examiner_third_score int64 `json:"examiner_third_score"`
Examiner_third_self_score int64 `json:"examiner_third_self_score"`
Leader_id string `json:"leader_id" xorm:"default('-1')"`
Leader_score int64 `json:"leader_score"`
Final_score int64 `json:"final_score"`
Final_score_id string `json:"finale_score_id"`
Pratice_error int64 `json:"pratice_error"`
}
func (t *TestPaper) GetTestPaperByQuestionIdAndQuestionStatus(question_id int64, question_statue int64) error {
has, err := x.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 GetTestPaperListByQuestionIdAndQuestionStatus(question_id int64, question_statue int64, tl *[]TestPaper) error {
err := x.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) error {
has, err := x.Where(builder.Eq{"test_id": id}).Get(t)
if !has || err != nil {
log.Println("could not find test paper")
}
return err
}
func (t *TestPaper) Update() error {
code, err := x.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
}

69
models/testPaperInfo.go Normal file
View File

@ -0,0 +1,69 @@
package models
import (
"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"`
Examiner_first_self_score int64 `json:"examiner_first_self_score"`
Examiner_second_id string `json:"examiner_second_id" xorm:"default('-1')"`
Examiner_second_score int64 `json:"examiner_second_score"`
Examiner_second_self_score int64 `json:"examiner_second_self_score"`
Examiner_third_id string `json:"examiner_third_id" xorm:"default('-1')"`
Examiner_third_score int64 `json:"examiner_third_score"`
Examiner_third_self_score int64 `json:"examiner_third_self_score"`
Leader_id string `json:"leader_id" xorm:"default('-1')"`
Leader_score int64 `json:"leader_score"`
Final_score int64 `json:"finale_score"`
Final_score_id string `json:"final_score_id" xorm:"default('-1')"`
}
func (t *TestPaperInfo) GetTestPaperInfoByTestIdAndQuestionDetailId(testId int64, questionDetailId int64) error {
has, err := x.Where("question_detail_id = ? and test_id = ?", questionDetailId, testId).Get(t)
if !has || err != nil {
log.Println("could not specific info")
}
return err
}
func (t *TestPaperInfo) GetTestPaperInfo(id int64) error {
has, err := x.Where(builder.Eq{"test_detail_id": id}).Get(t)
if !has || err != nil {
log.Println("could not find test paper info")
log.Println(err)
}
return err
}
func (t *TestPaperInfo) Update() error {
code, err := x.Where(builder.Eq{"test_detail_id": t.Test_detail_id}).Update(t)
if code == 0 || err != nil {
log.Println("update test paper info fail")
log.Println(err)
}
return err
}
func GetTestInfoListByTestId(id int64, as *[]TestPaperInfo) error {
err := x.Where("test_id = ?", id).Find(as)
if err != nil {
log.Println("could not find any paper")
}
return err
}
func GetTestInfoPicListByTestId(id int64, as *[]string) error {
err := x.Table("test_paper_info").Select("pic_src").Where("test_id = ?", id).Find(as)
if err != nil {
log.Println("could not find any paper")
}
return err
}

39
models/topic.go Normal file
View File

@ -0,0 +1,39 @@
package models
import (
"log"
"time"
"xorm.io/builder"
)
// Author: Junlang
// 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"`
}
func (t *Topic) GetTopic(id int64) error {
has, err := x.Where(builder.Eq{"question_id": id}).Get(t)
if !has || err != nil {
log.Println("could not find topic")
}
return err
}
func GetDistributedTestIdPaperByUserId(id string, up *[]int64) error {
err := x.Table("under_corrected_paper").Select("test_id").Where("user_id = ?", id).Find(up)
if err != nil {
log.Panic(err)
log.Println("could not find any paper")
}
return err
}

View File

@ -0,0 +1,59 @@
package models
import (
"log"
"xorm.io/builder"
)
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)"`
}
func (u *UnderCorrectedPaper) GetUnderCorrectedPaper(userId string, testId int64) error {
has, err := x.Where(builder.Eq{"test_id": testId, "user_id": userId}).Get(u)
if !has || err != nil {
log.Println("could not find under corrected paper")
log.Println(err)
}
return err
}
func (u *UnderCorrectedPaper) Delete() error {
code, err := x.Where(builder.Eq{"test_id": u.Test_id, "user_id": u.User_id}).Delete(u)
if code == 0 || err != nil {
log.Println("delete fail")
}
return err
}
func (u *UnderCorrectedPaper) Save() error {
code, err := x.Insert(u)
if code == 0 || err != nil {
log.Println("insert paper fail")
log.Println(err)
}
return err
}
func (u *UnderCorrectedPaper) IsDuplicate() (bool, error) {
var temp UnderCorrectedPaper
has, err := x.Where(builder.Eq{"test_id": u.Test_id, "problem_type": u.Problem_type}).Get(&temp)
if !has || err != nil {
log.Println(err)
}
return has, err
}
func GetDistributedPaperByUserId(id string, up *[]UnderCorrectedPaper) error {
err := x.Where("user_id = ?", id).Find(up)
if err != nil {
log.Println("could not find any paper")
}
return err
}

View File

@ -8,28 +8,21 @@ import (
)
type User struct {
User_id int64
User_name string
Examiner_count string
Password string
Id_card string
Address string
Tel string
Email string
Login_time time.Time
Exist_time time.Time
Online_time float64
Subject_name string
Status int64
UserType int64
IsDistribute int64
}
func initUserModels() {
err := x.Sync2(new(User))
if err != nil {
log.Println(err)
}
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 float64 `json:"online_time"`
Subject_name string `json:"subject_name"`
Status int64 `json:"status"`
UserType int64 `json:"userType"`
IsDistribute int64 `json:"isDistribute"`
}
func (u *User) GetUser(id int64) error {

View File

@ -3,33 +3,33 @@
# Content-Type: application/json
# {
# "testId":"1"
# "testId":1
# }
# POST http://localhost:8080/openct/marking/score/test/list HTTP/1.1
# Content-Type: application/json
POST http://localhost:8080/openct/marking/score/test/list HTTP/1.1
Content-Type: application/json
# {
# "userId":"100"
# }
{
"userId":"1"
}
# POST http://localhost:8080/openct/marking/score/test/point HTTP/1.1
# Content-Type: application/json
# {
# "userId":"10000",
# "scores": "6",
# "testId":"6",
# "testDetailId": "12"
# "userId":"1",
# "scores": "1-2-3",
# "testId":37,
# "testDetailId": "109-110-111"
# }
# POST http://localhost:8080/openct/marking/score/test/problem HTTP/1.1
# Content-Type: application/json
# {
# "userId":"102",
# "userId":"1",
# "problemType": "2",
# "testId":"1"
# "testId":38
# }
# POST http://localhost:8080/openct/marking/score/test/answer HTTP/1.1
@ -37,7 +37,7 @@
# {
# "userId":"101",
# "testId":"1"
# "testId":1
# }
# POST http://localhost:8080/openct/marking/score/test/example/detail HTTP/1.1
@ -53,19 +53,19 @@
# {
# "userId":"101",
# "testId":"1"
# "testId":1
# }
# POST http://localhost:8080/openct/marking/score/test/review HTTP/1.1
# Content-Type: application/json
# {
# "userId":"101"
# "userId":"1"
# }
# POST http://localhost:8080 HTTP/1.1
# GET http://localhost:8000/api/get-user HTTP/1.1
# Content-Type: application/json
# {
# "name":"100"
# "id":"a7efddcb-ec16-48f6-b73f-709a36fd0e7a"
# }

42
requests/test.go Normal file
View File

@ -0,0 +1,42 @@
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"`
}

42
responses/test.go Normal file
View File

@ -0,0 +1,42 @@
package responses
import (
"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"`
}