You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
2.0 KiB
52 lines
2.0 KiB
import json |
|
from dspt_api.util.general.handle_redis import get_data_from_redis |
|
from dspt_api.util.general.get_order_num import general_order_num |
|
import time |
|
import random |
|
|
|
|
|
""" |
|
UPDATE cinema_common_info SET cinema_common_info_val = '[{"channel_name":"ziying","shelf_id":"1"}]' WHERE cinema_common_info_key = 'third_channel_autosell_config'; |
|
""" |
|
|
|
|
|
class ApiGoodsDeduct: |
|
def __init__(self, **kwargs): |
|
self.member_type = kwargs.get('member_type') |
|
self.api = kwargs.get('api') |
|
self.ip = kwargs.get('ip') |
|
self.env = kwargs.get('env') |
|
self.cid = kwargs.get('cid') |
|
self.pid = kwargs.get('pid') |
|
self.user_data = { |
|
'ip': self.ip, |
|
'env': self.env, |
|
'member_type': self.member_type, |
|
'pid': self.pid, |
|
'cid': self.cid, |
|
} |
|
self.return_data = [] |
|
|
|
def get_suggestion(self): |
|
print('get_suggestion', self.user_data) |
|
self.handle() |
|
return self.return_data |
|
|
|
@staticmethod |
|
def get_timestamp(): |
|
return int(time.time() * 1000) |
|
|
|
def handle(self): |
|
# 获取 ticket_flag |
|
redis_key_prefix = f'dspt_api_{self.ip}_{self.env}_{self.member_type}_{self.pid}_{self.cid}' |
|
request_api_lock_buy = {'name': '3.3.3 混合下单(影票、卖品)', 'path': 'seat/lock-buy'} |
|
redis_key_api_lock_buy = f'{redis_key_prefix}_{request_api_lock_buy["path"]}' |
|
result_lock_buy, _format_lock_buy, ticket_flag_lock_buy, _timestamp_lock_buy = get_data_from_redis( |
|
redis_key_api_lock_buy) |
|
if not result_lock_buy: |
|
self.add_param('center_flag', '请手动输入参数,或先请求接口:3.3.3 混合下单(影票、卖品)') |
|
self.add_param('center_flag', ticket_flag_lock_buy['ticketFlag1'] + ticket_flag_lock_buy['ticketFlag2']) |
|
|
|
def add_param(self, field, value, is_checked=True, result=True, timestamp=int(time.time() * 1000)): |
|
self.return_data.append( |
|
{'param': field, 'value': value, 'is_checked': is_checked, 'result': result, 'timestamp': timestamp})
|
|
|