修复注册赠送下载数异常

dependabot/npm_and_yarn/fir_admin/eventsource-1.1.1
I夏 3 years ago
parent f4ca8d48f9
commit 31fe8664a9
  1. 3
      fir_ser/admin/views/order.py
  2. 2
      fir_ser/api/views/getip.py
  3. 2
      fir_ser/api/views/notify.py
  4. 7
      fir_ser/api/views/order.py
  5. 2
      fir_ser/api/views/personalconfig.py
  6. 2
      fir_ser/common/constants.py
  7. 2
      fir_ser/common/libs/sendmsg/template_content.py
  8. 2
      fir_ser/common/notify/notify.py
  9. 2
      fir_ser/common/notify/ntasks.py
  10. 2
      fir_ser/common/notify/utils.py
  11. 5
      fir_ser/common/utils/caches.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="订单创建失败")

@ -3,7 +3,7 @@
# project: fir_ser
# filename: getip
# author: liuyu
# data: 2022/3/28
# date: 2022/3/28
import logging

@ -3,7 +3,7 @@
# project: fir_ser
# filename: notify
# author: liuyu
# data: 2022/3/25
# date: 2022/3/25
import logging

@ -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)

@ -3,7 +3,7 @@
# project: fir_ser
# filename: getip
# author: liuyu
# data: 2022/3/28
# date: 2022/3/28
import logging

@ -3,7 +3,7 @@
# project: fir_ser
# filename: constants
# author: liuyu
# data: 2022/4/5
# date: 2022/4/5
class DeviceStatus(object):
"""

@ -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

@ -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

@ -3,7 +3,7 @@
# project: fir_ser
# filename: ntasks
# author: liuyu
# data: 2022/3/26
# date: 2022/3/26
import datetime
import logging

@ -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

@ -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

Loading…
Cancel
Save