Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: 社区版支持审批助手的能力 #1188

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions itsm/ticket/views/ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ class TicketModelViewSet(ModelViewSet):
"service_id": ["exact", "in"],
"create_at": ["lte", "gte"],
"bk_biz_id": ["exact", "in"],
"tag": ["exact"],
}
ordering_fields = ("create_at",)

Expand Down
15 changes: 9 additions & 6 deletions platform_config/open/bkchat/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,10 @@ def send_fast_approval_message(title, content, receivers, ticket, state_id):
)
)
# 验证是否请求成功
if result.get("code") != 0:
if not result.get("result"):
logger.info(
"[fast_approval({})]send fast approval message failed:{}".format(
ticket_sn, result.message
ticket_sn, result.get("message")
)
)
except ComponentCallError as error:
Expand All @@ -210,7 +210,7 @@ def proceed_fast_approval(request):
"""

# 1.解密request变携带的加密信息
result = json.loads(request.body)
result = request.data

# 2.对解密后的字段进行获取
ticket_id = int(result.get("context").get("ticket_id"))
Expand All @@ -227,8 +227,11 @@ def proceed_fast_approval(request):
return JsonResponse(
{
"result": False,
"data": {"approver": ticket.get_approver(state_id)},
"code": 0,
"data": {
"approve_result": ticket.get_state_approve_result(state_id),
"approver": ticket.get_approver(state_id),
},
"code": -1,
"message": "{}\n{}".format(title, content),
}
)
Expand Down Expand Up @@ -280,7 +283,7 @@ def proceed_fast_approval(request):
{
"result": False,
"data": None,
"code": 0,
"code": -1,
"message": "快速审批异常,请联系管理员",
}
)
Expand Down