Эх сурвалжийг харах

修改返回的图片路径

tanghongbin 5 жил өмнө
parent
commit
9eb87714bb

+ 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.generic.base import View
 
+import Ansjer
 from Ansjer.config import BASE_DIR, SERVER_TYPE
 from Ansjer.config_formal import SERVER_DOMAIN
-from Ansjer.config_test import SERVER_DOMAIN
 from Model.models import FAQModel
 from Object.RedisObject import RedisObject
 from Object.ResponseObject import ResponseObject
@@ -68,7 +68,10 @@ class FAQUploadView(View):
                     file_name = images[str(fileName)]
                     index = file_name.find('static/')
                     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
                     return response.json(0, {'filePath': filePath})
 
@@ -103,7 +106,10 @@ class FAQUploadView(View):
         else:
             index = file_name.find('static/')
             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
             return response.json(0, {'filePath': filePath})