Ejemplo n.º 1
0
def intros_query():
    """
    工作简介查询接口i2
    :return: dst.my_json字典
    """
    detail = bool(request.args.get('detail', None))
    query = request.args.get('query', None)
    page = request.args.get('page', None)  # 分页预留
    per_page = request.args.get('per_page', None)  # 分页预留
    success, result["message"], result["data"] = TbIntros.query_daily(detail, query)
    result["status"] = 1 if success else 0
    return result
Ejemplo n.º 2
0
def intros_data():
    """
    工作简介数据接口i1
    :return: dst.my_json字典
    """
    detail = bool(request.args.get('detail', None))  # 前端传过来的的true与false是字符串 需转为bool
    query = request.args.get('query', None)
    page = request.args.get('page', None)  # 分页预留
    per_page = request.args.get('per_page', None)  # 分页预留
    result["data"] = TbIntros.himself_intros(detail)
    result["message"] = "数据获取成功"
    result["status"] = 1
    return result
Ejemplo n.º 3
0
def common_projects_data():
    """
    项目信息数据接口c0
    :return:
    """
    result = deepcopy(my_json)  # 存储给用户的提示信息msg以及给前端的状态码
    limit = request.args.get("limit", None)
    projects = []
    projects.extend(TbIntros.history_projects_in_intros())
    projects.extend(TbProject.all_projects(
        limit))  # 获取最近的limit个项目 以 [{"id":***, "name":***}]形式
    projects = sorted(set(projects), key=projects.index)  # 保留原顺序的去重
    result["data"]["projects"] = [{"id": i[0], "name": i[1]} for i in projects]
    return result
Ejemplo n.º 4
0
def common_intros_query():
    """
    项目简介信息查询接口c3
    :return:
    """
    result = deepcopy(my_json)  # 存储给用户的提示信息msg以及给前端的状态码
    try:
        query = request.args["query"]
        project_id = request.args["project_id"]
    except KeyError as e:
        result["message"] = e.args[0] + "字段不能为空"
        result["status"] = 2
        return result
    result["data"]["intros"] = TbIntros.search_his_intros(query, project_id)
    return result
Ejemplo n.º 5
0
def common_intros_data():
    """
    项目简介信息数据接口c1
    :return:
    """

    result = deepcopy(my_json)  # 存储给用户的提示信息msg以及给前端的状态码
    try:
        project_id = request.args["project_id"]
    except KeyError as e:
        result["message"] = e.args[0] + "字段不能为空"
        result["status"] = 2
        return result
    result["data"]["intros"] = TbIntros.intros_of_project(project_id)
    return result
Ejemplo n.º 6
0
def intros_edit_data():
    """
    当前工作简介信息接口i4
    :return: dst.my_json字典
    """
    result["data"] = {}
    args = {}
    try:
        args["intro_id"] = request.args["intro_id"]  # 日报id必须有
        check_empty_args(args)
    except KeyError as e:
        result["message"] = e.args[0] + "字段不能无或为空"
        result["status"] = "0"
        return result
    # 查询当前工作日报的编辑信息
    success, result["message"], result["data"] = TbIntros.get_the_intro(args["intro_id"])
    result["status"] = 1 if success else 0
    return result
Ejemplo n.º 7
0
def intros_add():
    """
    工作简介新增提交接口i3
    :return: dst.my_json字典
    """
    args = {}
    try:
        args["workaddress"] = request.json['work_address']
        args["workproperty"] = request.json['work_property_id']
        args["projectid"] = request.json['project_id']
        args["workintro"] = request.json['work_intro']
        check_empty_args(args)
    except KeyError as e:
        result["message"] = e.args[0] + "字段不能无或为空"
        result["status"] = "0"
        return result

    args["remarks"] = request.json.get('remarks', "")  # remark字段可以为空
    success, result["message"] = TbIntros.add_intro(**args)
    result["status"] = 1 if success else 0
    result["data"] = {}
    return result