-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathjit.go
33 lines (29 loc) · 1.01 KB
/
jit.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
package temu
import (
"context"
"github.com/hiscaler/temu-go/normal"
)
// JIT 服务
type jitService struct {
service
PresaleRule jitPresaleRuleService // 预售规则
VirtualInventory jitVirtualInventoryService // 虚拟库存
}
// Activate 打开 JIT(bg.jitmode.activate)
// https://seller.kuajingmaihuo.com/sop/view/706628248275137588#b4ikfi
// 全托管JIT开通:全托管的SKC开通JIT模式,进行虚拟库存售卖,关联查询bg.product.search,SKC出参满足applyJitStatus=1时,可开通JIT模式,进行虚拟库存售卖
func (s jitService) Activate(ctx context.Context, productId, productSkcId int64) (bool, error) {
var result = struct {
normal.Response
Result any `json:"result"`
}{}
resp, err := s.httpClient.R().
SetContext(ctx).
SetBody(map[string]int64{"productId": productId, "productSkcId": productSkcId}).
SetResult(&result).
Post("bg.jitmode.activate")
if err = recheckError(resp, result.Response, err); err != nil {
return false, err
}
return true, nil
}