logo search

This commit is contained in:
eson
2023-10-20 15:59:03 +08:00
parent 615032a0a8
commit 956cbde1bc
5 changed files with 38 additions and 9 deletions

View File

@@ -30,18 +30,14 @@ func NewPreLogoSearchSuggestionsLogic(ctx context.Context, svcCtx *svc.ServiceCo
// func (l *PreLogoSearchSuggestionsLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
// }
func (l *PreLogoSearchSuggestionsLogic) PreLogoSearchSuggestions(req *types.PreLogoSearchRequest, userinfo *auth.UserInfo) (resp *basic.Response) {
func (l *PreLogoSearchSuggestionsLogic) PreLogoSearchSuggestions(req *types.PreLogoSearchSuggestionsRequest, userinfo *auth.UserInfo) (resp *basic.Response) {
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
// userinfo 传入值时, 一定不为null
if !userinfo.IsOnlooker() {
return resp.SetStatus(basic.CodeSearchAuthErr)
}
if len(req.ZipCode) < 4 {
return resp.SetStatus(basic.CodeSearchZipCodeErr)
}
result, err := l.svcCtx.AllModels.FsPreprocessLogo.PreLogoSearch(l.ctx, req.ZipCode, req.Keywords, 5)
result, err := l.svcCtx.AllModels.FsPreprocessLogo.PreLogoSearchSuggestions(l.ctx, req.Keywords, 5)
if err != nil {
return resp.SetStatus(basic.CodeApiErr, err)
}