def post(self, request): userId = request.POST.get('userId') if is_none_or_empty(userId): return EmptyResponse() user = userId2user(userId) if user: try: userinfo = UserInfo.objects.get(username=user.username) except UserInfo.DoesNotExist: userinfo = None if userinfo: data = { 'username': userinfo.username, 'name': userinfo.name, 'gender': userinfo.gender, 'grade': userinfo.grade, 'college': userinfo.college, 'professional': userinfo.professional, 'classname': userinfo.classname, 'dormitory': userinfo.dormitory, 'number': userinfo.number } return SuccessResponse('获取用户数据成功', data) return ErrorResponse('暂时没有当前用户的信息') else: return UserIdErrorResponse()
def post(self, request): userId = request.POST.get('userId') if is_none_or_empty(userId): return EmptyResponse() user = userId2user(userId) if user: scheduleOption.update_schedule(user) return SuccessResponse('课表更新成功') else: return UserIdErrorResponse()
def post(self, request): userId = request.POST.get('userId') time = request.POST.get('time') if is_none_or_empty(userId, time): return EmptyResponse() user = userId2user(userId) if user: data = resultsOption.query_results(user, time) return SuccessResponse('成绩查询获取成功', data) else: return UserIdErrorResponse()
def post(self, request): state = request.POST.get('state') userId = request.POST.get('userId') if is_none_or_empty(state, userId): return EmptyResponse() user = userId2user(userId) if user: data = attendanceOption.query_state(user, state) return SuccessResponse('考勤数据获取成功', data) else: return UserIdErrorResponse()
def post(self, request): userId = request.POST.get('userId') time = request.POST.get('time') if is_none_or_empty(userId, time): return EmptyResponse() user = userId2user(userId) if user: data = examOption.query_exam_arrangement(user, time) return SuccessResponse('考试安排查询成功', data) else: return UserIdErrorResponse()
def post(self, request): taskNos = request.POST.get('taskNos') userId = request.POST.get('userId') week = request.POST.get('week') if is_none_or_empty(taskNos, userId, week): return EmptyResponse() user = userId2user(userId) if user: if teachingOption.one_key(user, week, taskNos): return SuccessResponse('一键评教成功') else: return UserIdErrorResponse()
def post(self, request): userId = request.POST.get('userId') week = request.POST.get('week') if is_none_or_empty(userId): return EmptyResponse() if is_none_or_empty(week) or int(week) < 0: week = current_week() - 1 user = userId2user(userId) if user: data = teachingOption.info(user, week) return SuccessWeekResponse('评教信息获取成功', int(week), data) else: return UserIdErrorResponse()
def post(self, request): userId = request.POST.get('userId') if is_none_or_empty(userId): return EmptyResponse() user = userId2user(userId) if user: has_schedule = scheduleOption.exist_schedule_for_semester(user) if has_schedule: return SuccessResponse("本学期已存在课表哦") else: return ErrorResponse('本学期没有导入课表哦', 2) else: return UserIdErrorResponse()
def post(self, request): userId = request.POST.get('userId') if is_none_or_empty(userId): return EmptyResponse() user = userId2user(userId) if user: schedules = scheduleOption.schedule_for_tomorrow(user) if schedules: return SuccessWeekResponse('明日课表获取成功', current_week(), schedules) else: return ErrorResponse('明天没有课哦', 2) else: return UserIdErrorResponse()
def post(self, request): userId = request.POST.get('userId') if is_none_or_empty(userId): return EmptyResponse() user = userId2user(userId) if user: if scheduleOption.exist_schedule_for_semester(user): return ErrorResponse('本学期课表已经存在或者正在导入中') scheduleOption.import_schedule(user) # 导入课表 if scheduleOption.exist_schedule_for_semester(user): # 检查课表是否导入成功 return SuccessResponse('导入课表成功') else: return ErrorResponse('导入课表失败') else: return UserIdErrorResponse()
def post(self, request): userId = request.POST.get('userId') love = request.POST.get('love') if is_none_or_empty(userId, love): return EmptyResponse() user = userId2user(userId) if not user: return UserIdErrorResponse() userWeChatInfo = userId2UserWeChatInfo(userId) if not userWeChatInfo: # 当前用户未授权用户 return ErrorResponse('当前用户未授权微信信息', 2) love = Love.objects.create( user=user, user_weChat_info=userWeChatInfo, content=love, ) return SuccessResponse('发布表白成功,请等待审核哦!', love.id)
def post(self, request): userId = request.POST.get('userId') username = request.POST.get('username') password = request.POST.get('password') if is_none_or_empty(userId, username, password): return EmptyResponse() # 检测用户名和密码是否正确 if userOption.check_username_and_password(username, password): user = userId2user(userId) if user: user.is_active = 1 user.username = username user.password = password user.save() return SuccessResponse('当前用户已激活') return UserIdErrorResponse() else: return ErrorResponse('用户名或密码错误')
def post(self, request): userId = request.POST.get('userId') week = request.POST.get('week') if is_none_or_empty(userId): return EmptyResponse() if is_none_or_empty(week) or int(week) < 0: week = current_week() user = userId2user(userId) if user: schedules = scheduleOption.schedule_for_week(user, week) if schedules: return SuccessWeekResponse('课表获取成功', week, schedules) else: return ErrorResponse('这周没有课哦', 2) else: return UserIdErrorResponse()
def post(self, request): userId = request.POST.get('userId') if is_none_or_empty(userId): return EmptyResponse() user = userId2user(userId) if user: try: user_wechat_info = UserWeChatInfo.objects.get(user=user) except UserWeChatInfo.DoesNotExist: user_wechat_info = None if user_wechat_info: data = { 'avatarUrl': user_wechat_info.avatarUrl, 'gender': user_wechat_info.gender } return SuccessResponse('获取用户数据成功', data) return ErrorResponse('暂时没有当前用户的信息') else: return UserIdErrorResponse()