|
|
@ -256,13 +256,12 @@ def general_seat_params_member(pay_type, data, card): |
|
|
|
card_type = get_card_type(data["env"], data["pid"], data["cid"], card) |
|
|
|
card_type = get_card_type(data["env"], data["pid"], data["cid"], card) |
|
|
|
if card_type is False: |
|
|
|
if card_type is False: |
|
|
|
return_str = '此会员卡在该影院无法使用,请使用3.1.3 查询会员卡的详细信息接口查看卡信息' |
|
|
|
return_str = '此会员卡在该影院无法使用,请使用3.1.3 查询会员卡的详细信息接口查看卡信息' |
|
|
|
return False, return_str, return_str, return_str, return_str, return_str, '2', 'Y', None, int(time.time() * 1000) |
|
|
|
return False, return_str, return_str, return_str, return_str, return_str, '2', 'Y', None, int( |
|
|
|
|
|
|
|
time.time() * 1000) |
|
|
|
|
|
|
|
|
|
|
|
# 获取其他参数 |
|
|
|
# 获取其他参数 |
|
|
|
redis_key_prefix = f'dspt_api_{data["ip"]}_{data["env"]}_{data["member_type"]}_{data["pid"]}_{data["cid"]}' |
|
|
|
redis_key_prefix = f'dspt_api_{data["ip"]}_{data["env"]}_{data["member_type"]}_{data["pid"]}_{data["cid"]}' |
|
|
|
|
|
|
|
|
|
|
|
seat_list = [] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# seat_id |
|
|
|
# seat_id |
|
|
|
request_api_seat = {'name': '3.2.6 获取某场次座位状态', 'path': 'play/seat-status'} |
|
|
|
request_api_seat = {'name': '3.2.6 获取某场次座位状态', 'path': 'play/seat-status'} |
|
|
|
redis_key_api_seat = f'{redis_key_prefix}_{request_api_seat["path"]}' |
|
|
|
redis_key_api_seat = f'{redis_key_prefix}_{request_api_seat["path"]}' |
|
|
@ -312,6 +311,8 @@ def general_seat_params_member(pay_type, data, card): |
|
|
|
return_str = '请手动输入参数,检查相关接口返回值:3.2.6 获取某场次座位状态、3.2.3 获取放映计划列表、3.4.3 座位锁定、3.4.4 锁定座位后获取票价、3.2.2 获取单个影院配置信息' |
|
|
|
return_str = '请手动输入参数,检查相关接口返回值:3.2.6 获取某场次座位状态、3.2.3 获取放映计划列表、3.4.3 座位锁定、3.4.4 锁定座位后获取票价、3.2.2 获取单个影院配置信息' |
|
|
|
return False, return_str, return_str, return_str, return_str, return_str, '1', None, None, last_timestamp |
|
|
|
return False, return_str, return_str, return_str, return_str, return_str, '1', None, None, last_timestamp |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
seat_list = [] |
|
|
|
|
|
|
|
|
|
|
|
# 处理影院定价逻辑 |
|
|
|
# 处理影院定价逻辑 |
|
|
|
if pay_type['select_price_type'] == 'cinema_price': |
|
|
|
if pay_type['select_price_type'] == 'cinema_price': |
|
|
|
# 11682-1-27.7-会员票-1 |
|
|
|
# 11682-1-27.7-会员票-1 |
|
|
@ -334,10 +335,13 @@ def general_seat_params_member(pay_type, data, card): |
|
|
|
cash_pay += 0 |
|
|
|
cash_pay += 0 |
|
|
|
|
|
|
|
|
|
|
|
return True, ','.join( |
|
|
|
return True, ','.join( |
|
|
|
seat_list), play_id, play_update_time, lock_flag, seat_coupons, is_cinema_price, is_split_service_fee, str(cash_pay), last_timestamp |
|
|
|
seat_list), play_id, play_update_time, lock_flag, seat_coupons, is_cinema_price, is_split_service_fee, str( |
|
|
|
|
|
|
|
cash_pay), last_timestamp |
|
|
|
|
|
|
|
|
|
|
|
# 处理三方定价的逻辑 |
|
|
|
# 处理三方定价的逻辑 |
|
|
|
if pay_type['select_price_type'] == 'third_price': |
|
|
|
if pay_type['select_price_type'] == 'third_price': |
|
|
|
|
|
|
|
quan_type = pay_type['ticket_quan']['ticket_quan_type'] |
|
|
|
|
|
|
|
|
|
|
|
# 11664-1-16.5-会员票-1-26.5-1.5 |
|
|
|
# 11664-1-16.5-会员票-1-26.5-1.5 |
|
|
|
is_cinema_price = '2' |
|
|
|
is_cinema_price = '2' |
|
|
|
|
|
|
|
|
|
|
@ -351,65 +355,71 @@ def general_seat_params_member(pay_type, data, card): |
|
|
|
# 11663-Rog自营兑换券10元@@6777bbcfhirW6VAqkHItn3PZ@@10.00@@0 |
|
|
|
# 11663-Rog自营兑换券10元@@6777bbcfhirW6VAqkHItn3PZ@@10.00@@0 |
|
|
|
quan_list = [] |
|
|
|
quan_list = [] |
|
|
|
quan_price_list = [] |
|
|
|
quan_price_list = [] |
|
|
|
quan_price_num = [] |
|
|
|
|
|
|
|
seat_id_quan_list = [] |
|
|
|
|
|
|
|
if pay_type['ticket_quan_check']: |
|
|
|
if pay_type['ticket_quan_check']: |
|
|
|
|
|
|
|
|
|
|
|
quan_per_ticket = int(int(pay_type['ticket_quan']['ticket_quan_num'])/len(seat_data)) # 每张票平均分配的券数量 |
|
|
|
quan_per_ticket = int(int(pay_type['ticket_quan']['ticket_quan_num']) / len(seat_data)) # 每张票平均分配的券数量 |
|
|
|
quan_price_num = [quan_per_ticket] * len(seat_data) # 每张票平均分配的券数量列表 |
|
|
|
quan_price_num = [quan_per_ticket] * len(seat_data) # 每张票平均分配的券数量列表 |
|
|
|
# 多余的券添加到每张票上 |
|
|
|
# 多余的券添加到每张票上 |
|
|
|
for i in range(int(pay_type['ticket_quan']['ticket_quan_num'])%len(seat_data)): |
|
|
|
for i in range(int(pay_type['ticket_quan']['ticket_quan_num']) % len(seat_data)): |
|
|
|
quan_price_num[i] += 1 |
|
|
|
quan_price_num[i] += 1 |
|
|
|
print('quan_price_num', quan_price_num) |
|
|
|
print('quan_price_num', quan_price_num) # quan_price_num [2, 2, 1] 3个座位 5张券 |
|
|
|
|
|
|
|
|
|
|
|
# 遍历座位券列表,获取座位id,并写入列表 |
|
|
|
|
|
|
|
for index, num in enumerate(quan_price_num): |
|
|
|
|
|
|
|
for i in range(num): |
|
|
|
|
|
|
|
seat_id_quan_list.append(seat_data[index]['cineSeatId']) |
|
|
|
|
|
|
|
print('seat_id_quan_list', seat_id_quan_list) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 生成券字段列表 |
|
|
|
# 生成券字段列表 |
|
|
|
quan_price = f2(pay_type['ticket_quan']['ticket_quan_value']) |
|
|
|
quan_price = f2(pay_type['ticket_quan']['ticket_quan_value']) |
|
|
|
quan_num = int(pay_type['ticket_quan']['ticket_quan_num']) |
|
|
|
|
|
|
|
for i in range(quan_num): |
|
|
|
for i, num in enumerate(quan_price_num): |
|
|
|
seat_id = seat_id_quan_list[i] |
|
|
|
seat_id = seat_data[i]['cineSeatId'] |
|
|
|
quan_list.append(f"{seat_id}-Rog接口测试券{str(quan_price)}@@rog{str(time.time_ns())}{seat_id}@@{str(quan_price)}@@0") |
|
|
|
quan_code_list = [f"rog{str(time.time_ns())}{seat_id}{str(n)}" for n in range(num)] |
|
|
|
quan_price_list.append(quan_price) |
|
|
|
quan_code = '|'.join(quan_code_list) |
|
|
|
|
|
|
|
quan_code_price = f2(quan_price * num) |
|
|
|
|
|
|
|
# 券名称@@券码@@券面额@@券抵值金额 |
|
|
|
|
|
|
|
if quan_type == '抵值兑换券': |
|
|
|
|
|
|
|
quan_list.append( |
|
|
|
|
|
|
|
f"{seat_id}-Rog{quan_type}{str(quan_price)}@@{quan_code}@@{str(quan_code_price)}@@{str(quan_code_price)}") |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
quan_list.append( |
|
|
|
|
|
|
|
f"{seat_id}-Rog{quan_type}{str(quan_price)}@@{quan_code}@@{str(quan_code_price)}@@0") |
|
|
|
|
|
|
|
quan_price_list.append(quan_code_price) |
|
|
|
|
|
|
|
|
|
|
|
seat_coupons = ','.join(quan_list) if len(quan_list) > 0 else None # 生成券字段 |
|
|
|
seat_coupons = ','.join(quan_list) if len(quan_list) > 0 else None # 生成券字段 |
|
|
|
|
|
|
|
print('quan_price_list', |
|
|
|
|
|
|
|
quan_price_list) # quan_price_list [Decimal('22.22'), Decimal('22.22'), Decimal('11.11')] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 计算影票价格部分 |
|
|
|
ticket_price = f2(pay_type['ticket_info']['ticket_price']) |
|
|
|
ticket_price = f2(pay_type['ticket_info']['ticket_price']) |
|
|
|
ticket_service = f2(f2(seat_data_price['totalServiceCharge']) / int(seat_data_price['ticketNum'])) |
|
|
|
service_fee = f2(f2(seat_data_price['totalServiceCharge']) / int(seat_data_price['ticketNum'])) |
|
|
|
ticket_price_service = f2(ticket_price + ticket_service) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cash_pay = 0 |
|
|
|
cash_pay = 0 |
|
|
|
for i, seat in enumerate(seat_data): |
|
|
|
|
|
|
|
if i+1 <= len(quan_price_list): |
|
|
|
|
|
|
|
real_pay_tmp = f2(ticket_price_service - (quan_price_list[i] * quan_price_num[i])) # 实付票价减去券核销的价格 |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
real_pay_tmp = ticket_price_service # 无券核销的实付价格 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if is_split_service_fee == 'N': |
|
|
|
for i, seat in enumerate(seat_data): |
|
|
|
real_pay_tmp -= ticket_service # 如果不包含服务费,则要从实付价格中减去服务费 |
|
|
|
# 计算实付金额 |
|
|
|
real_pay = real_pay_tmp if real_pay_tmp > 0 else 0 # 因为使用了券,实付价格可能低于0,需要修正到0 |
|
|
|
ticket_real_pay = ticket_price |
|
|
|
|
|
|
|
if pay_type['ticket_quan_check']: |
|
|
|
if card_type == '权益卡(积分卡)': |
|
|
|
if quan_type == '代金券': |
|
|
|
cash_pay += f2(real_pay + handle_fee) # 当使用权益卡支付时,需要将实付票价累加到现金支付字段中 |
|
|
|
ticket_real_pay = f2(ticket_price - quan_price_list[i]) |
|
|
|
|
|
|
|
elif quan_type in ['抵值兑换券', '兑换券']: |
|
|
|
|
|
|
|
ticket_real_pay = quan_price_list[i] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ticket_real_pay = ticket_real_pay if ticket_real_pay > 0 else 0 # 处理用券后小于0的情况 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 计算影票结算金额 |
|
|
|
|
|
|
|
ticket_pay = ticket_real_pay |
|
|
|
|
|
|
|
if ticket_real_pay < lowest_price: |
|
|
|
|
|
|
|
ticket_pay = lowest_price |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if is_split_service_fee == 'Y': |
|
|
|
|
|
|
|
ticket_real_pay += service_fee |
|
|
|
|
|
|
|
ticket_pay += service_fee |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if card_type == '权益卡(积分卡)' or quan_type == '抵值兑换券': |
|
|
|
|
|
|
|
cash_pay += f2(ticket_real_pay + handle_fee) # 当使用权益卡支付时,需要将实付票价累加到现金支付字段中 |
|
|
|
else: |
|
|
|
else: |
|
|
|
cash_pay += 0 |
|
|
|
cash_pay += 0 |
|
|
|
|
|
|
|
|
|
|
|
if ticket_price >= lowest_price: |
|
|
|
|
|
|
|
real_ticket_price = ticket_price_service # 计算应付票价,如果用户设定的票价低于最低票价,则按照最低票价计算,否则按照用户定义价计算 |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
real_ticket_price = f2(lowest_price + ticket_service) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if is_split_service_fee == 'N': |
|
|
|
|
|
|
|
real_ticket_price -= ticket_service # 如果不包含服务费,则要减去服务费 |
|
|
|
|
|
|
|
if card_type == '权益卡(积分卡)': |
|
|
|
|
|
|
|
cash_pay += ticket_service # 如果是权益卡则单独累加服务费 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
seat_list.append( |
|
|
|
seat_list.append( |
|
|
|
f"{seat['cineSeatId']}-{str(handle_fee)}-{str(real_pay)}-会员票-1-{str(real_ticket_price)}-{str(ticket_service)}") |
|
|
|
f"{seat['cineSeatId']}-{str(handle_fee)}-{str(ticket_real_pay)}-会员票-1-{str(ticket_pay)}-{str(service_fee)}") |
|
|
|
|
|
|
|
|
|
|
|
return True, ','.join( |
|
|
|
return True, ','.join( |
|
|
|
seat_list), play_id, play_update_time, lock_flag, seat_coupons, is_cinema_price, is_split_service_fee, str(cash_pay), last_timestamp |
|
|
|
seat_list), play_id, play_update_time, lock_flag, seat_coupons, is_cinema_price, is_split_service_fee, str( |
|
|
|
|
|
|
|
cash_pay), last_timestamp |
|
|
|