feat: 实现套餐管理模块,包含套餐系列、双状态管理、废弃模型清理
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 5m24s
All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 5m24s
- 新增套餐系列管理 (CRUD + 状态切换) - 新增套餐管理 (CRUD + 启用/禁用 + 上架/下架双状态) - 清理 8 个废弃分佣模型及对应数据库表 - Package 模型新增建议成本价、建议售价、上架状态字段 - 完整的 Store/Service/Handler 三层实现 - 包含单元测试和集成测试 - 归档 add-package-module change - 新增多个 OpenSpec changes (订单支付、店铺套餐分配、一次性分佣、卡设备系列绑定)
This commit is contained in:
@@ -17,6 +17,7 @@ import (
|
||||
"github.com/break/junhong_cmp_fiber/pkg/config"
|
||||
"github.com/break/junhong_cmp_fiber/pkg/response"
|
||||
"github.com/break/junhong_cmp_fiber/tests/testutil"
|
||||
"github.com/break/junhong_cmp_fiber/tests/testutils"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/redis/go-redis/v9"
|
||||
"github.com/stretchr/testify/assert"
|
||||
@@ -30,7 +31,7 @@ import (
|
||||
// shopManagementTestEnv 商户管理测试环境
|
||||
type shopManagementTestEnv struct {
|
||||
tx *gorm.DB
|
||||
rdb *redis.Client
|
||||
rdb *redis.Client
|
||||
tokenManager *auth.TokenManager
|
||||
app *fiber.App
|
||||
adminToken string
|
||||
@@ -113,7 +114,7 @@ func setupShopManagementTestEnv(t *testing.T) *shopManagementTestEnv {
|
||||
|
||||
return &shopManagementTestEnv{
|
||||
tx: tx,
|
||||
rdb: rdb,
|
||||
rdb: rdb,
|
||||
tokenManager: tokenManager,
|
||||
app: app,
|
||||
adminToken: adminToken,
|
||||
@@ -146,7 +147,7 @@ func TestShopManagement_CreateShop(t *testing.T) {
|
||||
ShopName: "测试商户",
|
||||
ShopCode: "TEST001",
|
||||
InitUsername: "testuser",
|
||||
InitPhone: "13800138000",
|
||||
InitPhone: testutils.GenerateUniquePhone(),
|
||||
InitPassword: "password123",
|
||||
}
|
||||
|
||||
@@ -191,12 +192,11 @@ func TestShopManagement_CreateShop_DuplicateCode(t *testing.T) {
|
||||
env := setupShopManagementTestEnv(t)
|
||||
defer env.teardown()
|
||||
|
||||
// 通过 API 创建第一个商户
|
||||
firstReq := dto.CreateShopRequest{
|
||||
ShopName: "商户1",
|
||||
ShopCode: "DUP001",
|
||||
InitUsername: "dupuser1",
|
||||
InitPhone: "13800138101",
|
||||
InitPhone: testutils.GenerateUniquePhone(),
|
||||
InitPassword: "password123",
|
||||
}
|
||||
firstBody, _ := json.Marshal(firstReq)
|
||||
@@ -210,12 +210,11 @@ func TestShopManagement_CreateShop_DuplicateCode(t *testing.T) {
|
||||
|
||||
require.Equal(t, 0, firstResult.Code, "第一个商户应该创建成功")
|
||||
|
||||
// 尝试创建编码重复的商户
|
||||
reqBody := dto.CreateShopRequest{
|
||||
ShopName: "商户2",
|
||||
ShopCode: "DUP001", // 使用相同编码
|
||||
ShopCode: "DUP001",
|
||||
InitUsername: "dupuser2",
|
||||
InitPhone: "13800138102",
|
||||
InitPhone: testutils.GenerateUniquePhone(),
|
||||
InitPassword: "password123",
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user