Esempio n. 1
0
def get_data_details():
    R = request.form if request.method == 'POST' else request.args
    level = int(R.get('level', 1))
    code = R.get('name', '')

    data = DC.get_data_latest(level, code)
    return NormalResponseJson(request, data)
Esempio n. 2
0
def get_data_pos():
    add_count()
    R = request.form if request.method == 'POST' else request.args
    code = R.get('code', '420000')

    data = DP.get_region_data(int(code))
    return NormalResponseJson(request, data)
Esempio n. 3
0
def _get_task_control(user, R):
    tid = R.get('tid', '')
    multi = R.get('multi')
    
    data = T.get_task_control(tid, user)
    
    return NormalResponseJson(data)
Esempio n. 4
0
def get_time_data():
    R = request.form if request.method == 'POST' else request.args
    level = int(R.get('level', 1))
    code = R.get('name', '86')
    if code == 'china' or code == '': code = '86'

    data = DC.get_time_data(level, int(code))
    return NormalResponseJson(request, data)
Esempio n. 5
0
def _list_module(user, R):
    pid = R.get('pid', '')
    create_user = R.get('createUser', '')
    category = R.get('category', '')
    department = R.get('department', '')
    
    data = M.get_module_list(pid, create_user, category, department)
    
    return NormalResponseJson(data)
Esempio n. 6
0
def get_rumor_data():
    add_count()
    R = request.args
    keyword = R.get('keyword', None)
    type = R.get('rumorType', None)
    page = R.get('page', None)
    num = R.get('num', None)
    data, length = DC.get_rumor_data(keyword, type, page, num)
    return NormalResponseJson(request, data, length)
Esempio n. 7
0
def _list_project(user, R):
    create_user = R.get('createUser', '')
    category = R.get('category', '')
    department = R.get('department', '')
    page = int(R.get('page', 0))
    size = int(R.get('page', 26))
    data = P.get_project_list(create_user, category, department, page, size)
    
    return NormalResponseJson(data)
Esempio n. 8
0
def get_data_summary():
    add_count()
    R = request.form if request.method == 'POST' else request.args
    level = int(R.get('level', 1))
    code = R.get('name', '86')
    if code == 'china' or code == '': code = '86'

    data = DC.get_data_summary(level, code)
    return NormalResponseJson(request, data)
Esempio n. 9
0
def _create_project(user, R):
    name = R.get('name', '')
    description = R.get('description', '')
    if name == '' or description == '': return ErrorResponseJson('项目名和描述不能为空!') 
    data = P.create_project(user, name, description) 
    
    if not data: return ErrorResponseJson('操作失败!')
    
    return NormalResponseJson({'id': data}) 
Esempio n. 10
0
def get_map():
    R = request.form if request.method == 'POST' else request.args
    name = R.get('id', '')
    path = FILE_PATH + "/data/geojson/{}.json".format(name)
    if not os.path.exists(path):
        return ErrorResponseJson("地图文件不存在")

    with open(path, encoding='utf8') as fp:
        data = ''.join(fp.readlines())
        return NormalResponseJson(request, data)
Esempio n. 11
0
def get_news_data():
    add_count()
    R = request.args
    province = R.get('province', None)
    keyword = R.get('keyword', None)
    date = R.get('pubDate', None)
    page = R.get('page', None)
    num = R.get('num', None)
    data, length = DC.get_news_data(province, keyword, date, page, num)
    return NormalResponseJson(request, data, length)
Esempio n. 12
0
def _create_module(user, R):
    pid = R.get('pid', '')
    name = R.get('name', '')
    description = R.get('description', '')
    if pid == "" or name == '' or description == '': return ErrorResponseJson('模块名和描述不能为空!') 
    data = M.create_module(pid, user, name, description)
    
    print(data)
    if not data: return ErrorResponseJson('操作失败,请检查是否填写完整!')
    
    return NormalResponseJson({'id': data}) 
Esempio n. 13
0
def submit_report(user, R):
    params = R.get('params', '{}')
    data = json.loads(params, encoding="utf8")
    if not data: return ErrorResponseJson("参数错误")
    
    jobs = data.get('jobs', [])
    plans = data.get('plans', [])
    
    flag, data = RC.submit_record(user, jobs, plans)
    if not flag: return ErrorResponseJson("提交失败:" + data)
    
    return NormalResponseJson(data)
Esempio n. 14
0
def _list_task(user, R):
    project = R.get('project', None)
    pid = int(R.get('pid', -1))
    mid = int(R.get('mid', -1))
    category = R.get('category', '')
    department = R.get('department', '')
    
    if mid != -1: 
        data = T.get_task_list(mid, "", category, department)
    else:
        data = T.get_task_hint(user, pid, project)
    
    return NormalResponseJson(data)
Esempio n. 15
0
def _create_task(user, R):
    pid = R.get('pid', '')
    mid = R.get('mid', '')
    name = R.get('name', '')
    multi = {'true': 1, 'false': 0}[R.get('multi')]
    plan_time = R.get('date')
    description = R.get('description', '')
    if mid == "" or name == '' or plan_time == '': return ErrorResponseJson('模块名和描述不能为空!')
    
    data = T.create_task(pid, mid, user, name, multi, plan_time, description)
    if not data: return ErrorResponseJson('操作失败,请检查是否填写完整!')
    
    return NormalResponseJson({'id': data}) 
Esempio n. 16
0
def set_rumor_user():
    add_count()
    if request.method == 'GET':
        R = request.args
        id = R.get("id", None)
        url = R.get("url", None)
        if id and url:
            rumor_user_list = read_rumor_user()
            if int(id) < len(rumor_user_list):
                rumor_user_list[int(id)]["url"] = url
                write_rumor_user(rumor_user_list)
                return NormalResponseJson(request, rumor_user_list[int(id)])
    return ErrorResponseJson()
Esempio n. 17
0
def test_rumor_data():
    add_count()
    R = request.args
    sentence = R.get('sentence', None)
    if not sentence:
        return ErrorResponseJson("参数不正确")
    data = DC.test_rumor(sentence)

    rumor_user_list = read_rumor_user()
    had = False
    for i in rumor_user_list:
        if sentence == i["info"]:
            had = True
            break
    if not had:
        item = dict()
        item["id"] = len(rumor_user_list)
        item["info"] = sentence
        item["url"] = ""
        rumor_user_list.append(item)
        write_rumor_user(rumor_user_list)

    return NormalResponseJson(request, data)
Esempio n. 18
0
def is_login(user):
    L.info("User %s Request login status" % user)
    return NormalResponseJson({})
Esempio n. 19
0
def get_topic():
    add_count()
    R = request.args
    date = R.get('date', None)
    data = DC.get_topic(date)
    return NormalResponseJson(request, data, len(data))
Esempio n. 20
0
def get_rumor_user():
    add_count()
    if request.method == "GET":
        rumor_user_list = read_rumor_user()
        return NormalResponseJson(request, rumor_user_list)
    return ErrorResponseJson()
Esempio n. 21
0
def test(r):
    R = request.form if request.method == 'POST' else request.args
    status = R.get('status', '')
    if status == '': return ErrorResponseJson("请求的参数有误!")
    return NormalResponseJson(request, {'status': status})