logo search
This commit is contained in:
@@ -14,7 +14,7 @@ import (
|
||||
func PreLogoSearchSuggestionsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
var req types.PreLogoSearchRequest
|
||||
var req types.PreLogoSearchSuggestionsRequest
|
||||
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
|
||||
if err != nil {
|
||||
return
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -12,6 +12,10 @@ type ContactUsRequest struct {
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
type PreLogoSearchSuggestionsRequest struct {
|
||||
Keywords string `json:"keywords"` // 关键字
|
||||
}
|
||||
|
||||
type PreLogoSearchRequest struct {
|
||||
ZipCode string `json:"zip_code"` // 邮编
|
||||
Keywords string `json:"keywords"` // 关键字
|
||||
|
||||
Reference in New Issue
Block a user