Skip to content

Commit

Permalink
Merge pull request #1188 from hanshuaikang/feature/develop_by_han
Browse files Browse the repository at this point in the history
feature: 社区版支持审批助手的能力
  • Loading branch information
hanshuaikang authored Sep 1, 2023
2 parents eb6b69a + 5dba980 commit 36134a8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
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

0 comments on commit 36134a8

Please sign in to comment.