Sfoglia il codice sorgente

云存即将到期通知

chenshibin 4 anni fa
parent
commit
106874d5a5
2 ha cambiato i file con 43 aggiunte e 4 eliminazioni
  1. 2 0
      Ansjer/urls.py
  2. 41 4
      Controller/CloudStorage.py

+ 2 - 0
Ansjer/urls.py

@@ -259,6 +259,8 @@ urlpatterns = [
 
     #云存操作系统消息
     path('cv/vodMsgNotice', CloudStorage.do_vod_msg_Notice),
+    path('cv/vodMsgEnd', CloudStorage.do_vod_msg_end),
+
 
     # app 设备消息模板
     # 路由加参数参考

+ 41 - 4
Controller/CloudStorage.py

@@ -1030,7 +1030,7 @@ class CloudStorageView(View):
                                                price=price, currency=currency, addTime=nowTime, updTime=nowTime,
                                                pay_url=approval_url, isSelectDiscounts=is_select_discount,
                                                commodity_code=commodity_code, commodity_type=commodity_type,
-                                               rank_id=rank)
+                                               rank_id=rank, lang=lang)
                     return response.json(0, {"redirectUrl": approval_url, "orderID": orderID})
             return response.json(10, 'generate_order_false')
         elif pay_type == 2:
@@ -1073,7 +1073,7 @@ class CloudStorageView(View):
                                                price=price, currency=currency, addTime=nowTime, updTime=nowTime,
                                                pay_url=redirectUrl, isSelectDiscounts=is_select_discount,
                                                commodity_code=commodity_code, commodity_type=commodity_type,
-                                               rank_id=rank)
+                                               rank_id=rank, lang=lang)
 
                     return JsonResponse(status=200, data={'result_code': 0, 'reason': 'success',
                                                           'result': {"redirectUrl": redirectUrl, "orderID": orderID},
@@ -1100,7 +1100,7 @@ class CloudStorageView(View):
                                        desc=content, payType=pay_type, payTime=nowTime,
                                        price=price, currency=currency, addTime=nowTime, updTime=nowTime,
                                        pay_url=notify_url, isSelectDiscounts=is_select_discount,
-                                       commodity_code=commodity_code, commodity_type=commodity_type, rank_id=rank)
+                                       commodity_code=commodity_code, commodity_type=commodity_type, rank_id=rank, lang=lang)
             return JsonResponse(status=200, data={'result_code': 0, 'reason': 'success',
                                                   'result': response,
                                                   'orderId': orderID,
@@ -1343,4 +1343,41 @@ def do_vod_msg_Notice(request, uid , userID , lang, sys_msg_text_list):
     create_data = {'userID_id': userID, 'msg': sys_msg_text, 'addTime': nowTime,
                    'updTime': nowTime, 'uid': uid, 'eventType': 0}
     SysMsgModel.objects.create(**create_data)
-    logger.info('出去了')
+    logger.info('出去了')
+
+# 云存到期续费提醒   提前1天
+def do_vod_msg_end(request):
+    response = ResponseObject()
+    now_time = int(time.time())
+
+    list = UID_Bucket.objects.filter(Q(endTime__lte=(now_time - 3600 * 24)) & Q(endTime__gt=now_time)).values('id', 'uid', 'bucket__area')
+
+
+    uq_list = []
+    ids = []
+    for ub in list:
+        ids.append(ub['id'])
+
+
+    oqlist = Order_Model.objects.filter(uid_bucket_id__in=ids).values('userID_id', 'uid_bucket_id')
+    nowTime = int(time.time())
+    for ub in list:
+        for oo in oqlist:
+            if ub['id'] == oo['uid_bucket_id']:
+                if ub['bucket__area'] == 'cn':
+                    sys_msg_text = "云存即将过期,请您注意!"
+                else:
+                    sys_msg_text = "Cloud storage is about to expire, please pay attention!"
+                uq_list.append(SysMsgModel(
+                    userID_id=oo['userID_id'],
+                    addTime=now_time,
+                    updTime=now_time,
+                    uid=ub['uid'],
+                    eventType=0,
+                    msg=sys_msg_text,
+                    status=0
+                ))
+
+    SysMsgModel.objects.bulk_create(uq_list)
+
+    return response.json(0)