加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
student.py 1.46 KB
一键复制 编辑 原始数据 按行查看 历史
So1aric 提交于 2022-09-18 11:04 . Debug
from flask import Blueprint, request
import json
from deco import *
from res import *
import oppressor as OP
Student = Blueprint('student', __name__)
@Student.route('/student/volbook/<int:stuId>', methods = ['GET'])
@Deco
def getVolunteerWork(stuId, json_data, token_data):
fl,r=OP.select("volId,volTimeInside,volTimeOutside,volTimeLarge,status","stu_vol","stuId=%s", stuId,
["volId","inside","outside","large","status"],only=False)
if not fl:
if "message" in r and r["message"]==OP.OP_NOT_FOUND:
return {"type":"ERROR","message":"该学生没有义工记录"}
return r
for i in r:
ff,rr=OP.select("volName","volunteer","volId=%s",i["volId"], ["name"])
if not ff: return rr
i.update({"name": rr["name"]})
return {"type":"SUCCESS","message":"获取成功","rec":r}
@Student.route('/student/volcert/', methods = ['POST'])
@Deco
def getVolunteerCertification(json_data, token_data):
stuId,volId=json_data["stuId"],json_data["volId"]
f1,r1=OP.select(
"stuId,volTimeInside,volTimeOutside,volTimeLarge,status,thought",
"stu_vol","stuId=%s AND volId=%s",(stuId,volId),
["id","inside","outside","large","status","thought"],only=True
)
if not f1: return r1
f2,r2=OP.select(
"volId,volName,description,volTime,volDate,volTimeInside,volTimeOutside,volTimeLarge",
"volunteer","volId=%s",volId,
["id","name","description","time","date","inside","outside","large"],only=True
)
if not f2: return r2
return {"type":"SUCCESS","message":"获取成功","stu":r1,"vol":r2}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化