diff --git a/fir_ser/api/migrations/0001_initial.py b/fir_ser/api/migrations/0001_initial.py index 47b6e7d..23c5daa 100644 --- a/fir_ser/api/migrations/0001_initial.py +++ b/fir_ser/api/migrations/0001_initial.py @@ -5,6 +5,59 @@ import django.contrib.auth.models from django.db import migrations, models import django.db.models.deletion +price_info_list = [ + { + "name": "1k_times", + "title": "1k_times", + "description": "1k_times", + "price": 2500, + "package_size": 1000, + "download_count_gift": 100, + "is_enable": True, + }, + { + "name": "10k_times", + "title": "10k_times", + "description": "10k_times", + "price": 22000, + "package_size": 10000, + "download_count_gift": 800, + "is_enable": True, + }, + { + "name": "100k_times", + "title": "100k_times", + "description": "100k_times", + "price": 200000, + "package_size": 100000, + "download_count_gift": 8000, + "is_enable": True, + }, +] +WEB_DOMAIN = settings.WEB_DOMAIN.split('//'[1]) +domain_cname_info_list = [ + { + "domain_record": WEB_DOMAIN, + "ip_address": WEB_DOMAIN, + "is_enable": True, + "is_system": True, + "is_https": True if settings.WEB_DOMAIN.startswith('https') else False, + "description": f"默认下载页域名 {WEB_DOMAIN}", + }, +] + + +def add_default_price(apps, schema_editor): + for price in price_info_list: + price_model = apps.get_model('api', 'Price') + price_model.objects.create(**price) + + +def add_default_domain_cname(apps, schema_editor): + for domain_cname_info in domain_cname_info_list: + domain_cname_info_model = apps.get_model('api', 'DomainCnameInfo') + domain_cname_info_model.objects.create(**domain_cname_info) + class Migration(migrations.Migration): initial = True @@ -526,4 +579,6 @@ class Migration(migrations.Migration): name='appiosdeveloperinfo', unique_together={('user_id', 'issuer_id')}, ), + migrations.RunPython(add_default_price), + migrations.RunPython(add_default_domain_cname), ] diff --git a/fir_ser/api/utils/middlewares.py b/fir_ser/api/utils/middlewares.py index f8b6092..0bae9cd 100644 --- a/fir_ser/api/utils/middlewares.py +++ b/fir_ser/api/utils/middlewares.py @@ -15,7 +15,7 @@ class CorsMiddleWare(MiddlewareMixin): response["Access-Control-Allow-Origin"] = request.META.get("HTTP_ORIGIN") response["Access-Control-Allow-Credentials"] = 'true' - response["Cache-Control"] = "no-cache" + # response["Cache-Control"] = "no-cache" except Exception as e: logger.error(e) return response diff --git a/fir_ser/nginx-vhost.conf b/fir_ser/nginx-vhost.conf index 5fbe7ca..14e1a45 100644 --- a/fir_ser/nginx-vhost.conf +++ b/fir_ser/nginx-vhost.conf @@ -40,7 +40,7 @@ server set_real_ip_from 0.0.0.0/0; real_ip_header X-Forwarded-For; - location ~ ^/(download|api|files|udid|captcha|show_udid) { + location ~ ^/(download|api|files|udid|captcha|show_udid|flower) { #proxy_pass http://synchrotron; #proxy_send_timeout 180; #proxy_connect_timeout 180; diff --git a/fir_ser/tmp/.gitkeep b/fir_ser/tmp/.gitkeep new file mode 100644 index 0000000..e69de29