Browse Source

添加返回域名接口

linhaohong 1 year ago
parent
commit
4e5669e003
2 changed files with 35 additions and 1 deletions
  1. 2 1
      Ansjer/urls.py
  2. 33 0
      Controller/DeviceCommonController.py

+ 2 - 1
Ansjer/urls.py

@@ -23,7 +23,7 @@ from Controller import FeedBack, EquipmentOTA, EquipmentInfo, AdminManage, AppIn
     RegionController, VPGController, LanguageController, TestController, DeviceConfirmRegion, S3GetStsController, \
     DetectControllerV2, PcInfo, PctestController, DeviceDebug, PaymentCycle, \
     DeviceLogController, CouponController, AiController, ShadowController, AppAccountManagement, InitController, \
-    WeatherControl, InAppPurchaseController
+    WeatherControl, InAppPurchaseController, DeviceCommonController
 from Controller.Cron import CronTaskController
 from Controller.MessagePush import EquipmentMessagePush
 from Controller.Surveys import CloudStorageController
@@ -375,6 +375,7 @@ urlpatterns = [
     re_path('customSubscription/(?P<operation>.*)', UserSubscriptionController.UserSubscriptionControllerView.as_view()),
     re_path(r'^basic/serialNo/(?P<operation>.*)', SerialNumberCheckController.SerialNumberView.as_view()),
     re_path('inAppPurchase/(?P<operation>.*)', InAppPurchaseController.InAppPurchaseView.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 = [
+            {"title": "国内", "server": "https://www.zositechc.cn/", "push": "https://push.zositechc.cn/"},
+            {"title": "美洲", "server": "https://www.dvema.com/", "push": "https://push.dvema.com/"},
+            {"title": "欧洲", "server": "https://www.zositeche.com/", "push": "https://push.zositeche.com/"},
+            {"title": "测试", "server": "https://test.zositechc.cn/", "push": "https://test.push.zositechc.cn/"},
+        ]
+        return response.json(0, data)