feat: sale manager
This commit is contained in:
@@ -52,5 +52,5 @@ func (l *CreateLogic) Create(in *ad.CreateReq) (*ad.Response, error) {
|
||||
return failResponse(utils.Fail), nil
|
||||
}
|
||||
|
||||
return okResponse(utils.StringEmpty), nil
|
||||
return okResponse(nil), nil
|
||||
}
|
||||
|
||||
@@ -64,5 +64,5 @@ func (l *EditLogic) Edit(in *ad.EditReq) (*ad.Response, error) {
|
||||
return failResponse(utils.Fail), nil
|
||||
}
|
||||
|
||||
return okResponse(utils.StringEmpty), nil
|
||||
return okResponse(nil), nil
|
||||
}
|
||||
|
||||
@@ -62,8 +62,8 @@ func (l *ItemsLogic) Items(in *ad.ItemsReq) (*ad.Response, error) {
|
||||
items = append(items, toAdItem(row))
|
||||
}
|
||||
|
||||
return okResponse(utils.StructToJson(&ad.ItemsData{
|
||||
return okResponse(&ad.ItemsData{
|
||||
Count: result.Count,
|
||||
Items: items,
|
||||
})), nil
|
||||
}), nil
|
||||
}
|
||||
|
||||
@@ -3,13 +3,16 @@ package logic
|
||||
import (
|
||||
"lone-services/pkg/utils"
|
||||
ad "lone-services/rpc/ad/pb"
|
||||
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
)
|
||||
|
||||
func okResponse(data string) *ad.Response {
|
||||
func okResponse(data any) *ad.Response {
|
||||
buf, _ := jsoniter.Marshal(data)
|
||||
return &ad.Response{
|
||||
Code: utils.Ok.Code,
|
||||
Msg: utils.Ok.Msg,
|
||||
Data: data,
|
||||
Data: string(buf),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,5 +62,5 @@ func (l *StatusLogic) Status(in *ad.StatusReq) (*ad.Response, error) {
|
||||
return failResponse(utils.Fail), nil
|
||||
}
|
||||
|
||||
return okResponse(utils.StringEmpty), nil
|
||||
return okResponse(nil), nil
|
||||
}
|
||||
|
||||
@@ -64,5 +64,5 @@ func (l *WebItemsLogic) WebItems(in *ad.WebItemsReq) (*ad.Response, error) {
|
||||
items = append(items, toAdWebItem(row))
|
||||
}
|
||||
|
||||
return okResponse(utils.StructToJson(items)), nil
|
||||
return okResponse(items), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user