1. 为前端增加reload的判断依据, 返回的推荐字段增加result

2. 写入cine库是删除所有的function和view,方便对比
main
RogerWork 3 months ago
parent 3accec70cf
commit db3cc7cd3c
  1. 8
      dspt_api/util/api/cinema_goods_pic.py
  2. 4
      dspt_api/util/api/cinema_hall_seats.py
  3. 2
      dspt_api/util/api/cinema_plays_increment.py
  4. 4
      dspt_api/util/api/play_info.py
  5. 8
      dspt_api/util/api/play_period_changed_seats.py
  6. 2
      dspt_api/util/api/play_seat_overview.py
  7. 8
      dspt_api/util/api/play_seat_status.py
  8. 2
      dspt_api/util/general/handle_redis.py
  9. 24
      update/utils/git_util.py

@ -19,10 +19,10 @@ class ApiCinemaGoodsPic(object):
goods = random.choice(goods_list) goods = random.choice(goods_list)
goods_id = goods['id'] goods_id = goods['id']
goods_type = goods['type'] goods_type = goods['type']
return [{'param': 'goods_id', 'value': goods_id, 'is_checked': True}, return [{'param': 'goods_id', 'value': goods_id, 'is_checked': True, 'result': True},
{'param': 'type', 'value': goods_type, 'is_checked': True}] {'param': 'type', 'value': goods_type, 'is_checked': True, 'result': True}]
else: else:
# 返回推荐参数应该包含参数名,参数值,和是否勾选的状态 # 返回推荐参数应该包含参数名,参数值,和是否勾选的状态
return [ return [
{'param': 'goods_id', 'value': redis_data + request_api["name"], 'is_checked': True}, {'param': 'goods_id', 'value': redis_data + request_api["name"], 'is_checked': True, 'result': False},
{'param': 'type', 'value': redis_data + request_api["name"], 'is_checked': True}] {'param': 'type', 'value': redis_data + request_api["name"], 'is_checked': True, 'result': False}]

@ -16,10 +16,10 @@ class ApiCinemaHallSeats:
if result: if result:
hall_data = random.choice(redis_data) hall_data = random.choice(redis_data)
hall_id = hall_data['id'] hall_id = hall_data['id']
return [{'param': 'hall_id', 'value': hall_id, 'is_checked': True}] return [{'param': 'hall_id', 'value': hall_id, 'is_checked': True, 'result': True}]
else: else:
# 返回推荐参数应该包含参数名,参数值,和是否勾选的状态 # 返回推荐参数应该包含参数名,参数值,和是否勾选的状态
return [ return [
{'param': 'hall_id', 'value': redis_data + request_api["name"], 'is_checked': True}] {'param': 'hall_id', 'value': redis_data + request_api["name"], 'is_checked': True, 'result': False}]

@ -16,4 +16,4 @@ class ApiCinemaPlaysIncrement:
# 生成默认值 # 生成默认值
start = redis_data['nextSyncStartTime'] if result else datetime.datetime.strftime(datetime.datetime.now(), start = redis_data['nextSyncStartTime'] if result else datetime.datetime.strftime(datetime.datetime.now(),
'%Y-%m-%d') + ' 06:00:00' '%Y-%m-%d') + ' 06:00:00'
return [{'param': 'start', 'value': start, 'is_checked': True}] return [{'param': 'start', 'value': start, 'is_checked': True, 'result': True}]

@ -17,10 +17,10 @@ class ApiPlayInfo:
if result: if result:
play_data = random.choice(redis_data) play_data = random.choice(redis_data)
play_id = play_data['id'] play_id = play_data['id']
return [{'param': 'play_id', 'value': play_id, 'is_checked': True}] return [{'param': 'play_id', 'value': play_id, 'is_checked': True, 'result': True}]
else: else:
# 返回推荐参数应该包含参数名,参数值,和是否勾选的状态 # 返回推荐参数应该包含参数名,参数值,和是否勾选的状态
return [ return [
{'param': 'play_id', 'value': redis_data + request_api["name"], 'is_checked': True}] {'param': 'play_id', 'value': redis_data + request_api["name"], 'is_checked': True, 'result': True}]

@ -18,10 +18,10 @@ class ApiPlayPeriodChangedSeats:
play_data = random.choice(redis_data) play_data = random.choice(redis_data)
play_id = play_data['id'] play_id = play_data['id']
start = datetime.datetime.strftime(datetime.datetime.now(), '%Y-%m-%d') + ' 06:00:00' start = datetime.datetime.strftime(datetime.datetime.now(), '%Y-%m-%d') + ' 06:00:00'
return [{'param': 'play_id', 'value': play_id, 'is_checked': True}, return [{'param': 'play_id', 'value': play_id, 'is_checked': True, 'result': True},
{'param': 'start', 'value': start, 'is_checked': True}] {'param': 'start', 'value': start, 'is_checked': True, 'result': True}]
else: else:
# 返回推荐参数应该包含参数名,参数值,和是否勾选的状态 # 返回推荐参数应该包含参数名,参数值,和是否勾选的状态
return [ return [
{'param': 'play_id', 'value': redis_data + request_api["name"], 'is_checked': True}, {'param': 'play_id', 'value': redis_data + request_api["name"], 'is_checked': True, 'result': True},
{'param': 'start', 'value': redis_data + request_api["name"], 'is_checked': True}] {'param': 'start', 'value': redis_data + request_api["name"], 'is_checked': True, 'result': True}]

@ -20,4 +20,4 @@ class ApiPlaySeatOverview:
else: else:
# 返回推荐参数应该包含参数名,参数值,和是否勾选的状态 # 返回推荐参数应该包含参数名,参数值,和是否勾选的状态
return [ return [
{'param': 'play_id', 'value': redis_data + request_api["name"], 'is_checked': True}] {'param': 'play_id', 'value': redis_data + request_api["name"], 'is_checked': True, 'result': True}]

@ -17,10 +17,10 @@ class ApiPlaySeatStatus:
play_data = random.choice(redis_data) play_data = random.choice(redis_data)
play_id = play_data['id'] play_id = play_data['id']
play_update_time = play_data['cineUpdateTime'] play_update_time = play_data['cineUpdateTime']
return [{'param': 'play_id', 'value': play_id, 'is_checked': True}, return [{'param': 'play_id', 'value': play_id, 'is_checked': True, 'result': True},
{'param': 'play_update_time', 'value': play_update_time, 'is_checked': True}] {'param': 'play_update_time', 'value': play_update_time, 'is_checked': True, 'result': True}]
else: else:
# 返回推荐参数应该包含参数名,参数值,和是否勾选的状态 # 返回推荐参数应该包含参数名,参数值,和是否勾选的状态
return [ return [
{'param': 'play_id', 'value': redis_data + request_api["name"], 'is_checked': True}, {'param': 'play_id', 'value': redis_data + request_api["name"], 'is_checked': True, 'result': True},
{'param': 'play_update_time', 'value': redis_data + request_api["name"], 'is_checked': True}] {'param': 'play_update_time', 'value': redis_data + request_api["name"], 'is_checked': True, 'result': True}]

@ -7,11 +7,13 @@ import xmltodict
def get_data_from_redis(redis_key): def get_data_from_redis(redis_key):
# 初始化redis # 初始化redis
redis_conn = get_redis_connection() redis_conn = get_redis_connection()
# 如果有用户数据则处理用户数据
if redis_conn.exists(redis_key + '_user_data'): if redis_conn.exists(redis_key + '_user_data'):
redis_data = json.loads(redis_conn.get(redis_key + '_user_data')) redis_data = json.loads(redis_conn.get(redis_key + '_user_data'))
user_data = redis_data['user_data'] user_data = redis_data['user_data']
print('user_data', json.dumps(user_data)) print('user_data', json.dumps(user_data))
return True, redis_data['format'], user_data return True, redis_data['format'], user_data
# 没有用户数据时,随机选择数据
if redis_conn.exists(redis_key): if redis_conn.exists(redis_key):
redis_data = json.loads(redis_conn.get(redis_key)) redis_data = json.loads(redis_conn.get(redis_key))
resp_data = [] resp_data = []

@ -1,4 +1,6 @@
from git import Repo from git import Repo
from dspt_api.util.insert_api_to_db import db_conn, db_cursor
from update.models import Release from update.models import Release
import os import os
import shutil import shutil
@ -29,6 +31,7 @@ class GitUtil:
'user': settings.CONFIG[ENV]['DB']['USER'], 'user': settings.CONFIG[ENV]['DB']['USER'],
'password': settings.CONFIG[ENV]['DB']['PASSWORD'], 'password': settings.CONFIG[ENV]['DB']['PASSWORD'],
'port': 3309, 'port': 3309,
'database': self.db_name,
'connect_timeout': 5, 'connect_timeout': 5,
} }
@ -110,6 +113,27 @@ class GitUtil:
r = os.system(cmd) r = os.system(cmd)
print('cine.sql写入结果', r) print('cine.sql写入结果', r)
def del_func_view(self):
cmd_list = [
f'DROP FUNCTION IF EXISTS `{self.db_name}`.`GetCostAverage`;',
f'DROP FUNCTION IF EXISTS `{self.db_name}`.`GetGoodsCount`;',
f'DROP FUNCTION IF EXISTS `{self.db_name}`.`GetSumIn`;',
f'DROP FUNCTION IF EXISTS `{self.db_name}`.`GetCostFifo`;',
f'DROP FUNCTION IF EXISTS `{self.db_name}`.`GetSumOut`;',
f'DROP FUNCTION IF EXISTS `{self.db_name}`.`GetCost`;',
f'DROP FUNCTION IF EXISTS `{self.db_name}`.`GetGoodsPrice`;',
f'DROP FUNCTION IF EXISTS `{self.db_name}`.`GetCostMobile`;',
f'DROP VIEW IF EXISTS `{self.db_name}`.`retail_inventory_list`;'
]
_db_conn = pymysql.connect(**self.db_config)
_db_cursor = db_conn.cursor()
_db_cursor.execute()
for cmd in cmd_list:
_db_cursor.execute(cmd)
_db_conn.commit()
_db_cursor.close()
_db_conn.close()
# 获取数据库名称 # 获取数据库名称
def get_db_name(self, _release=''): def get_db_name(self, _release=''):
if _release == '': if _release == '':

Loading…
Cancel
Save