/
taobao.go
48 lines (40 loc) · 1 KB
/
taobao.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package service
import (
"context"
"github.com/jinzhu/copier"
pb "github.com/lalifeier/vvgo-mall/gen/api/go/taoke/interface/v1"
)
func (s *TaoKeService) GetCarouseList(ctx context.Context, req *pb.GetCarouseListReq) (*pb.GetCarouseListResp, error) {
var (
params = make(map[string]string)
)
carouseList, err := s.taoBaoUseCase.CarouseList(ctx, params)
if err != nil {
return nil, err
}
data := make([]*pb.Carouse, 0)
err = copier.Copy(&data, &carouseList)
if err != nil {
return nil, err
}
return &pb.GetCarouseListResp{
Data: data,
}, nil
}
func (s *TaoKeService) GetSuperCategory(ctx context.Context, req *pb.GetSuperCategoryReq) (*pb.GetSuperCategoryResp, error) {
var (
params = make(map[string]string)
)
categoriesList, err := s.taoBaoUseCase.GetSuperCategory(ctx, params)
if err != nil {
return nil, err
}
data := make([]*pb.Categories, 0)
err = copier.Copy(&data, &categoriesList)
if err != nil {
return nil, err
}
return &pb.GetSuperCategoryResp{
Data: data,
}, nil
}