diff --git a/fir_ser/admin/views/order.py b/fir_ser/admin/views/order.py index e865ec4..a85f36f 100644 --- a/fir_ser/admin/views/order.py +++ b/fir_ser/admin/views/order.py @@ -15,6 +15,7 @@ from admin.utils.utils import BaseModelSet, AppsPageNumber from api.models import UserInfo, Order from common.core.auth import AdminTokenAuthentication from common.core.response import ApiResponse +from common.core.sysconfig import Config from common.utils.caches import update_order_info, admin_change_user_download_times logger = logging.getLogger(__name__) @@ -56,7 +57,7 @@ class OrderInfoView(BaseModelSet): obj = UserInfo.objects.filter(pk=pk).first() if obj: if amount > 0: - if admin_change_user_download_times(obj, amount): + if admin_change_user_download_times(obj, amount * Config.APP_USE_BASE_DOWNLOAD_TIMES): return ApiResponse() else: return ApiResponse(code=1005, msg="订单创建失败") diff --git a/fir_ser/api/views/getip.py b/fir_ser/api/views/getip.py index 922d808..dc0090c 100644 --- a/fir_ser/api/views/getip.py +++ b/fir_ser/api/views/getip.py @@ -3,7 +3,7 @@ # project: fir_ser # filename: getip # author: liuyu -# data: 2022/3/28 +# date: 2022/3/28 import logging diff --git a/fir_ser/api/views/notify.py b/fir_ser/api/views/notify.py index cfac914..77039b8 100644 --- a/fir_ser/api/views/notify.py +++ b/fir_ser/api/views/notify.py @@ -3,7 +3,7 @@ # project: fir_ser # filename: notify # author: liuyu -# data: 2022/3/25 +# date: 2022/3/25 import logging diff --git a/fir_ser/api/views/order.py b/fir_ser/api/views/order.py index 9ab091e..f535e4c 100644 --- a/fir_ser/api/views/order.py +++ b/fir_ser/api/views/order.py @@ -15,6 +15,7 @@ from api.utils.response import BaseResponse from api.utils.serializer import PriceSerializer, OrdersSerializer from common.base.baseutils import get_order_num, get_choices_dict from common.core.auth import ExpiringTokenAuthentication +from common.core.sysconfig import Config from common.libs.pay.util import get_pay_obj_form_name, get_enable_pay_choices, get_payment_type from common.utils.caches import update_order_status from common.utils.pending import get_pending_result @@ -69,10 +70,12 @@ class OrderView(APIView): pay_obj = get_pay_obj_form_name(pay_id) if pay_obj: pay_url = pay_obj.get_pay_pc_url(order_number, int(actual_amount), {'user_id': request.user.id}) + actual_download_times = price_obj.package_size * Config.APP_USE_BASE_DOWNLOAD_TIMES + actual_download_gift_times = price_obj.download_count_gift * Config.APP_USE_BASE_DOWNLOAD_TIMES Order.objects.create(payment_type=get_payment_type(pay_obj.p_type), order_number=order_number, user_id=request.user, status=1, order_type=0, actual_amount=actual_amount, - actual_download_times=price_obj.package_size, payment_name=pay_obj.name, - actual_download_gift_times=price_obj.download_count_gift) + actual_download_times=actual_download_times, payment_name=pay_obj.name, + actual_download_gift_times=actual_download_gift_times) res.data = pay_url logger.info(f"{request.user} 下单成功 {res.dict}") return Response(res.dict) diff --git a/fir_ser/api/views/personalconfig.py b/fir_ser/api/views/personalconfig.py index 3749d78..2852492 100644 --- a/fir_ser/api/views/personalconfig.py +++ b/fir_ser/api/views/personalconfig.py @@ -3,7 +3,7 @@ # project: fir_ser # filename: getip # author: liuyu -# data: 2022/3/28 +# date: 2022/3/28 import logging diff --git a/fir_ser/common/constants.py b/fir_ser/common/constants.py index c4d2df5..71879ee 100644 --- a/fir_ser/common/constants.py +++ b/fir_ser/common/constants.py @@ -3,7 +3,7 @@ # project: fir_ser # filename: constants # author: liuyu -# data: 2022/4/5 +# date: 2022/4/5 class DeviceStatus(object): """ diff --git a/fir_ser/common/libs/sendmsg/template_content.py b/fir_ser/common/libs/sendmsg/template_content.py index 1e1b00b..9763bfd 100644 --- a/fir_ser/common/libs/sendmsg/template_content.py +++ b/fir_ser/common/libs/sendmsg/template_content.py @@ -3,7 +3,7 @@ # project: fir_ser # filename: send_template_msg # author: liuyu -# data: 2022/4/8 +# date: 2022/4/8 from django.template import loader diff --git a/fir_ser/common/notify/notify.py b/fir_ser/common/notify/notify.py index d189d72..10e05cb 100644 --- a/fir_ser/common/notify/notify.py +++ b/fir_ser/common/notify/notify.py @@ -3,7 +3,7 @@ # project: fir_ser # filename: notify # author: liuyu -# data: 2022/3/26 +# date: 2022/3/26 import logging from api.utils.modelutils import get_notify_wx_queryset, get_wx_nickname diff --git a/fir_ser/common/notify/ntasks.py b/fir_ser/common/notify/ntasks.py index 6f7d2ac..e98fef8 100644 --- a/fir_ser/common/notify/ntasks.py +++ b/fir_ser/common/notify/ntasks.py @@ -3,7 +3,7 @@ # project: fir_ser # filename: ntasks # author: liuyu -# data: 2022/3/26 +# date: 2022/3/26 import datetime import logging diff --git a/fir_ser/common/notify/utils.py b/fir_ser/common/notify/utils.py index 0372dee..a576b8b 100644 --- a/fir_ser/common/notify/utils.py +++ b/fir_ser/common/notify/utils.py @@ -3,7 +3,7 @@ # project: fir_ser # filename: wx # author: liuyu -# data: 2022/3/23 +# date: 2022/3/23 import logging from api.utils.modelutils import get_notify_email_queryset diff --git a/fir_ser/common/utils/caches.py b/fir_ser/common/utils/caches.py index c8b1238..37140b4 100644 --- a/fir_ser/common/utils/caches.py +++ b/fir_ser/common/utils/caches.py @@ -289,11 +289,12 @@ def update_order_info(user_id, out_trade_no, payment_number, payment_type, descr if description: default_description = description order_obj.description = default_description % ( - download_times, user_obj.download_times + download_times) + download_times // Config.APP_USE_BASE_DOWNLOAD_TIMES, + (user_obj.download_times + download_times) // Config.APP_USE_BASE_DOWNLOAD_TIMES) order_obj.save( update_fields=["status", "payment_type", "payment_number", "pay_time", "description"]) - add_user_download_times(user_id, download_times * Config.APP_USE_BASE_DOWNLOAD_TIMES) + add_user_download_times(user_id, download_times) logger.info(f"{user_obj} 订单 {out_trade_no} msg:{order_obj.description}") pay_success_notify(user_obj, order_obj) return True