This commit is contained in:
邹宗楠
2024-06-28 15:42:23 +08:00
parent 1b6b7fbe49
commit 88c315d874
8 changed files with 20 additions and 68 deletions

View File

@@ -29,7 +29,7 @@ func init() {
// api = New("62289", "d3ec2358d6a819ea")
// 京西菜市
api = New("34665", "c3db75b754ea2d89")
//api = New("34665", "c3db75b754ea2d89")
//菜市测试
// api = New("62923", "aa4cdc6c1108486b")

View File

@@ -79,7 +79,7 @@ func TestGetReverseOrder(t *testing.T) {
}
}
func TestOrderGet2(t *testing.T) {
result, err := api.OrderGet2("4048550075863379470")
result, err := api.OrderGet2("601124101999169939")
if err != nil {
t.Fatal(err)
} else {

View File

@@ -117,30 +117,14 @@ func TestDoPrint(t *testing.T) {
func TestName23(t *testing.T) {
url := "https://www.jxc4.com/v2/store/sku/UpdateStoresSkus"
var storeList = []int64{
101036,
668614,
668986,
668545,
668642,
100726,
102475,
668849,
100129,
669055,
668659,
668095,
668631,
668802,
669025,
}
var storeList = []int64{100116, 100120, 100124, 100130, 100132, 100134, 100146, 100152, 100234, 100324, 100369, 100670, 100881, 100884, 100905, 100971, 101028, 101043, 101097, 101099, 101118, 102138, 102320, 102357, 102483, 102561, 102594, 102595, 102613, 102720, 102749, 102756, 102780, 102788, 102851, 102856, 102925, 102967, 102987, 102999, 103022, 103074, 103075, 103184, 103194, 103201, 666706, 666707, 666746, 666891, 666919, 666922, 666974, 666993, 666996, 667007, 667082, 667104, 667155, 667157, 667235, 667236, 667239, 667240, 667242, 667253, 667255, 667258, 667261, 667264, 667268, 667270, 667283, 667288, 667290, 667294, 667295, 667300, 667301, 667305, 667306, 667309, 667311, 667326, 667327, 667336, 667352, 667355, 667373, 667376, 667380, 667405, 667407, 667413, 667416, 667420, 667423, 667424, 667429, 667431, 667440, 667441, 667443, 667446, 667449, 667452, 667456, 667457, 667464, 667468, 667474, 667484, 667489, 667492, 667493, 667496, 667509, 667512, 667524}
for _, v := range storeList {
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"storeIDs\"\r\n\r\n[" + utils.Int64ToStr(v) + "]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"payload\"\r\n\r\n[{\"nameID\":11557,\"unitPrice\":5000}]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"causeFlag\"\r\n\r\n16\r\n-----011000010111000001101001--\r\n\r\n")
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"storeIDs\"\r\n\r\n[" + utils.Int64ToStr(v) + "]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"payload\"\r\n\r\n[{\"nameID\":9125,\"unitPrice\":2000}]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"causeFlag\"\r\n\r\n16\r\n-----011000010111000001101001--\r\n\r\n")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("token", "TOKEN.V2.2452A93EEB9111EC9B06525400E86DC0.20240521-140307.localpass.CB50D7D0173711EFB566525400E86DC0.[18981810340]")
req.Header.Add("token", "TOKEN.V2.2452A93EEB9111EC9B06525400E86DC0.20240621-164332.localpass.575AD74C2FAA11EFA239525400E86DC0.[18981810340]")
req.Header.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")
_, err := http.DefaultClient.Do(req)

View File

@@ -26,7 +26,7 @@ func init() {
//api = New("4123", "df2c88338b85f830cebce2a9eab56628", "", "")
//商超
api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_kYOJ_jIKPYCvQgkDdCJMug") //token_n4TwqCntWWuvQwAawzxC0w
//api = New("5873", "41c479790a76f86326f89e8048964739", "", "token_kYOJ_jIKPYCvQgkDdCJMug") //token_n4TwqCntWWuvQwAawzxC0w
cookieStr := `
acctId=57396785; token=0bWbK5VbK50E2BmIhIH2zHB-am_y7mB37yXHm6RLZWx4*; wmPoiId=-1;
`

View File

@@ -506,39 +506,6 @@ func (a *API) OrderGetOrderDetail(orderID int64, isMTLogistics bool) (orderInfo
return nil, err
}
func (a *API) OrderGetOrderDetail2(orderID int64, isMTLogistics bool) (orderInfo *OrderInfo, err error) {
orderMap, err := a.OrderGetOrderDetail(orderID, isMTLogistics)
if err == nil {
if err = utils.Map2StructByJson(orderMap, &orderInfo, false); err == nil {
if orderInfo.Detail != "" {
err = utils.UnmarshalUseNumber([]byte(orderInfo.Detail), &orderInfo.DetailList)
}
if err != nil {
return nil, err
}
if orderInfo.Extras != "" {
err = utils.UnmarshalUseNumber([]byte(orderInfo.Extras), &orderInfo.ExtraList)
}
if err != nil {
return nil, err
}
if orderInfo.SkuBenefitDetail != "" {
err = utils.UnmarshalUseNumber([]byte(orderInfo.SkuBenefitDetail), &orderInfo.SkuBenefitDetailList)
}
if err != nil {
return nil, err
}
if orderInfo.PoiReceiveDetail != "" {
err = utils.UnmarshalUseNumber([]byte(orderInfo.PoiReceiveDetail), &orderInfo.PoiReceiveDetailPtr)
}
}
}
return orderInfo, err
}
func (a *API) OrderGetPartRefundFoods(orderID int64) (canRefundFoodList []*CanRefundFoodInfo, err error) {
params := map[string]interface{}{
KeyOrderID: orderID,

View File

@@ -30,7 +30,7 @@ func getTimeFromTimestamp(timeStamp int64) time.Time {
}
func TestOrderGetOrderDetail(t *testing.T) {
result, err := api.OrderGetOrderDetail(601120932924530076, false)
result, err := api.OrderGetOrderDetail(301135342863962437, false)
if err != nil {
t.Fatal(err)
}
@@ -53,14 +53,6 @@ func StandardPrice2Int2(value float64) int64 {
return int64(math.Round(value * 100))
}
func TestOrderGetOrderDetail2(t *testing.T) {
result, err := api.OrderGetOrderDetail2(1100687990339131759, false)
if err != nil {
t.Fatal(err)
}
t.Log(utils.Format4Output(result, false))
}
func TestOrderGetPartRefundFoods(t *testing.T) {
result, err := api.OrderGetPartRefundFoods(93475541926981203)
if err != nil {
@@ -150,7 +142,15 @@ func TestOrderGetRiderInfoPhoneNumber(t *testing.T) {
}
func TestGetOrderRefundDetail(t *testing.T) {
result, err := api.GetOrderRefundDetail(3801105140856800486, 0)
result, err := api.GetOrderRefundDetail(301135342863962437, 0)
if err != nil {
t.Fatal(err)
}
t.Log(utils.Format4Output(result, false))
}
func TestGetOrderRefundDetail2(t *testing.T) {
result, err := api.GetOrderRefundDetail(601112850243823799, 0)
if err != nil {
t.Fatal(err)
}

View File

@@ -63,7 +63,8 @@ type PoiInfo struct {
// 经常会奇怪的报错:商家已接入美团配送,不可修改门店配送相关信息,但实际并没有修改任何与配送相关的东西
// 参见https://developer.waimai.meituan.com/home/myquestionDetail/6194
func (a *API) PoiSave(poiCode string, poiParams map[string]interface{}) (err error) {
_, err = a.AccessAPI("poi/save", false, utils.MergeMaps(utils.Params2Map(KeyAppPoiCode, poiCode), poiParams))
result, err := a.AccessAPI("poi/save", false, utils.MergeMaps(utils.Params2Map(KeyAppPoiCode, poiCode), poiParams))
fmt.Println(result)
return err
}

View File

@@ -59,10 +59,10 @@ func TestPoiSave(t *testing.T) {
//}
poiParams := map[string]interface{}{}
//utils.FilterMapNilMembers(utils.Struct2FlatMap(result[0]))
poiParams["address"] = "云南省昆明市官渡区太和街道办事处双龙桥32号院临江路693号"
poiParams["pic_url"] = "https://image.jxc4.com/image/9a280909d07c46100756bf3fd0b68063.jpg"
//poiParams["pic_url"] = "https://image.jxc4.com/image/259873ec6392f963d2f3d30669d1c0a9.jpg"
//poiParams["name"] = "京西菜市(礼嘉桥村市场店)"
err := api.PoiSave("3664790", poiParams)
err := api.PoiSave("7290541", poiParams)
fmt.Println(err)
}