Merge branch 'master' of https://gitea.xn--7p0a.site/2312072104/dm
This commit is contained in:
commit
b29f3fa341
|
@ -7,6 +7,7 @@ import axios from 'axios';
|
||||||
|
|
||||||
function StudentLink(){
|
function StudentLink(){
|
||||||
const testID=useParams()['key']
|
const testID=useParams()['key']
|
||||||
|
const [list,setlist]=useState([])
|
||||||
|
|
||||||
const sumbitScore=async()=>{
|
const sumbitScore=async()=>{
|
||||||
try{
|
try{
|
||||||
|
@ -15,6 +16,10 @@ function StudentLink(){
|
||||||
testID,
|
testID,
|
||||||
suggestion
|
suggestion
|
||||||
})
|
})
|
||||||
|
const delPods=await axios.post('/api/teacher/MarkDelPods',{
|
||||||
|
testID,
|
||||||
|
list
|
||||||
|
})
|
||||||
}catch{
|
}catch{
|
||||||
alert('提交出错')
|
alert('提交出错')
|
||||||
}
|
}
|
||||||
|
@ -33,6 +38,7 @@ function StudentLink(){
|
||||||
testID
|
testID
|
||||||
})
|
})
|
||||||
setTestLink(NotMarkTestSrc.data['result'])
|
setTestLink(NotMarkTestSrc.data['result'])
|
||||||
|
setlist(Object.keys(NotMarkTestSrc.data['result']).map(key => NotMarkTestSrc.data['result'][key][0]))
|
||||||
}catch{
|
}catch{
|
||||||
alert('出错')
|
alert('出错')
|
||||||
}
|
}
|
||||||
|
@ -58,6 +64,7 @@ function StudentLink(){
|
||||||
[name]: value
|
[name]: value
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<div className='body-right-studentlink'>
|
<div className='body-right-studentlink'>
|
||||||
<div className='link-box'>
|
<div className='link-box'>
|
||||||
|
|
|
@ -21,7 +21,7 @@ export default function Test({ ip = "", port = "22", password = "123456", user =
|
||||||
if (terminal !== null) {
|
if (terminal !== null) {
|
||||||
terminal.open(terminalObj.current);
|
terminal.open(terminalObj.current);
|
||||||
|
|
||||||
const newSocket = io("ws://36.138.114.105:31055");
|
const newSocket = io("ws:///");
|
||||||
setSocket(newSocket);
|
setSocket(newSocket);
|
||||||
|
|
||||||
terminal.onData((data) => {
|
terminal.onData((data) => {
|
||||||
|
|
|
@ -34,7 +34,7 @@ function SubjectPage(){
|
||||||
datasets: [
|
datasets: [
|
||||||
{
|
{
|
||||||
label: '得分情况分布',
|
label: '得分情况分布',
|
||||||
data: [HistoryTrain[key][0][4],HistoryTrain[key][0][5]], // 这里填写每个类型题目的数量
|
data: [HistoryTrain[key][0][5],HistoryTrain[key][0][4]], // 这里填写每个类型题目的数量
|
||||||
backgroundColor: ['#FF6384','#36A2EB'], // 颜色
|
backgroundColor: ['#FF6384','#36A2EB'], // 颜色
|
||||||
hoverOffset: 2,
|
hoverOffset: 2,
|
||||||
},
|
},
|
||||||
|
@ -103,7 +103,7 @@ function SubjectPage(){
|
||||||
<ul>
|
<ul>
|
||||||
<li>总得分:{parseInt(PieData['datasets'][0]['data'][0])+parseInt(PieData['datasets'][0]['data'][1])}/{score}</li>
|
<li>总得分:{parseInt(PieData['datasets'][0]['data'][0])+parseInt(PieData['datasets'][0]['data'][1])}/{score}</li>
|
||||||
<li>分析:{HistoryTrain[testID][0][10]}</li>
|
<li>分析:{HistoryTrain[testID][0][10]}</li>
|
||||||
<li>老师建议:{HistoryTrain[testID][0][9]}</li>
|
<li>老师建议:{HistoryTrain[testID][0][9]?`${HistoryTrain[testID][0][9]}`:'老师暂未批改该实训,请耐心等待'}</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>}
|
</div>}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -146,7 +146,7 @@ function Operation1() {
|
||||||
localStorage.setItem('answeredJudge',answeredJudge)
|
localStorage.setItem('answeredJudge',answeredJudge)
|
||||||
localStorage.setItem('TrainData',JSON.stringify(TrainData))
|
localStorage.setItem('TrainData',JSON.stringify(TrainData))
|
||||||
localStorage.setItem('score',score)
|
localStorage.setItem('score',score)
|
||||||
localStorage.setItem('succeed',succeed)
|
localStorage.setItem('succeed',JSON.stringify(succeed))
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -196,9 +196,7 @@ function Operation1() {
|
||||||
setscore(prevscore=>prevscore+5)
|
setscore(prevscore=>prevscore+5)
|
||||||
}else{
|
}else{
|
||||||
const itemText = item[0][9];
|
const itemText = item[0][9];
|
||||||
if (!succeed.includes(itemText)) {
|
|
||||||
setsucceed((prevSucceed) => [...prevSucceed, itemText]);
|
setsucceed((prevSucceed) => [...prevSucceed, itemText]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
CHO_sum++
|
CHO_sum++
|
||||||
}
|
}
|
||||||
|
@ -206,10 +204,8 @@ function Operation1() {
|
||||||
if (item[0][2]===completion_answer[COM_sum]) {
|
if (item[0][2]===completion_answer[COM_sum]) {
|
||||||
setscore(prevscore=>prevscore+5)
|
setscore(prevscore=>prevscore+5)
|
||||||
}else{
|
}else{
|
||||||
const itemText = item[0][5];
|
const itemText = item[0][9];
|
||||||
if (!succeed.includes(itemText)) {
|
|
||||||
setsucceed((prevSucceed) => [...prevSucceed, itemText]);
|
setsucceed((prevSucceed) => [...prevSucceed, itemText]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
COM_sum++
|
COM_sum++
|
||||||
}
|
}
|
||||||
|
@ -217,10 +213,8 @@ function Operation1() {
|
||||||
if (item[0][2]===judge_answer[JUD_sum]) {
|
if (item[0][2]===judge_answer[JUD_sum]) {
|
||||||
setscore(prevscore=>prevscore+5)
|
setscore(prevscore=>prevscore+5)
|
||||||
}else{
|
}else{
|
||||||
const itemText = item[0][5];
|
const itemText = item[0][9];
|
||||||
if (!succeed.includes(itemText)) {
|
|
||||||
setsucceed((prevSucceed) => [...prevSucceed, itemText]);
|
setsucceed((prevSucceed) => [...prevSucceed, itemText]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
JUD_sum++
|
JUD_sum++
|
||||||
}
|
}
|
||||||
|
@ -275,7 +269,7 @@ function Operation1() {
|
||||||
)}
|
)}
|
||||||
</li>
|
</li>
|
||||||
<Link to={`/operation2/${operateID}`} style={{color:'#000',textDecoration:'none'}}>
|
<Link to={`/operation2/${operateID}`} style={{color:'#000',textDecoration:'none'}}>
|
||||||
<li style={{ marginTop: isSubjectDropdownOpen ? '186px' : '0' }}>实训题</li>
|
<li style={{ marginTop: isSubjectDropdownOpen ? '186px' : '0' }} onClick={saveAnswers}>实训题</li>
|
||||||
</Link>
|
</Link>
|
||||||
</ul>
|
</ul>
|
||||||
{/* 题目预览框 */}
|
{/* 题目预览框 */}
|
||||||
|
|
|
@ -15,9 +15,10 @@ function Operation2() {
|
||||||
const score=localStorage.getItem('score')
|
const score=localStorage.getItem('score')
|
||||||
const { operateID } = useParams();
|
const { operateID } = useParams();
|
||||||
const [isTrue,setisTrue]=useState(false)
|
const [isTrue,setisTrue]=useState(false)
|
||||||
const [TrainScore,setTrainScore]=useState()
|
const [TrainScore,setTrainScore]=useState(null)
|
||||||
const succeed=localStorage.getItem('succeed')
|
const succeed=localStorage.getItem('succeed')
|
||||||
const TrainData=JSON.parse(localStorage.getItem('TrainData'))
|
const TrainData=JSON.parse(localStorage.getItem('TrainData'))
|
||||||
|
const subject=(TrainData['operateID'][3])
|
||||||
|
|
||||||
// 获取链接
|
// 获取链接
|
||||||
const [Src,setSrc]=useState()
|
const [Src,setSrc]=useState()
|
||||||
|
@ -99,7 +100,8 @@ function Operation2() {
|
||||||
TrainScore,
|
TrainScore,
|
||||||
operateID,
|
operateID,
|
||||||
student_ID,
|
student_ID,
|
||||||
succeed
|
succeed,
|
||||||
|
subject
|
||||||
})
|
})
|
||||||
}catch{
|
}catch{
|
||||||
alert('submitTrainSrc出错')
|
alert('submitTrainSrc出错')
|
||||||
|
@ -118,9 +120,9 @@ function Operation2() {
|
||||||
localStorage.removeItem('answeredJudge')
|
localStorage.removeItem('answeredJudge')
|
||||||
localStorage.removeItem('RemainingTime')
|
localStorage.removeItem('RemainingTime')
|
||||||
localStorage.removeItem('score')
|
localStorage.removeItem('score')
|
||||||
|
localStorage.removeItem('succeed')
|
||||||
alert('提交成功')
|
alert('提交成功')
|
||||||
window.location.href='/train'
|
window.location.href='/train'
|
||||||
localStorage.removeItem('TrainData')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检测按钮
|
// 检测按钮
|
||||||
|
@ -175,15 +177,23 @@ function Operation2() {
|
||||||
<div className='body-right2'>
|
<div className='body-right2'>
|
||||||
{/* 前端连接数据库⬇ */}
|
{/* 前端连接数据库⬇ */}
|
||||||
{ !isTrue&&TrainData&&Src&&<div>
|
{ !isTrue&&TrainData&&Src&&<div>
|
||||||
<p>题目:{TrainData['operateID'][3][0]}</p>
|
<p style={{fontSize:'26px'}}>题目:{TrainData['operateID'][3][0]}</p>
|
||||||
<Link to={Src[6]} style={{fontSize:'18px',marginLeft:'50px'}}>{Src[6]}</Link>
|
<span style={{fontSize:'18px',marginLeft:'50px'}}>点击此链接进入到ide编辑代码:</span>
|
||||||
<br />
|
<br />
|
||||||
<Link to={Src[7]} style={{fontSize:'18px',marginLeft:'50px'}}>{Src[7]}</Link>
|
<Link to={Src[6]} style={{fontSize:'18px',marginLeft:'90px'}} target='_blank'>{Src[6]}</Link>
|
||||||
<br />
|
<br />
|
||||||
<Link to={Src[8]} style={{fontSize:'18px',marginLeft:'50px'}}>{Src[8]}</Link>
|
|
||||||
<br />
|
<br />
|
||||||
<p>点击以上链接前往实训</p>
|
<span style={{fontSize:'18px',marginLeft:'50px'}}>5000端口映射到:</span>
|
||||||
|
<br />
|
||||||
|
<Link to={Src[7]} style={{fontSize:'18px',marginLeft:'90px'}} target='_blank'>{Src[7]}</Link>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
<span style={{fontSize:'18px',marginLeft:'50px'}}>3000端口映射到:</span>
|
||||||
|
<br />
|
||||||
|
<Link to={Src[8]} style={{fontSize:'18px',marginLeft:'90px'}} target='_blank'>{Src[8]}</Link>
|
||||||
|
<br />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
}
|
}
|
||||||
{/* 前端连接数据库 ⬆*/}
|
{/* 前端连接数据库 ⬆*/}
|
||||||
|
|
||||||
|
@ -191,11 +201,10 @@ function Operation2() {
|
||||||
{ isTrue&&TrainData&&
|
{ isTrue&&TrainData&&
|
||||||
<div>
|
<div>
|
||||||
<p>{TrainData['operateID'][3][0]}</p>
|
<p>{TrainData['operateID'][3][0]}</p>
|
||||||
{/* {Src&&<Test ip={Src[6]}/>} */}
|
{Src&&<Test ip={Src[6]}/>}
|
||||||
<div className='detection'><button onClick={detection}>检测</button></div>
|
<div className='detection'><button onClick={detection}>检测</button></div>
|
||||||
</div>}
|
</div>}
|
||||||
{/* 达梦数据库连接⬆ */}
|
{/* 达梦数据库连接⬆ */}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<Link className='btn-back2' to={`/operation1/${operateID}`} style={{color:'#000',textDecoration:'none'}}>
|
<Link className='btn-back2' to={`/operation1/${operateID}`} style={{color:'#000',textDecoration:'none'}}>
|
||||||
<p>上一页</p>
|
<p>上一页</p>
|
||||||
|
@ -205,6 +214,7 @@ function Operation2() {
|
||||||
<img src={arrowright} alt="" width='40px' height='40px' />
|
<img src={arrowright} alt="" width='40px' height='40px' />
|
||||||
<p>完成</p>
|
<p>完成</p>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import axios from 'axios';
|
||||||
const WarningModal = ({ isOpen, onClose }) => {
|
const WarningModal = ({ isOpen, onClose }) => {
|
||||||
// 添加一个状态来控制是否应用动画
|
// 添加一个状态来控制是否应用动画
|
||||||
const [isClosing, setIsClosing] = useState(false);
|
const [isClosing, setIsClosing] = useState(false);
|
||||||
|
localStorage.removeItem('TrainData')
|
||||||
// 定义关闭警告框的函数
|
// 定义关闭警告框的函数
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
setIsClosing(true); // 设置状态以触发动画
|
setIsClosing(true); // 设置状态以触发动画
|
||||||
|
|
|
@ -41,4 +41,5 @@ services:
|
||||||
- '8443:8443'
|
- '8443:8443'
|
||||||
- '5000:5000'
|
- '5000:5000'
|
||||||
- '3000:3000'
|
- '3000:3000'
|
||||||
|
command: service DmServiceDMTEST start && sleep 9999999999
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ ENV DEBIAN_FRONTEND="noninteractive"
|
||||||
WORKDIR /home/dmdba
|
WORKDIR /home/dmdba
|
||||||
USER root
|
USER root
|
||||||
|
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
git jq libatomic1 net-tools netcat python3-pip curl sudo catatonit libssl-dev \
|
git jq libatomic1 net-tools netcat python3-pip curl sudo catatonit libssl-dev \
|
||||||
cron \
|
cron \
|
||||||
|
@ -69,6 +70,12 @@ ADD --chmod=744 "https://raw.githubusercontent.com/linuxserver/docker-mods/mod-s
|
||||||
ADD --chmod=744 "https://raw.githubusercontent.com/linuxserver/docker-mods/mod-scripts/package-install.${PKG_INST_VERSION}" "/etc/s6-overlay/s6-rc.d/init-mods-package-install/run"
|
ADD --chmod=744 "https://raw.githubusercontent.com/linuxserver/docker-mods/mod-scripts/package-install.${PKG_INST_VERSION}" "/etc/s6-overlay/s6-rc.d/init-mods-package-install/run"
|
||||||
ADD --chmod=744 "https://raw.githubusercontent.com/linuxserver/docker-mods/mod-scripts/lsiown.${LSIOWN_VERSION}" "/usr/bin/lsiown"
|
ADD --chmod=744 "https://raw.githubusercontent.com/linuxserver/docker-mods/mod-scripts/lsiown.${LSIOWN_VERSION}" "/usr/bin/lsiown"
|
||||||
|
|
||||||
|
USER dmdba
|
||||||
|
WORKDIR /home/dmdba/dmdbms/bin
|
||||||
|
RUN /home/dmdba/dmdbms/bin/dminit path=/home/dmdba/data
|
||||||
|
USER root
|
||||||
|
RUN /home/dmdba/dmdbms/script/root/dm_service_installer.sh -t dmserver -dm_ini /home/dmdba/data/DAMENG/dm.ini -p DMTEST
|
||||||
|
|
||||||
|
|
||||||
# 添加本地目录
|
# 添加本地目录
|
||||||
COPY /root /
|
COPY /root /
|
||||||
|
|
|
@ -27,6 +27,7 @@ ENV PATH="$VIRTUAL_ENV/bin:$PATH"
|
||||||
COPY --from=build-dmpython --chown=flask:flask /home/dmdba/build_artifacts/dmPython-2.5.5-cp310-cp310-linux_x86_64.whl .
|
COPY --from=build-dmpython --chown=flask:flask /home/dmdba/build_artifacts/dmPython-2.5.5-cp310-cp310-linux_x86_64.whl .
|
||||||
|
|
||||||
RUN python3 -m venv "$VIRTUAL_ENV" && \
|
RUN python3 -m venv "$VIRTUAL_ENV" && \
|
||||||
|
pip3 config set global.index-url https://mirrors.bfsu.edu.cn/pypi/web/simple && \
|
||||||
export FLASK_APP=app.py && \
|
export FLASK_APP=app.py && \
|
||||||
pip3 install dmPython-2.5.5-cp310-cp310-linux_x86_64.whl && rm dmPython-2.5.5-cp310-cp310-linux_x86_64.whl && \
|
pip3 install dmPython-2.5.5-cp310-cp310-linux_x86_64.whl && rm dmPython-2.5.5-cp310-cp310-linux_x86_64.whl && \
|
||||||
MAKEFLAGS="-j$(nproc)" pip install -r requirements.txt
|
MAKEFLAGS="-j$(nproc)" pip install -r requirements.txt
|
||||||
|
|
|
@ -4,9 +4,9 @@ import time
|
||||||
|
|
||||||
import paramiko
|
import paramiko
|
||||||
|
|
||||||
|
from k8s_func import *
|
||||||
from teacher_func import *
|
from teacher_func import *
|
||||||
from student_func import *
|
from student_func import *
|
||||||
# from k8s_func import *
|
|
||||||
|
|
||||||
from flask import Flask, render_template, request, jsonify, send_from_directory, session
|
from flask import Flask, render_template, request, jsonify, send_from_directory, session
|
||||||
from flask_cors import CORS
|
from flask_cors import CORS
|
||||||
|
@ -178,10 +178,19 @@ def FindTrain1Src():
|
||||||
@app.route('/api/student/EntryTrainScore',methods=['POST'])
|
@app.route('/api/student/EntryTrainScore',methods=['POST'])
|
||||||
def EntryTrainScore():
|
def EntryTrainScore():
|
||||||
score=request.json['score']
|
score=request.json['score']
|
||||||
TrainScore=request.json['trainScore']
|
TrainScore=request.json['TrainScore']
|
||||||
operateID=request.json['operateID']
|
operateID=request.json['operateID']
|
||||||
student_ID=request.json['student_ID']
|
student_ID=request.json['student_ID']
|
||||||
AddTrainScoreFunc(score,TrainScore,student_ID,operateID)
|
succeed=request.json['succeed']
|
||||||
|
subject=request.json['subject']
|
||||||
|
print(subject[0])
|
||||||
|
print(type(subject))
|
||||||
|
if subject[0]=="达梦数据库连接":
|
||||||
|
Name='n'+student_ID+'-'+operateID
|
||||||
|
delete_pod(Name)
|
||||||
|
else:
|
||||||
|
print(False)
|
||||||
|
AddTrainScoreFunc(student_ID,operateID,score,TrainScore,succeed)
|
||||||
return jsonify({'result': '成功'})
|
return jsonify({'result': '成功'})
|
||||||
|
|
||||||
|
|
||||||
|
@ -346,38 +355,48 @@ def getTrainData():
|
||||||
return jsonify({'data': data})
|
return jsonify({'data': data})
|
||||||
|
|
||||||
|
|
||||||
# @app.route("/api/teacher/list_pods",methods=['POST']) # 列出pod
|
@app.route("/api/teacher/list_pods",methods=['POST']) # 列出pod
|
||||||
# def teacher_list_pods():
|
def teacher_list_pods():
|
||||||
# return list_pods()
|
return list_pods()
|
||||||
# @app.route("/api/teacher/list_services") # 列出服务
|
@app.route("/api/teacher/list_services") # 列出服务
|
||||||
# def teacher_list_services():
|
def teacher_list_services():
|
||||||
# return list_services()
|
return list_services()
|
||||||
|
|
||||||
# @app.route("/api/teacher/create_pod") # 创建服务 1为项目实训, 0为安装实训
|
# @app.route("/api/teacher/create_pod") # 创建服务 1为项目实训, 0为安装实训
|
||||||
# def teacher_create_pod():
|
# def teacher_create_pod():
|
||||||
# create_pod(1, "test2")
|
# create_pod(1, "test2")
|
||||||
|
|
||||||
# @app.route("/api/teacher/DelPods",methods=['POST']) # 删除服务
|
@app.route("/api/teacher/DelPods",methods=['POST']) # 删除服务
|
||||||
# def teacher_delete_pod():
|
def teacher_delete_pod():
|
||||||
# name=request.json['name']
|
name=request.json['name']
|
||||||
# studentID=name[1:9]
|
studentID=name[1:9]
|
||||||
# testID=name[10:]
|
testID=name[10:]
|
||||||
# delDMFunc(studentID,testID)
|
delDMFunc(studentID,testID)
|
||||||
# return delete_pod(name=name)
|
return delete_pod(name=name)
|
||||||
|
|
||||||
# @app.route("/api/student/check_pod",methods=['POST']) # 检测数据库是否安装成功 若成功,返回OK 否则返回NO
|
@app.route('/api/teacher/MarkDelPods',methods=['POST'])
|
||||||
# def teacher_check_pod():
|
def teacher_mark_del_pods():
|
||||||
# name=request.json["student_ID"]
|
studentList=request.json['list']
|
||||||
# testID=request.json["operateID"]
|
testID=request.json['testID']
|
||||||
# name= 'n' + str(name) + '-' + str(testID)
|
for i in studentList:
|
||||||
# result = check_dm(name)
|
Name='s'+i+'-'+testID
|
||||||
# return jsonify(result)
|
delete_pod(Name)
|
||||||
|
return '删除成功'
|
||||||
|
@app.route("/api/student/check_pod",methods=['POST']) # 检测数据库是否安装成功 若成功,返回OK 否则返回NO
|
||||||
|
def teacher_check_pod():
|
||||||
|
name=request.json["student_ID"]
|
||||||
|
testID=request.json["operateID"]
|
||||||
|
name= 'n' + str(name) + '-' + str(testID)
|
||||||
|
result = check_dm(name)
|
||||||
|
return jsonify(result)
|
||||||
|
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
@app.route('/<path:path>')
|
@app.route('/<path:path>')
|
||||||
def catch_all(path = "index.html"):
|
def catch_all(path = "index.html"):
|
||||||
return send_from_directory("public", path)
|
if os.path.exists(f"public/{path}"):
|
||||||
|
return send_from_directory("public", path)
|
||||||
|
else:
|
||||||
|
return send_from_directory("public", "index.html")
|
||||||
|
|
||||||
@socketio.on('connect_ssh')
|
@socketio.on('connect_ssh')
|
||||||
def handle_connect_ssh(data):
|
def handle_connect_ssh(data):
|
||||||
|
|
|
@ -4,6 +4,7 @@ from Crypto.Cipher import AES
|
||||||
from Crypto.Random import get_random_bytes
|
from Crypto.Random import get_random_bytes
|
||||||
import base64
|
import base64
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
import re
|
||||||
|
|
||||||
# 获取当前日期和时间
|
# 获取当前日期和时间
|
||||||
current_datetime = datetime.now()
|
current_datetime = datetime.now()
|
||||||
|
@ -344,12 +345,23 @@ def FindTrain1SrcFunc(ID,testID):
|
||||||
|
|
||||||
def AddTrainScoreFunc(ID,testID,score,trainResult,succeed):
|
def AddTrainScoreFunc(ID,testID,score,trainResult,succeed):
|
||||||
a=[]
|
a=[]
|
||||||
|
# 打印结果字符串
|
||||||
|
succeed=json.loads(succeed)
|
||||||
|
succeed=list(succeed)
|
||||||
for i in succeed:
|
for i in succeed:
|
||||||
a.append(succeed[i])
|
a.append(i)
|
||||||
a=set(a)
|
|
||||||
print(a)
|
a=list(set(a))
|
||||||
|
if None in a:
|
||||||
|
a.remove(None)
|
||||||
|
if len(a)==0:
|
||||||
|
result_string='全能高手'
|
||||||
|
else:
|
||||||
|
result_string = ','.join(a)+'需要加强'
|
||||||
|
|
||||||
cursor=db.cursor()
|
cursor=db.cursor()
|
||||||
cursor.execute("UPDATE TRAINSCORE SET TF='true', RESULT=(?), TRAINRESULT=(?) WHERE STUDENT_ID=(?) AND TEST_ID=(?)",(score,trainResult,ID,testID))
|
cursor.execute("UPDATE TRAINSCORE SET TF='true', RESULT=(?), TRAINRESULT=(?) ,ANALYSE=(?) WHERE STUDENT_ID=(?) AND TEST_ID=(?)",(score,trainResult,result_string,ID,testID))
|
||||||
|
print('加入成绩成功')
|
||||||
db.commit()
|
db.commit()
|
||||||
cursor.close()
|
cursor.close()
|
||||||
return '添加成功'
|
return '添加成功'
|
||||||
|
|
|
@ -291,8 +291,8 @@ def SendLink():
|
||||||
Link = 'http://36.138.114.105:' + str(j['ports'][0]['node_port'])
|
Link = 'http://36.138.114.105:' + str(j['ports'][0]['node_port'])
|
||||||
Link2 = 'http://36.138.114.105:' + str(j['ports'][1]['node_port'])
|
Link2 = 'http://36.138.114.105:' + str(j['ports'][1]['node_port'])
|
||||||
Link3 = 'http://36.138.114.105:' + str(j['ports'][2]['node_port'])
|
Link3 = 'http://36.138.114.105:' + str(j['ports'][2]['node_port'])
|
||||||
cursor.execute(f"INSERT INTO TRAINSCORE VALUES (?,?,?,?,?,?,?,?,?,?)",(
|
cursor.execute(f"INSERT INTO TRAINSCORE VALUES (?,?,?,?,?,?,?,?,?,?,?)",(
|
||||||
i,i[0:6],testID,'false','NULL','NULL',Link,Link2,Link3,'NULL'
|
i,i[0:6],testID,'false','NULL','NULL',Link,Link2,Link3,'NULL','NULL'
|
||||||
))
|
))
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
@ -304,8 +304,8 @@ def SendLink():
|
||||||
for j in item['list']:
|
for j in item['list']:
|
||||||
if j['name'] == name + '-service':
|
if j['name'] == name + '-service':
|
||||||
Link = j['ip']
|
Link = j['ip']
|
||||||
cursor.execute(f"INSERT INTO TRAINSCORE VALUES (?,?,?,?,?,?,?,?,?,?)", (
|
cursor.execute(f"INSERT INTO TRAINSCORE VALUES (?,?,?,?,?,?,?,?,?,?,?)", (
|
||||||
i, i[0:6], testID, 'false', 'NULL', 'NULL', Link, 'NULL', 'NULL','NULL'
|
i, i[0:6], testID, 'false', 'NULL', 'NULL', Link, 'NULL', 'NULL','NULL','NULL'
|
||||||
))
|
))
|
||||||
|
|
||||||
print('加入链接成功')
|
print('加入链接成功')
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
list1=[1,2,3,4,5]
|
import k8s_func
|
||||||
name='asd'
|
k8s_func.delete_pod('20240101')
|
||||||
dic={name:list1}
|
|
||||||
print(dic)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue