|
|
|
@ -216,8 +216,8 @@ def get_response(request): |
|
|
|
|
|
|
|
|
|
# 获取本机 IP 地址: |
|
|
|
|
def get_local_ip(): |
|
|
|
|
ip = CONFIG[ENV]['SERVER_IP'] |
|
|
|
|
if CONFIG[ENV]['SERVER_IP'] == '': |
|
|
|
|
ip = CONFIG[ENV]['WEB_SERVER_IP'] |
|
|
|
|
if CONFIG[ENV]['WEB_SERVER_IP'] == '': |
|
|
|
|
r = runserver() |
|
|
|
|
ip = socket.gethostbyname(socket.gethostname()) |
|
|
|
|
print(ip) |
|
|
|
@ -272,11 +272,11 @@ def enable_mock(request): |
|
|
|
|
server_ip = get_local_ip() |
|
|
|
|
current_host = db(ip, GET_ZZ_PLATFORM_HOST_SQL)['data'][0]['cinema_common_info_val'] |
|
|
|
|
if current_host == 'https://zzcs.yinghezhong.com' or current_host == 'https://dy.yinghezhong.com': |
|
|
|
|
db_result = db(ip, UPDATE_ZZ_PLATFORM_HOST_SQL, (f'http://{server_ip}:8000',)) |
|
|
|
|
db_result = db(ip, UPDATE_ZZ_PLATFORM_HOST_SQL, (f'http://{server_ip}',)) |
|
|
|
|
if db_result['result'] > 0: |
|
|
|
|
ZZMockModel.objects.filter(ip=ip).update(**mock_config) |
|
|
|
|
return JsonResponse({'status': 'success'}) |
|
|
|
|
if current_host == f'http://{server_ip}:8000': |
|
|
|
|
if current_host == f'http://{server_ip}': |
|
|
|
|
ZZMockModel.objects.filter(ip=ip).update(**mock_config) |
|
|
|
|
return JsonResponse({'status': 'success'}) |
|
|
|
|
return JsonResponse({'status': 'fail'}) |
|
|
|
|