def deleteTeacherByid(request): adminid = utils.getCookie(request, "adminid") if adminid == "" or adminid is None: responseReturn = Response(-2, "请登录") return HttpResponse(responseReturn.__str__()) teacherid = utils.getParam(request, "teacherid") count = TeachingService.getCountByTea(teacherid) if count > 0: responseReturn = Response("-1", "该教师下有未删除的实验教学") return HttpResponse(responseReturn.__str__()) TeacherService.deleteTeacher(teacherid) responseReturn = Response(None, None) return HttpResponse(responseReturn.__str__())
def deleteAdminByid(request): adminid = utils.getCookie(request, "adminid") if adminid == "" or adminid is None: responseReturn = Response(-2, "请登录") return HttpResponse(responseReturn.__str__()) issuperadmin = utils.getCookie(request, "issuperadmin") if issuperadmin != "1" or issuperadmin is None: responseReturn = Response("-1", "您不是超级管理员,没有删除管理员的权限!") return HttpResponse(responseReturn.__str__()) deleteadminid = utils.getParam(request, "adminid") deleteAdmin = AdminService.getAdminById(deleteadminid) count = TeachingService.getCountByTea(deleteAdmin.teacherid) if count > 0: responseReturn = Response("-1", "该教师下有未删除的实验教学") return HttpResponse(responseReturn.__str__()) admin = AdminService.deleteAmin(deleteadminid) if admin is None: responseReturn = Response("-1", "删除失败!") return HttpResponse(responseReturn.__str__()) responseReturn = Response(None, None) return HttpResponse(responseReturn.__str__())