def GET(self, arg): if session.login == 1: arg = web.input() if data.permission_check(session.user, arg.account, 'calendar'): calendar_data = data.get_calendar_data(arg) return render_template(type = session.type, template_name='calendar.json',\ mission_list = calendar_data)
def GET(self, arg): if session.login == 1: arg = web.input() if data.permission_check(session.user, arg.account, 'calendar'): return render_template( type = session.type, template_name = 'calendar.html', account_username = arg.account ) else:return json.dumps({"statusCode":"301", "message":"会话超时,请重新登录"})
def mission_search_list(user, arg): c = data.SQLconn() conn = MySQLdb.connect(host=c["host"], user=c["user"], passwd=c["passwd"], charset=c["charset"], db=c["db"]) cursor = conn.cursor(cursorclass = MySQLdb.cursors.DictCursor) account_list = account.account_list() account_list = list(account_list) for i in account_list: if data.permission_check(user, i, 'mission') == False: account_list.remove(i) if i == 'admin': account_list.remove(i) # print 'account_list', len(account_list) search_list = [] for i in account_list: cursor.execute("SELECT mission_name, mission_publisher, mission_doer, mission_status,\ mission_starttime, mission_plan_end_time, MISSION.mission_id\ FROM MISSION JOIN MISSIONS_DOERS\ ON MISSION.mission_id=MISSIONS_DOERS.mission_id\ WHERE mission_doer='%s' OR mission_publisher='%s'"%\ (i,i)) search_list += list(cursor.fetchall()) cursor.execute("SELECT mission_name, mission_publisher, mission_doer,\ mission_starttime, mission_plan_end_time, mission_id\ FROM HISTORY_MISSION \ WHERE mission_doer='%s' OR mission_publisher='%s'"\ %(i, i)) search_list += list(cursor.fetchall()) # 去除重复,一点处理 mlist = search_list search_list = list() for m in mlist: if m not in search_list: if 'mission_status' not in m: m['mission_status'] = '已完成' search_list.append(m); if arg == 'all': # print search_list return search_list mlist = list() for m in search_list: if arg.search_str == '' or arg.search_str in m['mission_name']: if arg.mission_publisher == '' or arg.mission_publisher == m['mission_publisher']: if arg.mission_doer == '' or arg.mission_doer == m['mission_doer']: if arg.mission_status == '' or arg.mission_status == m['mission_status']: if arg.mission_start_time == '' or datetime.datetime.strptime(arg.mission_start_time,"%Y-%m-%d").date() <= m['mission_starttime']: if arg.mission_end_time == '' or datetime.datetime.strptime(arg.mission_end_time,"%Y-%m-%d").date() >= m['mission_plan_end_time']: mlist.append(m) return mlist
def GET(self, arg): if session.login == 1: arg = web.input() if data.permission_check(session.user, arg.account, 'calendar'): return render_template( type = session.type, template_name = 'calendar_dialog.html', user = arg.account ) else: return json.dumps({"statusCode":"300", "message":"对不起,您没有查看权限"}) else:return json.dumps({"statusCode":"301", "message":"会话超时,请重新登录"})