|
@@ -2,14 +2,14 @@ from datetime import datetime
|
|
|
import concurrent.futures
|
|
|
import pytz
|
|
|
import requests
|
|
|
-from django.db.models import Q
|
|
|
+from django.db.models import Q, F
|
|
|
from django.views import View
|
|
|
from Crypto.Cipher import AES
|
|
|
from Crypto.Util.Padding import pad
|
|
|
from django.contrib.auth.hashers import check_password, make_password
|
|
|
import concurrent.futures
|
|
|
from Controller.CheckUserData import DataValid
|
|
|
-from Model.models import Device_User, CountryModel
|
|
|
+from Model.models import Device_User, CountryModel, LanguageModel, CountryLanguageModel
|
|
|
from Object.RedisObject import RedisObject
|
|
|
from Object.ResponseObject import ResponseObject
|
|
|
import base64
|
|
@@ -85,15 +85,17 @@ class ShopifyView(View):
|
|
|
|
|
|
def validation(self, request, request_dict, operation):
|
|
|
language = request_dict.get('language', 'cn')
|
|
|
- response = ResponseObject(language)
|
|
|
+ response = ResponseObject(language, "pc")
|
|
|
if operation == 'shopifyLogin':
|
|
|
return self.shopify_login(request_dict, response)
|
|
|
elif operation == 'shopifyRegister':
|
|
|
return self.shopify_register(request_dict, response)
|
|
|
- elif operation == 'searchCustomer': # 查询APP注册账号情况
|
|
|
+ elif operation == 'searchCustomer': # 查询FAPP注册账号情况
|
|
|
return self.search_customer(request_dict, response)
|
|
|
elif operation == 'searchAccount': # 官网检测账号接口
|
|
|
return self.search_account(request_dict, response)
|
|
|
+ elif operation == 'getCountryDomainList':
|
|
|
+ return self.get_country_domain_list(request_dict, response)
|
|
|
else:
|
|
|
return response.json(414)
|
|
|
|
|
@@ -244,7 +246,6 @@ class ShopifyView(View):
|
|
|
"accountCountry": account_country["eu"],
|
|
|
"shopifyCountry": shopify_country
|
|
|
})
|
|
|
-
|
|
|
return response.json(0, {"accountStatus": 3, "accountRegionList": account_region_list})
|
|
|
elif shopify_country:
|
|
|
if shopify_country == "eu":
|
|
@@ -270,8 +271,8 @@ class ShopifyView(View):
|
|
|
@staticmethod
|
|
|
def call_search_customer(email):
|
|
|
urls = {
|
|
|
- "us": "https://test.zositechc.cn/shopify/searchCustomer",
|
|
|
- "eu": "https://test.zositechc.cn/shopify/searchCustomer"
|
|
|
+ "us": "https://www.dvema.com/shopify/searchCustomer",
|
|
|
+ "eu": "https://api.zositeche.com/shopify/searchCustomer"
|
|
|
}
|
|
|
params = {"email": email} # Use the provided email parameter
|
|
|
|
|
@@ -306,3 +307,33 @@ class ShopifyView(View):
|
|
|
country_code = CountryModel.objects.filter(id=user_region_id).values_list("country_code", flat=True).first()
|
|
|
|
|
|
return response.json(0, country_code)
|
|
|
+
|
|
|
+ @staticmethod
|
|
|
+ def get_country_domain_list(request_dict, response):
|
|
|
+ lang = request_dict.get('lang', 'en')
|
|
|
+ time_stamp = request_dict.get('time_stamp', None)
|
|
|
+ time_stamp_token = request_dict.get('time_stamp_token', None)
|
|
|
+
|
|
|
+ if not all([time_stamp, time_stamp_token]):
|
|
|
+ return response.json(444)
|
|
|
+
|
|
|
+ try:
|
|
|
+ # 时间戳token校验
|
|
|
+ if not CommonService.check_time_stamp_token(time_stamp_token, time_stamp):
|
|
|
+ return response.json(13)
|
|
|
+
|
|
|
+ lang_qs = LanguageModel.objects.filter(lang=lang)
|
|
|
+ language = lang_qs[0]
|
|
|
+ country_qs = CountryLanguageModel.objects.filter(language_id=language.id)
|
|
|
+ country_qs = country_qs.annotate(api=F('country__region__zosi_api'))
|
|
|
+ country_qs = country_qs.values('country_id', 'country_name', 'api').order_by('country_id')
|
|
|
+ country_list = []
|
|
|
+ for country in country_qs:
|
|
|
+ country['api'] = country['api'] + 'shopify/shopifyRegister'
|
|
|
+ country_list.append(country)
|
|
|
+ return response.json(0, country_list)
|
|
|
+ except Exception as e:
|
|
|
+ print(e)
|
|
|
+ return response.json(500, 'error_line:{}, error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|
|
|
+
|
|
|
+
|