def cancel_sign(request): """ 取消打标 :param request: :return: """ if request.method == "POST": apk_id = int(request.POST.get(const.ID_KEY)) ApkDetailInfoController.cancel_sign(ApkDetailInfo, apk_id) return JsonResponse(FormatData.response_data()) return JsonResponse(FormatData.response_data(code=FormatData.ERROR_CODE, msg=FormatData.ERROR_MSG))
def update_sign(request): """ 更新打标信息 :param request: :return: """ if request.method == "POST": apk_id = int(request.POST.get(const.ID_KEY)) sign = request.POST.get(const.SIGN_KEY) ApkDetailInfoController.update_test_sign(ApkDetailInfo, apk_id, sign) return JsonResponse(FormatData.response_data()) return JsonResponse(FormatData.response_data(code=FormatData.ERROR_CODE, msg=FormatData.ERROR_MSG))
def update_description(request): """ 更新测试备注 :param request: :return: """ if request.method == "POST": apk_id = int(request.POST.get(const.ID_KEY)) description = request.POST.get(const.DESCRIPTION_KEY) ApkDetailInfoController.update_test_description(ApkDetailInfo, apk_id, description) return JsonResponse(FormatData.response_data()) return JsonResponse(FormatData.response_data(code=FormatData.ERROR_CODE, msg=FormatData.ERROR_MSG))
def update_test_result(request): """ 更新测试结果 :param request: :return: """ if request.method == "POST": apk_id = int(request.POST.get(const.ID_KEY)) test_result = request.POST.get(const.TEST_RESULT_KEY) ApkDetailInfoController.update_test_result(ApkDetailInfo, apk_id, test_result) return JsonResponse(FormatData.response_data()) return JsonResponse(FormatData.response_data(code=FormatData.ERROR_CODE, msg=FormatData.ERROR_MSG))
def del_test_report(request): """ 删除测试报告 :param request: :return: """ if request.method == "POST": report_id = int(request.POST.get(const.ID_KEY)) apk_id = int(request.POST.get(const.APP_ID_KEY)) del_ret = ApkReportDetailController.del_test_report(ApkReportDetail, report_id, apk_id) if del_ret: ApkDetailInfoController.update_test_report_status(ApkDetailInfo, apk_id) return JsonResponse(FormatData.response_data()) return JsonResponse(FormatData.response_data(code=FormatData.ERROR_CODE, msg=FormatData.ERROR_MSG))
def upload_test_report(request): """ 上传测试报告 :param request: :return: """ if request.method == "POST": apk_id = int(request.POST.get(const.ID_KEY)) file_obj = request.FILES.get(const.REPORT_KEY) if file_obj is not None: ApkReportDetailController.save_test_report(ApkReportDetail, file_obj, apk_id) ApkDetailInfoController.update_test_report_status(ApkDetailInfo, apk_id, False) return JsonResponse(FormatData.response_data()) return JsonResponse(FormatData.response_data(code=FormatData.ERROR_CODE, msg=FormatData.ERROR_MSG))
def jenkins_info(request): """ jenkins build完成后,消息通知,build msg获取 :param request: :return: """ print(request.POST) jenkins_object = Jenkins(JENKINS_URL, USER, PASSWORD) if request.method == 'POST': request_list = request.POST.get('url').split('/') job_name = request_list[-3] build_num = request_list[-2] job = jenkins_object[job_name] build_info = job.get_build(int(build_num)) build_msg = build_info.get_params() data = { **build_msg, **{ "success": build_info.is_good(), "jenkinsNum": build_num, "jobName": job_name } } print(data) name = data.get(NAME_KEY) if name == 'Mapa2_Android_phone': # android phone 逻辑 BuildInfoController(data).write_build_info( android_phone_package_manager_server.models.BuildInfo, Commit.ANDROID_PHONE_COMMIT_BASE_URI) ApkDetailInfoController(data).write_apk_detail_info( android_phone_package_manager_server.models.ApkDetailInfo) if name == 'Mapa2_ARM_MTK_xiaozhuo': BuildInfoController(data).write_build_info( mapa_package_manager_server.models.BuildInfo, Commit.MAPA_COMMIT_BASE_URI) ApkDetailInfoController(data).write_apk_detail_info( mapa_package_manager_server.models.ApkDetailInfo) # data = JenkinsInfo(data).write_jenkins_info() return HttpResponse(FormatData.response_data(data=data))
def sign_pull_request_info(request): """ 查看打标的 pull request 信息 :param request: :return: """ if request.method == "GET": apk_id = int(request.GET.get(const.ID_KEY)) pull_request_items = ApkDetailInfoController.query_pull_request_items(ApkDetailInfo, apk_id) data = PullRequestInfoController.query_pull_request_items(PullRequestInfo, pull_request_items) return JsonResponse(FormatData.response_data(data=data)) return JsonResponse(FormatData.response_data(code=FormatData.ERROR_CODE, msg=FormatData.ERROR_MSG))
def query_table_info_where_not_triggered_by_pull_request(request): """ pull request 信息不存在时,页面加载表格信息查询 :param request: :return: """ if request.method == "GET": page_num = int(request.GET.get(const.PAGE_NUM_KEY)) select_word = request.GET.get(const.SELECT_WORD_KEY) total, data = BuildInfoController.query_build_info_where_not_triggered_by_pull_request(BuildInfo, page_num, select_word) data = ApkDetailInfoController.query_apk_detail_where_pull_request_id_is_zero(ApkDetailInfo, data) return JsonResponse(FormatData.response_data(data=data, total=total)) return JsonResponse(FormatData.response_data(code=FormatData.ERROR_CODE, msg=FormatData.ERROR_MSG))
def query_market_table_info(request): """ 市场部需要展示的包信息 :param request: :return: """ time_format_str = "T01:01:01" if request.method == "GET": page_num = int(request.GET.get(const.PAGE_NUM_KEY)) select_word = request.GET.get(const.SELECT_WORD_KEY) start_time = request.GET.get(const.START_TIME_KEY) start_time = start_time + time_format_str if start_time != "" and start_time is not None and start_time != "null" else None end_time = request.GET.get(const.END_TIME_KEY) end_time = end_time + time_format_str if end_time != "" and end_time is not None and end_time != "null" else None total, data = ApkDetailInfoController.query_market_info(ApkDetailInfo, page_num, select_word, start_time, end_time) return JsonResponse(FormatData.response_data(data=data, total=total)) return JsonResponse(FormatData.response_data(code=FormatData.ERROR_CODE, msg=FormatData.ERROR_MSG))