3.8 KiB
3.8 KiB
Repository Reality
- This repository now contains the WeChat Mini Program, the uniapp/Vue 3 admin console, a Tencent Cloud SCF HTTP backend, deployment docs, and design/planning references.
- Current backend implementation lives in
server/and targets Tencent Cloud HTTP Function + TencentDB MySQL + COS. - The previous WeChat Cloud Development function directories have been removed from the active architecture.
- Do not treat older planning/review documents as current implementation truth unless they explicitly say they are current.
Verified System Scope
- Mini Program: native WeChat
WXML/WXSS/JSunderminiprogram/. - Device communication: BLE 5.0 GATT via
miniprogram/services/ble.js. - Mini Program cloud API: HTTPS requests through
miniprogram/utils/request.jsto the configured API base inminiprogram/config/env.js. - Backend: Tencent Cloud HTTP Function, package root uses executable
server/scf_bootstrapto startnode scripts/local-server.json port9000. - Database: TencentDB MySQL schema in
server/sql/schema.sql. - Storage: Tencent COS for firmware/admin H5 artifacts.
- Admin console: uniapp + Vue 3 under
admin-console/, H5 build can be uploaded to COS.
Current Deployment Facts
- Test API base is configured as
https://1426323813-ilxkhlxf4p.ap-guangzhou.tencentscf.comin both Mini Program and admin console test configs. - SCF function name used during deployment:
jw-beauty-api. - SCF is an HTTP function, not an event function. Use
scf_bootstrap, notindex.main_handler, for this function type. - SCF must be attached to the TencentDB VPC/subnet when using the database private endpoint.
- Real secrets must remain in local
.envor SCF environment variables. Never commitserver/.env.
Integration Facts Worth Preserving
- BLE frame format implemented in code: header
0xAA 0x55, length, type, payload, XOR checksum over header/length/type/payload. - BLE services in the document/code:
FFE0device info,FFE1data communication,FFE2OTA. - Device binding is two-phase: backend bind request creates pending token, Mini Program sends BLE bind, device returns bind success, Mini Program confirms backend binding.
- Device commands are queued in MySQL
device_commands; Mini Program pulls pending commands and executes BLE commands. - Current main cloud path is HTTPS API through the Mini Program, not MQTT/IoT direct device-cloud communication.
User Profile / Login Reality
wx.login()only provides a code for backendopenid/session_keyexchange.- The current login page uses
wx.getUserProfile()to request WeChat's official profile authorization popup and then stores returned nickname/avatar if WeChat provides them. - WeChat may still return masked values such as
微信用户and default avatar. This is platform policy, not a backend bug. - If reliable nickname/avatar capture becomes required, use the newer
chooseAvatar+input type="nickname"flow, but that is not the current requested UX. - Phone number authorization is scaffolded through
open-type="getPhoneNumber"and backend/api/v1/user/phone, currently hidden in the login UI.
Build And Deploy Commands
Backend local:
cd server
npm install
npm run db:init
npm start
Admin H5:
cd admin-console
npm install
npm run build:h5
npm run deploy:cos
Mini Program BLE frame test:
cd miniprogram
node scripts/test-ble-frame.js
Working Rules For Future Sessions
- Use current executable config and code as the source of truth before relying on older planning docs.
- Do not reintroduce
wx.cloud, WeChat Cloud Development functions, or MQTT unless the architecture is explicitly changed again. - Do not commit
.env, cloud credentials, database passwords, signed COS URLs, or generated build artifacts. - Before committing, check
git status --shortand scan staged files for secret-looking values.