@@ -21,11 +21,11 @@ from integral.models import SaleclerkSubmitLogInfo |
||
21 | 21 |
from logs.models import ComplementCodeLogInfo, MchInfoEncryptLogInfo |
22 | 22 |
from mch.models import AdministratorInfo, BrandInfo, ConsumeInfoSubmitLogInfo, DistributorInfo, ModelInfo |
23 | 23 |
from member.models import GoodsInfo, GoodsOrderInfo, MemberActivityGroupShareInfo, MemberActivityInfo |
24 |
-from pre.custom_message import sendwxasubscribemessage |
|
24 |
+from pre.custom_message import sendwxasubscribemessage, sendtemplatemessage |
|
25 | 25 |
from statistic.models import ConsumeModelSaleStatisticInfo, ConsumeSaleStatisticInfo, ConsumeUserStatisticInfo |
26 | 26 |
from utils.error.errno_utils import (AdministratorStatusCode, ComplementCodeStatusCode, ProductBrandStatusCode, |
27 | 27 |
ProductCouponStatusCode, ProductMachineStatusCode, UserStatusCode) |
28 |
- |
|
28 |
+ |
|
29 | 29 |
|
30 | 30 |
WECHAT = settings.WECHAT |
31 | 31 |
|
@@ -1507,7 +1507,6 @@ def complement_code_audit(request): |
||
1507 | 1507 |
|
1508 | 1508 |
# 如果"审核通过" |
1509 | 1509 |
if log.audit_status == ComplementCodeLogInfo.AUDIT_PASS: |
1510 |
- # # TODO: Send template_message |
|
1511 | 1510 |
try: |
1512 | 1511 |
brand = BrandInfo.objects.get(brand_id=brand_id) |
1513 | 1512 |
except BrandInfo.DoesNotExist: |
@@ -1533,6 +1532,40 @@ def complement_code_audit(request): |
||
1533 | 1532 |
log.ciphertext = ciphertext |
1534 | 1533 |
log.save() |
1535 | 1534 |
|
1535 |
+ try: |
|
1536 |
+ user = UserInfo.objects.get(user_id=log.user_id, status=True) |
|
1537 |
+ except: |
|
1538 |
+ return response() |
|
1539 |
+ |
|
1540 |
+ # Send template_message |
|
1541 |
+ data = { |
|
1542 |
+ "first": { |
|
1543 |
+ "value": u'你的补码申请已通过,请点击消息绑定您的电子保修卡', |
|
1544 |
+ "color": "#173177" |
|
1545 |
+ }, |
|
1546 |
+ "keyword1": { |
|
1547 |
+ "value": log.name, |
|
1548 |
+ "color": "#173177" |
|
1549 |
+ }, |
|
1550 |
+ "keyword2": { |
|
1551 |
+ "value": log.model_name, |
|
1552 |
+ "color": "#173177" |
|
1553 |
+ }, |
|
1554 |
+ "keyword3": { |
|
1555 |
+ "value": log.sn, |
|
1556 |
+ "color": "#173177" |
|
1557 |
+ }, |
|
1558 |
+ "remark": { |
|
1559 |
+ "value": u'感谢你的使用', |
|
1560 |
+ "color": "#173177" |
|
1561 |
+ } |
|
1562 |
+ } |
|
1563 |
+ |
|
1564 |
+ wxcfg = WECHAT.get('MINIAPP', {}) |
|
1565 |
+ appid = wxcfg.get('appID') |
|
1566 |
+ |
|
1567 |
+ sendtemplatemessage(openid=user.openid, template_id=settings.TEMPLATE_ID_COMPLEMENT, data=data, miniappid=appid, minipagepath='/pages/register/consumer/consumer?q={}&marketcode=1'.format(ciphertext)) |
|
1568 |
+ |
|
1536 | 1569 |
return response(data={ |
1537 | 1570 |
'ciphertext': ciphertext, |
1538 | 1571 |
}) |
@@ -419,6 +419,7 @@ DEBUG_STATISTIC_DATA_FLAG = False |
||
419 | 419 |
|
420 | 420 |
# 微信模版消息/订阅消息 |
421 | 421 |
TEMPLATE_ID_TRACKING = 'T5pvO7McZbDZkNwfpwQCAoqo8fWOu3iD45sLE__EiBc' |
422 |
+TEMPLATE_ID_COMPLEMENT = 'DXJzPqLPaxa-G2IjAQnv-5Lbca63OZwIqANwvBbMm5I' |
|
422 | 423 |
|
423 | 424 |
KODO_BRAND_NAME = '' |
424 | 425 |
|