logo search

This commit is contained in:
eson 2023-10-20 14:34:16 +08:00
parent 215dc8d254
commit aac869e435

View File

@ -11,10 +11,23 @@ import (
"github.com/zeromicro/go-zero/core/logx"
)
type PreLogoSearchResult struct {
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // 自增的唯一id
LocationCode *string `gorm:"index;default:'';" json:"location_code"` //
RestaurantName *string `gorm:"index;default:'';" json:"restaurant_name"` //
ResourceUrl *string `gorm:"default:'';" json:"resource_url"` //
RestaurantType *string `gorm:"default:'';" json:"restaurant_type"` //
Address *string `gorm:"default:'';" json:"address"` //
ZipCode *string `gorm:"default:'';" json:"zip_code"` //
Phone *string `gorm:"default:'';" json:"phone"` //
Website *string `gorm:"default:'';" json:"website"` //
IsBranch *int64 `gorm:"default:0;" json:"is_branch"` // 是否分店
}
// TODO: 使用model的属性做你想做的
// 搜索建议
func (p *FsPreprocessLogoModel) PreLogoSearch(ctx context.Context, zipcode string, keywordsStr string, count int) (resp []FsPreprocessLogo, err error) {
func (p *FsPreprocessLogoModel) PreLogoSearch(ctx context.Context, zipcode string, keywordsStr string, count int) (resp []PreLogoSearchResult, err error) {
keywords := regexp.MustCompile(`\s+`).Split(keywordsStr, -1)
for i, v := range keywords {
keywords[i] = "+" + v + "*"