Browse Source

Merge branch 'dev' into lang

lang 4 years ago
parent
commit
5a1297d4f8
2 changed files with 37 additions and 5 deletions
  1. 23 5
      Controller/CloudStorage.py
  2. 14 0
      Controller/CloudVod.py

+ 23 - 5
Controller/CloudStorage.py

@@ -202,7 +202,7 @@ class CloudStorageView(View):
     def do_commodity_list(self, request_dict, userID, response):
         mold = request_dict.get('mold', None)
         uid = request_dict.get('uid', None)
-        lang = response.lang
+        lang = request_dict.get('lang', None)
         qs = Store_Meal.objects
         eq = ExperienceContextModel.objects.filter(uid=uid, experience_type=0).values('id')
         # userqs = Device_User.objects.filter(userID=userID).values('is_experience')
@@ -638,12 +638,22 @@ class CloudStorageView(View):
     def do_pay_ok(self, request_dict):
         response = HttpResponse()
         paytype = request_dict.get('paytype', None)
+        lang = request_dict.get('lang', None)
+
         showtitle = "支付成功"
-        if paytype == "10":
+        if paytype == "10" :
             showtitle = "成功体验云存"
 
         if paytype == "11":
             showtitle = "兑换成功"
+
+        if lang != 'cn':
+            showtitle = "Payment successful"
+            if paytype == "10":
+                showtitle = "Successful experience of cloud storage"
+
+            if paytype == "11":
+                showtitle = "Successful exchange"
         response.content = '''
 <html>
 <head>
@@ -795,12 +805,16 @@ class CloudStorageView(View):
                 sys_msg_text_list = ['成功购买云存', 'Successful purchase of cloud storage']
                 self.do_vod_msg_Notice(UID, channel, userid, lang, sys_msg_text_list)
                 red_url = "{SERVER_DOMAIN}web/paid2/success.html".format(SERVER_DOMAIN=SERVER_DOMAIN)
+                if lang != 'cn':
+                    red_url = "{SERVER_DOMAIN}web/paid2/en_success.html".format(SERVER_DOMAIN=SERVER_DOMAIN)
                 return HttpResponseRedirect(red_url)
             return response.json(0, signature)
         except Exception as e:
             if order_qs:
                 order_qs.update(status=10)
             red_url = "{SERVER_DOMAIN}web/paid2/fail.html".format(SERVER_DOMAIN=SERVER_DOMAIN)
+            if lang != 'cn':
+                red_url = "{SERVER_DOMAIN}web/paid2/en_fail.html".format(SERVER_DOMAIN=SERVER_DOMAIN)
             return HttpResponseRedirect(red_url)
 
     def do_pay_by_paypal_callback(self, request_dict, response):
@@ -873,6 +887,8 @@ class CloudStorageView(View):
 
             # return response.json(0)
             red_url = "{SERVER_DOMAIN}web/paid2/success.html".format(SERVER_DOMAIN=SERVER_DOMAIN)
+            if lang != 'cn':
+                red_url = "{SERVER_DOMAIN}web/paid2/en_success.html".format(SERVER_DOMAIN=SERVER_DOMAIN)
             return HttpResponseRedirect(red_url)
         except Exception as e:
             print(repr(e))
@@ -880,6 +896,8 @@ class CloudStorageView(View):
                 order_qs.update(status=10)
 
             red_url = "{SERVER_DOMAIN}web/paid2/fail.html".format(SERVER_DOMAIN=SERVER_DOMAIN)
+            if lang != 'cn':
+                red_url = "{SERVER_DOMAIN}web/paid2/en_fail.html".format(SERVER_DOMAIN=SERVER_DOMAIN)
             return HttpResponseRedirect(red_url)
 
     def do_pay_by_wechat_callback(self, request, response):
@@ -1198,14 +1216,14 @@ class CloudStorageView(View):
 
         sys_msg_text_list = ['成功购买云存', 'Successful purchase of cloud storage']
         # return response.json(0)
-        returnurl = "{SERVER_DOMAIN}cloudstorage/payOK".format(SERVER_DOMAIN=SERVER_DOMAIN)
+        returnurl = "{SERVER_DOMAIN}cloudstorage/payOK?{lang}".format(SERVER_DOMAIN=SERVER_DOMAIN,lang=lang)
         if pay_type == 10:
             ExperienceContextModel.objects.create(
                 experience_type=0,
                 uid=uid,
                 do_time=nowTime
             )
-            returnurl = "{SERVER_DOMAIN}cloudstorage/payOK?paytype=10".format(SERVER_DOMAIN=SERVER_DOMAIN)
+            returnurl = "{SERVER_DOMAIN}cloudstorage/payOK?paytype=10&{lang}".format(SERVER_DOMAIN=SERVER_DOMAIN,lang=lang)
             sys_msg_text_list = ['成功体验云存', 'Successful experience of cloud storage']
 
         if pay_type == 11:
@@ -1213,7 +1231,7 @@ class CloudStorageView(View):
             update_dict['is_activate'] = 1
             update_dict['order'] = orderID
             CDKcontextModel.objects.filter(cdk=cdk).update(**update_dict)
-            returnurl = "{SERVER_DOMAIN}cloudstorage/payOK?paytype=11".format(SERVER_DOMAIN=SERVER_DOMAIN)
+            returnurl = "{SERVER_DOMAIN}cloudstorage/payOK?paytype=11&{lang}".format(SERVER_DOMAIN=SERVER_DOMAIN,lang=lang)
             sys_msg_text_list = ['成功兑换云存', 'Successful exchange of cloud storage']
 
 

+ 14 - 0
Controller/CloudVod.py

@@ -1116,6 +1116,7 @@ class CloudVodView(View):
 
     def do_pay_status(self, request_dict, userID, response):
         orderID = request_dict.get('orderID', None)
+        lang = request_dict.get('lang', None)
         om_qs = Order_Model.objects.filter(orderID=orderID).values('status')
         # response = HttpResponse()
         # success_pay_content = '''
@@ -1136,6 +1137,19 @@ class CloudVodView(View):
 
                 url = "{SERVER_DOMAIN}web/paid2/fail.html".format(SERVER_DOMAIN=SERVER_DOMAIN)
 
+        if lang !='cn':
+            status = 0
+            url = "{SERVER_DOMAIN}web/paid2/en_fail.html".format(SERVER_DOMAIN=SERVER_DOMAIN)
+
+            if om_qs.exists():
+                status = om_qs[0]['status']
+                if status == 1:
+
+                    url = "{SERVER_DOMAIN}web/paid2/en_success.html".format(SERVER_DOMAIN=SERVER_DOMAIN)
+                else:
+
+                    url = "{SERVER_DOMAIN}web/paid2/en_fail.html".format(SERVER_DOMAIN=SERVER_DOMAIN)
+
         res = {'status': status, 'url': url}
         return response.json(0, res)