wangjia
|
c402ea0070
|
feat(backend): license_devices 表 + 注册自动签发 trial (21B+21C)
21B — DB & model:
- licenses: 扩展 license_key 为 2048 字节(容纳 Ed25519 JWT),
新增 max_devices INT DEFAULT 3,device_id/activated_at 标为 deprecated
- 新增 license_devices 表(license_id+device_id 唯一索引)
- model/license_device.go:LicenseDevice struct
- main.go AutoMigrate 加入 LicenseDevice
- testutil/setup.go 同步 SQLite DDL
21C — trial at register:
- config: 新增 Ed25519PrivateKey 配置项(LICENSE_ED25519_PRIVATE_KEY 环境变量)
- service/license.go: createTrialLicense(tx, shopID) — 签发 30d trial,
私钥未配置时静默跳过(开发/测试不影响)
- service/auth.go: Register 事务末尾调用 createTrialLicense
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-06-10 00:42:56 +08:00 |
|
wangjia
|
1ec1d4209a
|
chore: release v1.0.24
Deploy / build-linux-web (push) Successful in 59s
Deploy / build-windows (push) Successful in 1m50s
Deploy / build-macos (push) Successful in 1m22s
Deploy / build-android (push) Successful in 1m26s
Deploy / build-ios (push) Successful in 7s
Deploy / release-deploy (push) Successful in 1m39s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-06-08 07:31:55 +08:00 |
|
wangjia
|
ba127826b2
|
feat(backend): 新增商品属性字典表(产地/保质期/储存方式/描述文档)
- model/product_attr.go: 新增 4 张字典表 struct(TenantBase 范式)
- model/product.go: Product 增加 4 个可空外键 + belongs-to 关联
- handler/product_attr.go: 4 组 16 个 CRUD handler(shop_id 隔离)
- handler/product.go: FindOrCreate/Update 支持写入 4 个属性 ID
- handler/public.go: Preload 4 表 + 三级回退介绍 + 默认话术常量
- router/router.go: /product-options/{origins,shelf-lives,storages,description-docs} 路由
- main.go: AutoMigrate 注册 4 个新 model
- testutil/setup.go: SQLite 测试库补齐新列与新表
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-06-08 06:56:16 +08:00 |
|
wangjia
|
eda7d37b64
|
feat: 新增用户自助注册功能
后端新增 POST /api/v1/public/register 接口,支持门店自助注册并自动生成门店编码(S000001 格式);shops 表加 description 字段。营销站新增 /register/ 注册页,含门店信息和管理员账号表单,注册成功后展示门店编码和登录提示。Flutter 登录页底部加「前往官网注册」跳转链接。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-05-26 13:56:34 +08:00 |
|
wangjia
|
e9a6543a8b
|
feat(search): 库存搜索支持拼音/首字母,按回车触发
- 新增 util.ToPinyin(),使用 go-pinyin 生成全拼和首字母
- Product model 新增 name_pinyin / name_initials 列(AutoMigrate)
- 启动时自动回填存量商品拼音
- Create / Update / FindOrCreate 写入时同步生成拼音
- 库存搜索 SQL 加入拼音/首字母 LIKE 条件
- 前端去掉 300ms 防抖,改为回车/点击搜索按钮触发
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-05-25 21:27:54 +08:00 |
|
wangjia
|
fbb4f90ebd
|
fix(test): shops 测试表补加 logo_url 列
Deploy / deploy (push) Successful in 1m15s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-05-24 20:15:39 +08:00 |
|
wangjia
|
86baaf3a1c
|
fix(model): users 唯一索引改为 (shop_id, username) 复合索引
Deploy / deploy (push) Successful in 1m13s
原来 uniqueIndex:uk_shop_username 只在 Username 字段上,导致用户名全局唯一。
S002/S003 的 admin 用户与 S001 冲突,INSERT 被静默跳过,无法登录。
将 User 的 TenantBase 改为直接定义 ShopID,使其参与复合唯一索引。
需要 Reset DB 使新索引生效。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-05-24 14:50:34 +08:00 |
|
wangjia
|
9f94cc97b7
|
fix(test): 修复测试数据库 schema 和 Flutter 测试与屏幕重构的兼容性
- backend/testutil/setup.go: SQLite shops 表补充 business_hours 列
- stock_in_screen_test: 入库管理双 Tab 重构后,draft/pending 测试改为先切换到「入库审核」Tab
- stock_out_insufficient_stock_flow_test: Inventory 构造参数 productUnit→unit,补充必填 id
- inventory_repository_test: mock 数据改为平铺字段格式,补充必填 id
- docs: 新增 NAS + Gitea 部署文档(Runner 设置、Shadowrocket 中继说明)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-05-24 10:48:21 +08:00 |
|
wangjia
|
1b4ca0c675
|
fix(test): 修复测试文件类型错误和测试数据库 schema 过期问题
- 修正 stock_in/out 测试中 WarehouseID/ProductID 指针误用(StockOrder 用 uint64,Inventory 用 *uint64)
- 更新 testutil/setup.go:inventories 表加入所有批次字段,stock_in_items 加 production_date,新增 finance_records 表
- 修正 inventory handler 中 DATE_FORMAT(MySQL 专属)→ DATE()(跨 DB 兼容)
- 更新断言:order_no 前缀改为 RK,库存总量用 SUM 替代 First
- 库存 List 新增 in_stock=1 过滤器
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-05-23 14:16:10 +08:00 |
|
wangjia
|
f5c41e04f3
|
fix: 修复测试 schema 缺失字段,标记过时测试为 skip
- testutil/setup.go 补充 products.public_id、description,partners.status
- 过时 products/stock 流程测试标记 skip(provider 已不挂载)
- deploy.sh 补充 PUBLIC_URL dart-define
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-04-30 00:46:25 +08:00 |
|
wangjia
|
31ea370cea
|
fix(backend): JWT config mapstructure tag 修复 + 模型从 hotel 重构为 shop
- 修复 JWTConfig 缺少 mapstructure tag 导致 access_expire_min 解析为 0,
token 签发即过期,所有 API 请求返回 401
- 全部 config struct 补齐 mapstructure tag(secret/dsn/hmac_secret 等)
- 模型层从 hotel/HotelID 统一重命名为 shop/ShopID
- 删除旧 migrations(001-004),新增 001_init 综合迁移文件
- 更新 schema.sql、testutil、handler/service/model 相关引用
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-04-07 22:20:12 +08:00 |
|
wangjia
|
7a09d1537c
|
test: 后端自动化测试套件
Service 单元测试(SQLite in-memory):
- auth: 登录成功/失败/禁用账号,token 刷新
- stock: 入库审核、出库审核(含库存不足)、单号生成
- license: 激活、设备绑定验证、过期检测
Handler 集成测试(httptest + SQLite):
- auth: 登录 API 成功/401 场景
- product: CRUD 完整流程 + hotel_id 隔离验证
- stock_in: 创建→提交→审核完整流程
- stock_out: 完整流程 + 库存不足 400
- inventory: 库存查询/过滤/盘点创建
- warehouse: CRUD
覆盖率:service 90.4%,handler 56.1%
共 50 个测试用例,全部 PASS
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
2026-04-04 07:24:14 +08:00 |
|