|
@@ -51,7 +51,7 @@ from Model.models import (
|
|
|
TestSerialRepetition,
|
|
|
UID_Bucket,
|
|
|
UIDCompanySerialModel,
|
|
|
- VodBucketModel, PaypalWebHookEvent, TimeZoneInfo,
|
|
|
+ VodBucketModel, PaypalWebHookEvent, TimeZoneInfo, CountryLanguageModel,
|
|
|
)
|
|
|
from Object.AliPayObject import AliPayObject
|
|
|
from Object.AWS.AmazonS3Util import AmazonS3Util
|
|
@@ -190,6 +190,8 @@ class testView(View):
|
|
|
return self.del_oci_obj(request_dict, request, response)
|
|
|
elif operation == 'get-token':
|
|
|
return self.get_token(request_dict, response)
|
|
|
+ elif operation == 'langCountry':
|
|
|
+ return self.lang_country(request_dict, response)
|
|
|
else:
|
|
|
return response.json(414)
|
|
|
|
|
@@ -1373,3 +1375,34 @@ class testView(View):
|
|
|
except Exception as e:
|
|
|
print(e)
|
|
|
return response.json(500, 'error_line:{}, error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|
|
|
+
|
|
|
+ @staticmethod
|
|
|
+ def lang_country(request_dict, response):
|
|
|
+ """
|
|
|
+ tb_country_language写入数据
|
|
|
+ @param request_dict: 请求参数
|
|
|
+ @param response: 响应对象
|
|
|
+ @return: response
|
|
|
+ """
|
|
|
+ try:
|
|
|
+ language_id = int(request_dict.get('language_id'))
|
|
|
+ now_time = int(time.time())
|
|
|
+ country_language_qs = CountryLanguageModel.objects.filter(language_id=1).\
|
|
|
+ order_by('-id').values('country_id')
|
|
|
+ country_list = []
|
|
|
+ with open('国家.txt', 'r') as file:
|
|
|
+ lines = file.readlines()
|
|
|
+ for line in lines:
|
|
|
+ country_list.append(line.rstrip())
|
|
|
+ print(country_list)
|
|
|
+ for country_language in country_language_qs:
|
|
|
+ country_name = country_list.pop()
|
|
|
+ country_id = country_language['country_id']
|
|
|
+ print(country_name, country_id)
|
|
|
+ CountryLanguageModel.objects.create(
|
|
|
+ country_name=country_name, language_id=language_id, country_id=country_id, add_time=now_time,
|
|
|
+ update_time=now_time)
|
|
|
+ return response.json(0)
|
|
|
+ except Exception as e:
|
|
|
+ print(e)
|
|
|
+ return response.json(500, 'error_line:{}, error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
|