产品和权限编码格式整理优化
This commit is contained in:
@@ -13,11 +13,6 @@ var Product = &productService{}
|
||||
|
||||
type productService struct{}
|
||||
|
||||
// 获取产品价格
|
||||
func (s *productService) GetPrice(code string) {
|
||||
q.ProductSku.Where(q.ProductSku.Code.Eq(code)).Find()
|
||||
}
|
||||
|
||||
// 获取所有产品
|
||||
func (s *productService) AllProducts() ([]*m.Product, error) {
|
||||
return q.Product.
|
||||
|
||||
@@ -30,7 +30,7 @@ func (s *productSkuService) Page(req *core.PageReq, productId *int32) (result []
|
||||
do = append(do, q.ProductSku.ProductID.Eq(*productId))
|
||||
}
|
||||
return q.ProductSku.
|
||||
Joins(q.ProductSku.Discount).
|
||||
Joins(q.ProductSku.Discount, q.ProductSku.Product).
|
||||
Where(do...).
|
||||
Order(q.ProductSku.ID).
|
||||
FindByPage(req.GetOffset(), req.GetLimit())
|
||||
|
||||
@@ -252,13 +252,13 @@ func (data *CreateResourceData) Code() string {
|
||||
|
||||
case data.Type == m.ResourceTypeShort && data.Short != nil:
|
||||
return fmt.Sprintf(
|
||||
"mode=%s,live=%d,expire=%d",
|
||||
"mode=%s&live=%d&expire=%d",
|
||||
data.Short.Mode.Code(), data.Short.Live, u.Else(data.Short.Expire, 0),
|
||||
)
|
||||
|
||||
case data.Type == m.ResourceTypeLong && data.Long != nil:
|
||||
return fmt.Sprintf(
|
||||
"mode=%s,live=%d,expire=%d",
|
||||
"mode=%s&live=%d&expire=%d",
|
||||
data.Long.Mode.Code(), data.Long.Live, u.Else(data.Long.Expire, 0),
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user