This commit is contained in:
eson 2023-11-03 17:15:17 +08:00
parent 9573286e7f
commit af9bf73313

View File

@ -36,7 +36,7 @@ func (p *FsPreprocessLogoModel) PreLogoSearch(ctx context.Context, zipcode strin
if len(keywords) != 0 {
sqlstr := fmt.Sprintf("SELECT id,restaurant_name,resource_url,address,zip_code,phone,website,is_branch FROM fs_preprocess_logo WHERE MATCH(restaurant_name) AGAINST(? IN BOOLEAN MODE) and zip_code = ? limit %d;", count)
sqlstr := fmt.Sprintf("SELECT id,restaurant_name,resource_url,address,zip_code,phone,website,is_branch FROM fs_preprocess_logo WHERE MATCH(restaurant_name) AGAINST(? IN BOOLEAN MODE) AND `is_del` = 0 AND `zip_code` = ? limit %d;", count)
tx := p.db.WithContext(ctx).Model(&FsPreprocessLogo{}).Raw(sqlstr, strings.Join(keywords, " "), zipcode)
err = tx.Scan(&resp).Error
@ -76,7 +76,7 @@ func (p *FsPreprocessLogoModel) PreLogoSearchSuggestions(ctx context.Context, ke
}
if len(keywords) != 0 {
sqlstr := fmt.Sprintf("SELECT id,restaurant_name,resource_url,address,zip_code,phone,website,is_branch FROM fs_preprocess_logo WHERE MATCH(restaurant_name) AGAINST(? IN BOOLEAN MODE) limit %d;", count)
sqlstr := fmt.Sprintf("SELECT id,restaurant_name,resource_url,address,zip_code,phone,website,is_branch FROM fs_preprocess_logo WHERE MATCH(restaurant_name) AGAINST(? IN BOOLEAN MODE) AND `is_del` = 0 limit %d;", count)
tx := p.db.WithContext(ctx).Model(&FsPreprocessLogo{}).Raw(sqlstr, strings.Join(keywords, " "))
err = tx.Scan(&resp).Error