def course_agree(cid_li): """审批同意操作""" if cid_li is None: return False for cid in cid_li: try: course = Courses.query.get(int(cid)) course.ispass = 1 course.isexamine = 1 db.session.add(course) # 把课程添加到缓存 RedisService.load_agree_course(Courses.list_to_dict(course)) except Exception as e: print(e) ExceptionLog.model_error(e.__str__()) try: db.session.rollback() except Exception as ex: print(ex) ExceptionLog.other_error(ex.__str__()) return False try: db.session.commit() return True except Exception as e: print(e) ExceptionLog.model_error(e.__str__()) return False
def set_seltime(stime, etime, remark, caid, lid): """设置选课时段操作""" # 查询数据库,并把没有添加到缓存未结束的课程添加到redis course_li = CourseManage.get_can_add_to_redis(caid) if course_li is not None: for course in course_li: RedisService.load_agree_course(Courses.list_to_dict(course)) # 保存记录到mysql,添加数据缓存到redis return RedisService.set_sel_time(stime, etime, caid, lid, remark)