非会员 3.1.4 获取影厅座位图 3.1.6 获取放映计划列表(增量) 3.1.7 获取某(几)个场次信息 3.1.8 获取某场次座位状态 3.1.9 获取某场次座位状态(增量) 3.1.10 获取某(几)个场次座位售卖统计信息 3.2.2 获取单个卖品的图片信息main
parent
9e1acfae20
commit
0e14a86aed
10 changed files with 173 additions and 11 deletions
@ -0,0 +1,28 @@ |
||||
from dspt_api.util.general.handle_redis import get_data_from_redis |
||||
from dspt_api.util.general.handle_goods import get_goods_list |
||||
import random |
||||
|
||||
|
||||
class ApiCinemaGoodsPic(object): |
||||
def __init__(self, **kwargs): |
||||
self.member_type = kwargs.get('member_type') |
||||
self.api = kwargs.get('api') |
||||
self.ip = kwargs.get('ip') |
||||
|
||||
def get_suggestion(self): |
||||
# play_id play_update_time |
||||
request_api = {'name': '3.2.1 获取卖品列表', 'path': 'cinema/goods'} |
||||
redis_key_api = f'dspt_api_{self.ip}_{self.member_type}_{request_api["path"]}' |
||||
result, _format, redis_data = get_data_from_redis(redis_key_api) |
||||
if result: |
||||
goods_list = get_goods_list(redis_data, _format) |
||||
goods = random.choice(goods_list) |
||||
goods_id = goods['id'] |
||||
goods_type = goods['type'] |
||||
return [{'param': 'goods_id', 'value': goods_id, 'is_checked': True}, |
||||
{'param': 'type', 'value': goods_type, 'is_checked': True}] |
||||
else: |
||||
# 返回推荐参数应该包含参数名,参数值,和是否勾选的状态 |
||||
return [ |
||||
{'param': 'goods_id', 'value': redis_data + request_api["name"], 'is_checked': True}, |
||||
{'param': 'type', 'value': redis_data + request_api["name"], 'is_checked': True}] |
@ -0,0 +1,25 @@ |
||||
from dspt_api.util.general.handle_redis import get_data_from_redis |
||||
import random |
||||
|
||||
|
||||
class ApiPlayInfo: |
||||
def __init__(self, **kwargs): |
||||
self.member_type = kwargs.get('member_type') |
||||
self.api = kwargs.get('api') |
||||
self.ip = kwargs.get('ip') |
||||
|
||||
def get_suggestion(self): |
||||
# hall_id |
||||
request_api = {'name': '3.1.5 获取放映计划列表', 'path': 'cinema/plays'} |
||||
redis_key_api = f'dspt_api_{self.ip}_{self.member_type}_{request_api["path"]}' |
||||
result, _format, redis_data = get_data_from_redis(redis_key_api) |
||||
if result: |
||||
play_data = random.choice(redis_data) |
||||
play_id = play_data['id'] |
||||
return [{'param': 'play_id', 'value': play_id, 'is_checked': True}] |
||||
else: |
||||
# 返回推荐参数应该包含参数名,参数值,和是否勾选的状态 |
||||
return [ |
||||
{'param': 'play_id', 'value': redis_data + request_api["name"], 'is_checked': True}] |
||||
|
||||
|
@ -0,0 +1,27 @@ |
||||
from dspt_api.util.general.handle_redis import get_data_from_redis |
||||
import random |
||||
import datetime |
||||
|
||||
|
||||
class ApiPlayPeriodChangedSeats: |
||||
def __init__(self, **kwargs): |
||||
self.member_type = kwargs.get('member_type') |
||||
self.api = kwargs.get('api') |
||||
self.ip = kwargs.get('ip') |
||||
|
||||
def get_suggestion(self): |
||||
# play_id play_update_time |
||||
request_api = {'name': '3.1.5 获取放映计划列表', 'path': 'cinema/plays'} |
||||
redis_key_api = f'dspt_api_{self.ip}_{self.member_type}_{request_api["path"]}' |
||||
result, _format, redis_data = get_data_from_redis(redis_key_api) |
||||
if result: |
||||
play_data = random.choice(redis_data) |
||||
play_id = play_data['id'] |
||||
start = datetime.datetime.strftime(datetime.datetime.now(), '%Y-%m-%d') + ' 06:00:00' |
||||
return [{'param': 'play_id', 'value': play_id, 'is_checked': True}, |
||||
{'param': 'start', 'value': start, 'is_checked': True}] |
||||
else: |
||||
# 返回推荐参数应该包含参数名,参数值,和是否勾选的状态 |
||||
return [ |
||||
{'param': 'play_id', 'value': redis_data + request_api["name"], 'is_checked': True}, |
||||
{'param': 'start', 'value': redis_data + request_api["name"], 'is_checked': True}] |
@ -0,0 +1,23 @@ |
||||
from dspt_api.util.general.handle_redis import get_data_from_redis |
||||
import random |
||||
|
||||
|
||||
class ApiPlaySeatOverview: |
||||
def __init__(self, **kwargs): |
||||
self.member_type = kwargs.get('member_type') |
||||
self.api = kwargs.get('api') |
||||
self.ip = kwargs.get('ip') |
||||
|
||||
def get_suggestion(self): |
||||
# play_id play_update_time |
||||
request_api = {'name': '3.1.5 获取放映计划列表', 'path': 'cinema/plays'} |
||||
redis_key_api = f'dspt_api_{self.ip}_{self.member_type}_{request_api["path"]}' |
||||
result, _format, redis_data = get_data_from_redis(redis_key_api) |
||||
if result: |
||||
play_data = random.choice(redis_data) |
||||
play_id = play_data['id'] |
||||
return [{'param': 'play_id', 'value': play_id, 'is_checked': True}] |
||||
else: |
||||
# 返回推荐参数应该包含参数名,参数值,和是否勾选的状态 |
||||
return [ |
||||
{'param': 'play_id', 'value': redis_data + request_api["name"], 'is_checked': True}] |
@ -0,0 +1,26 @@ |
||||
from dspt_api.util.general.handle_redis import get_data_from_redis |
||||
import random |
||||
|
||||
|
||||
class ApiPlaySeatStatus: |
||||
def __init__(self, **kwargs): |
||||
self.member_type = kwargs.get('member_type') |
||||
self.api = kwargs.get('api') |
||||
self.ip = kwargs.get('ip') |
||||
|
||||
def get_suggestion(self): |
||||
# play_id play_update_time |
||||
request_api = {'name': '3.1.5 获取放映计划列表', 'path': 'cinema/plays'} |
||||
redis_key_api = f'dspt_api_{self.ip}_{self.member_type}_{request_api["path"]}' |
||||
result, _format, redis_data = get_data_from_redis(redis_key_api) |
||||
if result: |
||||
play_data = random.choice(redis_data) |
||||
play_id = play_data['id'] |
||||
play_update_time = play_data['cineUpdateTime'] |
||||
return [{'param': 'play_id', 'value': play_id, 'is_checked': True}, |
||||
{'param': 'play_update_time', 'value': play_update_time, 'is_checked': True}] |
||||
else: |
||||
# 返回推荐参数应该包含参数名,参数值,和是否勾选的状态 |
||||
return [ |
||||
{'param': 'play_id', 'value': redis_data + request_api["name"], 'is_checked': True}, |
||||
{'param': 'play_update_time', 'value': redis_data + request_api["name"], 'is_checked': True}] |
@ -0,0 +1,12 @@ |
||||
def get_goods_list(goods_resp, _format): |
||||
goods_list = [] |
||||
if _format == 'json': |
||||
for goods_cate in goods_resp: |
||||
goods_list = goods_list + goods_cate['goods'] |
||||
if _format == 'xml': |
||||
for goods_cate in goods_resp['cate']: |
||||
if isinstance(goods_cate['goods']['item'], dict): |
||||
goods_list.append(goods_cate['goods']['item']) |
||||
else: |
||||
goods_list = goods_list + goods_cate['goods']['item'] |
||||
return goods_list |
Loading…
Reference in new issue