1
This commit is contained in:
@@ -29,13 +29,13 @@ func init() {
|
||||
// api = New("62289", "d3ec2358d6a819ea")
|
||||
|
||||
// 京西菜市
|
||||
api = New("34665", "c3db75b754ea2d89")
|
||||
//api = New("34665", "c3db75b754ea2d89")
|
||||
|
||||
//菜市测试
|
||||
// api = New("62923", "aa4cdc6c1108486b")
|
||||
|
||||
// 京西果园
|
||||
// api = New("35957", "10013fbb7c2ddad7")
|
||||
api = New("35957", "10013fbb7c2ddad7")
|
||||
// api.SetCookie("PASSPORT_DELIMONT_TOKEN", "PBE_2.0_5cd1c6141c127d4188f026ac01fc93656266683e8dfb3127c2fdf894259e9034125ff3bdd2a997a385802ee3ef1802ba93a04acea34fde2d2b6e802c5dcd4ec6e3f4ad909a1d806e3ceeb349ed726b03d60ed1fe7010d4140aa338d9c5f05e3fec172c78d3d7f0ca579d61b7015af1bf99aa46b04d2b8a64aa50646dc09afe94b6b60e0ba9a933635db5e8b2a035e9b6d693b289acf1b256d5b9a3f8478c87b0b009115bfd1394f20bb5a0dc2c07b8d013a25f286ec6bf7f2d86010d65507e31358834b7a6b58fbd88cb3f1a12cf71c997b91c1527f6f3c10693f7c2bd6073da8633a98cd2dc1114dfa5be5ee0e60b02cf7e4a94d0fb563a8c01717e7c050f02249117219c07a2eb211577c208ba77f4d536fa25139bc249be93b38d6fc495ef67a32aa206835d177db402bc534de1d29caf4f6b4fbcd912c13f167d00d1732222744c336a5189728f72fb5e153c4b1164171cfb0c811f34f4c2fedd43f721b8706b43f8d631251c")
|
||||
//api.SetCookie("WMUSS", "NTE2NDMTAwMDAyNzYxNzAwOTEyTmUzNWJNcDlQ ")
|
||||
//api.SetCookie("WMSTOKEN", "NTE2NDMTAwMDAyNzYxNzAwOTEyTmUzNWJNcDlQ ")
|
||||
|
||||
@@ -33,7 +33,7 @@ func TestOrderStatusGet(t *testing.T) {
|
||||
}
|
||||
}
|
||||
func TestOrderList(t *testing.T) {
|
||||
result, err := api.OrderList("", 0, 0, 0, 0, 0)
|
||||
result, err := api.OrderList("300104", 32267046052, utils.Str2Time("2022-08-22").Unix(), utils.Str2Time("2022-09-08").Unix(), 0, 1)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
} else {
|
||||
@@ -42,7 +42,7 @@ func TestOrderList(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestOrderListAll(t *testing.T) {
|
||||
result, err := api.OrderListAll("", 32267184047, utils.Str2Time("2019-12-25").Unix(), utils.Str2Time("2019-12-26").Unix(), 0)
|
||||
result, err := api.OrderListAll("", 32267046052, utils.Str2Time("2022-09-01").Unix(), utils.Str2Time("2022-09-08").Unix(), 0)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
} else {
|
||||
|
||||
@@ -3,6 +3,7 @@ package fnpsapi
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"time"
|
||||
)
|
||||
@@ -77,6 +78,12 @@ func (a *API) CreateOrder(createOrderParam *CreateOrderReqParam) (result string,
|
||||
}
|
||||
orderHead["business_data"] = string(bytes)
|
||||
resultData, err := a.AccessAPI(ApiURL, "createOrder", RequestPost, orderHead)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if utils.Interface2String(resultData["code"]) != "200" || utils.Interface2String(resultData["apiCode"]) != "" {
|
||||
return "", fmt.Errorf(fmt.Sprintf("其他异常错误信息:%s", utils.Interface2String(resultData["apiCode"])))
|
||||
}
|
||||
if orderId, ok := resultData["business_data"]; ok {
|
||||
res := &CreateOrderRes{}
|
||||
if err := json.Unmarshal([]byte(utils.Interface2String(orderId)), res); err != nil {
|
||||
|
||||
@@ -23,9 +23,11 @@ func init() {
|
||||
// sandbox
|
||||
// api = New("594ab45a-9a73-4a43-82b0-a64cbd55d883", "06692746f7224695ad4788ce340bc854", "d6b42a35a7414a5490d811654d745c84")
|
||||
// prod
|
||||
api = New("ff428cd2-a900-492e-a34e-5f86112fdb55", "21b627c23ea04c69b64b48d0b361213e", "51cd27a748e64c829b4b7f83f4844610")
|
||||
//api = New("ff428cd2-a900-492e-a34e-5f86112fdb55", "21b627c23ea04c69b64b48d0b361213e", "51cd27a748e64c829b4b7f83f4844610")
|
||||
// 天天果园
|
||||
//api = New("c45e6510-00ba-4be2-977e-bcb9c9792cc7", "5d5577a2506f41b8b4ec520ba83490f5", "0b01b9eeb15b41dab1c3d05d95c17a26")
|
||||
// 京东果园
|
||||
api = New("b1138139-9610-4b80-9a63-a63da4773885", "5d5577a2506f41b8b4ec520ba83490f5", "0b01b9eeb15b41dab1c3d05d95c17a26")
|
||||
|
||||
//prod zs
|
||||
// api = New("6f8d3290-0120-4ad7-8b53-943c67c84f3f", "789279b9ae814ba091ac52815566b54d", "5d668cd227644637bb0fd73ed8118ec8")
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package mtpsapi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
@@ -82,3 +83,9 @@ func TestSimulateReportException(t *testing.T) {
|
||||
err := api.SimulateReportException(123456789, "1529387562097059")
|
||||
handleError(t, err)
|
||||
}
|
||||
|
||||
func TestName(t *testing.T) {
|
||||
cc := 1
|
||||
cc |= 1 | 2
|
||||
fmt.Println(cc)
|
||||
}
|
||||
|
||||
@@ -11,25 +11,6 @@ type ShopBatchCreateStoreRequest struct {
|
||||
Param *ShopBatchCreateStoreParam
|
||||
}
|
||||
|
||||
type ShopBatchCreateStoreParam struct {
|
||||
RowID int64 `json:"row_id"`
|
||||
Name string `json:"name"`
|
||||
StoreCode string `json:"store_code"` //门店编码
|
||||
Longitude string `json:"longitude"` //经度
|
||||
Latitude string `json:"latitude"` //纬度
|
||||
Province string `json:"province"` //省份
|
||||
City string `json:"city"` //市
|
||||
District string `json:"district"` //区
|
||||
Address string `json:"address"` //详细地址
|
||||
Contact string `json:"contact"` //联系方式
|
||||
OpenTime OpenTime `json:"open_time"` //营业时间
|
||||
StoreID int64 `json:"store_id"` //创建成功的门店ID
|
||||
}
|
||||
type OpenTime struct {
|
||||
DayMap map[string]string `json:"day_map"`
|
||||
Custom string `json:"custom"` //暂时不使用
|
||||
}
|
||||
|
||||
func (c *ShopBatchCreateStoreRequest) GetUrlPath() string {
|
||||
return "/shop/batchCreateStore"
|
||||
}
|
||||
@@ -41,6 +22,7 @@ func New() *ShopBatchCreateStoreRequest {
|
||||
request.SetConfig(doudian_sdk.GlobalConfig)
|
||||
request.SetClient(doudian_sdk.DefaultDoudianOpApiClient)
|
||||
return request
|
||||
|
||||
}
|
||||
|
||||
func (c *ShopBatchCreateStoreRequest) Execute(accessToken *doudian_sdk.AccessToken) (*shop_batchCreateStore_response.ShopBatchCreateStoreResponse, error) {
|
||||
@@ -51,7 +33,9 @@ func (c *ShopBatchCreateStoreRequest) Execute(accessToken *doudian_sdk.AccessTok
|
||||
response := &shop_batchCreateStore_response.ShopBatchCreateStoreResponse{}
|
||||
_ = json.Unmarshal([]byte(responseJson), response)
|
||||
return response, nil
|
||||
|
||||
}
|
||||
|
||||
func (c *ShopBatchCreateStoreRequest) GetParamObject() interface{} {
|
||||
return c.Param
|
||||
}
|
||||
@@ -59,3 +43,36 @@ func (c *ShopBatchCreateStoreRequest) GetParamObject() interface{} {
|
||||
func (c *ShopBatchCreateStoreRequest) GetParams() *ShopBatchCreateStoreParam {
|
||||
return c.Param
|
||||
}
|
||||
|
||||
type ShopBatchCreateStoreParam struct {
|
||||
// 与createStore接口入参一致
|
||||
StoreList []StoreListItem `json:"store_list"`
|
||||
}
|
||||
type OpenTime struct {
|
||||
// Key:用数字表示周几,例:1:周一、2:周一、5:周五、6:周六、7:周日。Value: 营业时间,例:“x-x”。x的区间:[00:00, 23:59](24:00无效)。营业到次日举例:"19:00-02:00"。完整举例(周3周4不营业):{1:"12:00-16:00",2:"12:00-16:00",5:"19:00-02:00",6:"12:00-16:00",7:"12:00-16:00"}
|
||||
DayMap map[int64]string `json:"day_map"`
|
||||
}
|
||||
type StoreListItem struct {
|
||||
// 标识这行数据
|
||||
RowId int64 `json:"row_id"`
|
||||
// 门店名称
|
||||
Name string `json:"name"`
|
||||
// 门店编码
|
||||
StoreCode string `json:"store_code"`
|
||||
// 经度
|
||||
Longitude string `json:"longitude"`
|
||||
// 纬度
|
||||
Latitude string `json:"latitude"`
|
||||
// 省份
|
||||
Province string `json:"province"`
|
||||
// 市
|
||||
City string `json:"city"`
|
||||
// 区
|
||||
District string `json:"district"`
|
||||
// 详细地址
|
||||
Address string `json:"address"`
|
||||
// 电话
|
||||
Contact string `json:"contact"`
|
||||
// Key:用数字表示周几,例:1:周一、2:周一、5:周五、6:周六、7:周日。Value: 营业时间,例:“x-x”。x的区间:[00:00, 23:59](24:00无效)。营业到次日举例:"19:00-02:00"。完整举例(周3周4不营业):{1:"12:00-16:00",2:"12:00-16:00",5:"19:00-02:00",6:"12:00-16:00",7:"12:00-16:00"}
|
||||
OpenTime *OpenTime `json:"open_time"`
|
||||
}
|
||||
|
||||
@@ -1,29 +1,56 @@
|
||||
package shop_batchCreateStore_response
|
||||
|
||||
import doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
|
||||
import (
|
||||
doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
|
||||
)
|
||||
|
||||
type ShopBatchCreateStoreResponse struct {
|
||||
doudian_sdk.BaseDoudianOpApiResponse
|
||||
Data *ShopBatchCreateStoreData `json:"data"`
|
||||
}
|
||||
type DataItem struct {
|
||||
RowID int `json:"row_id"`
|
||||
Name string `json:"name"`
|
||||
StoreCode string `json:"store_code"` //门店编码
|
||||
Longitude string `json:"longitude"` //经度
|
||||
Latitude string `json:"latitude"` //纬度
|
||||
Province string `json:"province"` //省份
|
||||
City string `json:"city"` //市
|
||||
District string `json:"district"` //区
|
||||
Address string `json:"address"` //详细地址
|
||||
Contact string `json:"contact"` //联系方式
|
||||
OpenTime OpenTime `json:"open_time"` //营业时间
|
||||
}
|
||||
|
||||
type OpenTime struct {
|
||||
DayMap map[string]string `json:"day_map"`
|
||||
Custom string `json:"custom"` //暂时不使用
|
||||
// -
|
||||
DayMap map[int64]string `json:"day_map"`
|
||||
// -
|
||||
Custom string `json:"custom"`
|
||||
}
|
||||
type Store struct {
|
||||
// -
|
||||
RowId int64 `json:"row_id"`
|
||||
// -
|
||||
Name string `json:"name"`
|
||||
// -
|
||||
RelShopId int64 `json:"rel_shop_id"`
|
||||
// -
|
||||
StoreCode string `json:"store_code"`
|
||||
// -
|
||||
Longitude string `json:"longitude"`
|
||||
// -
|
||||
Latitude string `json:"latitude"`
|
||||
// -
|
||||
Province string `json:"province"`
|
||||
// -
|
||||
City string `json:"city"`
|
||||
// -
|
||||
District string `json:"district"`
|
||||
// -
|
||||
Address string `json:"address"`
|
||||
// -
|
||||
Contact string `json:"contact"`
|
||||
// -
|
||||
OpenTime *OpenTime `json:"open_time"`
|
||||
// 创建成功的门店ID
|
||||
StoreId int64 `json:"store_id"`
|
||||
}
|
||||
type ResultListItem struct {
|
||||
// 是否成功
|
||||
IsSuccess bool `json:"is_success"`
|
||||
// 错误描述
|
||||
Msg string `json:"msg"`
|
||||
// 提交过来的信息
|
||||
Store *Store `json:"store"`
|
||||
}
|
||||
type ShopBatchCreateStoreData struct {
|
||||
Data []DataItem `json:"data"`
|
||||
// 结果
|
||||
ResultList []ResultListItem `json:"result_list"`
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@ package shop_bindStoreSaleLimit_request
|
||||
import (
|
||||
"encoding/json"
|
||||
shop_bindStoreSaleLimit_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_bindStoreSaleLimit/response"
|
||||
|
||||
//shop_bindStoreSaleLimit_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_bindStoreSaleLimit/response"
|
||||
doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
|
||||
)
|
||||
|
||||
@@ -13,15 +11,6 @@ type ShopBindStoreSaleLimitRequest struct {
|
||||
Param *ShopBindStoreSaleLimitParam
|
||||
}
|
||||
|
||||
type ShopBindStoreSaleLimitParam struct {
|
||||
StoreID int64 `json:"store_id"` //创建成功的门店ID
|
||||
SaleLimitID int64 `json:"sale_limit_id"` //限售模板ID
|
||||
}
|
||||
type OpenTime struct {
|
||||
DayMap map[string]string `json:"day_map"`
|
||||
Custom string `json:"custom"` //暂时不使用
|
||||
}
|
||||
|
||||
func (c *ShopBindStoreSaleLimitRequest) GetUrlPath() string {
|
||||
return "/shop/bindStoreSaleLimit"
|
||||
}
|
||||
@@ -33,6 +22,7 @@ func New() *ShopBindStoreSaleLimitRequest {
|
||||
request.SetConfig(doudian_sdk.GlobalConfig)
|
||||
request.SetClient(doudian_sdk.DefaultDoudianOpApiClient)
|
||||
return request
|
||||
|
||||
}
|
||||
|
||||
func (c *ShopBindStoreSaleLimitRequest) Execute(accessToken *doudian_sdk.AccessToken) (*shop_bindStoreSaleLimit_response.ShopBindStoreSaleLimitResponse, error) {
|
||||
@@ -43,7 +33,9 @@ func (c *ShopBindStoreSaleLimitRequest) Execute(accessToken *doudian_sdk.AccessT
|
||||
response := &shop_bindStoreSaleLimit_response.ShopBindStoreSaleLimitResponse{}
|
||||
_ = json.Unmarshal([]byte(responseJson), response)
|
||||
return response, nil
|
||||
|
||||
}
|
||||
|
||||
func (c *ShopBindStoreSaleLimitRequest) GetParamObject() interface{} {
|
||||
return c.Param
|
||||
}
|
||||
@@ -51,3 +43,10 @@ func (c *ShopBindStoreSaleLimitRequest) GetParamObject() interface{} {
|
||||
func (c *ShopBindStoreSaleLimitRequest) GetParams() *ShopBindStoreSaleLimitParam {
|
||||
return c.Param
|
||||
}
|
||||
|
||||
type ShopBindStoreSaleLimitParam struct {
|
||||
// 门店ID
|
||||
StoreId int64 `json:"store_id"`
|
||||
// 限售模版ID
|
||||
SaleLimitId int64 `json:"sale_limit_id"`
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package shop_bindStoreSaleLimit_response
|
||||
|
||||
import doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
|
||||
import (
|
||||
doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
|
||||
)
|
||||
|
||||
type ShopBindStoreSaleLimitResponse struct {
|
||||
doudian_sdk.BaseDoudianOpApiResponse
|
||||
Data *ShopBindStoreSaleLimitData `json:"data"`
|
||||
}
|
||||
|
||||
type ShopBindStoreSaleLimitData struct {
|
||||
}
|
||||
|
||||
@@ -10,24 +10,6 @@ type ShopEditStoreRequest struct {
|
||||
doudian_sdk.BaseDoudianOpApiRequest
|
||||
Param *ShopEditStoreParam
|
||||
}
|
||||
type ShopEditStoreParam struct {
|
||||
RowID int64 `json:"row_id"`
|
||||
Name string `json:"name"`
|
||||
StoreCode string `json:"store_code"` //门店编码
|
||||
Longitude string `json:"longitude"` //经度
|
||||
Latitude string `json:"latitude"` //纬度
|
||||
Province string `json:"province"` //省份
|
||||
City string `json:"city"` //市
|
||||
District string `json:"district"` //区
|
||||
Address string `json:"address"` //详细地址
|
||||
Contact string `json:"contact"` //联系方式
|
||||
OpenTime OpenTime `json:"open_time"` //营业时间
|
||||
StoreID int64 `json:"store_id"` //创建成功的门店ID
|
||||
}
|
||||
type OpenTime struct {
|
||||
DayMap map[string]string `json:"day_map"`
|
||||
Custom string `json:"custom"` //暂时不使用
|
||||
}
|
||||
|
||||
func (c *ShopEditStoreRequest) GetUrlPath() string {
|
||||
return "/shop/editStore"
|
||||
@@ -51,6 +33,7 @@ func (c *ShopEditStoreRequest) Execute(accessToken *doudian_sdk.AccessToken) (*s
|
||||
response := &shop_editStore_response.ShopEditStoreResponse{}
|
||||
_ = json.Unmarshal([]byte(responseJson), response)
|
||||
return response, nil
|
||||
|
||||
}
|
||||
|
||||
func (c *ShopEditStoreRequest) GetParamObject() interface{} {
|
||||
@@ -60,3 +43,32 @@ func (c *ShopEditStoreRequest) GetParamObject() interface{} {
|
||||
func (c *ShopEditStoreRequest) GetParams() *ShopEditStoreParam {
|
||||
return c.Param
|
||||
}
|
||||
|
||||
type OpenTime struct {
|
||||
// 营业时间
|
||||
DayMap map[int64]string `json:"day_map"`
|
||||
}
|
||||
type ShopEditStoreParam struct {
|
||||
// 门店ID
|
||||
StoreId int64 `json:"store_id"`
|
||||
// 门店名
|
||||
Name string `json:"name"`
|
||||
// 自用编码
|
||||
StoreCode string `json:"store_code"`
|
||||
// 经度
|
||||
Longitude string `json:"longitude"`
|
||||
// 纬度
|
||||
Latitude string `json:"latitude"`
|
||||
// 省
|
||||
Province string `json:"province"`
|
||||
// 市
|
||||
City string `json:"city"`
|
||||
// 区
|
||||
District string `json:"district"`
|
||||
// 详细地址
|
||||
Address string `json:"address"`
|
||||
// 电话
|
||||
Contact string `json:"contact"`
|
||||
// 营业时间
|
||||
OpenTime *OpenTime `json:"open_time"`
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package shop_editStore_response
|
||||
|
||||
import doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
|
||||
import (
|
||||
doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
|
||||
)
|
||||
|
||||
type ShopEditStoreResponse struct {
|
||||
doudian_sdk.BaseDoudianOpApiResponse
|
||||
|
||||
@@ -10,10 +10,6 @@ type ShopStoreSuspendRequest struct {
|
||||
doudian_sdk.BaseDoudianOpApiRequest
|
||||
Param *ShopStoreSuspendParam
|
||||
}
|
||||
type ShopStoreSuspendParam struct {
|
||||
StoreID int64 `json:"store_id"` //门店ID
|
||||
Reason string `json:"reason"` //停业原因
|
||||
}
|
||||
|
||||
func (c *ShopStoreSuspendRequest) GetUrlPath() string {
|
||||
return "/shop/storeSuspend"
|
||||
@@ -37,6 +33,7 @@ func (c *ShopStoreSuspendRequest) Execute(accessToken *doudian_sdk.AccessToken)
|
||||
response := &shop_storeSuspend_response.ShopStoreSuspendResponse{}
|
||||
_ = json.Unmarshal([]byte(responseJson), response)
|
||||
return response, nil
|
||||
|
||||
}
|
||||
|
||||
func (c *ShopStoreSuspendRequest) GetParamObject() interface{} {
|
||||
@@ -46,3 +43,10 @@ func (c *ShopStoreSuspendRequest) GetParamObject() interface{} {
|
||||
func (c *ShopStoreSuspendRequest) GetParams() *ShopStoreSuspendParam {
|
||||
return c.Param
|
||||
}
|
||||
|
||||
type ShopStoreSuspendParam struct {
|
||||
// 门店ID
|
||||
StoreId int64 `json:"store_id"`
|
||||
// 停业原因
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
package shop_storeSuspend_response
|
||||
|
||||
import doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
|
||||
import (
|
||||
doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
|
||||
)
|
||||
|
||||
type ShopStoreSuspendResponse struct {
|
||||
doudian_sdk.BaseDoudianOpApiResponse
|
||||
Data *ShopStoreSuspendData `json:"data"`
|
||||
}
|
||||
type ShopStoreSuspendData struct {
|
||||
// 返回错误码
|
||||
RetCode int64 `json:"ret_code"`
|
||||
// -
|
||||
RetMsg string `json:"ret_msg"`
|
||||
}
|
||||
|
||||
@@ -10,10 +10,6 @@ type ShopUnsuspendStoreRequest struct {
|
||||
doudian_sdk.BaseDoudianOpApiRequest
|
||||
Param *ShopUnsuspendStoreParam
|
||||
}
|
||||
type ShopUnsuspendStoreParam struct {
|
||||
StoreID int64 `json:"store_id"` //门店ID
|
||||
Reason string `json:"reason"` //停业原因
|
||||
}
|
||||
|
||||
func (c *ShopUnsuspendStoreRequest) GetUrlPath() string {
|
||||
return "/shop/unsuspendStore"
|
||||
@@ -37,6 +33,7 @@ func (c *ShopUnsuspendStoreRequest) Execute(accessToken *doudian_sdk.AccessToken
|
||||
response := &shop_unsuspendStore_response.ShopUnsuspendStoreResponse{}
|
||||
_ = json.Unmarshal([]byte(responseJson), response)
|
||||
return response, nil
|
||||
|
||||
}
|
||||
|
||||
func (c *ShopUnsuspendStoreRequest) GetParamObject() interface{} {
|
||||
@@ -46,3 +43,10 @@ func (c *ShopUnsuspendStoreRequest) GetParamObject() interface{} {
|
||||
func (c *ShopUnsuspendStoreRequest) GetParams() *ShopUnsuspendStoreParam {
|
||||
return c.Param
|
||||
}
|
||||
|
||||
type ShopUnsuspendStoreParam struct {
|
||||
// 门店ID
|
||||
StoreId int64 `json:"store_id"`
|
||||
// 恢复营业原因
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
package shop_unsuspendStore_response
|
||||
|
||||
import doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
|
||||
import (
|
||||
doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
|
||||
)
|
||||
|
||||
type ShopUnsuspendStoreResponse struct {
|
||||
doudian_sdk.BaseDoudianOpApiResponse
|
||||
Data *ShopUnsuspendStoreData `json:"data"`
|
||||
}
|
||||
type ShopUnsuspendStoreData struct {
|
||||
// 返回错误码
|
||||
RetCode int64 `json:"ret_code"`
|
||||
// -
|
||||
RetMsg string `json:"ret_msg"`
|
||||
}
|
||||
|
||||
@@ -11,29 +11,6 @@ type TradeCreateTradeLimitTemplateRequest struct {
|
||||
Param *TradeCreateTradeLimitTemplateParam
|
||||
}
|
||||
|
||||
type TradeCreateTradeLimitTemplateParam struct {
|
||||
StoreID int64 `json:"store_id"` //门店ID
|
||||
TradeLimitRuleRequestList []*TradeLimitRuleRequestList `json:"trade_limit_rule_request_list"` //限购参数
|
||||
TradeLimitResourceObject TradeLimitResourceObject `json:"trade_limit_resource_object"` //限购资源值
|
||||
TradeLimitPattern TradeLimitPattern `json:"trade_limit_pattern"` //限购值,模型为重量则单位为毫克,模型为金额则单位为分
|
||||
TimePeriod TimePeriod `json:"time_period"` //限购时间
|
||||
}
|
||||
type TradeLimitRuleRequestList struct {
|
||||
TradeLimitModel int32 `json:"trade_limit_model"` //限购模型 1-重量,2-数量,3-地区,4-金额
|
||||
TradeLimitResource int32 `json:"trade_limit_resource"` //限购资源类别1-抖店,2-门店,3-商品ID,4-sku,5-类目,6-活动,7-商品标
|
||||
}
|
||||
type TradeLimitResourceObject struct {
|
||||
TradeLimitResourceIDList []string `json:"trade_limit_resource_id_list"` //限购资源值列表
|
||||
}
|
||||
type TradeLimitPattern struct {
|
||||
Minimum int64 `json:"minimum"` //单次下限
|
||||
Maximum int64 `json:"maximum"` //单次上限
|
||||
CumulativeMax int64 `json:"cumulative_max"` //累计限购值
|
||||
}
|
||||
type TimePeriod struct {
|
||||
TradeLimitSubjectList []int64 `json:"trade_limit_subject_list"` //限购维度1 // 端用户(比如uid=122,aid=1128) 2 // 用户组用户(比如uid=122,group=aweme) 3 // 设备 4 // 下单电话 5 // 收件电话 6 // 身份证号 7 // 支付账号
|
||||
}
|
||||
|
||||
func (c *TradeCreateTradeLimitTemplateRequest) GetUrlPath() string {
|
||||
return "/trade/createTradeLimitTemplate"
|
||||
}
|
||||
@@ -45,6 +22,7 @@ func New() *TradeCreateTradeLimitTemplateRequest {
|
||||
request.SetConfig(doudian_sdk.GlobalConfig)
|
||||
request.SetClient(doudian_sdk.DefaultDoudianOpApiClient)
|
||||
return request
|
||||
|
||||
}
|
||||
|
||||
func (c *TradeCreateTradeLimitTemplateRequest) Execute(accessToken *doudian_sdk.AccessToken) (*trade_createTradeLimitTemplate_response.TradeCreateTradeLimitTemplateResponse, error) {
|
||||
@@ -55,7 +33,9 @@ func (c *TradeCreateTradeLimitTemplateRequest) Execute(accessToken *doudian_sdk.
|
||||
response := &trade_createTradeLimitTemplate_response.TradeCreateTradeLimitTemplateResponse{}
|
||||
_ = json.Unmarshal([]byte(responseJson), response)
|
||||
return response, nil
|
||||
|
||||
}
|
||||
|
||||
func (c *TradeCreateTradeLimitTemplateRequest) GetParamObject() interface{} {
|
||||
return c.Param
|
||||
}
|
||||
@@ -63,3 +43,46 @@ func (c *TradeCreateTradeLimitTemplateRequest) GetParamObject() interface{} {
|
||||
func (c *TradeCreateTradeLimitTemplateRequest) GetParams() *TradeCreateTradeLimitTemplateParam {
|
||||
return c.Param
|
||||
}
|
||||
|
||||
type TradeLimitPattern struct {
|
||||
// 单次下限
|
||||
Minimum int64 `json:"minimum"`
|
||||
// 单次上限
|
||||
Maximum int64 `json:"maximum"`
|
||||
// 累计限购值
|
||||
CumulativeMax int64 `json:"cumulative_max"`
|
||||
}
|
||||
type TimePeriod struct {
|
||||
// 限购开始时间
|
||||
StartTime int64 `json:"start_time"`
|
||||
// 限购结束时间
|
||||
EndTime int64 `json:"end_time"`
|
||||
// 限购滑动窗口时长
|
||||
LimitPeriod int64 `json:"limit_period"`
|
||||
// 限购滑动窗口结束时间
|
||||
LimitPeriodEndTime int64 `json:"limit_period_end_time"`
|
||||
}
|
||||
type TradeLimitRuleRequestListItem struct {
|
||||
// 限购模型 1-重量,2-数量,3-地区,4-金额
|
||||
TradeLimitModel int32 `json:"trade_limit_model"`
|
||||
// 限购资源类别1-抖店,2-门店,3-商品ID,4-sku,5-类目,6-活动,7-商品标
|
||||
TradeLimitResource int32 `json:"trade_limit_resource"`
|
||||
// 限购资源值
|
||||
TradeLimitResourceObject *TradeLimitResourceObject `json:"trade_limit_resource_object"`
|
||||
// 限购值,模型为重量则单位为毫克,模型为金额则单位为分
|
||||
TradeLimitPattern *TradeLimitPattern `json:"trade_limit_pattern"`
|
||||
// 限购时间
|
||||
TimePeriod *TimePeriod `json:"time_period"`
|
||||
// 限购维度1 // 端用户(比如uid=122,aid=1128) 2 // 用户组用户(比如uid=122,group=aweme) 3 // 设备 4 // 下单电话 5 // 收件电话 6 // 身份证号 7 // 支付账号
|
||||
TradeLimitSubjectList []int32 `json:"trade_limit_subject_list"`
|
||||
}
|
||||
type TradeCreateTradeLimitTemplateParam struct {
|
||||
// 门店ID
|
||||
StoreId int64 `json:"store_id"`
|
||||
// 限购参数
|
||||
TradeLimitRuleRequestList []TradeLimitRuleRequestListItem `json:"trade_limit_rule_request_list"`
|
||||
}
|
||||
type TradeLimitResourceObject struct {
|
||||
// 限购资源值列表
|
||||
TradeLimitResourceIdList []string `json:"trade_limit_resource_id_list"`
|
||||
}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package trade_createTradeLimitTemplate_response
|
||||
|
||||
import doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
|
||||
import (
|
||||
doudian_sdk "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/core"
|
||||
)
|
||||
|
||||
type TradeCreateTradeLimitTemplateResponse struct {
|
||||
doudian_sdk.BaseDoudianOpApiResponse
|
||||
Data *TradeCreateTradeLimitTemplateData `json:"data"`
|
||||
}
|
||||
type TradeCreateTradeLimitTemplateData struct {
|
||||
TradeLimitID int64 `json:"trade_limit_id"` //限购模板ID
|
||||
// 限购模板ID
|
||||
TradeLimitId int64 `json:"trade_limit_id"`
|
||||
}
|
||||
|
||||
@@ -9,11 +9,11 @@ type CreateTokenRequest struct {
|
||||
param *CreateTokenParam
|
||||
}
|
||||
|
||||
func (r *CreateTokenRequest) GetParamObject() interface{}{
|
||||
func (r *CreateTokenRequest) GetParamObject() interface{} {
|
||||
return r.param
|
||||
}
|
||||
|
||||
func(r *CreateTokenRequest) GetParams() *CreateTokenParam {
|
||||
func (r *CreateTokenRequest) GetParams() *CreateTokenParam {
|
||||
return r.param
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ func (r *CreateTokenRequest) GetUrlPath() string {
|
||||
|
||||
func NewCreateTokenRequest() *CreateTokenRequest {
|
||||
request := &CreateTokenRequest{
|
||||
param: &CreateTokenParam{},
|
||||
param: &CreateTokenParam{},
|
||||
}
|
||||
request.SetConfig(GlobalConfig)
|
||||
request.SetClient(DefaultDoudianOpApiClient)
|
||||
@@ -45,9 +45,7 @@ type CreateTokenResponse struct {
|
||||
Data CreateTokenData `json:"data"`
|
||||
}
|
||||
|
||||
|
||||
type CreateTokenParam struct {
|
||||
|
||||
Code string `json:"code"`
|
||||
|
||||
GrantType string `json:"grant_type"`
|
||||
|
||||
@@ -2,6 +2,7 @@ package doudian_sdk
|
||||
|
||||
import (
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
@@ -35,7 +36,7 @@ func ConfigSpiWithUrlQuery(request DoudianOpSpiRequest, handler BizHandler, quer
|
||||
appKey := queries.Get("app_key")
|
||||
paramJson := queries.Get("param_json")
|
||||
if len(paramJson) == 0 {
|
||||
bs, _ := io.ReadAll(body)
|
||||
bs, _ := ioutil.ReadAll(body)
|
||||
paramJson = string(bs)
|
||||
}
|
||||
sign := queries.Get("sign")
|
||||
|
||||
@@ -22,7 +22,7 @@ type API struct {
|
||||
appSecret string
|
||||
accessToken string
|
||||
refreshToken string
|
||||
expiresIn int64
|
||||
expiresIn int64 // 当前时间的七天内为有效期
|
||||
locker sync.RWMutex
|
||||
}
|
||||
|
||||
@@ -36,7 +36,8 @@ func New(appKey, appSecret, accessToken string) *API {
|
||||
AccessToken = access
|
||||
}
|
||||
}
|
||||
|
||||
doudian_sdk.GlobalConfig.AppKey = appKey
|
||||
doudian_sdk.GlobalConfig.AppSecret = appSecret
|
||||
return &API{
|
||||
appKey: appKey,
|
||||
appSecret: appSecret,
|
||||
@@ -71,13 +72,17 @@ func (a *API) CreateToken(code string) (*doudian_sdk.CreateTokenData, error) {
|
||||
|
||||
a.accessToken = access.AccessToken
|
||||
a.refreshToken = access.RefreshToken
|
||||
a.expiresIn = access.ExpiresIn
|
||||
a.expiresIn = time.Now().Unix() + access.ExpiresIn
|
||||
AccessToken = access
|
||||
strData, _ := json.Marshal(access)
|
||||
globals.SugarLogger.Debug("=========", string(strData))
|
||||
return &access.CreateTokenData, nil
|
||||
}
|
||||
|
||||
// RefreshToken 刷新token
|
||||
func (a *API) RefreshToken() (*doudian_sdk.CreateTokenData, error) {
|
||||
doudian_sdk.GlobalConfig.AppKey = a.appKey
|
||||
doudian_sdk.GlobalConfig.AppSecret = a.appSecret
|
||||
refresh := doudian_sdk.NewRefreshTokenRequest()
|
||||
refresh.GetParam().RefreshToken = a.refreshToken
|
||||
refresh.GetParam().GrantType = "refresh_token"
|
||||
@@ -88,7 +93,7 @@ func (a *API) RefreshToken() (*doudian_sdk.CreateTokenData, error) {
|
||||
}
|
||||
a.accessToken = createToken.Data.AccessToken
|
||||
a.refreshToken = createToken.Data.RefreshToken
|
||||
a.expiresIn = createToken.Data.ExpiresIn
|
||||
a.expiresIn = time.Now().Unix() + createToken.Data.ExpiresIn
|
||||
AccessToken.CreateTokenData = createToken.Data
|
||||
return &createToken.Data, nil
|
||||
}
|
||||
|
||||
85
platformapi/tiktok_shop/tiktok_api/create_store_test.go
Normal file
85
platformapi/tiktok_shop/tiktok_api/create_store_test.go
Normal file
@@ -0,0 +1,85 @@
|
||||
package tiktok_api
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi"
|
||||
address_create_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/address_create/request"
|
||||
shop_batchCreateStore_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_batchCreateStore/request"
|
||||
"go.uber.org/zap"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var (
|
||||
api *address_create_request.AddressCreateRequest
|
||||
sugarLogger *zap.SugaredLogger
|
||||
)
|
||||
|
||||
func init() {
|
||||
logger, _ := zap.NewDevelopment()
|
||||
sugarLogger = logger.Sugar()
|
||||
baseapi.Init(sugarLogger)
|
||||
|
||||
// sandbox
|
||||
// api = New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0")
|
||||
// prod
|
||||
api = address_create_request.New()
|
||||
}
|
||||
|
||||
func TestCreateToken(t *testing.T) {
|
||||
api2 := New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", "")
|
||||
accessToken, err := api2.CreateToken("bb52688c-7bca-4b64-8747-5258a9a6ba33")
|
||||
fmt.Println(err)
|
||||
fmt.Println(accessToken)
|
||||
}
|
||||
|
||||
// {"access_token":"90868a42-1287-4453-ba71-34c72f22e886","expires_in":555553,"scope":"SCOPE","shop_id":"","shop_name":"小时达开放平台对接专用店","refresh_token":"4e8cf946-8df1-4489-be88-f96f2d4603a8","authority_id ":""}
|
||||
func TestCreateStore(t *testing.T) {
|
||||
accesstoken := `{"access_token":"90868a42-1287-4453-ba71-34c72f22e886","expires_in":555553,"scope":"SCOPE","shop_id":"","shop_name":"小时达开放平台对接专用店","refresh_token":"4e8cf946-8df1-4489-be88-f96f2d4603a8","authority_id ":""}`
|
||||
New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", accesstoken)
|
||||
request := address_create_request.New()
|
||||
param := request.GetParams()
|
||||
param.StoreId = 666667
|
||||
|
||||
storeParam := &address_create_request.Address{}
|
||||
storeParam.UserName = "火车南站店"
|
||||
storeParam.Mobile = "13688039650"
|
||||
storeParam.ProvinceId = 510000
|
||||
storeParam.CityId = 510100
|
||||
storeParam.TownId = 510107
|
||||
storeParam.Detail = "四川省成都市武侯区火车南站综合市场蔬菜区27-28号"
|
||||
storeParam.StreetId = 222
|
||||
storeParam.LinkType = 0
|
||||
storeParam.FixedPhone = "13688039650"
|
||||
storeParam.Remark = "抖音火车南站测试门店"
|
||||
param.Address = storeParam
|
||||
data, err := request.Execute(AccessToken)
|
||||
t.Fatal("err===========", err)
|
||||
fmt.Println("data==", fmt.Sprintf("%v", data))
|
||||
}
|
||||
|
||||
func TestCreateStoreList(t *testing.T) {
|
||||
accesstoken := `{"access_token":"90868a42-1287-4453-ba71-34c72f22e886","expires_in":555553,"scope":"SCOPE","shop_id":"","shop_name":"小时达开放平台对接专用店","refresh_token":"4e8cf946-8df1-4489-be88-f96f2d4603a8","authority_id ":""}`
|
||||
New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", accesstoken)
|
||||
request := shop_batchCreateStore_request.New()
|
||||
//param := request.GetParams()
|
||||
|
||||
//storeList := make([]*shop_batchCreateStore_request.ShopBatchCreateStoreParam, 0)
|
||||
list := &shop_batchCreateStore_request.StoreListItem{
|
||||
RowId: 1,
|
||||
Name: "京西菜市小时达测试店铺",
|
||||
StoreCode: "666667",
|
||||
Longitude: "104.065132",
|
||||
Latitude: "30.610506",
|
||||
Province: "510000",
|
||||
City: "510100",
|
||||
District: "510107",
|
||||
Address: "武侯区火车南站综合市场蔬菜区27-28号",
|
||||
Contact: "18981810340",
|
||||
OpenTime: &shop_batchCreateStore_request.OpenTime{DayMap: map[int64]string{1: "07:00-19:00"}},
|
||||
}
|
||||
request.Param.StoreList = append(request.Param.StoreList, *list)
|
||||
resp, err := request.Execute(AccessToken)
|
||||
t.Fatal("err===========", err)
|
||||
t.Fatalf("resp===========:%v", resp)
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"git.rosy.net.cn/baseapi"
|
||||
order_orderDetail_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/order_orderDetail/request"
|
||||
order_orderDetail_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/order_orderDetail/response"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
)
|
||||
@@ -45,82 +46,125 @@ func (a *API) CreateOrderCallback(request *http.Request) ([]*OrderCallback, *Cal
|
||||
switch data.Tag {
|
||||
case CallbackCreatedOrderMsgTagId: // 创建订单
|
||||
create := CreateOrderData{}
|
||||
if err := json.Unmarshal([]byte(data.Data), create); err != nil {
|
||||
if err := json.Unmarshal([]byte(utils.Interface2String(data.Data)), create); err != nil {
|
||||
return nil, CallbackResponseErr(false)
|
||||
}
|
||||
data.Body[CallbackCreatedOrderMsgTagId] = append(data.Body[CallbackCreatedOrderMsgTagId], create)
|
||||
case CallbackPayOrderMsgTagId: // 支付订单
|
||||
create := PayOrderData{}
|
||||
if err = json.Unmarshal([]byte(data.Data), create); err != nil {
|
||||
if err = json.Unmarshal([]byte(utils.Interface2String(data.Data)), create); err != nil {
|
||||
return nil, CallbackResponseErr(false)
|
||||
}
|
||||
data.Body[CallbackPayOrderMsgTagId] = append(data.Body[CallbackPayOrderMsgTagId], create)
|
||||
case CallbackWaitOrderMsgTagId: // 支付订单待处理(风控审核)
|
||||
create := WaitOrderData{}
|
||||
if err = json.Unmarshal([]byte(data.Data), create); err != nil {
|
||||
if err = json.Unmarshal([]byte(utils.Interface2String(data.Data)), create); err != nil {
|
||||
return nil, CallbackResponseErr(false)
|
||||
}
|
||||
data.Body[CallbackWaitOrderMsgTagId] = append(data.Body[CallbackWaitOrderMsgTagId], create)
|
||||
case CallbackPartGoodsMsgTagId: // 卖家部分发货
|
||||
create := SomeSendOrderData{}
|
||||
if err = json.Unmarshal([]byte(data.Data), create); err != nil {
|
||||
if err = json.Unmarshal([]byte(utils.Interface2String(data.Data)), create); err != nil {
|
||||
return nil, CallbackResponseErr(false)
|
||||
}
|
||||
data.Body[CallbackPartGoodsMsgTagId] = append(data.Body[CallbackPartGoodsMsgTagId], create)
|
||||
case CallbackPartAllGoodsMsgTagId: // 卖家发货
|
||||
create := BusinessDeliveryData{}
|
||||
if err = json.Unmarshal([]byte(data.Data), create); err != nil {
|
||||
if err = json.Unmarshal([]byte(utils.Interface2String(data.Data)), create); err != nil {
|
||||
return nil, CallbackResponseErr(false)
|
||||
}
|
||||
data.Body[CallbackPartAllGoodsMsgTagId] = append(data.Body[CallbackPartAllGoodsMsgTagId], create)
|
||||
case CallbackCancelOrderMsgTagId: // 取消订单
|
||||
create := CancelOrderData{}
|
||||
if err = json.Unmarshal([]byte(data.Data), create); err != nil {
|
||||
if err = json.Unmarshal([]byte(utils.Interface2String(data.Data)), create); err != nil {
|
||||
return nil, CallbackResponseErr(false)
|
||||
}
|
||||
data.Body[CallbackCancelOrderMsgTagId] = append(data.Body[CallbackCancelOrderMsgTagId], create)
|
||||
case CallbackSuccessOrderMsgTagId: // 卖家确认收货时,会自动完成
|
||||
create := SuccessOrderData{}
|
||||
if err = json.Unmarshal([]byte(data.Data), create); err != nil {
|
||||
if err = json.Unmarshal([]byte(utils.Interface2String(data.Data)), create); err != nil {
|
||||
return nil, CallbackResponseErr(false)
|
||||
}
|
||||
data.Body[CallbackSuccessOrderMsgTagId] = append(data.Body[CallbackSuccessOrderMsgTagId], create)
|
||||
case CallbackWayBillChangeOrderMsgTagId: // 发货物流消息便跟
|
||||
create := WayBillChangeData{}
|
||||
if err = json.Unmarshal([]byte(data.Data), create); err != nil {
|
||||
if err = json.Unmarshal([]byte(utils.Interface2String(data.Data)), create); err != nil {
|
||||
return nil, CallbackResponseErr(false)
|
||||
}
|
||||
data.Body[CallbackWayBillChangeOrderMsgTagId] = append(data.Body[CallbackWayBillChangeOrderMsgTagId], create)
|
||||
case CallbackReceivingChangeOrderMsgTagId: // 收货地址消息变更(商家审核通过触发)
|
||||
create := ReceivingAddressChangeData{}
|
||||
if err = json.Unmarshal([]byte(data.Data), create); err != nil {
|
||||
if err = json.Unmarshal([]byte(utils.Interface2String(data.Data)), create); err != nil {
|
||||
return nil, CallbackResponseErr(false)
|
||||
}
|
||||
data.Body[CallbackReceivingChangeOrderMsgTagId] = append(data.Body[CallbackReceivingChangeOrderMsgTagId], create)
|
||||
case CallbackChangeMoneyMsgTagId: // 卖家修改订单/运单金额回调
|
||||
create := UpdateAmountChangeData{}
|
||||
if err = json.Unmarshal([]byte(data.Data), create); err != nil {
|
||||
if err = json.Unmarshal([]byte(utils.Interface2String(data.Data)), create); err != nil {
|
||||
return nil, CallbackResponseErr(false)
|
||||
}
|
||||
data.Body[CallbackChangeMoneyMsgTagId] = append(data.Body[CallbackChangeMoneyMsgTagId], create)
|
||||
case CallbackBusinessRemarkMsgTagId: // 买家收货消息变更(手机,地址,姓名),用户C端修改触发(需要上面审核接口)
|
||||
create := BuyerUpdateWayBillData{}
|
||||
if err = json.Unmarshal([]byte(data.Data), create); err != nil {
|
||||
if err = json.Unmarshal([]byte(utils.Interface2String(data.Data)), create); err != nil {
|
||||
return nil, CallbackResponseErr(false)
|
||||
}
|
||||
data.Body[CallbackBusinessRemarkMsgTagId] = append(data.Body[CallbackBusinessRemarkMsgTagId], create)
|
||||
case CallbackApplyUpdateAddressMsgTagId: // 商家修改交易备注回调
|
||||
create := BusinessUpdateRemakeData{}
|
||||
if err = json.Unmarshal([]byte(data.Data), create); err != nil {
|
||||
if err = json.Unmarshal([]byte(utils.Interface2String(data.Data)), create); err != nil {
|
||||
return nil, CallbackResponseErr(false)
|
||||
}
|
||||
data.Body[CallbackApplyUpdateAddressMsgTagId] = append(data.Body[CallbackApplyUpdateAddressMsgTagId], create)
|
||||
case CallbackSendOrderTimeChangeMsgTagId: // 订单发货时消息变更回调
|
||||
create := AppointmentChangeData{}
|
||||
if err = json.Unmarshal([]byte(data.Data), create); err != nil {
|
||||
if err = json.Unmarshal([]byte(utils.Interface2String(data.Data)), create); err != nil {
|
||||
return nil, CallbackResponseErr(false)
|
||||
}
|
||||
data.Body[CallbackSendOrderTimeChangeMsgTagId] = append(data.Body[CallbackSendOrderTimeChangeMsgTagId], create)
|
||||
/*********下面属于订单退货消息************/
|
||||
case CallbackRefundOrderMsgTagId: // 买家发起售后申请消息
|
||||
create := BuyerRefundCreatedData{}
|
||||
if err = json.Unmarshal([]byte(utils.Interface2String(data.Data)), create); err != nil {
|
||||
return nil, CallbackResponseErr(false)
|
||||
}
|
||||
data.Body[CallbackRefundOrderMsgTagId] = append(data.Body[CallbackRefundOrderMsgTagId], create)
|
||||
case CallbackUpdateRefundOrderMsgTagId: // 买家修改售后申请消息
|
||||
create := BuyerRefundModifiedData{}
|
||||
if err = json.Unmarshal([]byte(utils.Interface2String(data.Data)), create); err != nil {
|
||||
return nil, CallbackResponseErr(false)
|
||||
}
|
||||
data.Body[CallbackUpdateRefundOrderMsgTagId] = append(data.Body[CallbackUpdateRefundOrderMsgTagId], create)
|
||||
case CallbackRefundOrderSuccessMsgTagId: // 退款成功消息
|
||||
create := BusinessRefundSuccessData{}
|
||||
if err = json.Unmarshal([]byte(utils.Interface2String(data.Data)), create); err != nil {
|
||||
return nil, CallbackResponseErr(false)
|
||||
}
|
||||
data.Body[CallbackRefundOrderSuccessMsgTagId] = append(data.Body[CallbackRefundOrderSuccessMsgTagId], create)
|
||||
case CallbackRefundOrderRefuseMsgTagId: // 拒绝退款消息
|
||||
create := BusinessNotRefundRefusedData{}
|
||||
if err = json.Unmarshal([]byte(utils.Interface2String(data.Data)), create); err != nil {
|
||||
return nil, CallbackResponseErr(false)
|
||||
}
|
||||
data.Body[CallbackRefundOrderRefuseMsgTagId] = append(data.Body[CallbackRefundOrderRefuseMsgTagId], create)
|
||||
case CallbackRefundShopMsgTagId: // 拒绝退货申请消息
|
||||
create := BusinessNotReturnApplyRefusedData{}
|
||||
if err = json.Unmarshal([]byte(utils.Interface2String(data.Data)), create); err != nil {
|
||||
return nil, CallbackResponseErr(false)
|
||||
}
|
||||
data.Body[CallbackRefundShopMsgTagId] = append(data.Body[CallbackRefundShopMsgTagId], create)
|
||||
case CallbackReturnApplyAgreedMsgTagId: // 卖家同意时,推送此消息
|
||||
create := BusinessReturnApplyAgreedData{}
|
||||
if err = json.Unmarshal([]byte(utils.Interface2String(data.Data)), create); err != nil {
|
||||
return nil, CallbackResponseErr(false)
|
||||
}
|
||||
data.Body[CallbackReturnApplyAgreedMsgTagId] = append(data.Body[CallbackReturnApplyAgreedMsgTagId], create)
|
||||
case CallbackReturnRefundAgreedMsgTagId: // 同意退款消息
|
||||
create := AppointmentChangeData{}
|
||||
if err = json.Unmarshal([]byte(utils.Interface2String(data.Data)), create); err != nil {
|
||||
return nil, CallbackResponseErr(false)
|
||||
}
|
||||
data.Body[CallbackReturnRefundAgreedMsgTagId] = append(data.Body[CallbackReturnRefundAgreedMsgTagId], create)
|
||||
default:
|
||||
return nil, CallbackResponseErr(false)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package tiktok_api
|
||||
|
||||
import "time"
|
||||
|
||||
type CallbackResponse struct {
|
||||
Code int `json:"code"`
|
||||
Msg string `json:"msg"`
|
||||
@@ -14,7 +16,7 @@ type PublicOrderCallback struct {
|
||||
type OrderCallback struct {
|
||||
Tag string `json:"tag"` // 消息种类,订单创建消息的tag值为"100"
|
||||
MsgId string `json:"msgId"` //消息记录id
|
||||
Data string `json:"data"` // 消息正文
|
||||
Data interface{} `json:"data"` // 消息正文
|
||||
Body map[string][]interface{} `json:"body"`
|
||||
}
|
||||
|
||||
@@ -310,3 +312,171 @@ type AppointmentChangeData struct {
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
/*******************************退款退货回调消息**********************************************/
|
||||
|
||||
//#region 买家发起售后申请消息
|
||||
|
||||
type BuyerRefundCreatedCallback struct {
|
||||
PublicOrderCallback
|
||||
Data *BuyerRefundCreatedData `json:"data"`
|
||||
}
|
||||
|
||||
type BuyerRefundCreatedData struct {
|
||||
AftersaleId int64 `json:"aftersale_id"`
|
||||
AftersaleStatus int `json:"aftersale_status"`
|
||||
AftersaleType int `json:"aftersale_type"`
|
||||
ApplyTime int `json:"apply_time"`
|
||||
PId int64 `json:"p_id"`
|
||||
ReasonCode int `json:"reason_code"`
|
||||
RefundAmount int `json:"refund_amount"`
|
||||
RefundPostAmount int `json:"refund_post_amount"`
|
||||
RefundVoucherNum int `json:"refund_voucher_num"`
|
||||
SId int64 `json:"s_id"`
|
||||
ShopId int `json:"shop_id"`
|
||||
UpdateTime time.Time `json:"update_time"`
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region 买家修改售后申请消息
|
||||
|
||||
type BuyerRefundModifiedCallBack struct {
|
||||
PublicOrderCallback
|
||||
Data *BuyerRefundModifiedData `json:"data"`
|
||||
}
|
||||
type BuyerRefundModifiedData struct {
|
||||
AftersaleId int64 `json:"aftersale_id"`
|
||||
AftersaleStatus int `json:"aftersale_status"`
|
||||
AftersaleType int `json:"aftersale_type"`
|
||||
ModifyTime int `json:"modify_time"`
|
||||
PId int64 `json:"p_id"`
|
||||
ReasonCode int `json:"reason_code"`
|
||||
RefundAmount int `json:"refund_amount"`
|
||||
RefundPostAmount int `json:"refund_post_amount"`
|
||||
RefundVoucherNum int `json:"refund_voucher_num"`
|
||||
SId int64 `json:"s_id"`
|
||||
ShopId int `json:"shop_id"`
|
||||
UpdateTime time.Time `json:"update_time"`
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region 退款成功消息
|
||||
|
||||
type BusinessRefundSuccessCallback struct {
|
||||
PublicOrderCallback
|
||||
Data *BusinessRefundSuccessData `json:"data"`
|
||||
}
|
||||
|
||||
type BusinessRefundSuccessData struct {
|
||||
AftersaleId int64 `json:"aftersale_id"`
|
||||
AftersaleStatus int `json:"aftersale_status"`
|
||||
AftersaleType int `json:"aftersale_type"`
|
||||
PId int64 `json:"p_id"`
|
||||
ReasonCode int `json:"reason_code"`
|
||||
RefundAmount int `json:"refund_amount"`
|
||||
RefundPostAmount int `json:"refund_post_amount"`
|
||||
RefundVoucherNum int `json:"refund_voucher_num"`
|
||||
SId int64 `json:"s_id"`
|
||||
ShopId int `json:"shop_id"`
|
||||
SuccessTime int `json:"success_time"`
|
||||
UpdateTime time.Time `json:"update_time"`
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region 拒绝退货申请消息
|
||||
|
||||
type BusinessNotReturnApplyRefusedCallBack struct {
|
||||
PublicOrderCallback
|
||||
Data *BusinessNotReturnApplyRefusedData `json:"data"`
|
||||
}
|
||||
type BusinessNotReturnApplyRefusedData struct {
|
||||
AftersaleId int64 `json:"aftersale_id"`
|
||||
AftersaleStatus int `json:"aftersale_status"`
|
||||
AftersaleType int `json:"aftersale_type"`
|
||||
PId int64 `json:"p_id"`
|
||||
ReasonCode int `json:"reason_code"`
|
||||
RefundAmount int `json:"refund_amount"`
|
||||
RefundPostAmount int `json:"refund_post_amount"`
|
||||
RefundVoucherNum int `json:"refund_voucher_num"`
|
||||
RefuseTime int `json:"refuse_time"`
|
||||
SId int64 `json:"s_id"`
|
||||
ShopId int `json:"shop_id"`
|
||||
UpdateTime time.Time `json:"update_time"`
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region 拒绝退款消息
|
||||
|
||||
type BusinessNotRefundRefusedCallBack struct {
|
||||
PublicOrderCallback
|
||||
Data *BusinessNotRefundRefusedData `json:"data"`
|
||||
}
|
||||
|
||||
type BusinessNotRefundRefusedData struct {
|
||||
AftersaleId int64 `json:"aftersale_id"`
|
||||
AftersaleStatus int `json:"aftersale_status"`
|
||||
AftersaleType int `json:"aftersale_type"`
|
||||
PId int64 `json:"p_id"`
|
||||
ReasonCode int `json:"reason_code"`
|
||||
RefundAmount int `json:"refund_amount"`
|
||||
RefundPostAmount int `json:"refund_post_amount"`
|
||||
RefundVoucherNum int `json:"refund_voucher_num"`
|
||||
RefuseTime int `json:"refuse_time"`
|
||||
SId int64 `json:"s_id"`
|
||||
ShopId int `json:"shop_id"`
|
||||
UpdateTime time.Time `json:"update_time"`
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region 卖家同意退货申请消息
|
||||
|
||||
type BusinessReturnApplyAgreedCallback struct {
|
||||
PublicOrderCallback
|
||||
Data *BusinessReturnApplyAgreedData `json:"data"`
|
||||
}
|
||||
type BusinessReturnApplyAgreedData struct {
|
||||
Addr string `json:"addr"` // 退货地址
|
||||
AftersaleId int64 `json:"aftersale_id"` // 售后单ID
|
||||
AftersaleStatus int `json:"aftersale_status"` // 售后状态
|
||||
AftersaleType int `json:"aftersale_type"` // 售后类型
|
||||
AgreeTime int `json:"agree_time"` // 同意时间
|
||||
PId int64 `json:"p_id"` // 父id
|
||||
ReasonCode int `json:"reason_code"` // 申请码
|
||||
RefundAmount int `json:"refund_amount"` // 申请退款的金额(含运费)
|
||||
RefundPostAmount int `json:"refund_post_amount"` // 申请退的运费金额
|
||||
RefundVoucherNum int `json:"refund_voucher_num"` // 申请退款的卡券的数量
|
||||
SId int64 `json:"s_id"` // 子订单ID
|
||||
ShopId int `json:"shop_id"` // 店铺ID
|
||||
UpdateTime time.Time `json:"update_time"` // 售后单更新时间
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region 卖家同意退款回调
|
||||
|
||||
type BusinessRefundAgreedCallback struct {
|
||||
PublicOrderCallback
|
||||
Data *AppointmentChangeData `json:"data"`
|
||||
}
|
||||
|
||||
type BusinessRefundAgreedData struct {
|
||||
AftersaleId int64 `json:"aftersale_id"` // 售后单ID
|
||||
AftersaleStatus int `json:"aftersale_status"` // 售后状态码,枚举值如下
|
||||
AftersaleType int `json:"aftersale_type"` // 售后类型: 0: 退货 1: 售后仅退款 2: 发货前退款 3:换货
|
||||
AgreeTime int `json:"agree_time"` // 同意退款时间
|
||||
PId int64 `json:"p_id"` // 父订单ID
|
||||
ReasonCode int `json:"reason_code"` // 申请售后原因码,枚举值如下
|
||||
RefundAmount int `json:"refund_amount"` // 申请退款的金额(含运费)
|
||||
RefundPostAmount int `json:"refund_post_amount"` // 申请退的运费金额
|
||||
RefundVoucherNum int `json:"refund_voucher_num"` // 申请退款的卡券的数量
|
||||
SId int64 `json:"s_id"` // 子订单ID
|
||||
ShopId int `json:"shop_id"` // 店铺ID
|
||||
UpdateTime time.Time `json:"update_time"` // 售后单更新时间
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package tiktok_api
|
||||
|
||||
// 回调类型
|
||||
// 订单消息回调类型(正向订单)
|
||||
const (
|
||||
CallbackCreatedOrderMsgTagId = "100" // 创建订单回调
|
||||
CallbackPayOrderMsgTagId = "101" // 支付订单回调
|
||||
@@ -52,3 +52,14 @@ const (
|
||||
OrderComeTiktokBig = 14 // 抖+
|
||||
OrderComePangolin = 15 // 穿山甲
|
||||
)
|
||||
|
||||
// CallbackRefundOrderMsgTagId 订单退款状态,逆向订单
|
||||
const (
|
||||
CallbackRefundOrderMsgTagId = "200" // 买家发起售后申请消息
|
||||
CallbackUpdateRefundOrderMsgTagId = "208" // 买家修改售后申请消息
|
||||
CallbackRefundOrderSuccessMsgTagId = "206" // 退款成功消息
|
||||
CallbackRefundOrderRefuseMsgTagId = "204" // 拒绝退款消息
|
||||
CallbackRefundShopMsgTagId = "205" // 拒绝退货申请消息
|
||||
CallbackReturnApplyAgreedMsgTagId = "202" // 卖家同意时,推送此消息
|
||||
CallbackReturnRefundAgreedMsgTagId = "201" // 同意退款消息
|
||||
)
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
//
|
||||
@@ -48,11 +47,11 @@ import (
|
||||
// }
|
||||
// return nil, a.Err2CallbackResponse("", err, nil)
|
||||
//}
|
||||
|
||||
func GetCmd(request *http.Request) (cmd string) {
|
||||
cmd, _ = url.QueryUnescape(request.FormValue("tag"))
|
||||
return cmd
|
||||
}
|
||||
//
|
||||
//func GetCmd(request *http.Request) (cmd string) {
|
||||
// cmd, _ = url.QueryUnescape(request.FormValue("tag"))
|
||||
// return cmd
|
||||
//}
|
||||
|
||||
// EventSignChange 回调消息防伪标签校验
|
||||
func (a *API) EventSignChange(c *http.Request) *CallbackResponse {
|
||||
|
||||
@@ -24,22 +24,9 @@ func (a *API) GetStoreDetail() {
|
||||
}
|
||||
|
||||
//BatchCreateStore 批量创建门店
|
||||
func (a *API) BatchCreateStore(storeInfo BatchCreateStoreReq) (*shop_batchCreateStore_response.ShopBatchCreateStoreData, error) {
|
||||
func (a *API) BatchCreateStore(param *shop_batchCreateStore_request.ShopBatchCreateStoreParam) (*shop_batchCreateStore_response.ShopBatchCreateStoreData, error) {
|
||||
request := shop_batchCreateStore_request.New()
|
||||
request.Param = &shop_batchCreateStore_request.ShopBatchCreateStoreParam{
|
||||
RowID: int64(storeInfo.RowID),
|
||||
Name: storeInfo.Name,
|
||||
StoreCode: storeInfo.StoreCode,
|
||||
Longitude: storeInfo.Longitude,
|
||||
Latitude: storeInfo.Latitude,
|
||||
Province: storeInfo.Province,
|
||||
City: storeInfo.City,
|
||||
District: storeInfo.District,
|
||||
Address: storeInfo.Address,
|
||||
Contact: storeInfo.Contact,
|
||||
OpenTime: storeInfo.OpenTime,
|
||||
StoreID: int64(storeInfo.StoreID),
|
||||
}
|
||||
request.Param = param
|
||||
response, err := request.Execute(AccessToken)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -51,22 +38,9 @@ func (a *API) BatchCreateStore(storeInfo BatchCreateStoreReq) (*shop_batchCreate
|
||||
}
|
||||
|
||||
// EditStore 编辑门店
|
||||
func (a *API) EditStore(storeInfo EditStoreReq) (*shop_editStore_response.ShopEditStoreData, error) {
|
||||
func (a *API) EditStore(param *shop_editStore_request.ShopEditStoreParam) (*shop_editStore_response.ShopEditStoreData, error) {
|
||||
request := shop_editStore_request.New()
|
||||
request.Param = &shop_editStore_request.ShopEditStoreParam{
|
||||
RowID: int64(storeInfo.RowID),
|
||||
Name: storeInfo.Name,
|
||||
StoreCode: storeInfo.StoreCode,
|
||||
Longitude: storeInfo.Longitude,
|
||||
Latitude: storeInfo.Latitude,
|
||||
Province: storeInfo.Province,
|
||||
City: storeInfo.City,
|
||||
District: storeInfo.District,
|
||||
Address: storeInfo.Address,
|
||||
Contact: storeInfo.Contact,
|
||||
OpenTime: storeInfo.OpenTime,
|
||||
StoreID: int64(storeInfo.StoreID),
|
||||
}
|
||||
request.Param = param
|
||||
response, err := request.Execute(AccessToken)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -78,12 +52,9 @@ func (a *API) EditStore(storeInfo EditStoreReq) (*shop_editStore_response.ShopEd
|
||||
}
|
||||
|
||||
//暂停营业
|
||||
func (a *API) StoreSuspend(info StoreSuspendReq) (*shop_storeSuspend_response.ShopStoreSuspendData, error) {
|
||||
func (a *API) StoreSuspend(param *shop_storeSuspend_request.ShopStoreSuspendParam) (*shop_storeSuspend_response.ShopStoreSuspendData, error) {
|
||||
request := shop_storeSuspend_request.New()
|
||||
request.Param = &shop_storeSuspend_request.ShopStoreSuspendParam{
|
||||
StoreID: int64(info.StoreID),
|
||||
Reason: info.Reason,
|
||||
}
|
||||
request.Param = param
|
||||
response, err := request.Execute(AccessToken)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -95,12 +66,9 @@ func (a *API) StoreSuspend(info StoreSuspendReq) (*shop_storeSuspend_response.Sh
|
||||
}
|
||||
|
||||
//门店恢复营业
|
||||
func (a *API) UnsuspendStore(info UnsuspendStoreReq) (*shop_unsuspendStore_response.ShopUnsuspendStoreData, error) {
|
||||
func (a *API) UnsuspendStore(param *shop_unsuspendStore_request.ShopUnsuspendStoreParam) (*shop_unsuspendStore_response.ShopUnsuspendStoreData, error) {
|
||||
request := shop_unsuspendStore_request.New()
|
||||
request.Param = &shop_unsuspendStore_request.ShopUnsuspendStoreParam{
|
||||
StoreID: int64(info.StoreID),
|
||||
Reason: info.Reason,
|
||||
}
|
||||
request.Param = param
|
||||
response, err := request.Execute(AccessToken)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -112,15 +80,9 @@ func (a *API) UnsuspendStore(info UnsuspendStoreReq) (*shop_unsuspendStore_respo
|
||||
}
|
||||
|
||||
//创建限售规则模板
|
||||
func (a *API) CreateTradeLimitTemplate(info CreateTradeLimitTemplateReq) (*trade_createTradeLimitTemplate_response.TradeCreateTradeLimitTemplateData, error) {
|
||||
func (a *API) CreateTradeLimitTemplate(param *trade_createTradeLimitTemplate_request.TradeCreateTradeLimitTemplateParam) (*trade_createTradeLimitTemplate_response.TradeCreateTradeLimitTemplateData, error) {
|
||||
request := trade_createTradeLimitTemplate_request.New()
|
||||
request.Param = &trade_createTradeLimitTemplate_request.TradeCreateTradeLimitTemplateParam{
|
||||
StoreID: info.StoreID,
|
||||
TradeLimitRuleRequestList: info.TradeLimitRuleRequestList,
|
||||
TradeLimitResourceObject: info.TradeLimitResourceObject,
|
||||
TradeLimitPattern: info.TradeLimitPattern,
|
||||
TimePeriod: info.TimePeriod,
|
||||
}
|
||||
request.Param = param
|
||||
response, err := request.Execute(AccessToken)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -132,12 +94,9 @@ func (a *API) CreateTradeLimitTemplate(info CreateTradeLimitTemplateReq) (*trade
|
||||
}
|
||||
|
||||
//门店绑定限售模板
|
||||
func (a *API) BindStoreSaleLimit(info BindBindStoreSaleLimitReq) (*shop_bindStoreSaleLimit_response.ShopBindStoreSaleLimitData, error) {
|
||||
func (a *API) BindStoreSaleLimit(param *shop_bindStoreSaleLimit_request.ShopBindStoreSaleLimitParam) (*shop_bindStoreSaleLimit_response.ShopBindStoreSaleLimitData, error) {
|
||||
request := shop_bindStoreSaleLimit_request.New()
|
||||
request.Param = &shop_bindStoreSaleLimit_request.ShopBindStoreSaleLimitParam{
|
||||
StoreID: info.StoreID,
|
||||
SaleLimitID: info.SaleLimitID,
|
||||
}
|
||||
request.Param = param
|
||||
response, err := request.Execute(AccessToken)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -149,23 +108,9 @@ func (a *API) BindStoreSaleLimit(info BindBindStoreSaleLimitReq) (*shop_bindStor
|
||||
}
|
||||
|
||||
//门店新增查询发货地址
|
||||
func (a *API) AddressCreate(info CreateAddressReq) (*address_create_response.AddressCreateData, error) {
|
||||
func (a *API) AddressCreate(param *address_create_request.AddressCreateParam) (*address_create_response.AddressCreateData, error) {
|
||||
request := address_create_request.New()
|
||||
request.Param = &address_create_request.AddressCreateParam{
|
||||
Address: &address_create_request.Address{
|
||||
UserName: info.Address.UserName,
|
||||
Mobile: info.Address.Mobile,
|
||||
ProvinceId: info.Address.ProvinceId,
|
||||
CityId: info.Address.CityId,
|
||||
TownId: info.Address.TownId,
|
||||
Detail: info.Address.Detail,
|
||||
StreetId: info.Address.StreetId,
|
||||
LinkType: info.Address.LinkType,
|
||||
FixedPhone: info.Address.FixedPhone,
|
||||
Remark: info.Address.Remark,
|
||||
},
|
||||
StoreId: info.StoreId,
|
||||
}
|
||||
request.Param = param
|
||||
response, err := request.Execute(AccessToken)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
package tiktok_api
|
||||
|
||||
import (
|
||||
shop_batchCreateStore_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_batchCreateStore/request"
|
||||
shop_editStore_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_editStore/request"
|
||||
trade_createTradeLimitTemplate_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/trade_createTradeLimitTemplate/request"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
//限购模型
|
||||
@@ -40,37 +34,37 @@ const (
|
||||
|
||||
//门店信息
|
||||
type Store struct {
|
||||
StoreID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
StoreCode string `json:"store_code"` //门店编码
|
||||
RelShopID int `json:"rel_shop_id"` //关联抖店Id
|
||||
PoiID int `json:"poi_id"`
|
||||
Longitude string `json:"longitude"` //经度
|
||||
Latitude string `json:"latitude"` //纬度
|
||||
Province string `json:"province"` //省份
|
||||
ProvinceCode string `json:"province_code"` //省份code
|
||||
City string `json:"city"` //市
|
||||
CityCode string `json:"city_code"` //城市code
|
||||
District string `json:"district"` //区
|
||||
DistrictCode string `json:"district_code"` //区code
|
||||
Town string `json:"town"` //街道/镇
|
||||
TownCode string `json:"town_code"` //街道/镇code
|
||||
Address string `json:"address"` //详细地址
|
||||
Contact string `json:"contact"` //联系方式
|
||||
OpenTime shop_batchCreateStore_request.OpenTime `json:"open_time"` //营业时间
|
||||
IsOpenNow bool `json:"is_open_now"` //当前时间是否在营业时间中,如果不在则是打烊中
|
||||
State int `json:"state"` //绑定状态 1绑定中;2绑定成功;3:资质验证中;4账户认证中;5正常营业(c端可下单);6暂停营业\
|
||||
PoiAuditState int `json:"poi_audit_state"` //poi审核子状态:1审核中;2绑定成功;3驳回
|
||||
QualState int `json:"qual_state"` //资质审核状态:0未提交;1审核中;2审核通过;3驳回
|
||||
RemitState int `json:"remit_state"` //账户验证状态:0未提交;1验证中;2通过;3失败
|
||||
OpenAccountState int `json:"open_account_state"` //开户状态:0未开户;1已开户
|
||||
SuspendType int `json:"suspend_type"` //停业类型:1商家主动操作;2平台处罚
|
||||
BoundTime int `json:"bound_time"` //绑定成功的时间
|
||||
CreateTime int `json:"create_time"` // 创建时间
|
||||
UpdateTime int `json:"update_time"` //更新时间
|
||||
QualPassTime int `json:"qual_pass_time"` //资质验证通过时间
|
||||
RemitPassTime int `json:"remit_pass_time"` //账户验证通过时间
|
||||
OpenAccountTime int `json:"open_account_time"` //变成已开户的时间
|
||||
StoreID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
StoreCode string `json:"store_code"` //门店编码
|
||||
RelShopID int `json:"rel_shop_id"` //关联抖店Id
|
||||
PoiID int `json:"poi_id"`
|
||||
Longitude string `json:"longitude"` //经度
|
||||
Latitude string `json:"latitude"` //纬度
|
||||
Province string `json:"province"` //省份
|
||||
ProvinceCode string `json:"province_code"` //省份code
|
||||
City string `json:"city"` //市
|
||||
CityCode string `json:"city_code"` //城市code
|
||||
District string `json:"district"` //区
|
||||
DistrictCode string `json:"district_code"` //区code
|
||||
Town string `json:"town"` //街道/镇
|
||||
TownCode string `json:"town_code"` //街道/镇code
|
||||
Address string `json:"address"` //详细地址
|
||||
Contact string `json:"contact"` //联系方式
|
||||
OpenTime OpenTime `json:"open_time"` //营业时间
|
||||
IsOpenNow bool `json:"is_open_now"` //当前时间是否在营业时间中,如果不在则是打烊中
|
||||
State int `json:"state"` //绑定状态 1绑定中;2绑定成功;3:资质验证中;4账户认证中;5正常营业(c端可下单);6暂停营业\
|
||||
PoiAuditState int `json:"poi_audit_state"` //poi审核子状态:1审核中;2绑定成功;3驳回
|
||||
QualState int `json:"qual_state"` //资质审核状态:0未提交;1审核中;2审核通过;3驳回
|
||||
RemitState int `json:"remit_state"` //账户验证状态:0未提交;1验证中;2通过;3失败
|
||||
OpenAccountState int `json:"open_account_state"` //开户状态:0未开户;1已开户
|
||||
SuspendType int `json:"suspend_type"` //停业类型:1商家主动操作;2平台处罚
|
||||
BoundTime int `json:"bound_time"` //绑定成功的时间
|
||||
CreateTime int `json:"create_time"` // 创建时间
|
||||
UpdateTime int `json:"update_time"` //更新时间
|
||||
QualPassTime int `json:"qual_pass_time"` //资质验证通过时间
|
||||
RemitPassTime int `json:"remit_pass_time"` //账户验证通过时间
|
||||
OpenAccountTime int `json:"open_account_time"` //变成已开户的时间
|
||||
}
|
||||
|
||||
//关联抖店信息
|
||||
@@ -88,26 +82,26 @@ type RelShopUser struct {
|
||||
|
||||
//poi审核信息
|
||||
type PoiAudiInfo struct {
|
||||
PoiAuditID string `json:"poi_audit_id"` //poi审核id
|
||||
PoiAuditState int `json:"poi_audit_state"` //poi审核子状态:1审核中;2绑定成功;3驳回
|
||||
StoreID int `json:"store_id"` //门店ID
|
||||
Name string `json:"name"` //门店名称
|
||||
StoreCode string `json:"store_code"` //门店编码
|
||||
Longitude string `json:"longitude"` //经度
|
||||
Latitude string `json:"latitude"` //纬度
|
||||
Province string `json:"province"` //省份
|
||||
ProvinceCode string `json:"province_code"` //省份code
|
||||
City string `json:"city"` //市
|
||||
District string `json:"district"` //区
|
||||
Address string `json:"address"` //详细地址
|
||||
Contact string `json:"contact"` //联系方式
|
||||
OpenTime shop_batchCreateStore_request.OpenTime `json:"open_time"` //营业时间
|
||||
PoiAuditID string `json:"poi_audit_id"` //poi审核id
|
||||
PoiAuditState int `json:"poi_audit_state"` //poi审核子状态:1审核中;2绑定成功;3驳回
|
||||
StoreID int `json:"store_id"` //门店ID
|
||||
Name string `json:"name"` //门店名称
|
||||
StoreCode string `json:"store_code"` //门店编码
|
||||
Longitude string `json:"longitude"` //经度
|
||||
Latitude string `json:"latitude"` //纬度
|
||||
Province string `json:"province"` //省份
|
||||
ProvinceCode string `json:"province_code"` //省份code
|
||||
City string `json:"city"` //市
|
||||
District string `json:"district"` //区
|
||||
Address string `json:"address"` //详细地址
|
||||
Contact string `json:"contact"` //联系方式
|
||||
OpenTime OpenTime `json:"open_time"` //营业时间
|
||||
}
|
||||
|
||||
//营业时间
|
||||
type OpenTime struct {
|
||||
DayMap map[string]string `json:"day_map"`
|
||||
Custom string `json:"custom"` //暂时不使用
|
||||
DayMap map[int]string `json:"day_map"`
|
||||
Custom string `json:"custom"` //暂时不使用
|
||||
}
|
||||
|
||||
//负责人信息
|
||||
@@ -126,34 +120,37 @@ type StoreDetail struct {
|
||||
|
||||
//批量创建门店
|
||||
type BatchCreateStoreReq struct {
|
||||
RowID int `json:"row_id"`
|
||||
Name string `json:"name"`
|
||||
StoreCode string `json:"store_code"` //门店编码
|
||||
Longitude string `json:"longitude"` //经度
|
||||
Latitude string `json:"latitude"` //纬度
|
||||
Province string `json:"province"` //省份
|
||||
City string `json:"city"` //市
|
||||
District string `json:"district"` //区
|
||||
Address string `json:"address"` //详细地址
|
||||
Contact string `json:"contact"` //联系方式
|
||||
OpenTime shop_batchCreateStore_request.OpenTime `json:"open_time"` //营业时间
|
||||
StoreID int `json:"store_id"` //创建成功的门店ID
|
||||
StoreList []*StoreList `json:"store_list"`
|
||||
}
|
||||
type StoreList struct {
|
||||
RowID int64 `json:"row_id"`
|
||||
Name string `json:"name"`
|
||||
StoreCode string `json:"store_code"` //门店编码
|
||||
Longitude string `json:"longitude"` //经度
|
||||
Latitude string `json:"latitude"` //纬度
|
||||
Province string `json:"province"` //省份
|
||||
City string `json:"city"` //市
|
||||
District string `json:"district"` //区
|
||||
Address string `json:"address"` //详细地址
|
||||
Contact string `json:"contact"` //联系方式
|
||||
OpenTime *OpenTime `json:"open_time"` //营业时间
|
||||
StoreID int64 `json:"store_id"` //创建成功的门店ID
|
||||
}
|
||||
|
||||
//批量创建门店
|
||||
type EditStoreReq struct {
|
||||
RowID int `json:"row_id"`
|
||||
Name string `json:"name"`
|
||||
StoreCode string `json:"store_code"` //门店编码
|
||||
Longitude string `json:"longitude"` //经度
|
||||
Latitude string `json:"latitude"` //纬度
|
||||
Province string `json:"province"` //省份
|
||||
City string `json:"city"` //市
|
||||
District string `json:"district"` //区
|
||||
Address string `json:"address"` //详细地址
|
||||
Contact string `json:"contact"` //联系方式
|
||||
OpenTime shop_editStore_request.OpenTime `json:"open_time"` //营业时间
|
||||
StoreID int `json:"store_id"` //创建成功的门店ID
|
||||
RowID int `json:"row_id"`
|
||||
Name string `json:"name"`
|
||||
StoreCode string `json:"store_code"` //门店编码
|
||||
Longitude string `json:"longitude"` //经度
|
||||
Latitude string `json:"latitude"` //纬度
|
||||
Province string `json:"province"` //省份
|
||||
City string `json:"city"` //市
|
||||
District string `json:"district"` //区
|
||||
Address string `json:"address"` //详细地址
|
||||
Contact string `json:"contact"` //联系方式
|
||||
OpenTime OpenTime `json:"open_time"` //营业时间
|
||||
StoreID int `json:"store_id"` //创建成功的门店ID
|
||||
}
|
||||
|
||||
//暂停营业
|
||||
@@ -170,11 +167,26 @@ type UnsuspendStoreReq struct {
|
||||
|
||||
//创建限售规则模板
|
||||
type CreateTradeLimitTemplateReq struct {
|
||||
StoreID int64 `json:"store_id"` //门店ID
|
||||
TradeLimitRuleRequestList []*trade_createTradeLimitTemplate_request.TradeLimitRuleRequestList `json:"trade_limit_rule_request_list"` //限购参数
|
||||
TradeLimitResourceObject trade_createTradeLimitTemplate_request.TradeLimitResourceObject `json:"trade_limit_resource_object"` //限购资源值
|
||||
TradeLimitPattern trade_createTradeLimitTemplate_request.TradeLimitPattern `json:"trade_limit_pattern"` //限购值,模型为重量则单位为毫克,模型为金额则单位为分
|
||||
TimePeriod trade_createTradeLimitTemplate_request.TimePeriod `json:"time_period"` //限购时间
|
||||
StoreID int64 `json:"store_id"` //门店ID
|
||||
TradeLimitRuleRequestList []*TradeLimitRuleRequestList `json:"trade_limit_rule_request_list"` //限购参数
|
||||
TradeLimitResourceObject TradeLimitResourceObject `json:"trade_limit_resource_object"` //限购资源值
|
||||
TradeLimitPattern TradeLimitPattern `json:"trade_limit_pattern"` //限购值,模型为重量则单位为毫克,模型为金额则单位为分
|
||||
TimePeriod TimePeriod `json:"time_period"` //限购时间
|
||||
}
|
||||
type TradeLimitRuleRequestList struct {
|
||||
TradeLimitModel int32 `json:"trade_limit_model"` //限购模型 1-重量,2-数量,3-地区,4-金额
|
||||
TradeLimitResource int32 `json:"trade_limit_resource"` //限购资源类别1-抖店,2-门店,3-商品ID,4-sku,5-类目,6-活动,7-商品标
|
||||
}
|
||||
type TradeLimitResourceObject struct {
|
||||
TradeLimitResourceIDList []string `json:"trade_limit_resource_id_list"` //限购资源值列表
|
||||
}
|
||||
type TradeLimitPattern struct {
|
||||
Minimum int64 `json:"minimum"` //单次下限
|
||||
Maximum int64 `json:"maximum"` //单次上限
|
||||
CumulativeMax int64 `json:"cumulative_max"` //累计限购值
|
||||
}
|
||||
type TimePeriod struct {
|
||||
TradeLimitSubjectList []int64 `json:"trade_limit_subject_list"` //限购维度1 // 端用户(比如uid=122,aid=1128) 2 // 用户组用户(比如uid=122,group=aweme) 3 // 设备 4 // 下单电话 5 // 收件电话 6 // 身份证号 7 // 支付账号
|
||||
}
|
||||
|
||||
//门店绑定限售模板
|
||||
|
||||
Reference in New Issue
Block a user