Explorar o código

配置和区分返回http和https

locky %!s(int64=4) %!d(string=hai) anos
pai
achega
cdfeb72333
Modificáronse 3 ficheiros con 23 adicións e 8 borrados
  1. 3 1
      Ansjer/config_formal.py
  2. 4 2
      Ansjer/config_test.py
  3. 16 5
      Controller/DetectControllerV2.py

+ 3 - 1
Ansjer/config_formal.py

@@ -28,7 +28,9 @@ PAYPAL_CRD = {
 }
 
 DETECT_PUSH_DOMAIN = 'http://push.dvema.com/'
-DETECT_PUSH_DOMAIN_V2 = 'http://jiuan.push.dvema.com/'
+DETECT_PUSH_DOMAINS = 'https://push.dvema.com/'
+DETECT_PUSH_DOMAIN_JIUAN = 'http://jiuan.push.dvema.com/'
+DETECT_PUSH_DOMAINS_JIUAN = 'https://jiuan.push.dvema.com/'
 # 数据库dyanamo品牌日志数据库
 USER_BRAND = 'user_brand'
 USER_BRAND_ALL = 'user_brand_all'

+ 4 - 2
Ansjer/config_test.py

@@ -38,8 +38,10 @@ PAYPAL_CRD = {
 #     "client_id": "ATXTpWs8sajNYeU46jNs1yzpy4H_o3RRrGVIJ8Tscc312BjMx12cpRgCucfWX07a4G6GbK8hzElB04Pd",
 #     "client_secret": "EHcnfrpL1o1ev9WnlQ-C1uymeRKDoJ6li6Y0d6iHoRGj4u8Sx5lSEEH774XphP4LQZ0DrDUdvxbux0T2"
 # }
-DETECT_PUSH_DOMAIN = 'http://test.push.dvema.com/'
-DETECT_PUSH_DOMAIN_V2 = 'http://jiuan.push.dvema.com/'
+DETECT_PUSH_DOMAIN = 'http://push.dvema.com/'
+DETECT_PUSH_DOMAINS = 'https://push.dvema.com/'
+DETECT_PUSH_DOMAIN_JIUAN = 'http://jiuan.push.dvema.com/'
+DETECT_PUSH_DOMAINS_JIUAN = 'https://jiuan.push.dvema.com/'
 # 数据库dyanamo品牌日志数据库
 USER_BRAND = 'test_user_brand'
 USER_BRAND_ALL = 'test_user_brand_all'

+ 16 - 5
Controller/DetectControllerV2.py

@@ -21,8 +21,10 @@ from django.http import JsonResponse
 from django.views.generic.base import View
 from pyfcm import FCMNotification
 from Object.RedisObject import RedisObject
-from Ansjer.config import OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET, DETECT_PUSH_DOMAIN_V2, JPUSH_CONFIG, \
-    FCM_CONFIG, APNS_CONFIG, BASE_DIR, APNS_MODE
+from Ansjer.config import OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET, DETECT_PUSH_DOMAIN, DETECT_PUSH_DOMAIN_V2, \
+    JPUSH_CONFIG, \
+    FCM_CONFIG, APNS_CONFIG, BASE_DIR, APNS_MODE, DETECT_PUSH_DOMAINS, DETECT_PUSH_DOMAIN_JIUAN, \
+    DETECT_PUSH_DOMAINS_JIUAN
 from Model.models import Device_Info, VodHlsModel, Equipment_Info, UidSetModel, UidPushModel, CompanyModel
 from Object.ETkObject import ETkObject
 from Object.RedisObject import RedisObject
@@ -216,9 +218,18 @@ class DetectControllerViewV2(View):
                 # utko.generate(data={'uid': uid})
                 etkObj = ETkObject(etk='')
                 etk = etkObj.encrypt(uid)
-                detectUrl = "{DETECT_PUSH_DOMAIN_V2}notifyV2/push?etk={etk}&company_secrete={company_secrete}". \
-                    format(etk=etk, company_secrete=company_secrete, DETECT_PUSH_DOMAIN_V2=DETECT_PUSH_DOMAIN_V2)
-                return response.json(0, {'detectUrl': detectUrl})
+
+                if company_secrete == 'MTEyMTNB':
+                    url = DETECT_PUSH_DOMAIN
+                    urls = DETECT_PUSH_DOMAINS
+                else:
+                    url = DETECT_PUSH_DOMAIN_JIUAN
+                    urls = DETECT_PUSH_DOMAINS_JIUAN
+                detectUrl = "{DETECT_PUSH_DOMAIN}notifyV2/push?etk={etk}&company_secrete={company_secrete}". \
+                    format(etk=etk, company_secrete=company_secrete, DETECT_PUSH_DOMAIN=url)
+                detectUrls = "{DETECT_PUSH_DOMAIN_V2}notifyV2/push?etk={etk}&company_secrete={company_secrete}". \
+                    format(etk=etk, company_secrete=company_secrete, DETECT_PUSH_DOMAIN_V2=urls)
+                return response.json(0, {'detectUrl': detectUrl, 'detectUrls': detectUrls})
         else:
             return response.json(14)