Commit aa406493 authored by Wallen姚文辉's avatar Wallen姚文辉

需求加优化

parent 00b1323a
......@@ -38,15 +38,16 @@ def getproject():
headers=getheader(session.get("id"))
if not headers:
return jsonify({"code": 502, "message": "请完善jira信息"}),502
result=requests.request("get",jiraAddress+"/rest/api/1.0/menus/browse_link?inAdminMode=false",headers=headers).json()
# return jsonify({"code": 200, "message": "请求成功", "data": result}),200
res=[]
for each in result["sections"]:
if each.get("title")=="当前活动的项目" or each.get("title")=="您最近参与的项目":
for ele in each["items"]:
res.append({"key":ele["url"].split("/")[-1],"name":ele["label"]})
if res:
return jsonify({"code": 200, "message": "请求成功", "data": res}),200
result=requests.request("get",jiraAddress+"/rest/greenhopper/1.0/rapidviews/viewsData?query=&startAt=0&maxResults=200",headers=headers).json()
# result=requests.request("get",jiraAddress+"/rest/api/1.0/menus/browse_link?inAdminMode=false",headers=headers).json()
# # return jsonify({"code": 200, "message": "请求成功", "data": result}),200
# res=[]
# for each in result["sections"]:
# if each.get("title")=="当前活动的项目" or each.get("title")=="您最近参与的项目":
# for ele in each["items"]:
# res.append({"key":ele["url"].split("/")[-1],"name":ele["label"]})
if result.get("views"):
return jsonify({"code": 200, "message": "请求成功", "data": result.get("views")}),200
else:
return jsonify({"code": 402, "message": "未找到相关项目,请确认jira信息是否正确"}),402
......@@ -55,9 +56,9 @@ def iteration(getproject):
headers=getheader(session.get("id"))
if not headers:
return jsonify({"code": 502, "message": "请完善jira信息"}),502
print(requests.request("get",jiraAddress+"/rest/agile/1.0/board?projectKeyOrId="+getproject,headers=headers).json())
id_=requests.request("get",jiraAddress+"/rest/agile/1.0/board?projectKeyOrId="+getproject,headers=headers).json().get("values")[0].get("id")
result=requests.request("get",jiraAddress+"/rest/greenhopper/1.0/xboard/plan/backlog/data.json?rapidViewId="+str(id_)+"&selectedProjectKey="+getproject,headers=headers).json()
# print(requests.request("get",jiraAddress+"/rest/agile/1.0/board?projectKeyOrId="+getproject,headers=headers).json())
# id_=requests.request("get",jiraAddress+"/rest/agile/1.0/board?projectKeyOrId="+getproject,headers=headers).json().get("values")[0].get("id")
result=requests.request("get",jiraAddress+"/rest/greenhopper/1.0/xboard/plan/backlog/data.json?rapidViewId="+str(getproject),headers=headers).json()
res=[]
for each in result["sprints"]:
res.append({"key":each["id"],"name":each["name"]})
......@@ -71,8 +72,8 @@ def reportinfo():
project=request.args.get("project")
iteration=request.args.get("iteration")
headers=getheader(session.get("id"))
id_=requests.request("get",jiraAddress+"/rest/agile/1.0/board?projectKeyOrId="+project,headers=headers).json().get("values")[0].get("id")
result=requests.request("get",jiraAddress+"/rest/greenhopper/1.0/xboard/plan/backlog/data.json?rapidViewId="+str(id_)+"&selectedProjectKey="+project,headers=headers).json()
# id_=requests.request("get",jiraAddress+"/rest/agile/1.0/board?projectKeyOrId="+project,headers=headers).json().get("values")[0].get("id")
result=requests.request("get",jiraAddress+"/rest/greenhopper/1.0/xboard/plan/backlog/data.json?rapidViewId="+str(project),headers=headers).json()
all_=result.get("issues")
status={}
for k,v in result["entityData"]["statuses"].items():
......@@ -108,7 +109,7 @@ def reportinfo():
if chan and chan not in peoples["chan"]:
peoples["chan"].append(chan)
i["peoples"]=[chan]
info=requests.request("get",jiraAddress+"/rest/greenhopper/1.0/xboard/issue/details.json?rapidViewId="+str(id_)+"&issueIdOrKey="+i["key"]+"&loadSubtasks=true",headers=headers).json()
info=requests.request("get",jiraAddress+"/rest/greenhopper/1.0/xboard/issue/details.json?rapidViewId="+str(project)+"&issueIdOrKey="+i["key"]+"&loadSubtasks=true",headers=headers).json()
for j in info.get("tabs").get("defaultTabs"):
if j.get("tabId")=="SUB_TASKS":
for m in j.get("subtaskEntries"):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment