1
This commit is contained in:
@@ -33,7 +33,7 @@ func TestAddPrinter(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDelPrinter(t *testing.T) {
|
func TestDelPrinter(t *testing.T) {
|
||||||
err := api.DelPrinter([]string{"20210615000012"})
|
err := api.DelPrinter([]string{"20210615000012"}, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("PrintMsg return error:%v", err)
|
t.Fatalf("PrintMsg return error:%v", err)
|
||||||
}
|
}
|
||||||
@@ -67,7 +67,7 @@ func TestGetPrintMsg(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGetPrinterStatus(t *testing.T) {
|
func TestGetPrinterStatus(t *testing.T) {
|
||||||
result, err := api.GetPrinterStatus("20210615000010")
|
result, err := api.GetPrinterStatus("120220915001012")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,13 +20,13 @@ func init() {
|
|||||||
baseapi.Init(sugarLogger)
|
baseapi.Init(sugarLogger)
|
||||||
|
|
||||||
// 菜市
|
// 菜市
|
||||||
//api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "")
|
api = New("589", "a81eb3df418d83d6a1a4b7c572156d2f", "", "")
|
||||||
|
|
||||||
// 果园
|
// 果园
|
||||||
//api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
|
//api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
|
||||||
|
|
||||||
//商超
|
//商超
|
||||||
api = New("5873", "41c479790a76f86326f89e8048964739", "", "") //token_nH_IlcWQKAkZBqklwItNRw
|
//api = New("5873", "41c479790a76f86326f89e8048964739", "", "") //token_nH_IlcWQKAkZBqklwItNRw
|
||||||
cookieStr := `
|
cookieStr := `
|
||||||
acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1;
|
acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1;
|
||||||
`
|
`
|
||||||
|
|||||||
@@ -361,6 +361,29 @@ func (a *API) RetailSellStatus(trackInfo, poiCode string, foodData []*BareStoreF
|
|||||||
return failedFoodList, err
|
return failedFoodList, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 此接口部分失败也返回成功,但错误消息格式(errorMsg, appFoodCode)与其它两个不一样
|
||||||
|
func (a *API) RetailSellStatus2(trackInfo, poiCode string, foodData []map[string]string, sellStatus int) (failedFoodList []*AppFoodResult, err error) {
|
||||||
|
result, err := a.AccessAPI2("retail/sellStatus", false, map[string]interface{}{
|
||||||
|
KeyAppPoiCode: poiCode,
|
||||||
|
"food_data": foodData,
|
||||||
|
"sell_status": sellStatus,
|
||||||
|
}, resultKeyMsg, trackInfo)
|
||||||
|
if err == nil {
|
||||||
|
var tmpFailedFoodList []*AppFoodResult4SellStatus
|
||||||
|
if msg, ok := result.(string); ok && msg != "" {
|
||||||
|
if err = utils.UnmarshalUseNumber([]byte(msg), &tmpFailedFoodList); err == nil {
|
||||||
|
for _, v := range tmpFailedFoodList {
|
||||||
|
failedFoodList = append(failedFoodList, &AppFoodResult{
|
||||||
|
AppFoodCode: v.AppFoodCode,
|
||||||
|
ErrorMsg: v.Msg,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return failedFoodList, err
|
||||||
|
}
|
||||||
|
|
||||||
func (a *API) RetailGet(poiCode, foodCode string) (food *AppFood, err error) {
|
func (a *API) RetailGet(poiCode, foodCode string) (food *AppFood, err error) {
|
||||||
result, err := a.AccessAPI("retail/get", true, map[string]interface{}{
|
result, err := a.AccessAPI("retail/get", true, map[string]interface{}{
|
||||||
KeyAppPoiCode: poiCode,
|
KeyAppPoiCode: poiCode,
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -6,38 +6,54 @@ type FreightTemplateDetailResponse struct {
|
|||||||
doudian_sdk.BaseDoudianOpApiResponse
|
doudian_sdk.BaseDoudianOpApiResponse
|
||||||
Data *FreightTemplateDetailData `json:"data"`
|
Data *FreightTemplateDetailData `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ColumnsItem struct {
|
type ColumnsItem struct {
|
||||||
// 首重(单位:kg) 按重量计价必填 0.1-999.9之间的小数,小数点后一位
|
AddNum int `json:"add_num"`
|
||||||
FirstWeight float64 `json:"first_weight"`
|
AddNumPrice int `json:"add_num_price"`
|
||||||
// 首重价格(单位:元) 按重量计价必填 0.00-30.00之间的小数,小数点后两位
|
AddWeight int `json:"add_weight"`
|
||||||
FirstWeightPrice float64 `json:"first_weight_price"`
|
AddWeightPrice int `json:"add_weight_price"`
|
||||||
// 首件数量(单位:个) 按数量计价必填 1-999的整数
|
FirstNum int `json:"first_num"`
|
||||||
FirstNum int64 `json:"first_num"`
|
FirstNumPrice int `json:"first_num_price"`
|
||||||
// 首件价格(单位:元)按数量计价必填 0.00-30.00之间的小数,小数点后两位
|
FirstWeight int `json:"first_weight"`
|
||||||
FirstNumPrice float64 `json:"first_num_price"`
|
FirstWeightPrice int `json:"first_weight_price"`
|
||||||
// 续重(单位:kg) 按重量计价必填 0.1-999.9之间的小数,小数点后一位
|
IsDefault int `json:"is_default"`
|
||||||
AddWeight float64 `json:"add_weight"`
|
IsLimited bool `json:"is_limited"`
|
||||||
// 续重价格(单位:元) 按重量计价必填 0.00-30.00之间的小数,小数点后两位
|
IsOverFree bool `json:"is_over_free"`
|
||||||
AddWeightPrice float64 `json:"add_weight_price"`
|
OverAmount int `json:"over_amount"`
|
||||||
// 续件(单位:个) 按数量计价必填 1-999的整数
|
OverNum int `json:"over_num"`
|
||||||
AddNum int64 `json:"add_num"`
|
OverWeight int `json:"over_weight"`
|
||||||
// 续件价格(单位:元) 按数量计价必填 0.00-30.00之间的小数,小数点后两位
|
//// 首重(单位:kg) 按重量计价必填 0.1-999.9之间的小数,小数点后一位
|
||||||
AddNumPrice float64 `json:"add_num_price"`
|
//FirstWeight float64 `json:"first_weight"`
|
||||||
// 是否默认计价方式(1:是;0:不是)
|
//// 首重价格(单位:元) 按重量计价必填 0.00-30.00之间的小数,小数点后两位
|
||||||
IsDefault int64 `json:"is_default"`
|
//FirstWeightPrice float64 `json:"first_weight_price"`
|
||||||
// 是否限运规则
|
//// 首件数量(单位:个) 按数量计价必填 1-999的整数
|
||||||
IsLimited bool `json:"is_limited"`
|
//FirstNum int64 `json:"first_num"`
|
||||||
// 是否包邮规则
|
//// 首件价格(单位:元)按数量计价必填 0.00-30.00之间的小数,小数点后两位
|
||||||
IsOverFree bool `json:"is_over_free"`
|
//FirstNumPrice float64 `json:"first_num_price"`
|
||||||
// 满xx重量包邮(单位:kg)0.1-10.0之间的小数,小数点后一位
|
//// 续重(单位:kg) 按重量计价必填 0.1-999.9之间的小数,小数点后一位
|
||||||
OverWeight float64 `json:"over_weight"`
|
//AddWeight float64 `json:"add_weight"`
|
||||||
// 满xx金额包邮(单位:分)10-99900的整数
|
//// 续重价格(单位:元) 按重量计价必填 0.00-30.00之间的小数,小数点后两位
|
||||||
OverAmount int64 `json:"over_amount"`
|
//AddWeightPrice float64 `json:"add_weight_price"`
|
||||||
// 满xx件包邮 1-10之间的整数
|
//// 续件(单位:个) 按数量计价必填 1-999的整数
|
||||||
OverNum int64 `json:"over_num"`
|
//AddNum int64 `json:"add_num"`
|
||||||
|
//// 续件价格(单位:元) 按数量计价必填 0.00-30.00之间的小数,小数点后两位
|
||||||
|
//AddNumPrice float64 `json:"add_num_price"`
|
||||||
|
//// 是否默认计价方式(1:是;0:不是)
|
||||||
|
//IsDefault int64 `json:"is_default"`
|
||||||
|
//// 是否限运规则
|
||||||
|
//IsLimited bool `json:"is_limited"`
|
||||||
|
//// 是否包邮规则
|
||||||
|
//IsOverFree bool `json:"is_over_free"`
|
||||||
|
//// 满xx重量包邮(单位:kg)0.1-10.0之间的小数,小数点后一位
|
||||||
|
//OverWeight float64 `json:"over_weight"`
|
||||||
|
//// 满xx金额包邮(单位:分)10-99900的整数
|
||||||
|
//OverAmount int64 `json:"over_amount"`
|
||||||
|
//// 满xx件包邮 1-10之间的整数
|
||||||
|
//OverNum int64 `json:"over_num"`
|
||||||
// 当前规则生效的地址,统一以List<Struct>结构返回,该结构为嵌套结构。对应的json格式为[{"id":"32","children":[{"id":"320500","children":[{"id":"320508","children":[{"id":"320508014"},{"id":"320508004"}]}]}]}] 注意:返回的为最新的四级地址版本(地址存储升级变更的可能,以最新的返回)
|
// 当前规则生效的地址,统一以List<Struct>结构返回,该结构为嵌套结构。对应的json格式为[{"id":"32","children":[{"id":"320500","children":[{"id":"320508","children":[{"id":"320508014"},{"id":"320508004"}]}]}]}] 注意:返回的为最新的四级地址版本(地址存储升级变更的可能,以最新的返回)
|
||||||
ProvinceInfos []ProvinceInfosItem `json:"province_infos"`
|
ProvinceInfos []ProvinceInfosItem `json:"province_infos"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Data struct {
|
type Data struct {
|
||||||
// 模板信息
|
// 模板信息
|
||||||
Template *Template `json:"template"`
|
Template *Template `json:"template"`
|
||||||
@@ -50,21 +66,29 @@ type FreightTemplateDetailData struct {
|
|||||||
}
|
}
|
||||||
type Template struct {
|
type Template struct {
|
||||||
// 模板id
|
// 模板id
|
||||||
Id int64 `json:"id"`
|
//Id int64 `json:"id"`
|
||||||
// 模板名称
|
//// 模板名称
|
||||||
TemplateName string `json:"template_name"`
|
//TemplateName string `json:"template_name"`
|
||||||
// 发货省份id
|
//// 发货省份id
|
||||||
|
//ProductProvince string `json:"product_province"`
|
||||||
|
//// 发货城市id
|
||||||
|
//ProductCity string `json:"product_city"`
|
||||||
|
//// 计价方式-1.按重量计价 2.按数量计价
|
||||||
|
//CalculateType int64 `json:"calculate_type"`
|
||||||
|
//// 快递方式-1.快递 目前仅支持1
|
||||||
|
//TransferType int64 `json:"transfer_type"`
|
||||||
|
//// 模板类型-0:阶梯计价 1:固定运费 2:卖家包邮 3:货到付款
|
||||||
|
//RuleType int64 `json:"rule_type"`
|
||||||
|
//// 固定运费金额(单位:分) 固定运费模板必填 1-9900之间的整数
|
||||||
|
//FixedAmount int64 `json:"fixed_amount"`
|
||||||
|
CalculateType int `json:"calculate_type"`
|
||||||
|
FixedAmount int `json:"fixed_amount"`
|
||||||
|
Id int `json:"id"`
|
||||||
|
ProductCity string `json:"product_city"`
|
||||||
ProductProvince string `json:"product_province"`
|
ProductProvince string `json:"product_province"`
|
||||||
// 发货城市id
|
RuleType int `json:"rule_type"`
|
||||||
ProductCity string `json:"product_city"`
|
TemplateName string `json:"template_name"`
|
||||||
// 计价方式-1.按重量计价 2.按数量计价
|
TransferType int `json:"transfer_type"`
|
||||||
CalculateType int64 `json:"calculate_type"`
|
|
||||||
// 快递方式-1.快递 目前仅支持1
|
|
||||||
TransferType int64 `json:"transfer_type"`
|
|
||||||
// 模板类型-0:阶梯计价 1:固定运费 2:卖家包邮 3:货到付款
|
|
||||||
RuleType int64 `json:"rule_type"`
|
|
||||||
// 固定运费金额(单位:分) 固定运费模板必填 1-9900之间的整数
|
|
||||||
FixedAmount int64 `json:"fixed_amount"`
|
|
||||||
}
|
}
|
||||||
type ChildrenItem struct {
|
type ChildrenItem struct {
|
||||||
// 地址id,第一级是省份、第二级是城市、第三级是区、第四级是街道
|
// 地址id,第一级是省份、第二级是城市、第三级是区、第四级是街道
|
||||||
|
|||||||
@@ -169,15 +169,16 @@ var c = []int64{
|
|||||||
//668708,
|
//668708,
|
||||||
//668713,
|
//668713,
|
||||||
//668707,
|
//668707,
|
||||||
//668712,
|
//668712,running
|
||||||
//668710,
|
//668710,running
|
||||||
//668714,
|
//668714,running
|
||||||
//668723,
|
|
||||||
//668790,
|
//668723, ok
|
||||||
//668789,
|
//668790, no
|
||||||
//668785,
|
//668789, no
|
||||||
//668512,
|
//668785, no
|
||||||
//667481,
|
//668512, running
|
||||||
|
//667481, running
|
||||||
|
|
||||||
// 删除已经创建商品,重新同步
|
// 删除已经创建商品,重新同步
|
||||||
func TestDeleteSkuAndUploadSku(t *testing.T) {
|
func TestDeleteSkuAndUploadSku(t *testing.T) {
|
||||||
@@ -217,10 +218,11 @@ func TestDeleteSkuAndUploadSkuFengJinBiXu222(t *testing.T) {
|
|||||||
var errList = make([]error, 0, 0)
|
var errList = make([]error, 0, 0)
|
||||||
for i := 1; i < 100; i++ {
|
for i := 1; i < 100; i++ {
|
||||||
result, err := a.GetSkuDetailList(&product_listV2_request.ProductListV2Param{
|
result, err := a.GetSkuDetailList(&product_listV2_request.ProductListV2Param{
|
||||||
//Status: 2,
|
Status: 0,
|
||||||
//CheckStatus: 3, // 1-未提交;2-待审核;3-审核通过;4-审核未通过;5-封禁;7-审核通过待上架
|
CheckStatus: 3, // 1-未提交;2-待审核;3-审核通过;4-审核未通过;5-封禁;7-审核通过待上架
|
||||||
Page: int64(i),
|
Page: int64(i),
|
||||||
Size: 100,
|
Size: 100,
|
||||||
|
StoreId: 69395217,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
globals.SugarLogger.Debugf("=index := %d ,err := %s", i, utils.Format4Output(err, false))
|
globals.SugarLogger.Debugf("=index := %d ,err := %s", i, utils.Format4Output(err, false))
|
||||||
|
|||||||
@@ -328,6 +328,7 @@ func (a *API) GetStoreFreight(storeId int64) ([]int64, error) {
|
|||||||
//获取运费模板详情
|
//获取运费模板详情
|
||||||
func (a *API) GetStoreFreightDetail(freightId int64) (*freightTemplate_detail_response.Data, error) {
|
func (a *API) GetStoreFreightDetail(freightId int64) (*freightTemplate_detail_response.Data, error) {
|
||||||
request := freightTemplate_detail_request.New()
|
request := freightTemplate_detail_request.New()
|
||||||
|
request.Param.FreightId = freightId
|
||||||
result, err := request.Execute(a.accessTokenObj)
|
result, err := request.Execute(a.accessTokenObj)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@@ -31,7 +31,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
//var token = `{"access_token":"f1ee4188-d49a-4eaf-9cb8-7d754a23d19e","expires_in":1678053416,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"08ce6c28-37b4-4c3e-9942-7d078c551bc2","authority_id":""}`
|
var token2 = `{"access_token":"26a0ee33-fca9-4b80-980a-3d6cf48ca159","expires_in":1678656378,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"ef12dcb4-766d-4e6b-905d-448a25279431","authority_id":""}`
|
||||||
|
var api2 = New("7136048270014416392", "c397aa9f-3927-47c4-8cfe-4d84e02602e0", token2)
|
||||||
|
|
||||||
//创建店铺
|
//创建店铺
|
||||||
func TestCreateStore(t *testing.T) {
|
func TestCreateStore(t *testing.T) {
|
||||||
@@ -558,3 +559,9 @@ func TryUnmarshalUseNumber(data []byte, result interface{}) error {
|
|||||||
d.UseNumber()
|
d.UseNumber()
|
||||||
return d.Decode(result)
|
return d.Decode(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestGetStoreFreightDetail(t *testing.T) {
|
||||||
|
detail, err := api2.GetStoreFreightDetail(25370494)
|
||||||
|
fmt.Println(utils.Format4Output(detail, false))
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package tiktok_api
|
package tiktok_api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
@@ -42,3 +43,23 @@ func TestGetShipmentInfo(t *testing.T) {
|
|||||||
func TestGetStoreAutoCallRiderInfo(t *testing.T) {
|
func TestGetStoreAutoCallRiderInfo(t *testing.T) {
|
||||||
a.GetStoreAutoCallRiderInfo(64212030)
|
a.GetStoreAutoCallRiderInfo(64212030)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestMap2(t *testing.T) {
|
||||||
|
aa := `{
|
||||||
|
"四川":[
|
||||||
|
{"张淋":"18981810340"},{"李伟达":"18988808752"},
|
||||||
|
{"张淋":"18981810340"},{"李伟达":"18988808752"}
|
||||||
|
],
|
||||||
|
"广州":[
|
||||||
|
{"张淋":"18981810340"},{"李伟达":"18988808752"},
|
||||||
|
{"张淋":"18981810340"},{"李伟达":"18988808752"}
|
||||||
|
],
|
||||||
|
"西安":[
|
||||||
|
{"张淋":"18981810340"},{"李伟达":"18988808752"},
|
||||||
|
{"张淋":"18981810340"},{"李伟达":"18988808752"}
|
||||||
|
]
|
||||||
|
}`
|
||||||
|
list := make(map[string][]map[string]string, 0)
|
||||||
|
json.Unmarshal([]byte(aa), &list)
|
||||||
|
t.Log(list)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user