2026-01-09 21:12:39 +08:00
|
|
|
package service
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"blazing/cool"
|
|
|
|
|
"blazing/modules/config/model"
|
2026-02-18 22:43:39 +08:00
|
|
|
"context"
|
|
|
|
|
|
|
|
|
|
"github.com/gogf/gf/v2/frame/g"
|
2026-01-09 21:12:39 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type ShopService struct {
|
|
|
|
|
*cool.Service
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func NewShopService() *ShopService {
|
|
|
|
|
return &ShopService{
|
|
|
|
|
&cool.Service{
|
|
|
|
|
Model: model.NewShopConfig(),
|
2026-02-18 22:43:39 +08:00
|
|
|
ListQueryOp: &cool.QueryOp{
|
|
|
|
|
Where: func(ctx context.Context) []g.Array {
|
|
|
|
|
return [][]interface{}{
|
|
|
|
|
|
|
|
|
|
{"is_enable", 1, true},
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
Select: "product_id,product_name,seerdou_price,jindou_price,remark",
|
|
|
|
|
},
|
2026-02-14 07:36:05 +08:00
|
|
|
|
2026-01-09 21:12:39 +08:00
|
|
|
PageQueryOp: &cool.QueryOp{
|
2026-01-10 03:14:23 +08:00
|
|
|
KeyWordField: []string{"desc", "product_name"},
|
2026-01-09 21:12:39 +08:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-01-10 03:14:23 +08:00
|
|
|
func (s *ShopService) Get(product_id uint32) *model.ShopConfig {
|
2026-02-14 23:14:43 +08:00
|
|
|
m := dbm_enable(s.Model).Where("product_id", product_id)
|
2026-01-10 03:14:23 +08:00
|
|
|
var tt *model.ShopConfig
|
|
|
|
|
m.Scan(&tt)
|
|
|
|
|
|
|
|
|
|
return tt
|
|
|
|
|
|
|
|
|
|
}
|