def phone_index_handler(): """ @api {get} /v1/asset/phone 查询 资产设备列表 @apiName GetPhoneList @apiGroup 项目 @apiDescription 查询 资产设备列表 @apiParam {int} [page_size] 分页-单页大小 @apiParam {int} [page_index] 分页-页数 @apiParam {string} [name] 资产名称 @apiParam {string} [vendor] 制造商 @apiParam {string} [os] 操作系统 @apiParam {string} [resolution] 分辨率 @apiParam {int} [borrower_id] 持有人 ID @apiParam {string} [device_source] 设备来源 @apiParam {string} [device_belong] 设备归属 @apiParamExample {json} Request-Example: ?page_size=10&page_index=1&name=小米 @apiSuccessExample {json} Success-Response: HTTP/1.1 200 OK { "code": 0, "data": [ { "asset_id": "1", "borrow_id": 5, "borrow_nickname": "周培丽hello", "borrow_status": "[周培丽hello] 持有", "buy_date": "2019-07-17T16:00:00.000Z", "confirm_status": 1, "core": "1", "cpu": "1", "creator_id": 5, "device_belong": "1", "device_number": "1", "device_source": "1", "id": 79, "move_status": 0, "name": "小米3", "os": "1", "ram": "1", "region": "1", "resolution": "1x1", "rom": "1", "status": 0, "vendor": "1", "device_belong": "1231", "device_source": "123123 } ], "message": "ok", "page_index": 1, "page_size": 10, "total": 3 } """ page_size, page_index = parse_list_args2() data, count = PhoneBusiness.get_phone_all(page_size, page_index) return json_list_render2(0, data, page_size, page_index, count)
def case_query_handler(): """ @api {get} /v1/case/ 查询 用例 @apiName GetCase @apiGroup 项目 @apiDescription 查询用例,可根据需求id查询 @apiParam {int} [page_size] 分页-单页数目 @apiParam {int} [page_index] 分页-页数 @apiParam {int} [requirement_id] 需求id @apiSuccessExample {json} Success-Response: HTTP/1.1 200 OK { "code": 0, "data": [ { "cnumber": "TC3891", "creation_time": "2019-07-26 16:14:07", "ctype": "1", "id": 3891, "is_auto": 1, "modified_time": "2019-07-26 16:14:07", "module": "看板管理", "moduleid": 342, "precondition": "1", "priority": 0, "requirement":[ { "requirement_id": 1, "requirement_title": "123123", } ], "status": 0, "step_result": "{\"step_result\":[{\"step\":\"1\",\"expect\":\"1\"}]}", "title": "1", "userid": 104, "username": "******" } ], "message": "ok", "page_index": 1, "page_size": 2, "total": 2915 } """ page_size, page_index = parse_list_args2() requirement_id = request.args.get('requirement_id') if requirement_id: data, count = CaseBusiness.query_by_requirement_id( requirement_id, page_size, page_index) else: data, count = CaseBusiness.paginate_data(page_size, page_index) return json_list_render2(0, data, page_size, page_index, count)
def credit_index_handler(): """ @api {GET} /v1/credit 查询 信用积分 @apiName GetCredit @apiGroup 项目 @apiDescription 查询 信用积分 @apiParam {int} [page_size] 分页-页面大小 @apiParam {int} [page_index] 分页-页数 @apiParamExample {json} Request-Example: ?page_size=1&page_index=5 @apiSuccessExample {json} Success-Response: HTTP/1.1 200 OK { "code": 0, "data": [ { "id": 6, "score": 48, "status": 0, "user_id": 95 }, { "id": 7, "score": 101, "status": 0, "user_id": 1 }, { "id": 8, "score": 110, "status": 0, "user_id": 26 } ], "message": "ok", "page_index": 1, "page_size": 3, "total": 8 } """ page_size, page_index = parse_list_args2() page_size = page_size or 10 page_index = page_index or 1 data, total = CreditBusiness.paginate_data(page_size, page_index) return json_list_render2(0, data, page_size, page_index, total)
def case_query_by_module_id_handler(mid): """ @api {get} /v1/case/querybymodule/mid 查询 单个模块下的用例 @apiName GetCaseByModuleId @apiGroup 项目 @apiDescription 查询单个模块下的用例 @apiParam {int} [page_size] 分页-单页数目 @apiParam {int} [page_index] 分页-页数 @apiSuccessExample {json} Success-Response: HTTP/1.1 200 OK { "code": 0, "data": [ { "cnumber": "TC8", "creation_time": "2018-12-19 11:04:57", "ctype": "1", "id": 8, "is_auto": 1, "modified_time": "2018-12-19 11:04:57", "module": "音频", "moduleid": 1, "precondition": "1231321321", "priority": "", "status": 0, "step_result": "{\"step_result\":[{\"step\":\"132\",\"expect\":\"321321321\"}]}", "title": "", "userid": 3, "username": "******" } ], "message": "ok", "page_index": 1, "page_size": 10, "total": 1 } """ page_size, page_index = parse_list_args2() data, count = CaseBusiness.paginate_data(mid=mid, page_size=page_size, page_index=page_index) return json_list_render2(0, data, page_size, page_index, count)
def virtual_asset_index_handler(): """ @api {get} /v1/asset/virtual 查询 虚拟资产列表 @apiName GetVirtualList @apiGroup 项目 @apiDescription 查询 虚拟资产列表 @apiParam {int} [page_size] 分页-单页大小 @apiParam {int} [page_index] 分页-页数 @apiParamExample {json} Request-Example: ?page_size=1&page_index=1 @apiSuccessExample {json} Success-Response: HTTP/1.1 200 OK { "code": 0, "data": [ { "administrator": "", "asset_id": "9", "asset_type": 1, "bind_tel": "", "id": 18, "idcard": "", "operator": "", "passwd": "", "status": 0 } ], "message": "ok", "page_index": 1, "page_size": 10, "total": 27 } """ page_size, page_index = parse_list_args2() data, count = VirtualAssetBusiness.paginate_data(page_size, page_index) return json_list_render2(0, data, page_size, page_index, count)
def requirement_query_list(): page_size, page_index = parse_list_args2() father_data, count = RequirementBusiness.paginate_data( page_size, page_index) return json_list_render2(0, father_data, page_size, page_index, count)
def task_query_all_handler(): """ @api {get} /v1/task/ 获取 task列表 @apiName GetTaskList @apiGroup 项目 @apiDescription 获取task列表 @apiParam {int} [page_size] 分页-单页大小 @apiParam {int} [page_index] 分页-页数 @apiSuccessExample {json} Success-Response: HTTP/1.1 200 OK { "code": 0, "data": [ { "creator": [ { "id": 1, "name": "wiggens" } ], "description": "str", "end_time": "", "executor": [ { "id": 1, "name": "wiggens" } ], "id": 4, "name": "str12", "priority": 1, "start_time": "", "status": 0, "tmethod": "", "ttype": "str" }, { "creator": [ { "id": 1, "name": "wiggens" } ], "description": "str", "end_time": "", "executor": [ { "id": 1, "name": "wiggens" } ], "id": 1, "name": "str12", "priority": 1, "start_time": "", "status": 0, "tmethod": "", "ttype": "str" } ], "limit": 99999, "message": "ok", "offset": 0 } """ page_size, page_index = parse_list_args2() data, count = TaskBusiness.query_task_case_json(page_size, page_index) return json_list_render2(0, data, page_size, page_index, count)
def issue_query_all_handler(): """ @api {get} /v1/issue/ 查询 issue 列表 @apiName SearchIssue @apiGroup 项目 @apiDescription 查询 issue 列表 @apiParam {int} [projectid] 项目 ID @apiParam {int} [versionid] 版本 ID @apiParam {string} [creator_id] 创建人 ID,使用 ',' 分割 @apiParam {string} [handler_id] 处理人 ID,使用 ',' 分割 @apiParam {int} [title] 标题 @apiParam {string} [handle_status] 处理状态 ID,使用 ',' 分割 @apiParam {string} [module_id] 模块 ID,使用 ',' 分割 @apiParam {string} [priority] 优先级 ID,使用 ',' 分割 @apiParam {int} [page_size] 分页 页面大小 @apiparam {int} [page_index] 分页 页数 @apiParamExample {json} Request-Example: { "projectid": 4, "versionid": 173, "creator_id": "1,2,3,4", "page_size": 1 } @apiSuccessExample {json} Success-Response: HTTP/1.1 200 OK { "code": 0, "data": [ { "attach": "{"images":[],"files":[],"videos":[]}", "chance": 2, "comment": "", "creation_time": "2019-08-08 20:58:49", "creator": [ { "id": 96, "name": "张宇" } ], "description": "", "detection_chance": "", "handle_status": 2, "handler": [ { "id": 96, "name": "张宇" } ], "issue_number": "T398", "issue_type": 1, "issueid": 398, "level": 1, "modified_time": "2019-08-08 20:58:49", "modifier": [], "module": [ { "id": 329, "name": "用例二级2222" } ], "priority": 1, "project_id": 4, "rank": 12, "reopen": 0, "repair_time": "", "requirement_id": "", "requirement_title": "", "stage": "", "status": 0, "system": "", "test_time": "", "title": "1.2.7issuse55555", "version": [ { "id": 173, "name": "1.2.7" } ], "weight": "" } ], "message": "ok", "page_index": 1, "page_size": 1, "total": 8 } """ requirement_id = request.args.get('requirement_id') if requirement_id: page_size, page_index = parse_list_args2() data, count = IssueBusiness.paginate_data_by_rid( page_size, page_index, requirement_id) return json_list_render2(0, data, page_size, page_index, count) else: page_size, page_index = parse_list_args2() data, count = IssueBusiness.paginate_data(page_size, page_index) return json_list_render2(0, data, page_size, page_index, count)
def unfinish_work_handler(): """ @api {GET} /v1/board/unfinish 查询 我的待办 @apiName GetTodoByMe @apiGroup 项目 @apiDescription 查询 我的待办 @apiParam {int} projectid 项目编号 @apiParam {string} type 类型 : task,issue, task_case @apiParam {string} title 标题:根据标题搜索 @apiParamExample {json} Request-Example: ?projectid=1 @apiSuccessExample {json} Success-Response: HTTP/1.1 200 OK { "code": 0, "data": { "issue_info": [ { "chance": 3, "creator_id": 26, "creator_name": "张素浈", "description": "", "handle_status": 1, "handler_id": "", "handler_name": "", "id": 363, "issue_number": "T363", "level": 4, "priority": 3, "project_id": 4, "stage": "", "title": "testsz111111", "version_id": 168, "version_name": "1.2.5啊啊" } ], "task_case_info": [ { "cnumber": "TC3835", "comment": "", "ctype": "1,5", "description": "", "exe_way": "", "executor_id": "", "executor_name": "", "handler_id": "", "handler_name": "", "is_auto": 1, "module_id": 321, "module_name": "二级目录11111111111111111111111", "precondition": "多条必须换行,由数字加、开头,可为空", "project_id": 4, "status": 0, "step_result": "{"step_result": [{"step": "点击新建流程按钮", "expect": "啊啊啊啊啊"}, {"step": "点击添加需求的按钮,选择需要的需求,点击确定", "expect": "求选择成功"}]}", "task_id": 152, "taskcaseid": 682, "title": "11111这是用例描述" } ] }, "message": "ok", "page_size": 1, "page_index": 1, "total": 1 } """ page_size, page_index = parse_list_args2() r_type = request.args.get("type") title = request.args.get("title") data, count = BoardBusiness.user_unfinish(page_size, page_index, r_type, title) return { "code": 0, "data": data, "total": count, "page_size": page_size, "page_index": page_index }