Files
xianyan/Scripts/upload_feed_fix.py
Developer a4a7e10722 feat: 完成2026-06-09版本迭代更新
此版本包含:
1. 新增位置消息发送与展示功能
2. 完善多语言本地化文案
3. 新增安卓端管理空间Activity与图标背景
4. 优化摇一摇开关逻辑与深度链接配置
5. 新增信息流平台过滤与A/B测试后台功能
6. 更新签名配置与构建脚本
7. 修复若干已知问题与代码优化
2026-06-09 23:18:13 +08:00

68 lines
2.2 KiB
Python

#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@name 上传Feed控制器到服务器
@desc SFTP上传修复后的Feed.php到服务器
@created 2026-06-09
@updated 2026-06-09
"""
import paramiko
import os
# 服务器配置
HOST = '123.207.67.197'
PORT = 22
USER = 'root'
PASS = '520Kiss123'
# 本地文件 -> 远程路径映射
UPLOAD_MAP = {
r'docs\toolsapi\application\api\controller\Feed.php': '/www/wwwroot/tools.wktyl.com/application/api/controller/Feed.php',
r'docs\toolsapi\application\admin\controller\FeedWeight.php': '/www/wwwroot/tools.wktyl.com/application/admin/controller/FeedWeight.php',
r'docs\toolsapi\application\admin\view\feed_weight\index.html': '/www/wwwroot/tools.wktyl.com/application/admin/view/feed_weight/index.html',
r'docs\toolsapi\public\assets\js\backend\feed_weight.js': '/www/wwwroot/tools.wktyl.com/public/assets/js/backend/feed_weight.js',
}
def upload():
local_base = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
print(f"本地项目根目录: {local_base}")
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
print(f"连接服务器 {HOST}:{PORT}...")
ssh.connect(HOST, port=PORT, username=USER, password=PASS, timeout=15)
sftp = ssh.open_sftp()
print("连接成功!")
for local_rel, remote_path in UPLOAD_MAP.items():
local_path = os.path.join(local_base, local_rel)
if not os.path.exists(local_path):
print(f"[跳过] 本地文件不存在: {local_path}")
continue
# 确保远程目录存在
remote_dir = os.path.dirname(remote_path)
try:
sftp.stat(remote_dir)
except FileNotFoundError:
print(f" 创建远程目录: {remote_dir}")
print(f"上传: {local_rel} -> {remote_path}")
sftp.put(local_path, remote_path)
print(f" ✓ 上传成功")
sftp.close()
# 清除服务器缓存
print("\n清除服务器运行时缓存...")
stdin, stdout, stderr = ssh.exec_command('rm -rf /www/wwwroot/tools.wktyl.com/runtime/cache/*')
print(f" 缓存清除: {stdout.read().decode()}")
ssh.close()
print("\n✓ 全部上传完成!")
if __name__ == '__main__':
upload()