...
|
...
|
@@ -2,6 +2,7 @@ |
|
|
# @Time : 2020/10/7 10:40
|
|
|
# @Author vanwhebin
|
|
|
import re
|
|
|
from urllib import parse
|
|
|
from rest_framework.generics import CreateAPIView, RetrieveAPIView, UpdateAPIView, ListAPIView
|
|
|
from rest_framework.permissions import IsAuthenticated, IsAdminUser
|
|
|
from rest_framework.exceptions import ValidationError
|
...
|
...
|
@@ -39,6 +40,7 @@ class CreateProject(CreateAPIView): |
|
|
# 企业微信推送
|
|
|
obj_dict = serializer.data
|
|
|
url = re.sub("PK", str(obj_dict['id']), FRONT_URL['flow_detail'])
|
|
|
url = re.sub("REDIRECT_URL", parse.quote(url, safe=''), FRONT_URL['wx_authorize'])
|
|
|
first_auditor = User.objects.filter(pk=AUDITORS[0][0]).first()
|
|
|
wx_client.push_card(first_auditor.wx_token, url, f"{request.user.username}提交了一个产品立项申请")
|
|
|
wx_client.push_card(request.user.wx_token, url, u"流程创建成功")
|
...
|
...
|
@@ -96,6 +98,7 @@ class AuditProject(UpdateAPIView): |
|
|
wx_client = WxPushHelper()
|
|
|
full_audit_done = self._check_audit(obj)
|
|
|
url = re.sub("PK", str(obj.id), FRONT_URL['flow_detail'])
|
|
|
url = re.sub("REDIRECT_URL", parse.quote(url, safe=''), FRONT_URL['wx_authorize'])
|
|
|
desc = "产品立项流程所有审批已完成" if full_audit_done else f"{request.user.username}已审批完成"
|
|
|
if full_audit_done:
|
|
|
obj.is_done = True
|
...
|
...
|
|