- nav-back: add text-align:left to override page-header's center
- ble-connect mock: call bind API first to get fresh token before
confirm, instead of relying on potentially stale URL params
- utils.js: use local time instead of UTC for toMysqlDate, fixing
timezone mismatch with MySQL NOW() that caused bind tokens to
appear immediately expired
Server:
- POST /api/v1/admin/password: admin password change with bcrypt migration
- POST /api/v1/subscription/trial: user trial activation, one per user
- POST /api/v1/admin/devices/batch: bulk device import (up to 500)
- Add trial plan (7 days, free) to PLANS constant
Admin console:
- Settings page: add password change form with validation
- Device page: add batch import modal with textarea input
Miniprogram:
- Treating page: add back button with stop-treatment confirmation
- Index page: add mock device bind button (dev mode only)
- Login bcrypt migration: write password_salt = '' instead of NULL,
which violated the NOT NULL constraint and caused 500 errors
- Schema: widen password_hash from CHAR(64) to VARCHAR(100) for bcrypt
compatibility, add DEFAULT '' to password_salt
- init-db: add ALTER TABLE migrations for existing databases
- app.js: enrich error logging with method, path, SQL error details
- request.js: also remove admin_token_expiry when clearing auth on
1001/1002 response, preventing stale expiry value in storage
- 01-服务端架构.md: fix table count from 10 to 11
- 03-管理后台架构.md: add /api/v1 prefix to all API endpoint paths
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.
- bcrypt password hashing with auto-migration from SHA-256
- BLE command retry (3 attempts, 500ms delay, skip on disconnect)
- BLE auto-reconnect with service re-discovery on disconnect
- Treatment page disconnect/reconnect event handling
- Token refresh endpoint with 3-day grace period
- Client-side token auto-refresh when <24h remaining
- Single treatment record detail API with ownership check
- docs/reviews/代码质量审计报告-20260428.md: full audit results and fix summary
- docs/planning/12-待办事项决策分类.md: action items split by decision owner
(hardware team / product team / ops / independent)
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
- fix manual bind stuck at BLE scan, redirect to bind-success
- add 15s timeout and stopScan to ble-connect
- add stopScan method to ble.js
- add back-to-home button on bind-success page
- fix field name in subscribe-plans (plan -> plan_type)
- fix history.js to handle created_at field
- fix index.js to handle device name field
- add subscription route alias in request.js
- extend admin cloud function from 1 to 9 actions
- add mock mode to admin-console request.js
- remove unused discover page and legacy record function
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>