Browse Source

修改返回的图片路径

tanghongbin 5 năm trước cách đây
mục cha
commit
9eb87714bb
1 tập tin đã thay đổi với 9 bổ sung3 xóa
  1. 9 3
      Controller/FAQController.py

+ 9 - 3
Controller/FAQController.py

@@ -11,9 +11,9 @@ from django.utils.decorators import method_decorator
 from django.views.decorators.csrf import csrf_exempt
 from django.views.decorators.csrf import csrf_exempt
 from django.views.generic.base import View
 from django.views.generic.base import View
 
 
+import Ansjer
 from Ansjer.config import BASE_DIR, SERVER_TYPE
 from Ansjer.config import BASE_DIR, SERVER_TYPE
 from Ansjer.config_formal import SERVER_DOMAIN
 from Ansjer.config_formal import SERVER_DOMAIN
-from Ansjer.config_test import SERVER_DOMAIN
 from Model.models import FAQModel
 from Model.models import FAQModel
 from Object.RedisObject import RedisObject
 from Object.RedisObject import RedisObject
 from Object.ResponseObject import ResponseObject
 from Object.ResponseObject import ResponseObject
@@ -68,7 +68,10 @@ class FAQUploadView(View):
                     file_name = images[str(fileName)]
                     file_name = images[str(fileName)]
                     index = file_name.find('static/')
                     index = file_name.find('static/')
                     filePath = file_name[index:]
                     filePath = file_name[index:]
-                    filePath = SERVER_DOMAIN + 'faq/image/' + filePath
+                    if SERVER_TYPE != "Ansjer.formal_settings":
+                        filePath = 'http://www.dvema.com/faq/image/' + filePath
+                    else:
+                        filePath = 'http://test.www.dvema.com/faq/image/' + filePath
                     # filePath = "http://192.168.136.35:8000/" + 'faq/image/' + filePath
                     # filePath = "http://192.168.136.35:8000/" + 'faq/image/' + filePath
                     return response.json(0, {'filePath': filePath})
                     return response.json(0, {'filePath': filePath})
 
 
@@ -103,7 +106,10 @@ class FAQUploadView(View):
         else:
         else:
             index = file_name.find('static/')
             index = file_name.find('static/')
             filePath = file_name[index:]
             filePath = file_name[index:]
-            filePath = SERVER_DOMAIN + 'faq/image/' + filePath
+            if SERVER_TYPE != "Ansjer.formal_settings":
+                filePath = 'http://www.dvema.com/faq/image/' + filePath
+            else:
+                filePath = 'http://test.www.dvema.com/faq/image/' + filePath
             # filePath = "http://192.168.136.35:8000/" + 'faq/image/' + filePath
             # filePath = "http://192.168.136.35:8000/" + 'faq/image/' + filePath
             return response.json(0, {'filePath': filePath})
             return response.json(0, {'filePath': filePath})