优化SQL执行语句,增加语句常量带入

增加REDIS配置(未启用)
This commit is contained in:
shileiye 2022-01-06 19:16:02 +08:00
parent 350b7194de
commit af16062ec8
3 changed files with 32 additions and 28 deletions

View File

@ -42,8 +42,8 @@ path12 = ${GAME:web_path}args_ios.php
path13 = ${GAME:web_path}api\notice.php
[GAME_DATA_SQL]
game_ip = UPDATE `gameback`.`bg_server` SET `server_ip` = '${GAME:now_ip}' WHERE `id` IN (1,2)
game_name = UPDATE `gameback`.`bg_server` SET `name` = REPLACE(`name`,'${GAME:game_name}','${GAME:game_name}_new') WHERE `name` LIKE '%${GAME:game_name}%';
game_ip = UPDATE `gameback`.`bg_server` SET `server_ip` = '~【game_ip】~' WHERE `id` IN (1,2)
game_name = UPDATE `gameback`.`bg_server` SET `name` = REPLACE(`name`,'${GAME:game_name}','~【game_name】~') WHERE `name` LIKE '%${GAME:game_name}%';
[WEB]
domain_name = localhost
@ -72,6 +72,13 @@ mysql_port = 3306
mysql_user = cq_dba
mysql_pass = 123456abc
[REDIS]
redis_path = ${GAME:tool_path}Redis\
redis_host = 127.0.0.1
redis_port = 6379
redis_dbfile = dump.rdb
redis_pass = 123456abc
[ANDROID]
android_path = ${GAME:client_path}apk\
android_name = ${android_path}game.apk

BIN
dist/main.exe vendored

Binary file not shown.

19
main.py
View File

@ -84,14 +84,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
def saveSet(self, event):
print('保存设置,按钮被单击')
# print(config['GAME_FILE_PATH']['game'])
# tinydict = ast.literal_eval(config['GAME_PATH']['game'])
# print("字典值 : %s" %tinydict.items())
# # 遍历字典列表
# for key, values in tinydict.items():
# print(key, values)
# print(config.items("GAME_FILE_PATH"))
# return
message = QMessageBox.information(self, "提示信息", "确定要保存设置吗?", QMessageBox.Ok | QMessageBox.No, QMessageBox.No)
if message == QMessageBox.No:
return
@ -110,11 +102,16 @@ class MainWindow(QMainWindow, Ui_MainWindow):
# 处理SQL语句
if config.has_section('GAME_DATA_SQL'):
sql_game_ip = config['GAME_DATA_SQL']['game_ip'].replace(now_ip, new_ip)
sql_game_name = config['GAME_DATA_SQL']['game_name'].replace(now_game + '_new', new_game)
sqls = [sql_game_ip, sql_game_name]
sqls = []
for key, value in config.items('GAME_DATA_SQL'):
print(key, value)
sql = value.replace('~【game_ip】~', new_ip)
sql = sql.replace('~【game_name】~', new_game)
sqls.append(sql)
print(key, sql)
# 判断MYSQL是否启动
if sqls:
if isinstance(checkprocess("mysqld.exe"), int):
mysql_run(sqls)
else: