diff --git a/modules/config/controller/admin/shop.go b/modules/config/controller/admin/shop.go new file mode 100644 index 00000000..361a85bc --- /dev/null +++ b/modules/config/controller/admin/shop.go @@ -0,0 +1,22 @@ +package admin + +import ( + "blazing/cool" + "blazing/modules/config/service" +) + +type ShopController struct { + *cool.Controller +} + +func init() { + + // 注册路由 + cool.RegisterController(&ShopController{ + &cool.Controller{ + Prefix: "/admin/game/shop", + Api: []string{"Add", "Delete", "Update", "Info", "List", "Page"}, + Service: service.NewShopService(), + }, + }) +} diff --git a/modules/config/model/shop.go b/modules/config/model/shop.go index c0a729c2..9beef52c 100644 --- a/modules/config/model/shop.go +++ b/modules/config/model/shop.go @@ -16,27 +16,22 @@ type ShopConfig struct { // 核心字段 ProductName string `gorm:"not null;size:128;comment:'商品名称'" json:"product_name" description:"商品名称"` //商品ID - ProductID uint32 `gorm:"not null;uniqueIndex;comment:'商品ID'" json:"product_id" description:"商品ID"` - Description string `gorm:"not null;size:512;comment:'商品描述'" json:"description" description:"商品描述"` + ProductID uint32 `gorm:"not null;uniqueIndex;comment:'商品ID'" json:"product_id" description:"商品ID"` + Desc string `gorm:"not null;size:512;comment:'商品描述'" json:"desc" description:"商品描述"` - // 价格信息 -1代表不允许购买,0免费赠送 - SeerdouPrice uint32 `gorm:"not null;default:0;comment:'骄阳豆价格'" json:"seerdou_price" description:"骄阳豆价格"` - JindouPrice uint32 `gorm:"not null;default:0;comment:'价格'" json:"jindou_price" description:"金豆价格"` + // 价格信息 -1代表不允许购买,0表示不支持购买 + SeerdouPrice int32 `gorm:"not null;default:0;comment:'骄阳豆价格'" json:"seerdou_price" description:"骄阳豆价格"` + JindouPrice int32 `gorm:"not null;default:0;comment:'金豆价格'" json:"jindou_price" description:"金豆价格"` // 库存信息 Stock uint32 `gorm:"not null;default:0;comment:'商品库存数量(0表示无限库存)'" json:"stock" description:"库存数量"` - Category uint32 `gorm:"not null;size:64;comment:'商品分类名称'" json:"category" description:"分类名称"` - // 状态信息 IsOnSale uint32 `gorm:"not null;default:1;comment:'是否上架(0-下架 1-上架)'" json:"is_on_sale" description:"是否上架"` // 限购信息 QuotaLimit uint32 `gorm:"not null;default:0;comment:'单位时间内的限购数量(0表示不限购)'" json:"quota_limit" description:"限购数量"` QuotaCycle uint32 `gorm:"not null;default:0;comment:'限购周期(单位:小时,0表示不限购)'" json:"quota_cycle" description:"限购周期(小时)"` - - // 备注信息 - Remark string `gorm:"size:512;default:'';comment:'商品备注'" json:"remark" description:"备注信息"` } // -------------------------- 核心配套方法(遵循项目规范)-------------------------- diff --git a/modules/config/service/shop.go b/modules/config/service/shop.go new file mode 100644 index 00000000..dab85695 --- /dev/null +++ b/modules/config/service/shop.go @@ -0,0 +1,21 @@ +package service + +import ( + "blazing/cool" + "blazing/modules/config/model" +) + +type ShopService struct { + *cool.Service +} + +func NewShopService() *ShopService { + return &ShopService{ + &cool.Service{ + Model: model.NewShopConfig(), + PageQueryOp: &cool.QueryOp{ + KeyWordField: []string{"desc"}, + }, + }, + } +} diff --git a/modules/config/service/task.go b/modules/config/service/task.go index 81b07e97..26026622 100644 --- a/modules/config/service/task.go +++ b/modules/config/service/task.go @@ -16,7 +16,8 @@ func NewTaskService() *TaskService { &cool.Service{ Model: model.NewTaskConfig(), PageQueryOp: &cool.QueryOp{ - FieldEQ: []string{"task_type"}, + FieldEQ: []string{"task_type"}, + KeyWordField: []string{"remark"}, }, //UniqueKey: map[string]string{"task_id": "索引不能重复"}, },