From f51dd7226f1ca5235826afe4337f1a271f29d065 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Thu, 28 Aug 2025 17:38:48 +0800 Subject: [PATCH] 1 --- platformapi/jdapi/jdapi_test.go | 4 +- platformapi/jdapi/order_test.go | 2 +- platformapi/lakala/lakala_order.go | 2 +- platformapi/mtwmapi/comment.go | 11 -- platformapi/mtwmapi/comment_test.go | 63 ++++--- platformapi/mtwmapi/retail_test.go | 211 +++++++----------------- platformapi/weixinapi/cgibin_test.go | 2 +- platformapi/weixinapi/weixinapi_test.go | 5 +- 8 files changed, 99 insertions(+), 201 deletions(-) diff --git a/platformapi/jdapi/jdapi_test.go b/platformapi/jdapi/jdapi_test.go index 2156d185..0a7a8186 100644 --- a/platformapi/jdapi/jdapi_test.go +++ b/platformapi/jdapi/jdapi_test.go @@ -30,7 +30,7 @@ func init() { // 天天果园 //api = New("c45e6510-00ba-4be2-977e-bcb9c9792cc7", "5d5577a2506f41b8b4ec520ba83490f5", "0b01b9eeb15b41dab1c3d05d95c17a26") // 京东果园 320406 - api = New("de4a9818-b171-41ed-ba37-0b060cad001f", "1dba76d40cac446ca500c0391a0b6c9d", "a88d031a1e7b462cb1579f12e97fe7f4") + //api = New("de4a9818-b171-41ed-ba37-0b060cad001f", "1dba76d40cac446ca500c0391a0b6c9d", "a88d031a1e7b462cb1579f12e97fe7f4") // 京东白货 //api = New("9053e4fd-4e0e-4e9e-8ab1-f348e5cbf3e7", "4602bd4b84984186815dbc03299c7094", "386ab19719d9470487011217d0c57349") // 果切 379599 @@ -38,7 +38,7 @@ func init() { // 李氏水果 346254 //api = New("c7c41cb6-6db4-4f67-a864-ca5f524653d0", "13493b4a951945f689dcc989b6693631", "7e28a37be43a430bb5928c835e482fe2") // 381564 - //api = New("4d0c707a-54eb-4f05-8187-6cedf95827c7", "d2d1e2e3213d4320bc2712a684307831", "1750f5b9848d4a6492c1c20b487074da") + api = New("4d0c707a-54eb-4f05-8187-6cedf95827c7", "d2d1e2e3213d4320bc2712a684307831", "1750f5b9848d4a6492c1c20b487074da") // 390558 //api = New("9053e4fd-4e0e-4e9e-8ab1-f348e5cbf3e7", "4602bd4b84984186815dbc03299c7094", "386ab19719d9470487011217d0c57349") diff --git a/platformapi/jdapi/order_test.go b/platformapi/jdapi/order_test.go index 08bf0aab..d3cdba8b 100644 --- a/platformapi/jdapi/order_test.go +++ b/platformapi/jdapi/order_test.go @@ -121,7 +121,7 @@ func TestGetAfsService2(t *testing.T) { } func TestOrderShoudSettlementService2(t *testing.T) { - result, err := api.OrderShoudSettlementService2("2305327970000571") + result, err := api.OrderShoudSettlementService2("334205528418") if err != nil { t.Fatal(err.Error()) } diff --git a/platformapi/lakala/lakala_order.go b/platformapi/lakala/lakala_order.go index 9ffe3846..45581570 100644 --- a/platformapi/lakala/lakala_order.go +++ b/platformapi/lakala/lakala_order.go @@ -180,7 +180,7 @@ func (a *API) ApplyElectronicContract(param *ApplyContractParam) (*ApplyContract func (a *API) ApplyElectronicContractByPeople(param *ApplyContractByPeople) error { reqParameter := map[string]interface{}{ "req_data": utils.Struct2Map(param, "", false), - "ver": Version, + "ver": Version2, "timestamp": utils.Time2TimeStrByFormat(time.Now(), TimeFormat), "req_id": utils.GetUUID(), } diff --git a/platformapi/mtwmapi/comment.go b/platformapi/mtwmapi/comment.go index 86cd955b..db0f99d3 100644 --- a/platformapi/mtwmapi/comment.go +++ b/platformapi/mtwmapi/comment.go @@ -114,17 +114,6 @@ func (a *API) CommentAddReply(poiCode string, commentID int64, reply string) (er } func (a *API) GetComment4ShanGou(param map[string]interface{}, isPost bool, cookie string) ([]*CommentsList, error) { - //wmPoiId := NumberCell + fmt.Sprintf("name=\"wmPoiId\"\r\n\r\n%v\r\n", param["wmPoiId"]) - //appType := NumberCell + fmt.Sprintf("name=\"appType\"\r\n\r\n%v\r\n", param["appType"]) - //pageNum := NumberCell + fmt.Sprintf("name=\"pageNum\"\r\n\r\n%v\r\n", param["pageNum"]) - //rate := NumberCell + fmt.Sprintf("name=\"rate\"\r\n\r\n%v\r\n", param["rate"]) - //reply := NumberCell + fmt.Sprintf("name=\"reply\"\r\n\r\n%v\r\n", param["reply"]) - //context := NumberCell + fmt.Sprintf("name=\"context\"\r\n\r\n%v\r\n", param["context"]) - //startDate := NumberCell + fmt.Sprintf("name=\"startDate\"\r\n\r\n%v\r\n", param["startDate"]) - //endDate := NumberCell + fmt.Sprintf("name=\"endDate\"\r\n\r\n%v\r\n", param["endDate"]) - //timeType := NumberCell + fmt.Sprintf("name=\"timeType\"\r\n\r\n%v\r\n-----011000010111000001101001--\r\n\r\n", param["timeType"]) - //date := wmPoiId + appType + pageNum + rate + reply + context + startDate + endDate + timeType - result, err := a.AccessStoreComment(CommentUrl, param, isPost, cookie) if err != nil { return nil, err diff --git a/platformapi/mtwmapi/comment_test.go b/platformapi/mtwmapi/comment_test.go index 5938b888..4b9d446d 100644 --- a/platformapi/mtwmapi/comment_test.go +++ b/platformapi/mtwmapi/comment_test.go @@ -12,44 +12,41 @@ import ( ) func TestCommentQuery(t *testing.T) { - result, err := api.CommentQuery("17896509", "20250716", "20250717", 0, 20, CommentReplyStatusAll) + result, err := api.CommentQuery("7070710", "20250820", "20250824", 0, 20, CommentReplyStatusAll) if err != nil { t.Fatal(err) } for _, mtwmComment := range result { - if mtwmComment.CommentID == 8667486211 { - - foodNameList := make(map[string]int, 0) - skuIdMap := make(map[string]int, 0) - for _, fn := range mtwmComment.PraiseRetailList { - skuIdMap[fn.SkuId] = 1 - foodNameList[fn.Name] = 1 - } - for _, fn := range mtwmComment.CriticRetailList { - skuIdMap[fn.SkuId] = 1 - foodNameList[fn.Name] = 1 - } - - for _, fn := range mtwmComment.CommentOrderDetail { - if len(fn.FoodName)-strings.LastIndex(fn.FoodName, ")") > 3 { - foodNameList[strings.TrimSpace(fn.FoodName)] = 1 - } else { - foodNameList[strings.TrimSpace(fn.FoodName[0:strings.LastIndex(fn.FoodName, "(")])] = 1 - } - } - nameList := make([]string, 0, 0) - skuIdList := make([]int, 0, 0) - for k, _ := range foodNameList { - nameList = append(nameList, k) - } - for k, _ := range skuIdMap { - skuIdList = append(skuIdList, utils.Str2Int(k)) - } - - globals.SugarLogger.Debugf("----------nameList:= %s", utils.Format4Output(nameList, false)) - globals.SugarLogger.Debugf("----------skuIdList:= %s", utils.Format4Output(skuIdList, false)) - break + foodNameList := make(map[string]int, 0) + skuIdMap := make(map[string]int, 0) + for _, fn := range mtwmComment.PraiseRetailList { + skuIdMap[fn.SkuId] = 1 + foodNameList[fn.Name] = 1 } + for _, fn := range mtwmComment.CriticRetailList { + skuIdMap[fn.SkuId] = 1 + foodNameList[fn.Name] = 1 + } + + for _, fn := range mtwmComment.CommentOrderDetail { + if len(fn.FoodName)-strings.LastIndex(fn.FoodName, ")") > 3 { + foodNameList[strings.TrimSpace(fn.FoodName)] = 1 + } else { + foodNameList[strings.TrimSpace(fn.FoodName[0:strings.LastIndex(fn.FoodName, "(")])] = 1 + } + } + nameList := make([]string, 0, 0) + skuIdList := make([]int, 0, 0) + for k, _ := range foodNameList { + nameList = append(nameList, k) + } + for k, _ := range skuIdMap { + skuIdList = append(skuIdList, utils.Str2Int(k)) + } + + globals.SugarLogger.Debugf("----------nameList:= %s", utils.Format4Output(nameList, false)) + globals.SugarLogger.Debugf("----------skuIdList:= %s", utils.Format4Output(skuIdList, false)) + break } } diff --git a/platformapi/mtwmapi/retail_test.go b/platformapi/mtwmapi/retail_test.go index 2b2f3a11..1f2dfdea 100644 --- a/platformapi/mtwmapi/retail_test.go +++ b/platformapi/mtwmapi/retail_test.go @@ -25,99 +25,6 @@ func TestRetailCatUpdate(t *testing.T) { } } -// 测试获取门店分类列表 -func TestRetailCatList(t *testing.T) { - result, err := api.RetailCatList("28657115") - if err != nil { - t.Fatal(err) - } - fmt.Println("parent name code level") - for k1, v1 := range result { - fmt.Println(k1-k1, fmt.Sprintf("0 %s %s %d", v1.Name, v1.Code, v1.Level)) - if v1.Children != nil { - for k2, v2 := range v1.Children { - time.Sleep(200 * time.Microsecond) - fmt.Println(k2-k2, fmt.Sprintf("%s %s %s %d", v1.Code, v2.Name, v2.Code, v2.Level)) - } - } - } - t.Log(utils.Format4Output(result, false)) -} - -// 测试删除门店分类列表 -func TestDeleteCat(t *testing.T) { - result, err := api.RetailCatList("26589198") - fmt.Println(result, err) - for _, v := range result { - if v.Children != nil { - for _, v2 := range v.Children { - err = api.RetailCatDelete("26589198", "", v2.Name, 1) - if err != nil { - t.Fatal(err) - } - } - } else { - err = api.RetailCatDelete("26589198", "", v.Name, 1) - if err != nil { - t.Fatal(err) - } - } - } - -} - -func TestRetailCatDelete(t *testing.T) { - ////var err error - ////errList := errlist.New() - ////errList1 := errlist.New() - ////info := []string{"11309161", "7379027", "14422863", "12405467", "12398353", "12422620", "12422751", "11437415", "2391979", "11037873", "11646173", "12286931", "11086818", "9000444", "13413407", "10874383", "11674367", "11824223", "11939392", "11810047", "12071134", "11799045", "12848707", "11596643", "14038247", "9676866", "15382980", "8967897", "11566485", "11774697", "11730687", "11798089", "11488932", "11651698", "11637939", "11831005", "11883106", "11011885", "11342761", "12131910", "12833849", "11209533", "12211457", "15874713", "11440630", "12665305", "11437682", "11440628", "9578183", "11796739", "11213162", "12665208", "13887316"} - ////str := []string{"token_gFkmTBCfctlpehYTENBNpw", "token_tnrjZftD5q4lU42KI3RPsQ", "token_ih9ZUCueA_dnrHBC6eBDew", "token_uJenwb2m6hWDe36e7hhAuw", "token_o2bWH171jXW8dIikHjFFog", "token_kfsqhhQ3kPXAwxUueglF_g", "token_h86ZqAP89I-Pe6vMACVLZQ", "token_uzWsBdnSIbv1KBQPoNRKRQ", "token_ucnSaUtKiUbonBnax5dDMQ", "token_o2-KGSi8lbh1ON4seUlEiQ", "token_v0gPiP4rH1vrS51GXgZJBg", "token_k0GWFzpjDtodAW5yFhVBgA", "token_oV2lXBnc1d8kc_JgWvtFxQ", "token_gl5GkKf9XKOO5ZNK-0JPRg", "token_suOF8ngaSTOcFcjNxvdHVA", "token_nf9QokI2udnECY2s1zBIeA", "token_nZjY3PlhFWlkHxdUDr9EsA", "token_kwq5HiBJI4vnavnmDyZBuA", "token_jhE-_ku5e7g6Ys4jWt5J0g", "token_lqAjjKmpEws1pKcspd1ETw", "token_mj31nyxnSIKFfxjViWpN4w", "token_kxjANA3lKNqfJrXApsZEEg", "token_kMttVFAYWLAcPAmZi3FNjg", "token_gd5aruWWQX2Iz8CXEg1Gaw", "token_j1HkNiZHh76aEGLqJT9Pfw", "token_muEkyBPPm6quxE2P2dlNQA", "token_uoHU5jcIZNx_QV0rZI1Now", "token_jj9M4B67tEr0DKgRiidDBQ", "token_gXpPtzRin_m9SEzohBJOFA", "token_rBIwyLoU2O6qfq2_VCdBQg", "token_qY6wArUbm8ypW1IoUc5Frw", "token_m5XZKS8TiL1ILCqy1flFjg", "token_n5xs7bSk96MekhNxWuJGPw", "token_oqbTOzEAZYvr4QgRIypA9w", "token_jmBHMy8LQi-TPa1fOsJJKQ", "token_nNzvPUZFeQ009kWinAhDiw", "token_q4EqYUsEXy726qXH1fdJeA", "token_o0aHQxC55_XjOLvWuYFFCQ", "token_k9vJhV8aAX2fN-39KZRGEA", "token_vdGAQ50zMvm_Ofqz1yJJwg", "token_r-XGhX8HFahkkDMelHxFbQ", "token_nHupX9FsP6nj6HWQm0RN2w", "token_hpNdSt3m1Hs-CKAiWZlMKw", "token_mQ16KE4knE2sdPP2r8ROSw", "token_uUrPsYavDU1ExUwEbuFG8Q", "token_oSSLl9h6zIt9hKz16e1N_g", "token_ifyMH0B_2YipwaBoBmdAdQ", "token_uryS4endUdFgySqEWo9Dwg", "token_kAFq-IIr_5KYQwo5wlhPcg", "token_shBMfRfZtOS1xaNn5MdI0Q", "token_sS0KoWshUu-WlGchoxBNcA"} - ////for _, v := range info { - //// for _, i := range str { - ////err := api.RetailCatDelete("15478260", "185", "") //其他水果 柑桔柚类 - ////15478260 16946099 - //if err != nil { - // fmt.Println(err) - //} - //// } - ////} - ////t.Fatal(errList) - ////str := []string{"15989234", "8469854", "9516023", "7685622", "13556506", "6881602", "8434218", "8055319", "9631487", "10304189", "12750127", "7763622", "10487156", "7111786", "7511838", "8694015", "8100274", "7890912", "8100271", "16031461", "12663480", "3439955", "9590548", "14518241", "9212291", "12949643", "11655829", "8803440", "8050205", "13757398", "7772819", "9298493", "14095978", "8066561", "7821246", "7870435", "9325918", "9489313", "15804487", "7653889", "10102158", "13832612", "13743831", "13653630", "15979646", "9566644", "11465562", "7804232", "12875244", "11396295", "11182878", "7890904", "7996691", "13757046", "8040308", "13894384", "8763090", "8474922", "12008311", "12772984", "7563325", "13673909", "13162342", "9833367", "9771682", "9252885", "13734300", "9397807", "7943872", "10179676", "8061767", "9151041", "7948392", "7837683", "7935102", "12973182", "9129147", "7111559", "9654444", "16148524", "9297448", "16454737", "16585188", "9567799", "9590547", "8763431", "11396293", "12971487", "13921940", "12958628", "9715274", "7653898", "7113851", "15076639", "14644525", "14672706", "9487906", "13272804", "13213430", "12818354", "8050208", "6994255", "7763623", "9252879", "7763618", "9004652", "16450657", "15526789", "7714376", "16148616", "9151008", "9590307", "12524795", "7837684", "7511835", "8363515", "11562292", "7530884", "7557374", "11333598", "7685548", "7379563", "9853707", "12566851", "13330828", "12977266", "9437489", "7887935", "13660949", "8025715", "9633587", "7877455", "13809322", "13353206", "14468256", "12725201", "8803326", "9431036", "9710572", "7188488", "8363514", "9487905", "9516024", "8988371", "15214524", "7653888", "13770681", "13424255", "11738499", "7870443", "15979510", "8694012", "16044491", "7379569", "9612115", "9853705", "9542449", "7332291", "11766973", "13668986", "11562892", "11712781", "8050204", "7852741", "14171520", "8470035", "7664598", "7593577", "8025712", "7648349", "8990050", "6868992", "6983421", "7026375", "9654442", "7332292", "7185767", "8474908", "8987050", "13007792", "9654445", "9397243", "7607959", "12648301", "7890906", "8953695", "9647891", "13210057", "8055320", "13823372", "6699483", "9202387", "13324613", "13780950", "8763089", "16445016", "7821250", "16278451", "7852744", "14785116", "7030977", "2461794", "9375123", "9542447", "7772806", "9503274", "7989322", "8171018", "9397258", "8164522", "11396290", "13716256", "9019253", "13601255", "13858191", "6868972", "8694017", "9521557", "16604873", "12814626", "9853708", "13945239", "11333594", "13512024", "8066220", "14789574", "13353428", "7875212", "16254463", "14802321", "8929645", "8803442", "7530882", "8070474", "16483095", "9718411", "7354669", "11895033", "12997752", "12796944", "6741258", "9075939", "8066562", "12822608", "7174094", "9375119", "12703509", "13456669", "12769341", "8872485", "16333742", "7844668", "8990052", "9612116", "7701893", "8070484", "7996688", "6793969", "8065767", "7169084", "7972984", "11562286", "9842860", "7763619", "7890902", "2461720", "11333597", "11478220", "9384986", "7489955", "11396297", "14204334", "9100089", "8469851", "16054304", "11735671", "9525711", "7388603", "12952781", "14018705", "7712772", "8475286", "8694207", "7891337", "9437485", "12988539", "13825019", "13630927", "15504368", "7989318", "9566643", "8570799", "9019257", "9737861", "8675995", "7877458", "12852060", "15917190", "7550514", "9460313", "11398621", "8024652", "7877453", "6783595", "15835521", "9656178", "15682431", "9298491", "9431247", "16492464", "9253031", "13810759", "9375163", "9431033", "12956339", "9431037", "8025713", "13860782", "9853710", "8429062", "9252877", "8025717", "11459135", "13470500", "8034434", "12917046", "9252889", "7648326", "13197160", "7821249", "9567798", "7802805", "15929504", "16367375", "11436066", "13251656", "8068105", "7870451", "10555090", "9238635", "6783201", "7844669", "12877927", "13874475", "7875174", "8171015", "8050201", "8450516", "7772812", "8040302", "8985811", "12836722", "9431032", "7258626", "12453501", "6699700", "7596245", "9764018", "8072067", "8607309", "16295002", "12901767", "9631485", "16374352", "11095322", "10591298", "14837468", "11092185", "7870437", "8050207", "13429030", "2461723", "16082287", "9375118", "7747521", "13745138", "4627675", "15952037", "9252886", "8988370", "10305892", "9921154", "7615274", "8232658", "7500734", "8475269", "11712677", "8929652", "11508265", "7963093", "7357682", "7963098", "9174914", "7963090", "8987052", "13867411", "9151007", "10559124", "16313795", "8664927", "6737142", "11396613", "11532316", "13700662", "14525543", "8579297", "7026319", "8476072", "13877003", "7601728", "13878902", "7290541", "7794610", "12583746", "9789218", "13325479", "7550515", "13657154", "8694421", "7838449", "8061771", "8363516", "9151006", "8025714", "9487903", "13693544", "7804237", "8566853", "11396291", "9126516", "7838448", "9851999", "8286596", "9566641", "14443179", "16082282", "15916538", "13167828", "2464037", "4385509", "9853704", "8763092", "9855224", "10217790", "7972981", "11459129", "9850817", "8040298", "2461713", "15369458", "16108585", "9681273", "16206350", "14446003", "9202390", "9589466", "3345154", "8100279", "13280673", "13625083", "7875166", "12833761", "13262364", "12822452", "13872125", "7954969", "8985813", "13787479", "15804661", "9566642", "9001942", "13845682", "7890907", "14893266", "9431038", "8383987", "14864158", "7544156", "13805203", "8429464", "8868139", "13734815", "7665673", "9589010", "8024650", "8929644", "9019256", "13781414", "11458974", "9631488", "9274733", "13924565", "12723888", "13365704", "8286597", "7756297", "7996690", "7665672", "6783841", "16012279", "9001940", "9375124", "12767290", "7763627", "7829629", "12944552", "9633391", "7500735", "16019319", "12923719", "7640862", "11334719", "9521556", "9431042", "7890908", "9151044", "7870453", "13086341", "9625435", "15827581", "7837687", "7887937", "13625349", "9202393", "7511829", "7653890", "7989315", "6794526", "9098128", "11139396", "7954976", "7996682", "7863777", "9431040", "7076576", "7111696", "13519111", "13156468", "9375121", "7870448", "7935100", "12704348", "7829623", "13248863", "8664921", "11539395", "7587064", "8803332", "12663071", "7681459", "9526555", "13348409", "7989317", "8068889", "11535796", "7821247", "7887892", "9465148", "13701057", "7685624", "8868140", "7681460", "9375164", "15114632", "7020772", "8987235", "13409561", "12874689", "9325917", "9098133", "13693149", "8434219", "7980754", "7169838", "13890060", "9614733", "7852740", "7821245", "7111680", "7955041", "6828292", "12266625", "6878158", "8694203", "6871562", "9202386", "8171011", "9541081", "9460315", "7996685", "13860778", "8803445", "8581969", "13927501", "9626729", "11526196", "13866566", "8450542", "16574388", "7870442", "7379574", "7821254", "15874706", "9812000", "8566855", "7634034", "14221271", "13929673", "12705611", "12822507", "13885386", "13352005", "9255373", "16492497", "8990051", "12782967", "12567599", "8953749", "2461716", "15927708", "14944126", "12952578", "16590875", "16193110", "7772818", "8677147", "15853822", "13440405", "8763430", "13453097", "16049008", "12836404", "11562288", "8024656", "9593462", "8231036", "16126640", "7470644", "12663103", "9489615", "7712774", "8868124", "7532178", "8579296", "13742303", "13949391", "12701972", "7273959", "9631486", "7963094", "9460317", "9263026", "8694366", "9832140", "9589008", "9465172", "8570801", "13834857", "12978850", "16030020", "9589009", "9833777", "8579295", "7513210", "8664924", "12863393", "7963096", "8286599", "7486365", "16445082", "16543494", "16071804", "11611416", "14813696", "9173503", "6994221", "7111597", "8061770", "9253633", "7890911", "7436124", "8110893", "9375120", "16344221", "12755558", "14676334", "8061769", "13961789", "8868132", "16578436", "9566645", "6698202", "7470639", "7809575", "13856237", "9252883", "9019258", "7890905", "11140731", "8929762", "7518261", "15144140", "8929648", "12755555", "12903714", "9019255", "8763401", "7169088", "2461795", "7786317", "16611720", "8070479", "8171012", "13777632", "13693675", "7935098", "7772809", "8245117", "8055322", "7379565", "7332289", "2464145", "12809013", "8040305", "16322381", "11139681", "7875172", "11458978", "13949371", "7809572", "12375547", "12782317", "9718640", "8245116", "7883776", "7870440", "8040306", "13451826", "11396288", "13424273", "9273031", "13207596", "13481543", "7925048", "8665212", "14281445", "9815326", "7844673", "9100088", "7134740", "9001943", "9431034", "9842380", "7954977", "11764356", "7653895", "8953697", "12949744", "9567797", "16563956", "8072051", "13721626", "13734286", "8956096", "8066219", "7026352", "16575557", "7837686", "9487904", "11738830", "13735157", "8070916", "13365041", "7870447", "7875175", "7943873", "7691225", "8040297", "13770708", "9474803", "9721793", "8171013", "11337965", "10531823", "9465149", "10305682", "8470034", "7870446", "8763093", "15827578", "13480436", "8171024", "16031473", "12838886", "12852059", "16581034", "13767666", "13699239", "7111603", "7756299", "7706725", "9437474", "9732183", "13960020", "11918887", "7719667", "7877452", "8232659", "8100272", "9855199", "12364252", "7557366", "8607304", "12852062", "11895037", "7963091", "7634043", "6929996", "8579294", "8286600", "13809270", "8034439", "6976084", "11465560", "11562341", "7615276", "7607952", "15951700", "8872677", "13872273", "7963095", "12840066", "12949636", "9923051", "11552428", "8024654", "9263745", "7794611", "13986537", "16454849", "6975987", "7443262", "7653899", "8050193", "14799080", "7935105", "6699461", "16579957", "7550513", "11459134", "16071685", "12975661", "13352655", "8474909", "6741392", "13359961", "7877456", "9663329", "8763088", "12670042", "4366765", "7954973", "8040309", "7756296", "13141893", "9624199", "7870444", "8985814", "13262158", "4462977", "8050194", "7685568", "12954902", "9612113", "14881541", "9266332", "8469853", "11918886", "13445608", "8665210", "7559890", "7685534", "9437478", "14860083", "7500737", "13440385", "11713570", "16081447", "16022200", "6976606", "13157978", "7174130", "13403669", "15988255", "9252881", "16027287", "10071426", "8664919", "9541080", "13685406", "9855198", "7511834", "6741144", "13734298", "8664923", "9736869", "7105609", "9577658", "9612112", "7535672", "7070710", "7943868", "9876552", "9842876", "12941218", "11918888"} - ////var errStr1 string - ////var errStr2 string - ////for _, v := range str { - //// if err := api.RetailCatDelete(v, "" /*utils.GetUpperUUID()*/, "热销"); err != nil { - //// errList.AddErr(err) - //// errStr1 += v + "," - //// } - //// if err1 := api.RetailCatDelete(v, "" /*utils.GetUpperUUID()*/, "底料"); err1 != nil { - //// errList1.AddErr(err1) - //// errStr2 += v + "," - //// } - ////} - ////fmt.Sprintf("热销:%s", errStr1) - ////fmt.Sprintf("底料:%s", errStr2) - ////t.Fatal(errList.GetErrListAsOne()) - ////t.Fatal(errList1.GetErrListAsOne()) - //str := []string{"15989234", "8469854", "9516023", "7685622", "13556506", "6881602", "8434218", "8055319", "9631487", "10304189", "12750127", "7763622", "10487156", "7111786", "7511838", "8694015", "8100274", "7890912", "8100271", "16031461", "12663480", "3439955", "9590548", "14518241", "9212291", "12949643", "11655829", "8803440", "8050205", "13757398", "7772819", "9298493", "14095978", "8066561", "7821246", "7870435", "9325918", "9489313", "15804487", "7653889", "10102158", "13832612", "13743831", "13653630", "15979646", "9566644", "11465562", "7804232", "12875244", "11396295", "11182878", "7890904", "7996691", "13757046", "8040308", "13894384", "8763090", "8474922", "12008311", "12772984", "7563325", "13673909", "13162342", "9833367", "9771682", "9252885", "13734300", "9397807", "7943872", "10179676", "8061767", "9151041", "7948392", "7837683", "7935102", "12973182", "9129147", "7111559", "9654444", "16148524", "9297448", "16454737", "16585188", "9567799", "9590547", "8763431", "11396293", "12971487", "13921940", "12958628", "9715274", "7653898", "7113851", "15076639", "14644525", "14672706", "9487906", "13272804", "13213430", "12818354", "8050208", "6994255", "7763623", "9252879", "7763618", "9004652", "16450657", "15526789", "7714376", "16148616", "9151008", "9590307", "12524795", "7837684", "7511835", "8363515", "11562292", "7530884", "7557374", "11333598", "7685548", "7379563", "9853707", "12566851", "13330828", "12977266", "9437489", "7887935", "13660949", "8025715", "9633587", "7877455", "13809322", "13353206", "14468256", "12725201", "8803326", "9431036", "9710572", "7188488", "8363514", "9487905", "9516024", "8988371", "15214524", "7653888", "13770681", "13424255", "11738499", "7870443", "15979510", "8694012", "16044491", "7379569", "9612115", "9853705", "9542449", "7332291", "11766973", "13668986", "11562892", "11712781", "8050204", "7852741", "14171520", "8470035", "7664598", "7593577", "8025712", "7648349", "8990050", "6868992", "6983421", "7026375", "9654442", "7332292", "7185767", "8474908", "8987050", "13007792", "9654445", "9397243", "7607959", "12648301", "7890906", "8953695", "9647891", "13210057", "8055320", "13823372", "6699483", "9202387", "13324613", "13780950", "8763089", "16445016", "7821250", "16278451", "7852744", "14785116", "7030977", "2461794", "9375123", "9542447", "7772806", "9503274", "7989322", "8171018", "9397258", "8164522", "11396290", "13716256", "9019253", "13601255", "13858191", "6868972", "8694017", "9521557", "16604873", "12814626", "9853708", "13945239", "11333594", "13512024", "8066220", "14789574", "13353428", "7875212", "16254463", "14802321", "8929645", "8803442", "7530882", "8070474", "16483095", "9718411", "7354669", "11895033", "12997752", "12796944", "6741258", "9075939", "8066562", "12822608", "7174094", "9375119", "12703509", "13456669", "12769341", "8872485", "16333742", "7844668", "8990052", "9612116", "7701893", "8070484", "7996688", "6793969", "8065767", "7169084", "7972984", "11562286", "9842860", "7763619", "7890902", "2461720", "11333597", "11478220", "9384986", "7489955", "11396297", "14204334", "9100089", "8469851", "16054304", "11735671", "9525711", "7388603", "12952781", "14018705", "7712772", "8475286", "8694207", "7891337", "9437485", "12988539", "13825019", "13630927", "15504368", "7989318", "9566643", "8570799", "9019257", "9737861", "8675995", "7877458", "12852060", "15917190", "7550514", "9460313", "11398621", "8024652", "7877453", "6783595", "15835521", "9656178", "15682431", "9298491", "9431247", "16492464", "9253031", "13810759", "9375163", "9431033", "12956339", "9431037", "8025713", "13860782", "9853710", "8429062", "9252877", "8025717", "11459135", "13470500", "8034434", "12917046", "9252889", "7648326", "13197160", "7821249", "9567798", "7802805", "15929504", "16367375", "11436066", "13251656", "8068105", "7870451", "10555090", "9238635", "6783201", "7844669", "12877927", "13874475", "7875174", "8171015", "8050201", "8450516", "7772812", "8040302", "8985811", "12836722", "9431032", "7258626", "12453501", "6699700", "7596245", "9764018", "8072067", "8607309", "16295002", "12901767", "9631485", "16374352", "11095322", "10591298", "14837468", "11092185", "7870437", "8050207", "13429030", "2461723", "16082287", "9375118", "7747521", "13745138", "4627675", "15952037", "9252886", "8988370", "10305892", "9921154", "7615274", "8232658", "7500734", "8475269", "11712677", "8929652", "11508265", "7963093", "7357682", "7963098", "9174914", "7963090", "8987052", "13867411", "9151007", "10559124", "16313795", "8664927", "6737142", "11396613", "11532316", "13700662", "14525543", "8579297", "7026319", "8476072", "13877003", "7601728", "13878902", "7290541", "7794610", "12583746", "9789218", "13325479", "7550515", "13657154", "8694421", "7838449", "8061771", "8363516", "9151006", "8025714", "9487903", "13693544", "7804237", "8566853", "11396291", "9126516", "7838448", "9851999", "8286596", "9566641", "14443179", "16082282", "15916538", "13167828", "2464037", "4385509", "9853704", "8763092", "9855224", "10217790", "7972981", "11459129", "9850817", "8040298", "2461713", "15369458", "16108585", "9681273", "16206350", "14446003", "9202390", "9589466", "3345154", "8100279", "13280673", "13625083", "7875166", "12833761", "13262364", "12822452", "13872125", "7954969", "8985813", "13787479", "15804661", "9566642", "9001942", "13845682", "7890907", "14893266", "9431038", "8383987", "14864158", "7544156", "13805203", "8429464", "8868139", "13734815", "7665673", "9589010", "8024650", "8929644", "9019256", "13781414", "11458974", "9631488", "9274733", "13924565", "12723888", "13365704", "8286597", "7756297", "7996690", "7665672", "6783841", "16012279", "9001940", "9375124", "12767290", "7763627", "7829629", "12944552", "9633391", "7500735", "16019319", "12923719", "7640862", "11334719", "9521556", "9431042", "7890908", "9151044", "7870453", "13086341", "9625435", "15827581", "7837687", "7887937", "13625349", "9202393", "7511829", "7653890", "7989315", "6794526", "9098128", "11139396", "7954976", "7996682", "7863777", "9431040", "7076576", "7111696", "13519111", "13156468", "9375121", "7870448", "7935100", "12704348", "7829623", "13248863", "8664921", "11539395", "7587064", "8803332", "12663071", "7681459", "9526555", "13348409", "7989317", "8068889", "11535796", "7821247", "7887892", "9465148", "13701057", "7685624", "8868140", "7681460", "9375164", "15114632", "7020772", "8987235", "13409561", "12874689", "9325917", "9098133", "13693149", "8434219", "7980754", "7169838", "13890060", "9614733", "7852740", "7821245", "7111680", "7955041", "6828292", "12266625", "6878158", "8694203", "6871562", "9202386", "8171011", "9541081", "9460315", "7996685", "13860778", "8803445", "8581969", "13927501", "9626729", "11526196", "13866566", "8450542", "16574388", "7870442", "7379574", "7821254", "15874706", "9812000", "8566855", "7634034", "14221271", "13929673", "12705611", "12822507", "13885386", "13352005", "9255373", "16492497", "8990051", "12782967", "12567599", "8953749", "2461716", "15927708", "14944126", "12952578", "16590875", "16193110", "7772818", "8677147", "15853822", "13440405", "8763430", "13453097", "16049008", "12836404", "11562288", "8024656", "9593462", "8231036", "16126640", "7470644", "12663103", "9489615", "7712774", "8868124", "7532178", "8579296", "13742303", "13949391", "12701972", "7273959", "9631486", "7963094", "9460317", "9263026", "8694366", "9832140", "9589008", "9465172", "8570801", "13834857", "12978850", "16030020", "9589009", "9833777", "8579295", "7513210", "8664924", "12863393", "7963096", "8286599", "7486365", "16445082", "16543494", "16071804", "11611416", "14813696", "9173503", "6994221", "7111597", "8061770", "9253633", "7890911", "7436124", "8110893", "9375120", "16344221", "12755558", "14676334", "8061769", "13961789", "8868132", "16578436", "9566645", "6698202", "7470639", "7809575", "13856237", "9252883", "9019258", "7890905", "11140731", "8929762", "7518261", "15144140", "8929648", "12755555", "12903714", "9019255", "8763401", "7169088", "2461795", "7786317", "16611720", "8070479", "8171012", "13777632", "13693675", "7935098", "7772809", "8245117", "8055322", "7379565", "7332289", "2464145", "12809013", "8040305", "16322381", "11139681", "7875172", "11458978", "13949371", "7809572", "12375547", "12782317", "9718640", "8245116", "7883776", "7870440", "8040306", "13451826", "11396288", "13424273", "9273031", "13207596", "13481543", "7925048", "8665212", "14281445", "9815326", "7844673", "9100088", "7134740", "9001943", "9431034", "9842380", "7954977", "11764356", "7653895", "8953697", "12949744", "9567797", "16563956", "8072051", "13721626", "13734286", "8956096", "8066219", "7026352", "16575557", "7837686", "9487904", "11738830", "13735157", "8070916", "13365041", "7870447", "7875175", "7943873", "7691225", "8040297", "13770708", "9474803", "9721793", "8171013", "11337965", "10531823", "9465149", "10305682", "8470034", "7870446", "8763093", "15827578", "13480436", "8171024", "16031473", "12838886", "12852059", "16581034", "13767666", "13699239", "7111603", "7756299", "7706725", "9437474", "9732183", "13960020", "11918887", "7719667", "7877452", "8232659", "8100272", "9855199", "12364252", "7557366", "8607304", "12852062", "11895037", "7963091", "7634043", "6929996", "8579294", "8286600", "13809270", "8034439", "6976084", "11465560", "11562341", "7615276", "7607952", "15951700", "8872677", "13872273", "7963095", "12840066", "12949636", "9923051", "11552428", "8024654", "9263745", "7794611", "13986537", "16454849", "6975987", "7443262", "7653899", "8050193", "14799080", "7935105", "6699461", "16579957", "7550513", "11459134", "16071685", "12975661", "13352655", "8474909", "6741392", "13359961", "7877456", "9663329", "8763088", "12670042", "4366765", "7954973", "8040309", "7756296", "13141893", "9624199", "7870444", "8985814", "13262158", "4462977", "8050194", "7685568", "12954902", "9612113", "14881541", "9266332", "8469853", "11918886", "13445608", "8665210", "7559890", "7685534", "9437478", "14860083", "7500737", "13440385", "11713570", "16081447", "16022200", "6976606", "13157978", "7174130", "13403669", "15988255", "9252881", "16027287", "10071426", "8664919", "9541080", "13685406", "9855198", "7511834", "6741144", "13734298", "8664923", "9736869", "7105609", "9577658", "9612112", "7535672", "7070710", "7943868", "9876552", "9842876", "12941218", "11918888"} - //var errStr1 string - //var errStr2 string - //for _, v := range str { - // if err := api.RetailCatDelete(v, "" /*utils.GetUpperUUID()*/, "热销", 1); err != nil { - // errList.AddErr(err) - // errStr1 += v + "," - // } - // if err1 := api.RetailCatDelete(v, "" /*utils.GetUpperUUID()*/, "底料", 1); err1 != nil { - // errList1.AddErr(err1) - // errStr2 += v + "," - // } - //} - //fmt.Sprintf("热销:%s", errStr1) - //fmt.Sprintf("底料:%s", errStr2) - //t.Fatal(errList.GetErrListAsOne()) - //t.Fatal(errList1.GetErrListAsOne()) -} - func TestRetailInitData(t *testing.T) { api.RetailInitData(utils.GetUUID(), "18877719", "1", map[string]interface{}{ "operate_type": 2, @@ -269,35 +176,6 @@ func TestBatchSetPrice(t *testing.T) { fmt.Println(err) } -func TestRetailDelete(t *testing.T) { - poiCode := "26589198" - - i := 0 - count := 0 - for { - // 同步商品 - fromFoodList, err1 := api.RetailListAll(poiCode, i) - if len(fromFoodList) == 0 || fromFoodList == nil { - fmt.Println(fmt.Errorf("fromFoodList 为空 %s ,i:= %d", utils.Format4Output(err1, false), i)) - return - } - count += len(fromFoodList) - - for k, v := range fromFoodList { - if err := api.RetailDelete(utils.Int2Str(k), poiCode, v.AppFoodCode); err != nil { - fmt.Println(err) - } - } - - i++ - - if len(fromFoodList) < 100 { - break - } - } - fmt.Println(count) -} - func TestMap(t *testing.T) { poiCode := "20802261" stockList := make([]*BareStoreFoodInfo, 0, 100) @@ -514,39 +392,72 @@ func TestRetailRecommendTag(t *testing.T) { t.Log(utils.Format4Output(result, false)) } -func TestSplit(t *testing.T) { - param := "门店内存在重复的分类:【柑桔柚类】 【底料】 【火锅】,请先删除重复分类后再操作。" - firstIndex := strings.Index(param, "【") - lastIndex := strings.LastIndex(param, "】") - newParam := param[firstIndex:lastIndex] - new2 := strings.Split(newParam, "【") - cc := make([]string, 0, 0) - for _, v := range new2 { - if strings.TrimSpace(v) == "" { - continue - } else if strings.Contains(v, "【") { - for _, v2 := range strings.Split(v, "【") { - if strings.TrimSpace(v) == "" { - continue - } - if strings.TrimSpace(v2) != "" { - cc = append(cc, v2) - } +func TestRetailDelete(t *testing.T) { + poiCode := "26589198" + + i := 0 + count := 0 + for { + // 同步商品 + fromFoodList, err1 := api.RetailListAll(poiCode, i) + if len(fromFoodList) == 0 || fromFoodList == nil { + fmt.Println(fmt.Errorf("fromFoodList 为空 %s ,i:= %d", utils.Format4Output(err1, false), i)) + return + } + count += len(fromFoodList) + + for k, v := range fromFoodList { + if err := api.RetailDelete(utils.Int2Str(k), poiCode, v.AppFoodCode); err != nil { + fmt.Println(err) } - } else if strings.Contains(v, "】") { - for _, v3 := range strings.Split(v, "】") { - if strings.TrimSpace(v3) == "" { - continue - } - if strings.TrimSpace(v3) != "" { - cc = append(cc, v3) + } + + i++ + + if len(fromFoodList) < 100 { + break + } + } + fmt.Println(count) +} + +// 测试获取门店分类列表 +func TestRetailCatList(t *testing.T) { + result, err := api.RetailCatList("28657115") + if err != nil { + t.Fatal(err) + } + fmt.Println("parent name code level") + for k1, v1 := range result { + fmt.Println(k1-k1, fmt.Sprintf("0 %s %s %d", v1.Name, v1.Code, v1.Level)) + if v1.Children != nil { + for k2, v2 := range v1.Children { + time.Sleep(200 * time.Microsecond) + fmt.Println(k2-k2, fmt.Sprintf("%s %s %s %d", v1.Code, v2.Name, v2.Code, v2.Level)) + } + } + } + t.Log(utils.Format4Output(result, false)) +} + +// 测试删除门店分类列表 +func TestDeleteCat(t *testing.T) { + result, err := api.RetailCatList("26589198") + fmt.Println(result, err) + for _, v := range result { + if v.Children != nil { + for _, v2 := range v.Children { + err = api.RetailCatDelete("26589198", "", v2.Name, 1) + if err != nil { + t.Fatal(err) } } } else { - cc = append(cc, v) + err = api.RetailCatDelete("26589198", "", v.Name, 1) + if err != nil { + t.Fatal(err) + } } } - fmt.Println("len-======", len(cc)) - globals.SugarLogger.Debugf("cc %s", utils.Format4Output(cc, false)) } diff --git a/platformapi/weixinapi/cgibin_test.go b/platformapi/weixinapi/cgibin_test.go index e7dc6da8..726f1d13 100644 --- a/platformapi/weixinapi/cgibin_test.go +++ b/platformapi/weixinapi/cgibin_test.go @@ -24,7 +24,7 @@ func TestCBMessageTemplateSend(t *testing.T) { // "oYN_ust9hXKEvEv0X6Mq6nlAWs_E": 1, // me // "oYN_usvnObzrPweIgHTad9-uMf78": 1, // 老赵 err := api.CBMessageTemplateSend("oYN_usjzxL9LBzh_hjf0-E_LGmvs", "b8-tLyWwAmK-1tEU1eGqp_YAAqQtSzoVDZkHuyUe9lk", "", map[string]interface{}{ - "appid": "wx4b5930c13f8b1170", + "appid": "wx2bb99eb5d2c9b82c", //"pagepath": "pages/order-manager/main", }, map[string]interface{}{ "first": map[string]interface{}{ diff --git a/platformapi/weixinapi/weixinapi_test.go b/platformapi/weixinapi/weixinapi_test.go index 1a5d2166..7cabb1f5 100644 --- a/platformapi/weixinapi/weixinapi_test.go +++ b/platformapi/weixinapi/weixinapi_test.go @@ -25,7 +25,8 @@ func init() { // 果园 //api = New("wx2d6949f724b2541d", "11f3c380551c4683c149990b004d6df9") // 菜市 wixnapp2 - api = New("wx4b5930c13f8b1170", "2a57228a716ce991a52739f0ff41111d") + //api = New("wx4b5930c13f8b1170", "2a57228a716ce991a52739f0ff41111d") + api = New("wx2bb99eb5d2c9b82c", "6bbbed1443cc062c20a015a64c07a531") //api.CBSetToken("79_3x4gI4IFn9JKJd0EouSLe2HYFFoscRntAYCTZec4VLBlgivhOR0D2vp0mF0u6T-DmzbnAXotpTs_5Yp5Knxak7bfaMDzoaFMZM14r5n4CKpNTOaLH4PSyap2TnALTKgAHASAR") - api.CBSetToken("79_gI9G28eqf110pCXCapGEKTPCDMYSo3i4tDo0GnftvpOGjm6n8zOgZGymLD5IpZrwh8Er2QLgg7bh3GYKs3wJiusDWYVQc6D-BouYF0DHIFJ3XtffYF3hxUFclAECWSeAEAICY") + api.CBSetToken("duyaeVYUsz8LuKBqJeQO1NX6KmoC43yfMsbJybcRJ3e") }