Exemplo n.º 1
0
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)
Exemplo n.º 2
0
def track_sdk_list():
    page = request.args.get('page_index')
    size = request.args.get('page_size')

    code, data, total, message = TrackBusiness.get_sdk_list()

    return json_list_render2(code, data, size, page, total)
Exemplo n.º 3
0
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)
Exemplo n.º 4
0
def job_list(ci_id):
    """
    @api {get} /v1/cidata/job/:ci_id 获取某个job的数据
    @apiName GetJenkinsJobData
    @apiGroup CI
    @apiDescription 获取某个job的数据
    @apiParam {int} ci_id job id
    @apiParam {int} page_size 当前页面的数量
    @apiParam {int} page_index 当前页面的页数
    @apiParam {string} start_time 开始日期
    @apiParam {string} end_time 结束日期
    @apiParam {string} start_name 触发者
    @apiParamExample {json} Request-Example:
    {
        "ci_id": 1,
        "page_size":10,
        "page_index":1,
        "start_time":"2019-04-27",
        "end_time":"2019-07-26",
        "start_name":""
    }
    @apiSuccessExample {json} Success-Response:
     HTTP/1.1 200 OK
    {
        "code": 0,
        "data": [
            {
                "ci_id": 16,
                "id": 3547,
                "job_accuracy": "0.7814",
                "job_count": 883,
                "number": 135,
                "report": "http://host:port/report.html",
                "run_date": "Tue, 23 Jul 2019 12:48:00 GMT",
                "run_time": "3232.939",
                "start_name": "timer",
                "status": 0,
                "url": "http://ci.tcloud.com/job/tcloud_activity_api/135/"
            }
        ],
        "message": "ok",
        "page_index": 1,
        "page_size": 10,
        "total": 1
    }
    """
    page_size, page_index = parse_list_args2()
    data = CiJobBusiness.query_json_by_id(ci_id, page_size, page_index)
    count = CiJobBusiness.query_count(ci_id)

    return json_list_render2(0, data, page_size, page_index, count)
Exemplo n.º 5
0
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)
Exemplo n.º 6
0
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 = request.args.get('page_size')
    page_index = request.args.get('page_index')
    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)
Exemplo n.º 7
0
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)
Exemplo n.º 8
0
def gain_old_data():
    """
    @api {get} /v1/deploy/history_data 获取历史部署记录
    @apiName deployHistory_data
    @apiGroup Deploy
    @apiDescription 获取历史部署记录
    @apiParam {int} server_id 服务id
    @apiParamExample {json} Request-Example:
    {
        "project_id": 4,
        "flow_id": 232,
        "page_size": 10,
        "page_index": 1
    }
    @apiSuccessExample {json} Success-Response:
     HTTP/1.1 200 OK
    {
        "code": 0,
        "data": [
            {
                "branch": "develop",
                "deploy_id": 160,
                "flow_id": 232,
                "id": 179,
                "node_id": 31,
                "node_name": "yn-244",
                "project_id": 4,
                "result": 1,
                "server_id": 45,
                "server_name": "submarine-test",
                "status": 0,
                "version": "1.1.75"
            },
            {
                "branch": "develop",
                "deploy_id": 159,
                "flow_id": 232,
                "id": 178,
                "node_id": 31,
                "node_name": "yn-244",
                "project_id": 4,
                "result": 4,
                "server_id": 45,
                "server_name": "submarine-test",
                "status": 0,
                "version": "1.1.74"
            }
        ],
        "message": "ok",
        "page_index": 1,
        "page_size": 10,
        "total": 2
    }
    """
    page_size, page_index = parse_list_args2()
    project_id = request.args.get('project_id')
    flow_id = request.args.get('flow_id')
    data = DeployRecordBusiness.query_all_json(page_size, page_index)

    count = DeployRecordBusiness.query_all_count(project_id, flow_id)

    return json_list_render2(0, data, page_size, page_index, count)
Exemplo n.º 9
0
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)
Exemplo n.º 10
0
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)
Exemplo n.º 11
0
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)
Exemplo n.º 12
0
def flow_query_all_handler():
    """
    @api {get} /v1/flow/ 查询流程
    @apiName GetFlow
    @apiGroup 流程
    @apiDescription 查询流程
    @apiParam {int} projectid 项目ID
    @apiParam {int} versionid 版本ID
    @apiParam {str} status 状态
    @apiParam {str} name 名称
    @apiParam {int} userid 用户ID
    @apiParam {str} start_time 开始时间
    @apiParam {str} end_time 结束时间
    @apiParam {int} flow_assemble_id 流程集合ID
    @apiParam {str} flow_type 备注
    @apiParam {int} flow_id 流程ID
    @apiParam {list} platform 涉及端
    @apiParam {int} page_size 每页条数
    @apiParam {int} page_index 第几页
    @apiParamExample {json} Request-Example:
    ?projectid=4&name=&page_size=10&page_index=1&status=0&flow_assemble_id=&flow_type=&flow_id=261
    @apiSuccessExample {json} Success-Response:
     HTTP/1.1 200 OK
    {
    "code":0,
    "data":[
        {
            "action":{
                "current_step":"2",
                "current_step_name":"开发自测",
                "process":0,
                "step_tab":[
                    {
                        "step_tab_id":"6",
                        "step_tab_name":"备注",
                        "step_tab_result":"会停留在当前步骤",
                        "step_tab_user":"******"
                    },
                    {
                        "step_tab_id":"1",
                        "step_tab_name":"通过",
                        "step_tab_result":"会跳转到下一步",
                        "step_tab_user":"******"
                    }
                ],
                "steps":[

                ]
            },
            "all_user_list":[
                96,
                20
            ],
            "comment":"<p>asdsad</p>",
            "creator_id":96,
            "creator_name":"张宇",
            "dependence":"",
            "end_time":"",
            "flow_assemble_id":4,
            "flow_assemble_name":"HotFix",
            "flow_assemble_type":1,
            "flow_base_list":"2,7,11,12,16",
            "flow_type":2,
            "id":261,
            "name":"asdsada",
            "picture":"https://p.qlogo.cn/bizmail/WRZVs2uMphoxc2918UvZzL31u6A9ibTNuqnIibzJ4GxjWIVVDxHvUGuA/0",
            "platform":"",
            "priority":"",
            "project_id":4,
            "requirement_list":"",
            "start_time":"2019-07-22 21:40:54",
            "status":0,
            "user_dev":[
                {
                    "user_id":96,
                    "user_name":"张宇"
                }
            ],
            "user_dev_id":[
                96
            ],
            "user_owner":[
                {
                    "user_id":20,
                    "user_name":"刘德华"
                }
            ],
            "user_owner_id":[
                20
            ],
            "user_prod":[
                {
                    "user_id":96,
                    "user_name":"张宇"
                }
            ],
            "user_prod_id":[
                96
            ],
            "user_test":[
                {
                    "user_id":96,
                    "user_name":"张宇"
                }
            ],
            "user_test_id":[
                96
            ],
            "version_id":"",
            "weight":1
        }
    ],
    "message":"ok",
    "page_index":1,
    "page_size":10,
    "total":1
    }
    """
    page_size, page_index = parse_list_args2()
    data, count, code = FlowBusiness.query_all_json(page_size, page_index)
    return json_list_render2(code, data, page_size, page_index, count)