-
Notifications
You must be signed in to change notification settings - Fork 3
/
mall.go
50 lines (44 loc) · 1.21 KB
/
mall.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
49
50
package temu
import (
"context"
"github.com/hiscaler/temu-go/entity"
"github.com/hiscaler/temu-go/normal"
)
type mallService struct {
service
Address mallAddressService
}
// IsSemiManaged 是否为半托管店铺
// https://seller.kuajingmaihuo.com/sop/view/634117628601810731#uJ0fSb
func (s mallService) IsSemiManaged(ctx context.Context) (bool, error) {
var result = struct {
normal.Response
Result struct {
SemiManagedMall bool `json:"semiManagedMall"`
} `json:"result"`
}{}
resp, err := s.httpClient.R().
SetContext(ctx).
SetResult(&result).
Post("bg.mall.info.get")
if err = recheckError(resp, result.Response, err); err != nil {
return false, err
}
return result.Result.SemiManagedMall, nil
}
// Permission 查询店铺权限
// https://seller.kuajingmaihuo.com/sop/view/634117628601810731#3tCaqU
func (s mallService) Permission(ctx context.Context) (p entity.MallPermission, err error) {
var result = struct {
normal.Response
Result entity.MallPermission `json:"result"`
}{}
resp, err := s.httpClient.R().
SetContext(ctx).
SetResult(&result).
Post("bg.open.accesstoken.info.get")
if err = recheckError(resp, result.Response, err); err != nil {
return
}
return result.Result, nil
}