You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
527 B
24 lines
527 B
package data
|
|
|
|
import (
|
|
"valuation/internal/biz"
|
|
)
|
|
|
|
type PriceRuleData struct {
|
|
data *Data
|
|
}
|
|
|
|
func NewPriceRuleInterface(data *Data) biz.PriceRuleInterface {
|
|
return &PriceRuleData{data: data}
|
|
}
|
|
|
|
// PriceRuleData 实现 PriceRuleInterface
|
|
func (prd *PriceRuleData) GetRule(cityid uint, curr int) (*biz.PriceRule, error) {
|
|
pr := &biz.PriceRule{}
|
|
result := prd.data.Mdb.Where("city_id=? AND start_at <= ? AND end_at > ?", cityid, curr, curr).First(pr)
|
|
if result.Error != nil {
|
|
return nil, result.Error
|
|
}
|
|
return pr, nil
|
|
}
|