155 Commits

Author SHA1 Message Date
admin 65a9465af4 fix: logout requires both device_id and instance_id
Only clear specific instance on specific device
Remove cross-device and all-instances clearing

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-28 18:24:23 +08:00
admin 008e66f84e fix: require instance_id when device_id is provided on logout
- Only device_id without instance_id returns error
- Three valid combinations:
  - device_id + instance_id: clear specific instance
  - only instance_id: clear instance across devices
  - no params: clear all instances

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-28 18:20:33 +08:00
admin ab3f188c04 fix: logout only clears instances, not devices
- Remove device deletion on logout
- Only delete DeviceSession records
- Support clearing specific instance or all instances

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-28 18:18:31 +08:00
admin f5343281a3 feat: add app user routes (logout, user-info, avatar, tickets)
- Logout: clear device sessions on logout
- User info: return expiry/balance based on billing type
- Avatar upload: support jpg/png/gif/webp, max 2MB
- App tickets: create, reply, close tickets for app users
- Add ClosedAt field to Ticket model

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-28 18:09:05 +08:00
admin 5298f8f58e feat: return expiry/balance based on billing type on login
- Return expiry_at for subscription mode
- Return balance for usage-based mode
- Return is_permanent for permanent members

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-28 17:58:33 +08:00
admin 16c68a855b fix: version display and comparison issues
- Remove duplicate 'v' prefix in version display
- Add version string cleanup (trim spaces, remove v/V prefix)
- Use custom download URL when set
- Fix has_update logic for same version comparison

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-28 16:53:46 +08:00
admin 53fd9ff7dc feat: add custom download URL for manual update method
- Add custom_download_url field to Version model
- Show custom download URL input when update method is 'manual'
- Use platform default URL if custom URL is not set
- Add i18n translations for new field

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-28 16:06:48 +08:00
admin ed4a561704 feat: add application API documentation and C++ SDK
- Add complete API documentation for application integration (docs/API_DOCUMENT.md)
- Fix check-update API to use version ID comparison instead of string comparison
- Add validation: client version must exist in server version list
- Add support for patch/incremental updates with base_version check
- Add C++ SDK with HTTP client, JSON parser, and crypto support
- Add simple_test.cpp for standalone testing on Windows

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-28 11:58:44 +08:00
admin ed73bb470c feat: agent devices/sessions filter by agent-associated users only
- Add created_by field to AppUser model to track who created the user
- Set created_by when agent creates users
- Extract getAgentUserIDs() helper: finds users who recharged with agent/sub-agent cards OR were created by agent/sub-agent
- Extract getAgentAppIDs() helper: finds agent's authorized applications
- Refactor handleGetUsers and checkAgentUserPermission to use getAgentUserIDs
- Create agent-specific handleGetDevices: filter by agent user IDs + app IDs
- Create agent-specific handleGetSessions: filter by agent user IDs + app IDs
- Replace admin handler references with agent-specific handlers for GET routes
2026-05-11 11:53:43 +08:00
admin 853c22fdbe feat: add balance display, user columns, device mgmt and sessions for agent
- Backend: add balance to agent stats API
- Backend: return full user details (balance, expiry, online_status, device_count, application) in agent users API
- Backend: export admin device/session handlers, add agent routes for devices and sessions
- Backend: add card type permission check and balance deduction for agent user creation
- Backend: extract checkAgentUserPermission helper, add user edit API
- Frontend: add balance card to agent dashboard
- Frontend: add application, online_status, device_count, balance, expiry_at columns to agent user table
- Frontend: add agent devices page (reuse admin data-table component)
- Frontend: add agent sessions page (reuse admin data-table component)
- Frontend: add devices and sessions to agent navigation and routes
- Add i18n keys for agent devices, sessions, user columns, dashboard balance
2026-05-11 10:46:29 +08:00
admin a76a30ee78 feat: add agent user edit, card type permission check and balance deduction
- Backend: check AgentApplicationCardType.can_generate before allowing card recharge
- Backend: deduct agent balance and record consumption when creating user with card
- Backend: add GET /agent/users/:id and PUT /agent/users/:id for user edit
- Backend: extract checkAgentUserPermission helper, refactor handleUpdateUserStatus
- Frontend: add user edit page ([id].vue) with username/email/password
- Frontend: add edit action in user list dropdown menu
- Frontend: add route for agent user edit page
- Add i18n keys for agent user edit
2026-05-11 08:48:02 +08:00
admin 57e1d10689 feat: add user creation and ban/unban for agent backend
- Backend: POST /agent/users - create user with optional card recharge
- Backend: PUT /agent/users/:id/status - ban/unban user
- Frontend: add create user page for agent (select app, card type)
- Frontend: add ban/unban action in user list with confirm dialog
- Frontend: add actions dropdown column in user data table
- Fix: cloud variables records page i18n key (agent.finance.to -> agent.cloudVariables.records.to)
- Add i18n keys for agent user management (create, ban, unban)
2026-05-11 08:24:30 +08:00
admin 3cea807353 refactor: change agent cloud data permission to cloud variables only
- Rename permission from '查看云端数据' to '查看云端变量'
- Remove cloud constants API and page for agents
- Add cloud variable records API for agents (stream type)
- Add agent cloud-variables page with full variable details
- Add agent cloud-variable records page (read-only)
- Update navigation from cloud-data to cloud-variables
- Update i18n keys: cloudData -> cloudVariables
- Backend returns var_type, default_value, max_records etc.
- Records page supports dynamic columns and date filtering
2026-05-11 08:05:40 +08:00
admin 6dcb5cde02 fix: add can_view_cloud_data to login and profile API responses
- Add can_view_cloud_data field to auth login response
- Add can_view_cloud_data field to agent profile response
- Fetch latest user permissions from /agent/profile on agent layout mount
- Update localStorage with latest can_view_cloud_data value
2026-05-11 00:15:21 +08:00
admin df4ad079f3 fix: agent finance page styling and cloud data API implementation
- Fix agent finance page: confirmed backend integration is working
- Add agent cloud-variables and cloud-constants API endpoints
- Rewrite agent cloud-data page to use real API calls instead of mock data
- Fix API path: /agent/applications -> /agent/apps
- Remove 'all' value from app filter SelectItem (empty string issue)
- Add cloudData i18n keys for zh and en
- Cloud data is read-only for agents, with CanViewCloudData permission check
2026-05-10 23:38:04 +08:00
admin 409ec4f75b 修复: 1.管理员编辑代理云端数据权限switch无效(后端缺少CanViewCloudData字段) 2.代理卡密status显示disabledbanned 3.代理用户管理只显示代理/子代理卡密充值过的用户 2026-05-10 14:12:35 +08:00
admin f3b9feca6a agent后台finance和users添加服务端分页和统计 2026-05-10 08:41:49 +08:00
admin 3cbb607ff3 修复所有分页页面统计从当前页计算的问题,改为服务端统计 2026-05-10 07:04:22 +08:00
admin f198ae268e 修复admin卡密统计GORM累积条件问题、data-table传递server-pagination 2026-05-10 05:44:16 +08:00
admin ba7b6015eb 修复管理员卡密管理页面统计数据显示不准确 2026-05-10 04:44:18 +08:00
admin c495f9b417 修复代理商卡密管理页面:增加服务端筛选、批量导出、复制功能 2026-05-10 04:27:55 +08:00
admin 83cd822717 fix: 修复代理卡密统计和列表查询逻辑
- 前端使用后端返回的total字段显示总数
- 后端查询条件兼容旧数据(agent_id IS NULL AND creator_id = ?)
- handleGetStats统计接口使用相同查询逻辑

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-10 02:36:26 +08:00
admin d83e7dfac9 fix: 添加代理生成卡密余额检查和扣费逻辑
- 检查代理余额是否足够
- 检查并限制生成数量(1-100)
- 使用事务确保数据一致性
- 扣除代理余额
- 记录消费记录

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-10 02:20:45 +08:00
admin 0cc3e85714 fix: 修复代理卡密列表数据不显示问题
- Card模型添加AgentID字段
- 生成卡密时设置AgentID
- handleGetCards返回正确格式的数据(包含app_name, card_type_name, code等)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-10 02:04:45 +08:00
admin a2ce784ac0 fix: 修复代理生成卡密权限检查和参数问题
- 后端兼容application_id和app_id参数
- 添加卡类权限检查,确保代理只能生成有权限的卡类
- 前端使用application_id参数名
- 移除卡类显示中的billing_type原始值,改为显示价格

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-10 01:16:28 +08:00
admin e63753a853 feat: 添加代理获取应用详情和卡类列表API
- 添加 GET /agent/apps/:id 接口
- 返回代理有权使用的卡类列表及其价格

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-09 23:58:34 +08:00
admin 08b4003db8 refactor: 清理多余字段并重新设计个人中心页面 2026-05-08 23:45:11 +08:00
admin 65fa7146e8 refactor: 拆分更新类型(全量/补丁)和更新方式(自动/手动),移除force_update字段 2026-05-08 23:34:14 +08:00
admin de0de10b8d refactor: 移除min_version/base_version_id,后端自动确定基础版本 2026-05-08 23:17:53 +08:00
admin 48ec0f97f7 fix: 状态列根据是否有更新的强制版本判断生效/失效 2026-05-08 22:54:38 +08:00
admin 426290e299 fix: 添加调试日志排查版本更新不生效问题 2026-05-08 21:34:22 +08:00
admin 3b4b0ac1e3 fix: 修复版本更新时字段未正确保存的问题 2026-05-08 21:16:17 +08:00
admin 01ca9e3df1 重构版本状态为动态计算
- 状态不再写入数据库,改为查询时动态计算
- 每个应用的最新版 = 有效, 旧版 = 已失效
- 移除后端 status 筛选参数
- 移除前端 status 筛选器
- 移除编辑页的状态手动编辑
- 移除创建版本时自动更新旧版本状态的逻辑
2026-05-08 16:40:02 +08:00
admin e2ebb6e46e 版本管理全面增强:状态、补丁更新、热更新
1. 自动状态管理
   - 新增版本自动标记状态:最新版本为'有效',旧版本自动标记为'已失效'
   - 前端列表页新增状态列和状态筛选

2. 更新方式升级
   - 更新方式从手动/自动改为:手动更新/热更新/完整更新
   - 热更新:运行时增量替换文件,无需重启
   - 完整更新:下载完整包替换,需重启

3. 补丁更新支持
   - 新增 base_version_id 字段支持增量补丁
   - 创建版本时可选择基础版本,自动识别为补丁模式
   - 补丁模式仅上传变更文件

4. ZIP解析上传(已有功能完善)
   - 上传ZIP自动解析文件列表
   - 支持选择入口文件

5. 国际化完善
   - 中英文新增状态、更新方式等翻译
2026-05-08 16:21:35 +08:00
admin ecf54d3e3f 修复仪表板用户分布统计:改用AppUser统计用户数而非设备数 2026-05-08 16:06:34 +08:00
admin 5e79955428 修复用户分布地图显示问题
- 修改后端返回正确的国家英文名称(China)以匹配世界地图
- 正确计算在线/离线设备数量
- 确保数据一致性:总数 = 在线 + 离线
2026-05-08 15:58:18 +08:00
admin 3a734e6dad 修复控制台首页的两个问题
1. 修复用户分布显示问题:
   - 后端添加 online 和 offline 字段到用户分布数据
   - 确保前端能正确显示在线和离线用户数

2. 修复 ECharts 初始化报错:
   - 添加 DOM 元素存在性检查
   - 添加异步加载时的卸载检查
   - 在重新初始化前清理旧实例
   - 防止页面切换时的空指针错误
2026-05-08 15:34:00 +08:00
admin 63cc2f80b3 修复编译错误:添加strings包导入和修复时间类型转换
- announcements.go: 添加strings包导入
- devices.go: 添加strings包导入
- cloud.go: 修复CreatedAt时间类型转换为字符串
2026-05-08 15:08:51 +08:00
admin dde179a896 修复工单、日志、卡密管理页面的分页和筛选功能
- 工单管理:后端添加分页和筛选支持(status, priority, type, 日期范围)
- 日志管理:前端使用服务端分页和筛选(后端已支持)
- 卡密管理:前端使用服务端分页和筛选(后端已支持)
- 所有页面移除前端筛选逻辑,改为服务端筛选
- 修复分页总数与筛选数据不匹配的问题
- 添加watch监听筛选条件变化,自动刷新数据
2026-05-08 14:45:38 +08:00
admin d0ef52ab4f 优化分页和筛选功能:实现服务端分页和筛选,修复总数不匹配问题
- 优化设备管理、版本管理、用户管理、在线实例、公告管理页面的分页功能
- 后端添加筛选参数支持(application_id, status, type, search等)
- 前端移除冗余的前端筛选逻辑,改为服务端筛选
- 修复分页总数与筛选数据不匹配的问题
- 优化云端变量记录页面的时间筛选和搜索功能
- 修复DateTimePicker组件关闭后不自动更新的问题
2026-05-08 13:45:21 +08:00
admin 29fb448d04 fix: 优化云端变量记录页面样式,对齐其他表格页面
- 移除ID列的font-mono text-xs样式,改用与其他页面一致的truncate样式
- 移除toolbar顶部多余的批量删除按钮,只保留BulkActions组件内的
- 搜索框和日期选择器尺寸对齐其他页面(h-8)
- 日期格式化对齐其他页面(zh-CN格式)
- 动态字段值显示改用truncate+title,替代pre标签
- 移除raw_data调试字段和诊断卡片
2026-05-08 09:31:47 +08:00
admin 375fd46224 fix: 修复云端变量记录data为null的问题
- 后端: handleAddRecord增加recordData nil检查,避免存入null
- 后端: 记录读取改用interface{}替代map[string]interface{}解析JSON
- 后端: JSON解析失败时回退返回原始字符串
- 后端: API返回raw_data字段暴露数据库原始数据用于诊断
- 后端: app/cloud.go同步修复同样的JSON解析问题
- 前端: parseRecordData增加raw_data回退解析
- 前端: 添加数据诊断卡片显示原始数据结构
2026-05-08 02:31:15 +08:00
admin 48889a1c90 perf: 优化上传文件缓存策略
- 上传新文件时删除同类型旧文件,避免文件堆积
- 文件名带时间戳,每次上传生成新 URL
- 缓存时间设为 1 年 + immutable,文件更新后 URL 变化自动重新请求
2026-05-07 14:12:45 +08:00
admin 4ffb7c0071 perf: 为 /uploads 静态资源添加缓存控制
- 设置 Cache-Control: public, max-age=3600 (缓存 1 小时)
- 减少 logo、favicon 等上传文件的重复请求
2026-05-07 14:04:20 +08:00
admin f290b81700 perf: 优化 Dashboard 接口性能,并行执行数据库查询
- 使用 goroutine 并行执行 8 个数据库查询
- 将串行查询改为并行,显著减少响应时间
- 使用 sync.WaitGroup 和 sync.Mutex 保证线程安全
2026-05-07 13:58:28 +08:00
admin 8811511ff8 refactor: 删除未实现的 call-function API
- 该功能与 dynamic-code/:key/execute 重复
- 保持代码整洁,移除无用代码
2026-05-07 13:22:43 +08:00
admin 6bdffcd90f fix: 云端函数区分当前用户和目标用户
- user 始终为当前登录用户(从 token 获取)
- 新增 targetUser 变量,当请求参数指定 user_id 时注入
- 同时注入 targetSubscription、targetUserVariables、targetDevices
2026-05-07 13:15:23 +08:00
admin 551eff2f60 fix: 云端函数默认注入当前登录用户信息
- 当请求参数未指定 user_id 时,使用 token 中的用户 ID
- 确保 user、subscription、devices 等变量始终有值
2026-05-07 13:13:18 +08:00
admin e019f6a55c fix: 移除云端函数HTTP客户端硬编码代理
- 将硬编码的代理地址改为从环境变量读取
- 使用 http.ProxyFromEnvironment 让代理配置更灵活
- 服务器环境不设置代理环境变量即可直连
2026-05-07 12:39:33 +08:00
admin 8c48c002d3 fix: 修复设备列表API的Count查询导致Find失败的问题 2026-05-07 09:39:53 +08:00