1. 前端个人中心新增真实姓名输入与实名状态展示,支持微信提现核验 2. 后端Auth接口新增真实姓名修改与手机号冲突校验逻辑 3. 后台新增用户详情综合看板,展示佣金、提现、分销等全量数据 4. 优化微信转账逻辑,支持paying状态重试时查询微信单号避免重复创建 5. 新增数据库ALTER脚本同步transfer_status字段结构 6. 新增部署与数据库变更工具脚本,支持线上线下环境同步
91 行
3.0 KiB
Python
91 行
3.0 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
部署最新修改至线上服务器
|
|
变动文件:
|
|
- application/admin/controller/fc/Userext.php
|
|
- application/admin/view/fc/userext/edit.html
|
|
- application/admin/view/fc/userext/detail.html
|
|
- application/api/controller/Auth.php
|
|
- public/assets/js/backend/fc/userext.js
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
import io
|
|
import paramiko
|
|
|
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace')
|
|
|
|
HOST = "8.137.181.63"
|
|
PORT = 22
|
|
USER = "root"
|
|
PASSWORD = "liyanxia@6688"
|
|
REMOTE_ROOT = "/www/wwwroot/fenleixinxi.gzyakj.com.cn"
|
|
LOCAL_ROOT = r"D:\Softwares\phpstudy_pro\WWW\fenleixinxi"
|
|
|
|
SYNC_FILES = [
|
|
"application/admin/controller/fc/Userext.php",
|
|
"application/admin/view/fc/userext/edit.html",
|
|
"application/admin/view/fc/userext/detail.html",
|
|
"application/api/controller/Auth.php",
|
|
"public/assets/js/backend/fc/userext.js",
|
|
]
|
|
|
|
def ssh_exec(client, cmd):
|
|
stdin, stdout, stderr = client.exec_command(cmd)
|
|
out = stdout.read().decode("utf-8", errors="replace").strip()
|
|
err = stderr.read().decode("utf-8", errors="replace").strip()
|
|
return out, err
|
|
|
|
def main():
|
|
print("=== [1/3] 连接线上服务器 ===")
|
|
client = paramiko.SSHClient()
|
|
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
client.connect(HOST, port=PORT, username=USER, password=PASSWORD, timeout=30)
|
|
print(f"✓ 成功连接 {HOST}")
|
|
|
|
sftp = client.open_sftp()
|
|
print("✓ SFTP 通道已建立")
|
|
|
|
print("\n=== [2/3] 同步最新修改文件 ===")
|
|
for rel_path in SYNC_FILES:
|
|
local_path = os.path.join(LOCAL_ROOT, rel_path.replace("/", "\\"))
|
|
remote_path = f"{REMOTE_ROOT}/{rel_path}"
|
|
|
|
if not os.path.exists(local_path):
|
|
print(f" ✗ 本地文件缺失: {local_path}")
|
|
continue
|
|
|
|
# 确保远程目录存在
|
|
remote_dir = os.path.dirname(remote_path)
|
|
ssh_exec(client, f"mkdir -p '{remote_dir}'")
|
|
|
|
sftp.put(local_path, remote_path)
|
|
ssh_exec(client, f"chown www:www '{remote_path}'")
|
|
file_size = os.path.getsize(local_path)
|
|
print(f" ✓ 已同步: {rel_path} ({file_size} 字节)")
|
|
|
|
sftp.close()
|
|
|
|
print("\n=== [3/3] 清理缓存与服务自检 ===")
|
|
ssh_exec(client, f"rm -rf {REMOTE_ROOT}/runtime/temp/* {REMOTE_ROOT}/runtime/cache/*")
|
|
print("✓ 线上 ThinkPHP 缓存清理完成")
|
|
|
|
# 接口健康自检
|
|
check_urls = [
|
|
("API 信息流接口", "https://fenleixinxi.gzyakj.com.cn/api/v1/home/feed"),
|
|
("API 分类接口", "https://fenleixinxi.gzyakj.com.cn/api/v1/home/categories"),
|
|
("后台登录页面", "https://fenleixinxi.gzyakj.com.cn/s.php/index/login"),
|
|
]
|
|
for name, url in check_urls:
|
|
cmd = f"curl -s -o /dev/null -w '%{{http_code}}' -k '{url}'"
|
|
code, _ = ssh_exec(client, cmd)
|
|
print(f" {name}: HTTP {code}")
|
|
|
|
client.close()
|
|
print("\n✓ 最新修改已顺利部署至线上服务器!")
|
|
|
|
if __name__ == "__main__":
|
|
main()
|