|
|
@ -144,14 +144,16 @@ def get_suggest_params_by_api(request): |
|
|
|
# 获取基础数据 |
|
|
|
# 获取基础数据 |
|
|
|
member_type = request.GET.get('member_type') |
|
|
|
member_type = request.GET.get('member_type') |
|
|
|
api = request.GET.get('api') |
|
|
|
api = request.GET.get('api') |
|
|
|
|
|
|
|
env = request.GET.get('env') |
|
|
|
|
|
|
|
cid = request.GET.get('cid') |
|
|
|
|
|
|
|
pid = request.GET.get('pid') |
|
|
|
user_ip = request.META.get('REMOTE_ADDR') |
|
|
|
user_ip = request.META.get('REMOTE_ADDR') |
|
|
|
sale_type = request.GET.get('options[sale_type]', None) |
|
|
|
sale_type = request.GET.get('options[sale_type]', None) |
|
|
|
print() |
|
|
|
|
|
|
|
print('sale_type', sale_type) |
|
|
|
print('sale_type', sale_type) |
|
|
|
if sale_type is None: |
|
|
|
if sale_type is None: |
|
|
|
params = suggest_params(member_type, api, user_ip) |
|
|
|
params = suggest_params(member_type, api, env, cid, pid, user_ip) |
|
|
|
else: |
|
|
|
else: |
|
|
|
params = suggest_params(member_type, api, user_ip, **{'sale_type': sale_type}) |
|
|
|
params = suggest_params(member_type, api, env, cid, pid, user_ip, **{'sale_type': sale_type}) |
|
|
|
return JsonResponse(params, safe=False) |
|
|
|
return JsonResponse(params, safe=False) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -160,8 +162,11 @@ def get_suggest_params_timestamp_by_api(request): |
|
|
|
# 获取基础数据 |
|
|
|
# 获取基础数据 |
|
|
|
member_type = request.GET.get('member_type') |
|
|
|
member_type = request.GET.get('member_type') |
|
|
|
api = request.GET.get('api') |
|
|
|
api = request.GET.get('api') |
|
|
|
|
|
|
|
env = request.GET.get('env') |
|
|
|
|
|
|
|
cid = request.GET.get('cid') |
|
|
|
|
|
|
|
pid = request.GET.get('pid') |
|
|
|
user_ip = request.META.get('REMOTE_ADDR') |
|
|
|
user_ip = request.META.get('REMOTE_ADDR') |
|
|
|
_ts = suggest_params_timestamp(member_type, api, user_ip) |
|
|
|
_ts = suggest_params_timestamp(member_type, api, env, cid, pid, user_ip) |
|
|
|
print('timestamp', _ts) |
|
|
|
print('timestamp', _ts) |
|
|
|
return JsonResponse({'timestamp': _ts}) |
|
|
|
return JsonResponse({'timestamp': _ts}) |
|
|
|
|
|
|
|
|
|
|
@ -204,12 +209,15 @@ def send_request(request): |
|
|
|
print('request_params', params) |
|
|
|
print('request_params', params) |
|
|
|
resp_format = params['format'] |
|
|
|
resp_format = params['format'] |
|
|
|
member_type = req.get('member_type') |
|
|
|
member_type = req.get('member_type') |
|
|
|
|
|
|
|
env = req.get('env') |
|
|
|
|
|
|
|
pid = req.get('pid') |
|
|
|
|
|
|
|
cid = req.get('cid') |
|
|
|
# 初始化redis |
|
|
|
# 初始化redis |
|
|
|
redis_conn = get_redis_connection() |
|
|
|
redis_conn = get_redis_connection() |
|
|
|
user_ip = request.META.get('REMOTE_ADDR') |
|
|
|
user_ip = request.META.get('REMOTE_ADDR') |
|
|
|
web_req = json.loads(request.body) |
|
|
|
web_req = json.loads(request.body) |
|
|
|
api = web_req.get('api') |
|
|
|
api = web_req.get('api') |
|
|
|
redis_key_api = f'dspt_api_{user_ip}_{member_type}_{api}' |
|
|
|
redis_key_api = f'dspt_api_{user_ip}_{env}_{member_type}_{pid}_{cid}_{api}' |
|
|
|
|
|
|
|
|
|
|
|
# 发送请求 |
|
|
|
# 发送请求 |
|
|
|
req, sig = handle_request(request) |
|
|
|
req, sig = handle_request(request) |
|
|
@ -266,6 +274,9 @@ def send_request(request): |
|
|
|
'member_type': member_type, |
|
|
|
'member_type': member_type, |
|
|
|
'api': api, |
|
|
|
'api': api, |
|
|
|
'format': resp_format, |
|
|
|
'format': resp_format, |
|
|
|
|
|
|
|
'env': env, |
|
|
|
|
|
|
|
'cid': cid, |
|
|
|
|
|
|
|
'pid': pid, |
|
|
|
} |
|
|
|
} |
|
|
|
random_params(user_data, handled_data) |
|
|
|
random_params(user_data, handled_data) |
|
|
|
|
|
|
|
|
|
|
@ -289,9 +300,12 @@ def set_user_select_data(request): |
|
|
|
resp_format = 'xml' if req.get('format') == 'html' else req.get('format') |
|
|
|
resp_format = 'xml' if req.get('format') == 'html' else req.get('format') |
|
|
|
user_data = req.get('user_data') |
|
|
|
user_data = req.get('user_data') |
|
|
|
user_ip = request.META.get('REMOTE_ADDR') |
|
|
|
user_ip = request.META.get('REMOTE_ADDR') |
|
|
|
|
|
|
|
env = req.get('env') |
|
|
|
|
|
|
|
pid = req.get('pid') |
|
|
|
|
|
|
|
cid = req.get('cid') |
|
|
|
# 初始化redis |
|
|
|
# 初始化redis |
|
|
|
redis_conn = get_redis_connection() |
|
|
|
redis_conn = get_redis_connection() |
|
|
|
redis_key_user_data = f'dspt_api_{user_ip}_{member_type}_{api}_user_data' |
|
|
|
redis_key_user_data = f'dspt_api_{user_ip}_{env}_{member_type}_{pid}_{cid}_{api}_user_data' |
|
|
|
print('user_data', user_data) |
|
|
|
print('user_data', user_data) |
|
|
|
# 记录用户选择 |
|
|
|
# 记录用户选择 |
|
|
|
data = { |
|
|
|
data = { |
|
|
|