linhaohong 1 жил өмнө
parent
commit
03b21d97e9

+ 2 - 1
Ansjer/urls.py

@@ -25,7 +25,7 @@ from Controller import FeedBack, EquipmentOTA, EquipmentInfo, AdminManage, AppIn
     RegionController, VPGController, LanguageController, TestController, DeviceConfirmRegion, S3GetStsController, \
     RegionController, VPGController, LanguageController, TestController, DeviceConfirmRegion, S3GetStsController, \
     DetectControllerV2, PcInfo, PctestController, DeviceDebug, PaymentCycle, \
     DetectControllerV2, PcInfo, PctestController, DeviceDebug, PaymentCycle, \
     DeviceLogController, CouponController, AiController, ShadowController, AppAccountManagement, InitController, \
     DeviceLogController, CouponController, AiController, ShadowController, AppAccountManagement, InitController, \
-    WeatherControl, SmartReplyController, InAppPurchaseController
+    WeatherControl, SmartReplyController, InAppPurchaseController, DeviceCommonController
 from Controller.Cron import CronTaskController
 from Controller.Cron import CronTaskController
 from Controller.MessagePush import EquipmentMessagePush
 from Controller.MessagePush import EquipmentMessagePush
 from Controller.SensorGateway import SensorGatewayController, EquipmentFamilyController
 from Controller.SensorGateway import SensorGatewayController, EquipmentFamilyController
@@ -280,6 +280,7 @@ urlpatterns = [
     re_path(r'^basic/serialNo/(?P<operation>.*)', SerialNumberCheckController.SerialNumberView.as_view()),
     re_path(r'^basic/serialNo/(?P<operation>.*)', SerialNumberCheckController.SerialNumberView.as_view()),
     re_path('inAppPurchase/(?P<operation>.*)', InAppPurchaseController.InAppPurchaseView.as_view()),
     re_path('inAppPurchase/(?P<operation>.*)', InAppPurchaseController.InAppPurchaseView.as_view()),
     re_path('account/changeAccountInfo/(?P<operation>.*)$', UserController.ChangeAccountInfoView.as_view()),
     re_path('account/changeAccountInfo/(?P<operation>.*)$', UserController.ChangeAccountInfoView.as_view()),
+    re_path('deviceCommon/(?P<operation>.*)$', DeviceCommonController.DeviceCommonView.as_view()),
 
 
 
 
 
 

+ 33 - 0
Controller/DeviceCommonController.py

@@ -0,0 +1,33 @@
+from django.views import View
+
+from Object.ResponseObject import ResponseObject
+
+
+class DeviceCommonView(View):
+    def get(self, request, *args, **kwargs):
+        request.encoding = 'utf-8'
+        operation = kwargs.get('operation')
+        request_dict = request.GET
+        return self.validation(request, request_dict, operation)
+
+    def post(self, request, *args, **kwargs):
+        request.encoding = 'utf-8'
+        operation = kwargs.get('operation')
+        request_dict = request.POST
+        return self.validation(request, request_dict, operation)
+
+    def validation(self, request, request_dict, operation):
+        language = request_dict.get('language', 'en')
+        response = ResponseObject(language)
+        if operation == 'getDomain':
+            return self.get_domain(response)
+
+    @staticmethod
+    def get_domain(response):
+        data = {
+            "cn": {"server": "https://www.zositechc.cn/", "push": "https://push.zositechc.cn/"},
+            "us": {"server": "https://www.dvema.com/", "push": "https://push.dvema.com/"},
+            "eur": {"server": "https://www.zositeche.com/", "push": "https://push.zositeche.com/"},
+            "test": {"server": "https://test.zositechc.cn/", "push": "https://test.push.zositechc.cn/"},
+        }
+        return response.json(0, data)