1
This commit is contained in:
@@ -12,6 +12,10 @@ type ShopBatchCreateStoreRequest struct {
|
||||
}
|
||||
|
||||
type ShopBatchCreateStoreParam struct {
|
||||
StoreList []*StoreList `json:"store_list"`
|
||||
}
|
||||
|
||||
type StoreList struct {
|
||||
RowID int64 `json:"row_id"`
|
||||
Name string `json:"name"`
|
||||
StoreCode string `json:"store_code"` //门店编码
|
||||
@@ -25,6 +29,7 @@ type ShopBatchCreateStoreParam struct {
|
||||
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"` //暂时不使用
|
||||
|
||||
@@ -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"`
|
||||
|
||||
@@ -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.StoreList{
|
||||
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[string]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 {
|
||||
|
||||
@@ -2,8 +2,6 @@ package tiktok_api
|
||||
|
||||
import (
|
||||
"errors"
|
||||
shop_batchCreateStore_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_batchCreateStore/request"
|
||||
shop_batchCreateStore_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_batchCreateStore/response"
|
||||
shop_bindStoreSaleLimit_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_bindStoreSaleLimit/request"
|
||||
shop_bindStoreSaleLimit_response "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_bindStoreSaleLimit/response"
|
||||
shop_editStore_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/shop_editStore/request"
|
||||
@@ -22,31 +20,31 @@ func (a *API) GetStoreDetail() {
|
||||
}
|
||||
|
||||
//BatchCreateStore 批量创建门店
|
||||
func (a *API) BatchCreateStore(storeInfo BatchCreateStoreReq) (*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),
|
||||
}
|
||||
response, err := request.Execute(AccessToken)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if response.Code != 1000 {
|
||||
return nil, errors.New(response.Msg)
|
||||
}
|
||||
return response.Data, nil
|
||||
}
|
||||
//func (a *API) BatchCreateStore(storeInfo BatchCreateStoreReq) (*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),
|
||||
// }
|
||||
// response, err := request.Execute(AccessToken)
|
||||
// if err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
// if response.Code != 1000 {
|
||||
// return nil, errors.New(response.Msg)
|
||||
// }
|
||||
// return response.Data, nil
|
||||
//}
|
||||
|
||||
// EditStore 编辑门店
|
||||
func (a *API) EditStore(storeInfo EditStoreReq) (*shop_editStore_response.ShopEditStoreData, error) {
|
||||
|
||||
Reference in New Issue
Block a user