Beispiel #1
0
 def POST(self):
     data = web.input()
     xh = data.xh
     gpa = GPA(xh)
     result = gpa.get_gpa()
     result = json.dumps(result)
     return result
Beispiel #2
0
def get_gpa(xh):
    """
    提供学号
    返回学分基点
    """
    gpa_obj = GPA(xh)
    gpa_obj.getscore_page()
    gpa = gpa_obj.get_gpa()#["ave_score"]

    return gpa
Beispiel #3
0
def get_gpa(xh):
    """
    提供学号
    返回学分基点
    """
    gpa_obj = GPA(xh)
    gpa_obj.getscore_page()
    gpa = gpa_obj.get_gpa()  #["ave_score"]

    return gpa
Beispiel #4
0
 def POST(self):
     data = web.input()
     try:
         xh = data.xh
     except AttributeError:
         return json_err("The id is xh")
     gpa = GPA(xh)
     gpa.getscore_page()
     result = gpa.get_gpa()
     if result == -1:
         return json_err("can not find your xh")
     result = json.dumps(result)
     return result
Beispiel #5
0
 def POST(self):
     data = web.input()
     try:
         xh = data.xh
     except AttributeError:
         return json_err("The id is xh")
     gpa = GPA(xh)
     gpa.getscore_page()
     result = gpa.get_gpa()
     if result == -1:
         return json_err("can not find your xh")
     result = json.dumps(result)
     return result
Beispiel #6
0
    def POST(self):
        form = info_form()
        if not form.validates():
            return render.index(form)
        else:
            _xh = form.d.number
            _pw = form.d.password
            t = form.d.Type
            
            if t == "1":
                func = "xscjcx_dq"
            elif t == "2":
                func = "xskscx"
            elif t == "3":
                func = "xskbcx"
            elif t == "4":
                gpa = GPA(_xh)
                a = gpa.get_gpa()
                table = [
                    # "<tr><td><strong>姓名</strong></td><td><strong>" + str(a["name"])+"</strong></td></tr>",
                    # "<tr><td><strong>班级</strong></td><td><strong>" + str(a["class"])+"</strong></td></tr>",
                    "<tr><td><strong>平均学分绩点</strong></td><td><strong>" + str(a["ave_score"])+"</strong></td></tr>",
                    # "<tr><td><strong>总基点</strong></td><td><strong>" + str(a["total_score"])+"</strong></td></tr>",
                    # "<tr><td><strong>总学分</strong></td><td><strong>" + str(a["totle_credits"])+"</strong></td></tr>",
                    # "<tr><td><strong>至今未通过科目</strong></td><td><strong>" + str(len(a['not_accept']))+"</strong></td></tr>",
                ]
                error = None
                return render.result_gpa(table,error)
            else:
                return '<script type="text/javascript">alert("输入不合理!");top.location="/"</script>'

            zheng = ZHENG(_xh,_pw,func)
            table = zheng.get_table()

            if table:
                error = None
                return render.result(table, error)
            else:
                table = None
                error = "can not find your index table"
                return render.result(table, error)