### 变更详情 1. 新增密保问题系统,支持8种预置验证问题,多场景支持多验证方式 2. 新增勋章管理模块,包含勋章配置、用户勋章关联管理 3. 新增每日任务系统,支持任务配置和用户进度追踪 4. 新增赛季排行榜功能,支持周/月赛季排行与奖励结算 5. 新增信息流推荐权重配置管理 6. 重构服务路径分层,按设备/网络/数据分类管理服务 7. 优化Feed请求参数截断逻辑,避免URL过长 8. 新增等级工具类,统一处理等级颜色与称号展示 9. 新增屏幕共享共享信令Provider,复用传输服务实例 10. 新增Android/iOS分享适配与桌面小组件支持 11. 清理旧版测试脚本,新增部署维护脚本 12. 完善用户注销关联数据清理逻辑
84 lines
3.0 KiB
Python
84 lines
3.0 KiB
Python
import paramiko
|
|
import os
|
|
import sys
|
|
|
|
HOST = '123.207.67.197'
|
|
PORT = 22
|
|
USER = 'root'
|
|
PASS = '520Kiss123'
|
|
|
|
BASE_DIR = r'e:\project\flutter\f\xianyan\docs\toolsapi'
|
|
REMOTE_BASE = '/www/wwwroot/tools.wktyl.com/'
|
|
|
|
UPLOAD_FILES = [
|
|
{
|
|
'local': os.path.join(BASE_DIR, 'application', 'api', 'controller', 'UserSecurity.php'),
|
|
'remote': REMOTE_BASE + 'application/api/controller/UserSecurity.php',
|
|
},
|
|
{
|
|
'local': os.path.join(BASE_DIR, 'application', 'api', 'controller', 'UserCenter.php'),
|
|
'remote': REMOTE_BASE + 'application/api/controller/UserCenter.php',
|
|
},
|
|
]
|
|
|
|
ssh = paramiko.SSHClient()
|
|
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
ssh.connect(HOST, PORT, USER, PASS)
|
|
sftp = ssh.open_sftp()
|
|
|
|
for item in UPLOAD_FILES:
|
|
local = item['local']
|
|
remote = item['remote']
|
|
if not os.path.exists(local):
|
|
print(f'[SKIP] Local file not found: {local}')
|
|
continue
|
|
|
|
backup_file = remote + '.bak.' + os.popen('echo %date:~0,4%%date:~5,2%%date:~8,2%_%time:~0,2%%time:~3,2%').read().strip().replace(' ', '0')
|
|
print(f'Backing up {remote} -> {backup_file}')
|
|
try:
|
|
sftp.rename(remote, backup_file)
|
|
print(' Backup created')
|
|
except:
|
|
print(' No existing file to backup (or rename failed)')
|
|
|
|
print(f'Uploading {local} -> {remote}')
|
|
sftp.put(local, remote)
|
|
print(' Upload complete')
|
|
sftp.chmod(remote, 0o644)
|
|
print(' Permissions set to 644')
|
|
|
|
print('\nRunning database migration...')
|
|
sql_file = os.path.join(BASE_DIR, 'application', 'admin', 'command', 'Install', 'migrate_v10_1.sql')
|
|
if os.path.exists(sql_file):
|
|
with open(sql_file, 'r', encoding='utf-8') as f:
|
|
sql_content = f.read()
|
|
sql_lines = [line.strip() for line in sql_content.split('\n') if line.strip() and not line.strip().startswith('--')]
|
|
for sql in sql_lines:
|
|
if sql:
|
|
stdin, stdout, stderr = ssh.exec_command(
|
|
f"cd {REMOTE_BASE} && php think sql \"{sql.replace('\"', '\\\"')}\" 2>/dev/null || "
|
|
f"mysql -u tools -ptools tools -e \"{sql.replace('\"', '\\\"')}\" 2>/dev/null || "
|
|
f"echo 'SQL_MANUAL: {sql[:80]}...'"
|
|
)
|
|
output = stdout.read().decode()
|
|
err = stderr.read().decode()
|
|
if output:
|
|
print(f' SQL: {output.strip()}')
|
|
if err and 'Warning' not in err:
|
|
print(f' SQL Err: {err.strip()}')
|
|
print('Migration commands sent (check manually if needed)')
|
|
|
|
print('\nClearing ThinkPHP cache...')
|
|
stdin, stdout, stderr = ssh.exec_command(f'rm -rf {REMOTE_BASE}runtime/cache/* {REMOTE_BASE}runtime/temp/*')
|
|
print(stdout.read().decode())
|
|
|
|
sftp.close()
|
|
|
|
print('\nDone! Files uploaded and migration executed.')
|
|
print('Please verify the migration manually if needed:')
|
|
print(f' SQL: ALTER TABLE tool_user ADD COLUMN sec_question TINYINT(2) UNSIGNED NOT NULL DEFAULT 0;')
|
|
print(f' SQL: ALTER TABLE tool_user ADD COLUMN sec_answer VARCHAR(32) NOT NULL DEFAULT \'\';')
|
|
print(f' SQL: ALTER TABLE tool_user ADD INDEX idx_sec_question (sec_question);')
|
|
|
|
ssh.close()
|