Browse Source

Merge branch 'dev' of http://192.168.136.99:3000/SERVER/AnsjerServer into dev

tanghongbin 4 years ago
parent
commit
3ae046fd8f
1 changed files with 7 additions and 10 deletions
  1. 7 10
      Controller/CloudStorage.py

+ 7 - 10
Controller/CloudStorage.py

@@ -826,25 +826,22 @@ class CloudStorageView(View):
         response = ResponseObject()
         response = ResponseObject()
         data = request.POST.dict()
         data = request.POST.dict()
         logger = logging.getLogger('log')
         logger = logging.getLogger('log')
-
         try:
         try:
-            logger.info(data)
             signature = data["sign"]
             signature = data["sign"]
             data.pop('sign')
             data.pop('sign')
             orderID = data['out_trade_no']
             orderID = data['out_trade_no']
 
 
             order_qs = Order_Model.objects.filter(orderID=orderID, status=0)
             order_qs = Order_Model.objects.filter(orderID=orderID, status=0)
 
 
-            # verify
             aliPayObj = AliPayObject()
             aliPayObj = AliPayObject()
             alipay = aliPayObj.conf()
             alipay = aliPayObj.conf()
             success = alipay.verify(data, signature)
             success = alipay.verify(data, signature)
-
             if success and data["trade_status"] in ("TRADE_SUCCESS", "TRADE_FINISHED"):
             if success and data["trade_status"] in ("TRADE_SUCCESS", "TRADE_FINISHED"):
                 print("trade succeed")
                 print("trade succeed")
-                order_qs = Order_Model.objects.filter(orderID=orderID)
+
                 nowTime = int(time.time())
                 nowTime = int(time.time())
-                order_list = order_qs.values("UID", "channel", "commodity_code", "rank", "isSelectDiscounts", "userID__userID", "userID__username")
+                order_list = order_qs.values("UID", "channel", "commodity_code", "rank", "isSelectDiscounts",
+                                             "userID__userID", "userID__username")
                 userid = order_list[0]['userID__userID']
                 userid = order_list[0]['userID__userID']
                 username = order_list[0]['userID__username']
                 username = order_list[0]['userID__username']
                 UID = order_list[0]['UID']
                 UID = order_list[0]['UID']
@@ -866,12 +863,13 @@ class CloudStorageView(View):
                     endTime = CommonService.calcMonthLater(expire, ubq['endTime'])
                     endTime = CommonService.calcMonthLater(expire, ubq['endTime'])
                     ub_cqs = UID_Bucket.objects.filter(id=ubq['id']).update \
                     ub_cqs = UID_Bucket.objects.filter(id=ubq['id']).update \
                         (uid=UID, channel=channel, bucket_id=bucketId,
                         (uid=UID, channel=channel, bucket_id=bucketId,
-                         endTime=endTime,updateTime=nowTime)
+                         endTime=endTime, updateTime=nowTime)
                     uid_bucket_id = ubq['id']
                     uid_bucket_id = ubq['id']
                 else:
                 else:
                     endTime = CommonService.calcMonthLater(expire)
                     endTime = CommonService.calcMonthLater(expire)
                     ub_cqs = UID_Bucket.objects.create \
                     ub_cqs = UID_Bucket.objects.create \
-                        (uid=UID, channel=channel, bucket_id=bucketId, endTime=endTime, addTime=nowTime, updateTime=nowTime)
+                        (uid=UID, channel=channel, bucket_id=bucketId, endTime=endTime, addTime=nowTime,
+                         updateTime=nowTime)
                     uid_bucket_id = ub_cqs.id
                     uid_bucket_id = ub_cqs.id
 
 
                 dvq = Device_Info.objects.filter(UID=UID, vodPrimaryUserID='', vodPrimaryMaster='')
                 dvq = Device_Info.objects.filter(UID=UID, vodPrimaryUserID='', vodPrimaryMaster='')
@@ -885,10 +883,9 @@ class CloudStorageView(View):
                 order_qs.update(status=1, updTime=nowTime, uid_bucket_id=uid_bucket_id)
                 order_qs.update(status=1, updTime=nowTime, uid_bucket_id=uid_bucket_id)
                 red_url = "{SERVER_DOMAIN}cloudstorage/payOK".format(SERVER_DOMAIN=SERVER_DOMAIN)
                 red_url = "{SERVER_DOMAIN}cloudstorage/payOK".format(SERVER_DOMAIN=SERVER_DOMAIN)
                 return HttpResponseRedirect(red_url)
                 return HttpResponseRedirect(red_url)
-            else:
-                order_qs.update(status=10)
             return response.json(0, signature)
             return response.json(0, signature)
         except Exception as e:
         except Exception as e:
+            logger.info(e)
             if order_qs:
             if order_qs:
                 order_qs.update(status=10)
                 order_qs.update(status=10)
             red_url = "{SERVER_DOMAIN}cloudstorage/payError".format(SERVER_DOMAIN=SERVER_DOMAIN)
             red_url = "{SERVER_DOMAIN}cloudstorage/payError".format(SERVER_DOMAIN=SERVER_DOMAIN)