diff --git a/fir_ser/api/views/notify.py b/fir_ser/api/views/notify.py
index 77039b8..bb33322 100644
--- a/fir_ser/api/views/notify.py
+++ b/fir_ser/api/views/notify.py
@@ -70,7 +70,7 @@ class NotifyConfigView(APIView):
notify_available_signs = threshold.get('notify_available_signs')
if notify_available_downloads is not None:
- request.user.notify_available_downloads = notify_available_downloads
+ request.user.notify_available_downloads = notify_available_downloads * Config.APP_USE_BASE_DOWNLOAD_TIMES
if notify_available_signs is not None:
request.user.notify_available_signs = notify_available_signs
if notify_available_downloads is not None or notify_available_signs is not None:
@@ -78,8 +78,10 @@ class NotifyConfigView(APIView):
NotifyLoopCache(request.user.uid, 'download_times').del_storage_cache()
NotifyLoopCache(request.user.uid, 'sign_device_times').del_storage_cache()
- res.data = UserInfo.objects.filter(pk=request.user.pk).values('notify_available_downloads',
- 'notify_available_signs').first()
+ data = UserInfo.objects.filter(pk=request.user.pk).values('notify_available_downloads',
+ 'notify_available_signs').first()
+ data['notify_available_downloads'] = data['notify_available_downloads'] // Config.APP_USE_BASE_DOWNLOAD_TIMES
+ res.data = data
return Response(res.dict)
def put(self, request):
diff --git a/fir_ser/common/libs/sendmsg/template_content.py b/fir_ser/common/libs/sendmsg/template_content.py
index 9763bfd..a338adc 100644
--- a/fir_ser/common/libs/sendmsg/template_content.py
+++ b/fir_ser/common/libs/sendmsg/template_content.py
@@ -10,11 +10,12 @@ from django.template import loader
from common.base.baseutils import get_format_time
-def get_pay_success_html_content(user_obj, order_obj):
+def get_pay_success_html_content(user_obj, order_obj, base_download_times=1):
return loader.render_to_string('pay_success.html',
{
'username': user_obj.first_name,
'order_obj': order_obj,
+ 'base_download_times': base_download_times
})
@@ -58,11 +59,12 @@ def get_check_developer_report_html_content(user_obj, developer_obj_list, develo
})
-def get_user_download_times_over_limit_html_content(user_obj):
+def get_user_download_times_over_limit_html_content(user_obj, base_download_times=1):
return loader.render_to_string('download_times_over_limit.html',
{
'username': user_obj.first_name,
'user_obj': user_obj,
+ 'base_download_times': base_download_times,
})
@@ -83,11 +85,12 @@ def get_developer_cert_expired_html_content(user_obj, developer_obj_list):
})
-def get_user_download_times_not_enough_html_content(user_obj):
+def get_user_download_times_not_enough_html_content(user_obj, base_download_times=1):
return loader.render_to_string('download_times_not_enough.html',
{
'username': user_obj.first_name,
'user_obj': user_obj,
+ 'base_download_times': base_download_times,
})
diff --git a/fir_ser/common/libs/sendmsg/templates/download_times_not_enough.html b/fir_ser/common/libs/sendmsg/templates/download_times_not_enough.html
index 82b64e9..ccaa401 100644
--- a/fir_ser/common/libs/sendmsg/templates/download_times_not_enough.html
+++ b/fir_ser/common/libs/sendmsg/templates/download_times_not_enough.html
@@ -210,14 +210,14 @@
- 您当前账户下载次数仅剩 {{ user_obj.download_times }}
+ 您当前账户下载次数仅剩 {% widthratio user_obj.download_times base_download_times 1 %}
|
- 您当前账户下载次数不足,应用已经无法下载安装。为了避免业务使用,望您尽快充值
+ 您当前账户下载次数不足,应用已经无法下载安装。为了避免业务暂停使用,望您尽快充值
|
diff --git a/fir_ser/common/libs/sendmsg/templates/download_times_over_limit.html b/fir_ser/common/libs/sendmsg/templates/download_times_over_limit.html
index e1ed46e..c51dada 100644
--- a/fir_ser/common/libs/sendmsg/templates/download_times_over_limit.html
+++ b/fir_ser/common/libs/sendmsg/templates/download_times_over_limit.html
@@ -210,21 +210,21 @@
- 您当前账户下载次数仅剩 {{ user_obj.download_times }}
+ 您当前账户下载次数仅剩 {% widthratio user_obj.download_times base_download_times 1 %}
|
- 已超过您设置的阈值 {{ user_obj.notify_available_downloads }}
+ 已超过您设置的阈值 {% widthratio user_obj.notify_available_downloads base_download_times 1 %}
|
- 为了避免业务使用,望您尽快充值!
+ 为了避免业务暂停使用,望您尽快充值!
|
diff --git a/fir_ser/common/libs/sendmsg/templates/pay_success.html b/fir_ser/common/libs/sendmsg/templates/pay_success.html
index 64b6707..1bdb2a3 100644
--- a/fir_ser/common/libs/sendmsg/templates/pay_success.html
+++ b/fir_ser/common/libs/sendmsg/templates/pay_success.html
@@ -239,8 +239,8 @@
- 订单信息:您充值了 {{ order_obj.actual_download_times }}
- 下载次数,【赠送 {{ order_obj.actual_download_gift_times }}】
+ 订单信息:您充值了 {% widthratio order_obj.actual_download_times base_download_times 1 %}
+ 下载次数,【赠送 {% widthratio order_obj.actual_download_gift_times base_download_times 1 %}】
|
diff --git a/fir_ser/common/notify/notify.py b/fir_ser/common/notify/notify.py
index 10e05cb..90dc49e 100644
--- a/fir_ser/common/notify/notify.py
+++ b/fir_ser/common/notify/notify.py
@@ -9,6 +9,7 @@ import logging
from api.utils.modelutils import get_notify_wx_queryset, get_wx_nickname
from common.base.baseutils import get_format_time
from common.base.magic import magic_call_in_times
+from common.core.sysconfig import Config
from common.libs.mp.wechat import WxTemplateMsg
from common.libs.sendmsg.template_content import get_pay_success_html_content, get_sign_failed_html_content, \
get_sign_unavailable_developer_html_content, get_sign_app_over_limit_html_content, \
@@ -26,10 +27,9 @@ def pay_success_notify(user_obj, order_obj):
:return:
"""
message_type = 4
-
- title = f'{order_obj.actual_download_times} 下载次数'
+ title = f'{order_obj.actual_download_times // Config.APP_USE_BASE_DOWNLOAD_TIMES} 下载次数'
if order_obj.actual_download_gift_times > 0:
- title = f'{title} 【赠送 {order_obj.actual_download_gift_times}】'
+ title = f'{title} 【赠送 {order_obj.actual_download_gift_times // Config.APP_USE_BASE_DOWNLOAD_TIMES}】'
for wx_user_obj in get_notify_wx_queryset(user_obj, message_type):
res = WxTemplateMsg(wx_user_obj.openid, get_wx_nickname(wx_user_obj.openid)).pay_success_msg(
title,
@@ -38,8 +38,8 @@ def pay_success_notify(user_obj, order_obj):
order_obj.pay_time.strftime("%Y/%m/%d %H:%M:%S"),
order_obj.order_number, order_obj.description)
logger.info(f'user_obj {user_obj} weixin notify pay success result: {res}')
-
- notify_by_email(user_obj, message_type, get_pay_success_html_content(user_obj, order_obj))
+ notify_by_email(user_obj, message_type,
+ get_pay_success_html_content(user_obj, order_obj, Config.APP_USE_BASE_DOWNLOAD_TIMES))
@magic_call_in_times(key=lambda *x: x[0].uid)
@@ -138,6 +138,7 @@ def download_times_not_enough(user_obj, msg):
message_type = 1
for wx_user_obj in get_notify_wx_queryset(user_obj, message_type):
res = WxTemplateMsg(wx_user_obj.openid, get_wx_nickname(wx_user_obj.openid)).download_times_not_enough_msg(
- user_obj.first_name, user_obj.download_times, msg)
+ user_obj.first_name, user_obj.download_times // Config.APP_USE_BASE_DOWNLOAD_TIMES, msg)
logger.info(f'user_obj {user_obj} download times not enough result: {res}')
- notify_by_email(user_obj, message_type, get_user_download_times_not_enough_html_content(user_obj))
+ notify_by_email(user_obj, message_type,
+ get_user_download_times_not_enough_html_content(user_obj, Config.APP_USE_BASE_DOWNLOAD_TIMES))
diff --git a/fir_ser/common/notify/ntasks.py b/fir_ser/common/notify/ntasks.py
index e98fef8..23b423d 100644
--- a/fir_ser/common/notify/ntasks.py
+++ b/fir_ser/common/notify/ntasks.py
@@ -24,17 +24,19 @@ logger = logging.getLogger(__name__)
def download_times_over_limit(user_obj):
"""
1, '下载次数不足'
- :param msg:
:param user_obj:
:return:
"""
message_type = 1
- msg = f"您当前账户下载次数仅剩 {user_obj.download_times},已超过您设置的阈值 {user_obj.notify_available_downloads},为了避免业务使用,望您尽快充值!"
+ download_times = user_obj.download_times // Config.APP_USE_BASE_DOWNLOAD_TIMES
+ notify_available_downloads = user_obj.notify_available_downloads // Config.APP_USE_BASE_DOWNLOAD_TIMES
+ msg = f"您当前账户下载次数仅剩 {download_times},已超过您设置的阈值 {notify_available_downloads},为了避免业务使用,望您尽快充值!"
for wx_user_obj in get_notify_wx_queryset(user_obj, message_type):
res = WxTemplateMsg(wx_user_obj.openid, get_wx_nickname(wx_user_obj.openid)).download_times_not_enough_msg(
- user_obj.first_name, user_obj.download_times, msg)
+ user_obj.first_name, download_times, msg)
logger.info(f'user_obj {user_obj} download times not enough result: {res}')
- notify_by_email(user_obj, message_type, get_user_download_times_over_limit_html_content(user_obj))
+ notify_by_email(user_obj, message_type,
+ get_user_download_times_over_limit_html_content(user_obj, Config.APP_USE_BASE_DOWNLOAD_TIMES))
def apple_developer_devices_over_limit(user_obj, device_count):
diff --git a/mailhtml/src/download_times_not_enough.mjml.html b/mailhtml/src/download_times_not_enough.mjml.html
index 6f30929..885ed92 100644
--- a/mailhtml/src/download_times_not_enough.mjml.html
+++ b/mailhtml/src/download_times_not_enough.mjml.html
@@ -17,10 +17,10 @@
- 您当前账户下载次数仅剩 {{user_obj.download_times}}
+ 您当前账户下载次数仅剩 {% widthratio user_obj.download_times base_download_times 1 %}
- 您当前账户下载次数不足,应用已经无法下载安装。为了避免业务使用,望您尽快充值
+ 您当前账户下载次数不足,应用已经无法下载安装。为了避免业务暂停使用,望您尽快充值
diff --git a/mailhtml/src/download_times_over_limit.mjml.html b/mailhtml/src/download_times_over_limit.mjml.html
index 3293053..407fa92 100644
--- a/mailhtml/src/download_times_over_limit.mjml.html
+++ b/mailhtml/src/download_times_over_limit.mjml.html
@@ -17,13 +17,13 @@
- 您当前账户下载次数仅剩 {{user_obj.download_times}}
+ 您当前账户下载次数仅剩 {% widthratio user_obj.download_times base_download_times 1 %}
- 已超过您设置的阈值 {{user_obj.notify_available_downloads}}
+ 已超过您设置的阈值 {% widthratio user_obj.notify_available_downloads base_download_times 1 %}
- 为了避免业务使用,望您尽快充值!
+ 为了避免业务暂停使用,望您尽快充值!
diff --git a/mailhtml/src/pay_success.mjml.html b/mailhtml/src/pay_success.mjml.html
index 36366a8..1d555b5 100644
--- a/mailhtml/src/pay_success.mjml.html
+++ b/mailhtml/src/pay_success.mjml.html
@@ -29,7 +29,8 @@
支付方式:{{order_obj.get_payment_type_display}}
- 订单信息:您充值了 {{order_obj.actual_download_times}} 下载次数,【赠送 {{order_obj.actual_download_gift_times}}】
+ 订单信息:您充值了 {% widthratio order_obj.actual_download_times base_download_times 1 %} 下载次数,【赠送
+ {% widthratio order_obj.actual_download_gift_times base_download_times 1 %}】
备注:{{order_obj.description}}