docs: add release runbook and seed data

This commit is contained in:
王鹏
2026-07-07 16:49:47 +08:00
parent 9ad43005c4
commit c2e46efdd9
4 changed files with 240 additions and 0 deletions

View File

@@ -17,7 +17,24 @@ cd backend
mvn test mvn test
``` ```
## Applications
- Backend API: `http://localhost:8080`
- Knife4j docs: `http://localhost:8080/doc.html`
- Admin web: `http://localhost:5173`
- Rider H5: `http://localhost:5174`
- Resident miniapp: open `miniapp/project.config.json` in WeChat DevTools
Demo accounts:
- Admin: `admin / admin123`
- Merchant: `merchant / merchant123`
- Rider: `rider / rider123`
- Resident: local dev miniapp login
Project docs: Project docs:
- `docs/superpowers/specs/2026-07-07-linxiaobang-prd-design.md` - `docs/superpowers/specs/2026-07-07-linxiaobang-prd-design.md`
- `docs/superpowers/plans/2026-07-07-linxiaobang-phase-one-implementation.md` - `docs/superpowers/plans/2026-07-07-linxiaobang-phase-one-implementation.md`
- `docs/api/manual-test-checklist.md`
- `docs/deploy/local-runbook.md`

View File

@@ -0,0 +1,94 @@
-- Development seed data for one-community MVP validation.
-- Demo login accounts are currently hard-coded in AuthService:
-- admin/admin123, merchant/merchant123, rider/rider123, resident via dev-miniapp-login.
INSERT INTO tenant (id, name, status) VALUES
(1, 'LinHelp Demo Tenant', 'ENABLED');
INSERT INTO community (id, tenant_id, name, address, contact_name, contact_phone, status) VALUES
(1, 1, '邻小帮示范小区', '示范路 1 号', '社区管理员', '13800000000', 'ENABLED');
INSERT INTO community_module_config (id, tenant_id, community_id, module_code, enabled) VALUES
(1, 1, 1, 'GOODS', 1),
(2, 1, 1, 'EXPRESS', 1),
(3, 1, 1, 'GROUP_BUY', 1),
(4, 1, 1, 'SECOND_HAND', 1),
(5, 1, 1, 'NOTICE', 1),
(6, 1, 1, 'BANNER', 1);
INSERT INTO sys_role (id, code, name) VALUES
(1, 'SUPER_ADMIN', '超级管理员'),
(2, 'COMMUNITY_ADMIN', '社区管理员'),
(3, 'MERCHANT', '商家'),
(4, 'RIDER', '配送员'),
(5, 'RESIDENT', '居民');
INSERT INTO app_user (id, tenant_id, community_id, openid, nickname, phone, status) VALUES
(1, 1, 1, NULL, '社区管理员', '13800000001', 'ENABLED'),
(2, 1, 1, NULL, '鲜果便利商家', '13800000002', 'ENABLED'),
(3, 1, 1, NULL, '配送员小林', '13800000003', 'ENABLED'),
(1000, 1, 1, 'dev-openid-1000', '示范居民', '13800001000', 'ENABLED');
INSERT INTO user_role (id, user_id, role_code, tenant_id, community_id, merchant_id) VALUES
(1, 1, 'COMMUNITY_ADMIN', 1, 1, NULL),
(2, 2, 'MERCHANT', 1, 1, 1),
(3, 3, 'RIDER', 1, 1, NULL),
(4, 1000, 'RESIDENT', 1, 1, NULL);
INSERT INTO user_address (id, tenant_id, community_id, user_id, contact_name, phone, building, room, detail, is_default) VALUES
(1, 1, 1, 1000, '示范居民', '13800001000', '1 号楼', '1201', '东门旁', 1);
INSERT INTO merchant (id, tenant_id, community_id, name, merchant_type, contact_name, contact_phone, status) VALUES
(1, 1, 1, '邻小帮社区便利店', 'CONVENIENCE', '王店长', '13800002000', 'ENABLED');
INSERT INTO delivery_user (id, tenant_id, community_id, user_id, name, phone, status) VALUES
(1, 1, 1, 3, '配送员小林', '13800000003', 'ENABLED');
INSERT INTO product_category (id, tenant_id, community_id, name, sort_no, enabled) VALUES
(1, 1, 1, '水果', 10, 1),
(2, 1, 1, '零食', 20, 1),
(3, 1, 1, '饮料', 30, 1),
(4, 1, 1, '早餐', 40, 1),
(5, 1, 1, '蔬菜', 50, 1),
(6, 1, 1, '日用品', 60, 1);
INSERT INTO product (id, tenant_id, community_id, merchant_id, category_id, name, cover_url, description, unit_name, status) VALUES
(1, 1, 1, 1, 1, '烟台苹果', '/mock/apple.jpg', '脆甜多汁,适合家庭日常补货', '', 'ON_SHELF'),
(2, 1, 1, 1, 1, '海南香蕉', '/mock/banana.jpg', '当日到货,成熟度适中', '', 'ON_SHELF'),
(3, 1, 1, 1, 2, '每日坚果', '/mock/nuts.jpg', '独立小包装,办公室零食', '', 'ON_SHELF'),
(4, 1, 1, 1, 2, '海苔脆片', '/mock/seaweed.jpg', '轻食小零嘴', '', 'ON_SHELF'),
(5, 1, 1, 1, 3, '鲜牛奶', '/mock/milk.jpg', '冷藏配送', '', 'ON_SHELF'),
(6, 1, 1, 1, 3, '矿泉水', '/mock/water.jpg', '整箱可送上门', '', 'ON_SHELF'),
(7, 1, 1, 1, 4, '鲜肉包', '/mock/baozi.jpg', '早餐预订,次日送达', '', 'ON_SHELF'),
(8, 1, 1, 1, 4, '豆浆', '/mock/soy-milk.jpg', '现磨豆浆', '', 'ON_SHELF'),
(9, 1, 1, 1, 5, '上海青', '/mock/greens.jpg', '新鲜蔬菜,约 500g', '', 'ON_SHELF'),
(10, 1, 1, 1, 6, '抽纸三包装', '/mock/tissue.jpg', '家庭常备日用品', '', 'ON_SHELF');
INSERT INTO product_sku (id, tenant_id, community_id, product_id, sku_name, price_cent, origin_price_cent, stock, enabled) VALUES
(1, 1, 1, 1, '约 1kg', 1290, 1590, 80, 1),
(2, 1, 1, 2, '约 1.5kg', 990, 1290, 70, 1),
(3, 1, 1, 3, '12 包', 2990, 3590, 45, 1),
(4, 1, 1, 4, '原味 40g', 690, 890, 90, 1),
(5, 1, 1, 5, '950ml', 1390, 1590, 60, 1),
(6, 1, 1, 6, '24 瓶', 2990, 3590, 30, 1),
(7, 1, 1, 7, '4 个', 800, 1000, 100, 1),
(8, 1, 1, 8, '300ml', 350, 500, 120, 1),
(9, 1, 1, 9, '约 500g', 590, 790, 80, 1),
(10, 1, 1, 10, '3 包', 1890, 2290, 55, 1);
INSERT INTO group_buy (id, tenant_id, community_id, merchant_id, title, cover_url, description, price_cent, origin_price_cent, stock, deadline_at, expected_delivery_at, status) VALUES
(1, 1, 1, 1, '今日团购:麒麟西瓜', '/mock/watermelon.jpg', '满 20 份成团,晚饭前送到小区门口', 1990, 2590, 120, DATE_ADD(NOW(), INTERVAL 1 DAY), DATE_ADD(NOW(), INTERVAL 2 DAY), 'ONGOING');
INSERT INTO notice (id, tenant_id, community_id, title, content, category, pinned, status, published_at) VALUES
(1, 1, 1, '本周六小区便民服务日', '物业联合邻小帮提供快递代取、生活用品预订和家电检测服务。', 'ACTIVITY', 1, 'PUBLISHED', NOW()),
(2, 1, 1, '地下车库临时清洗通知', '本周三 9:00-12:00 清洗地下车库,请车主提前挪车。', 'PROPERTY', 0, 'PUBLISHED', NOW());
INSERT INTO banner (id, tenant_id, community_id, title, image_url, link_type, link_value, sort_no, enabled) VALUES
(1, 1, 1, '邻小帮今日到家', '/mock/banner-home.jpg', 'PAGE', '/pages/products/index', 10, 1);
INSERT INTO second_goods (id, tenant_id, community_id, user_id, title, price_cent, description, category, contact_phone, trade_method, status) VALUES
(1, 1, 1, 1000, '九成新儿童自行车', 12000, '适合 5-8 岁儿童,小区内可面交。', '母婴', '13800001000', 'FACE_TO_FACE', 'PUBLISHED'),
(2, 1, 1, 1000, '闲置置物架', 3000, '待后台审核的示例闲置。', '家居', '13800001000', 'FACE_TO_FACE', 'PENDING_REVIEW');
INSERT INTO second_goods_img (id, tenant_id, community_id, second_goods_id, image_url, sort_no) VALUES
(1, 1, 1, 1, '/mock/bike.jpg', 1);

View File

@@ -0,0 +1,26 @@
# Manual Test Checklist
Use this checklist after starting the backend, admin web, rider H5, and opening the miniapp in WeChat DevTools.
- [ ] Admin can log in with `admin / admin123`.
- [ ] Admin can create and publish a notice.
- [ ] Miniapp can list published notices.
- [ ] Admin can create product and SKU stock.
- [ ] Miniapp can submit goods order.
- [ ] Admin can confirm goods order and mark prepared.
- [ ] Admin can assign delivery order to rider.
- [ ] Rider can log in with `rider / rider123`.
- [ ] Rider can start delivery and upload delivered photo.
- [ ] Miniapp can confirm goods order completion.
- [ ] Miniapp can submit express pickup order.
- [ ] Admin can confirm express order and assign rider.
- [ ] Rider can mark express order delivered.
- [ ] Miniapp can submit group buy order before cutoff.
- [ ] Admin can review secondhand listing.
- [ ] Public secondhand list only shows approved listings.
Notes:
- Resident miniapp login uses `/api/auth/dev-miniapp-login` in local mode.
- Current payment flow is offline payment status tracking; WeChat Pay is reserved for a later integration.
- The backend service layer is still in-memory for this MVP. The SQL seed is kept ready for the persistence milestone.

View File

@@ -0,0 +1,103 @@
# Local Runbook
## Prerequisites
- JDK 8
- Maven
- Node.js 18+
- Docker Desktop, for MySQL, Redis, and MinIO
- WeChat DevTools, for native miniapp compile and preview
## Start Dependencies
```powershell
docker compose -f deploy/docker-compose.dev.yml up -d
```
Expected dependency URLs:
```text
MySQL: localhost:3306
Redis: localhost:6379
MinIO API: http://localhost:9000
MinIO console: http://localhost:9001
```
## Start Backend
```powershell
cd backend
mvn spring-boot:run
```
Expected local URLs:
```text
Backend API: http://localhost:8080
Knife4j docs: http://localhost:8080/doc.html
```
Demo accounts:
```text
Admin: admin / admin123
Merchant: merchant / merchant123
Rider: rider / rider123
Resident: dev miniapp login
```
## Start Admin Web
```powershell
cd admin-web
npm install
npm run dev
```
URL:
```text
http://localhost:5173
```
## Start Rider H5
```powershell
cd rider-h5
npm install
npm run dev
```
URL:
```text
http://localhost:5174
```
## Open Miniapp
Use WeChat DevTools to open:
```text
miniapp/project.config.json
```
The miniapp request base URL is configured in `miniapp/miniprogram/utils/request.js`.
## Verification Commands
```powershell
cd backend
mvn test
cd ..\admin-web
npm test
npm run build
cd ..\miniapp
npm test
cd ..\rider-h5
npm test
npm run build
```