显示FTP列表
(self)
| 530 | return True |
| 531 | |
| 532 | def list_ftp(self): |
| 533 | """显示FTP列表""" |
| 534 | try: |
| 535 | result = public.M('ftps').field('id,name,path,status,ps,addtime').select() |
| 536 | |
| 537 | if not result: |
| 538 | print(Colors.warning("暂无FTP账户")) |
| 539 | return |
| 540 | |
| 541 | headers = ["ID", "FTP用户名", "状态", "路径", "备注", "创建时间"] |
| 542 | rows = [] |
| 543 | |
| 544 | for ftp_user in result: |
| 545 | status = Colors.success("正常") if ftp_user['status'] == '1' else Colors.error("已禁用") |
| 546 | rows.append([ |
| 547 | ftp_user['id'], |
| 548 | ftp_user['name'], |
| 549 | status, |
| 550 | ftp_user['path'][:40] + "..." if len(ftp_user['path']) > 40 else ftp_user['path'], |
| 551 | ftp_user.get('ps', '-')[:20], |
| 552 | ftp_user['addtime'] |
| 553 | ]) |
| 554 | |
| 555 | TablePrinter.print_table(headers, rows, f"FTP账户列表 (共 {len(rows)} 个)") |
| 556 | |
| 557 | except Exception as e: |
| 558 | print(Colors.error(f"获取FTP列表失败: {str(e)}")) |
| 559 | |
| 560 | def add_ftp(self, username: str, password: str, path: str, **kwargs): |
| 561 | """ |