提交图
7 次代码提交
作者 SHA1 备注 提交日期
Guoguo bb4b80f867 refactor: restructure entire project for human maintainability
Server:
- Add Express framework, replace custom router/request parser
- Create DAO layer (12 files) centralizing all 73 SQL queries
- Rewrite 7 route files as thin Express controllers calling DAOs
- Add SCF-to-Express adapter (lib/serverless.js)
- Add auth middleware (middleware/auth.js)
- Remove dead code from lib/auth.js

Admin console:
- Extract DataTable component (table + pagination)
- Extract ConfirmModal component (modal + form styles)
- Create listMixin for paginated list pages
- Move form styles to common.css for slot compatibility
- Refactor device + subscription pages as examples

Miniprogram:
- Split 734-line BLE monolith into 4 focused modules
  (protocol, connection, commands, barrel index)
- Create API module (utils/api.js) with named functions
- Create page utilities (utils/page.js)
- Refactor index + profile pages to use API module
2026-04-29 05:58:20 -07:00
Guoguo 8d1cde8636 fix: resolve 8 bugs and add admin features
Miniprogram:
- Profile "我的设备": show unbind option when device bound, scan when not
- Add device status indicator (已绑定/未绑定) to profile menu

Admin console:
- Login: add @confirm to inputs so Enter key submits the form
- Record detail: wire up 详情 link with modal showing full record info
- Dashboard: add subscription stats row (月卡/年卡/试用/收入)
- Subscription: add 取消 action for active subscriptions
- Format: fix -8h timezone display for UTC ISO date strings

Server:
- POST /api/v1/admin/subscriptions/cancel: cancel active subscriptions
- Dashboard API: include sub_stats (plan counts + monthly revenue)
- IP extraction: add X-Forwarded-For fallback for logging
2026-04-29 05:33:12 -07:00
Guoguo 6201b97fcd fix: resolve critical audit issues across all modules
Server: add filter/search/pagination to admin list endpoints, enrich
user/device queries with JOINs and subqueries, prevent duplicate active
subscriptions on creation.

Admin console: fix record page TypeError on numeric record_id, correct
mode comparison (integer vs string), fix device detail field names and
command opcode, remove hardcoded login credentials, wire up dead buttons
(unbind, view logs, export), fix user/subscription field mappings.

Miniprogram: fix subscription status string/number mismatches across
index/treatment-setup/profile pages, fix device name field reference,
fix treatment-done null device_id by capturing at onLoad.
2026-04-28 18:46:03 -07:00
Guoguo b80e872600 fix: comprehensive security, quality and consistency fixes
Server:
- Block startup with default JWT secrets in production
- Make subscription verify admin-only (no payment integration yet)
- Add device ownership validation on command/result, event, treatment/sync
- Remove admin token from request body fallback
- Add pageParams boundary protection (pageSize capped at 100)
- Fix COS getObjectUrl to use callback-based Promise
- Add settings key whitelist matching frontend fields
- Add user existence check before subscription creation
- Fix firmware always returning has_update:true
- Replace hardcoded trial subscription with actual DB query
- Extract shared utilities (limitClause, toMysqlDate, formatDate)

Miniprogram:
- Replace fake PD random data with placeholder
- Mark client-timer treatment completions with source field
- Disable mock.js
- Fix BLE listener leaks (save refs, cleanup in onUnload)
- Fix ble.off clearing all listeners (pass specific callback)
- Add BLE disconnect detection via onBLEConnectionStateChange
- Fix subscription status type consistency (number not string)
- Fix scan callback accumulation in ble.js
- Fix history stats accumulation across pages
- Fix subscribe-success/treatment-done hardcoded values
- Fix profile subscription view logic
- Replace purchase flow with admin-contact modal
- Add error logging in command-sync report

Admin console:
- Fix AdminLayout logout (require->import, logout->clearToken)
- Remove all mock data from production request.js
- Replace dashboard fake data with real API calls
- Replace monthly_revenue with subscription_count
- Fix subscription stats fallback (|| -> ??)
- Add token expiry tracking (7 days)
- Unify device status map and subscription status text
- Fix user page record link navigation
- Fix subscription createForm.user_id type handling
- Add error feedback in all empty catch blocks
- Remove unused remember checkbox and uview-plus dependency
- Extract common CSS to shared stylesheet (-900 lines)
- Extract formatDate to shared utils/format.js
- Show real admin name in layout header
2026-04-28 08:46:59 -07:00
Guoguo 5064cf119d fix(ui): polish miniprogram and admin console details
小程序修复:
- 首页/我的/记录页移除自定义头部,使用原生导航栏
- tabBar '护理记录' 改为 '记录'
- 智能模式跳转auto-scan页面(不再跳过)
- 扫码区域尺寸 300→360rpx,图标 100→120rpx
- 护理中倒计时 120→144rpx
- 完成页图标 120→140rpx
- 完成页时长格式 '10分0秒' → '10分钟'
- 蓝牙连接 '连接中' → '点击连接'
- 订阅套餐默认选中年卡
- 订阅成功页改为动态数据(非硬编码)
- 我的页增加退出登录按钮
- 护理记录日期支持'今天/昨天'相对格式
- 扫描进度居中
- 锁定模式图标加灰度滤镜

管理后台修复:
- 所有页面移除重复页面标题
- 仪表盘统计卡片改为垂直布局
- 快捷操作图标统一粉色+箭头
- 设备管理搜索placeholder和库存badge修正
- 用户管理头像、次后缀、月卡/试用badge颜色修正
- 订阅管理stat背景改白色、过期改红色、tab切换修复
- 护理记录模式badge修正
- 操作日志改为平铺列表
- 系统设置开关改绿色、表单改水平布局
- 全局背景色 #f5f5f5 → #f0f2f5
2026-04-23 01:18:50 +08:00
Guoguo aa4b215c8b feat(ui): redesign all miniprogram pages
- 全局样式改为粉色(#E6508C)/金色(#DCB982)/绿色(#52c41a)配色
- 所有非tab页使用自定义导航栏,带彩色头部+标题+副标题
- login页: 粉色头部+🌸图标+微信授权登录
- scan页: 粉色头部+虚线扫码框+手动输入按钮
- ble-connect页: 蓝牙提示+搜索中/已发现设备卡片
- bind-success页: 绿色头部+成功图标+7天试用提示卡
- wear-check页: 设备信息行+佩戴指引卡片
- index首页: 粉色设备卡片+开始护理/设备管理按钮
- treatment-setup页: 模式选择+面部地图选区域
- auto-scan页: 面部轮廓+扫描线动画+检测标签
- treating页: 蓝色头部+大倒计时+渐变进度条+放松提示
- treatment-done页: 绿色头部+统计卡片+已记录提示
- subscribe-prompt页: 普通/智能模式对比+试用提示+金色订阅按钮
- subscribe-plans页: 金色头部+服务卡片+月卡/年卡选择
- subscribe-success页: 绿色头部+订阅详情卡+金色按钮
- profile页: 渐变头部+用户行+订阅卡+菜单列表
- history页: 粉色统计行+模式标签记录列表
2026-04-22 21:40:55 +08:00
Guoguo a84e37a6e2 feat: init project with miniprogram, cloud functions and admin console 2026-04-22 21:24:20 +08:00