441 lines
36 KiB
Go
441 lines
36 KiB
Go
package mtwmapi
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
"git.rosy.net.cn/baseapi/utils"
|
|
"git.rosy.net.cn/jx-callback/globals"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// 测试添加分类
|
|
func TestRetailCatUpdate(t *testing.T) {
|
|
err := api.RetailCatUpdate("19120530", "海鲜火锅丸", &Param4UpdateCat{
|
|
CategoryNameOrigin: "海鲜火锅丸",
|
|
CategoryCodeOrigin: "",
|
|
CategoryCode: "",
|
|
SecondaryCategoryName: "火锅丸",
|
|
Sequence: 1,
|
|
})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
// 测试获取门店分类列表
|
|
func TestRetailCatList(t *testing.T) {
|
|
result, err := api.RetailCatList("19284062")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
// 测试删除门店分类列表
|
|
func TestDeleteCat(t *testing.T) {
|
|
err := api.RetailCatDelete("12663480", "", "火锅底料", 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 TestRetailList(t *testing.T) {
|
|
offset := 0
|
|
skus := make(map[string]string, 0)
|
|
for {
|
|
result, err := api.RetailList("17211186", offset, 100)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(result) == 0 {
|
|
t.Fatal("should have items")
|
|
}
|
|
|
|
for _, v := range result {
|
|
if v.SkuList != nil && len(v.SkuList) > 0 {
|
|
for _, v2 := range v.SkuList {
|
|
mapSkuList := utils.Struct2MapByJson(v2)
|
|
if mapSkuList["upc"].(string) != "" {
|
|
skus[mapSkuList["upc"].(string)] = mapSkuList["price"].(string)
|
|
break
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if len(result) < 100 {
|
|
break
|
|
}
|
|
offset++
|
|
}
|
|
|
|
t.Log(utils.Format4Output(skus, false))
|
|
t.Log(utils.Format4Output(len(skus), false))
|
|
}
|
|
|
|
func TestRetailGet(t *testing.T) {
|
|
result, err := api.RetailGet("18048546", "305011012")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestRetailGetSpTagIds(t *testing.T) {
|
|
result, err := api.RetailGetSpTagIds()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(result) == 0 {
|
|
t.Fatal("should have items")
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestRetailCatSkuBatchDelete(t *testing.T) {
|
|
err := api.RetailCatSkuBatchDelete2(utils.GetUUID(), testPoiCode, nil, []string{"精品水果2"}, nil, nil, nil)
|
|
t.Log(IsErrCategoryNotExist(err))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
//批量更新商品进货价
|
|
func TestBatchSetPrice(t *testing.T) {
|
|
param := []*SpuData{
|
|
{
|
|
AppSpuCode: "25420",
|
|
SkuID: "11395394828",
|
|
PurchasePrice: "50",
|
|
},
|
|
}
|
|
err := api.BatchSetRestockingPrice(utils.GetUUID(), "12422751", param)
|
|
fmt.Println(err)
|
|
}
|
|
func TestRetailDelete(t *testing.T) {
|
|
err := api.RetailDelete(utils.GetUUID(), testPoiCode, "32427")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func TestRetailDat(t *testing.T) {
|
|
err := api.RetailInitData("F71D0F0881A211ED9D81525400E86DC0", "16185779", "31173", map[string]interface{}{
|
|
"app_spu_code": "31173",
|
|
"category_code": "3039",
|
|
"common_attr_value": "[{\"attrId\":1200000088,\"attrName\":\"品牌\",\"valueList\":[{\"valueId\":1000001,\"value\":\"其他品牌\"}]},{\"attrId\":1200000094,\"attrName\":\"产地\",\"valueList\":[{\"valueId\":100000050,\"value\":\"中国\"}]},{\"attrId\":1200000132,\"attrName\":\"国产/进口\",\"valueList\":[{\"valueId\":1300000003,\"value\":\"国产\"}]},{\"attrId\":1200000210,\"attrName\":\"商品类别\",\"valueList\":[{\"valueId\":1300002991,\"value\":\"水果混合切片\"}]},{\"attrId\":1200000286,\"attrName\":\"果品品牌\",\"valueList\":[{\"valueId\":1300000249,\"value\":\"其他\"}]},{\"attrId\":1200004449,\"attrName\":\"拼数\",\"valueList\":[{\"valueId\":1300015654,\"value\":\"单拼\"}]}]",
|
|
"description": "",
|
|
"is_sold_out": 0,
|
|
"min_order_count": 1,
|
|
"name": "【果切】香甜芒果果切1盒约250g",
|
|
"picture": "https://image.jxc4.com/image/4fd5cd77a6fce23ee26f8d40392d83b1.jpg,https://image.jxc4.com/image/4fd5cd77a6fce23ee26f8d40392d83b1.jpg,https://image.jxc4.com/image/4fd5cd77a6fce23ee26f8d40392d83b1.jpg,https://image.jxc4.com/image/4fd5cd77a6fce23ee26f8d40392d83b1.jpg,https://image.jxc4.com/image/4fd5cd77a6fce23ee26f8d40392d83b1.jpg",
|
|
"price": 13.9,
|
|
"sequence": 494,
|
|
"skus": "[{\"ladder_box_num\":1,\"ladder_box_price\":0.5,\"price\":13.9,\"sku_id\":\"31173\",\"spec\":\"250g\",\"stock\":\"9999\",\"weight\":250}]",
|
|
"tag_id": "200002727",
|
|
"unit": "盒",
|
|
})
|
|
globals.SugarLogger.Debugf("err %s", utils.Format4Output(err, false))
|
|
}
|
|
|
|
func TestErrList(t *testing.T) {
|
|
data := utils.IsErrMatch(errors.New("无需切自配送 level:0, code:1"), "301251", nil)
|
|
fmt.Println(data)
|
|
}
|
|
|
|
func TestRetailBatchInitData(t *testing.T) {
|
|
failedFoods, err := api.RetailBatchInitData(utils.GetUUID(), "19284062", []map[string]interface{}{
|
|
map[string]interface{}{
|
|
"app_food_code": "1680630415808835610",
|
|
"category_name": "厨卫",
|
|
"common_attr_value": "[{\"attrId\":1200000094,\"attrName\":\"产地\",\"setAttrId\":true,\"setAttrName\":true,\"setValueList\":true,\"valueList\":[{\"setValue\":true,\"setValueId\":true,\"value\":\"中国\",\"valueId\":100000050}],\"valueListIterator\":[{\"$ref\":\"$[0].valueList[0]\"}],\"valueListSize\":1},{\"attrId\":1200000132,\"attrName\":\"国产/进口\",\"setAttrId\":true,\"setAttrName\":true,\"setValueList\":true,\"valueList\":[{\"setValue\":true,\"setValueId\":true,\"value\":\"国产\",\"valueId\":1300000003}],\"valueListIterator\":[{\"$ref\":\"$[1].valueList[0]\"}],\"valueListSize\":1},{\"attrId\":1200000210,\"attrName\":\"商品类别\",\"setAttrId\":true,\"setAttrName\":true,\"setValueList\":true,\"valueList\":[{\"setValue\":true,\"setValueId\":true,\"value\":\"其他\",\"valueId\":1300000249}],\"valueListIterator\":[{\"$ref\":\"$[2].valueList[0]\"}],\"valueListSize\":1},{\"attrId\":1200000088,\"attrName\":\"品牌\",\"setAttrId\":true,\"setAttrName\":true,\"setValueList\":true,\"valueList\":[{\"setValue\":true,\"setValueId\":true,\"value\":\"豫皇星\",\"valueId\":2533451}],\"valueListIterator\":[{\"$ref\":\"$[3].valueList[0]\"}],\"valueListSize\":1}]",
|
|
"description": "",
|
|
"is_sold_out": 0,
|
|
"min_order_count": 1,
|
|
"name": "多功能清洁膏 330g/盒",
|
|
"picture": "http://p0.meituan.net/wmproduct/1d6406c367a2f31dd1c629c10fc024d4143352.jpg,http://p0.meituan.net/wmproduct/92af919285d5720c1952462db686f8ff134176.jpg,http://p0.meituan.net/xianfu/81fa0a6f3d8c556c2ba990fac8471c24157451.jpg,http://p0.meituan.net/xianfu/89eecafad3db2dd6090f8fbb1817e10549354.jpg,http://p0.meituan.net/xianfu/8dceb0ad6317462dc0c9f2d005c2e60b48474.jpg,http://p0.meituan.net/wmproduct/69e2ceb065768ee7440d61a48c087177143299.jpg",
|
|
"picture_contents": "",
|
|
"price": 25,
|
|
"sequence": -100,
|
|
"skus": []map[string]interface{}{
|
|
{
|
|
"available_times": map[string]string{
|
|
"friday": "",
|
|
"monday": "",
|
|
"saturday": "",
|
|
"sunday": "",
|
|
"thursday": "",
|
|
"tuesday": "",
|
|
"wednesday": "",
|
|
},
|
|
//"box_num": "",
|
|
//"box_price": "",
|
|
"isSellFlag": 1,
|
|
"ladder_box_num": "1",
|
|
"ladder_box_price": "0.0",
|
|
"limit_open_sync_stock_now": false,
|
|
"location_code": "",
|
|
"min_order_count": "1",
|
|
"price": "25.0",
|
|
"sku_id": "1680630417767739457",
|
|
"spec": "330g*1盒",
|
|
"stock": "998",
|
|
"unit": "份",
|
|
"upc": "6948385202395",
|
|
//"weight": "330",
|
|
"weight_unit": "克(g)",
|
|
"weight_for_unit": "330",
|
|
},
|
|
},
|
|
"tag_id": 200004920,
|
|
"unit": "份",
|
|
},
|
|
})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(failedFoods, false))
|
|
}
|
|
|
|
func TestRetailSkuPrice(t *testing.T) {
|
|
result, err := api.RetailSkuPrice(utils.GetUUID(), testPoiCode, []*BareStoreFoodInfo{
|
|
&BareStoreFoodInfo{
|
|
AppFoodCode: "23841",
|
|
Skus: []*BareStoreSkuInfo{
|
|
&BareStoreSkuInfo{
|
|
SkuID: "23841",
|
|
Price: "1.2",
|
|
},
|
|
},
|
|
},
|
|
&BareStoreFoodInfo{
|
|
AppFoodCode: "23840",
|
|
Skus: []*BareStoreSkuInfo{
|
|
&BareStoreSkuInfo{
|
|
SkuID: "23840",
|
|
Price: "1.1",
|
|
},
|
|
},
|
|
},
|
|
})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestRetailSkuStock(t *testing.T) {
|
|
result, err := api.RetailSkuStock(utils.GetUUID(), testPoiCode, []*BareStoreFoodInfo{
|
|
&BareStoreFoodInfo{
|
|
AppFoodCode: "2212",
|
|
Skus: []*BareStoreSkuInfo{
|
|
&BareStoreSkuInfo{
|
|
SkuID: "2212",
|
|
Price: "1.2",
|
|
Stock: "123",
|
|
},
|
|
},
|
|
},
|
|
&BareStoreFoodInfo{
|
|
AppFoodCode: "23840",
|
|
Skus: []*BareStoreSkuInfo{
|
|
&BareStoreSkuInfo{
|
|
SkuID: "23840",
|
|
Stock: "123",
|
|
},
|
|
},
|
|
},
|
|
})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestRetailSkuSellStatus(t *testing.T) {
|
|
result, err := api.RetailSkuSellStatus(utils.GetUUID(), testPoiCode, []*BareStoreFoodInfo{
|
|
&BareStoreFoodInfo{
|
|
AppFoodCode: "23841",
|
|
Skus: []*BareStoreSkuInfo{
|
|
&BareStoreSkuInfo{
|
|
SkuID: "23841",
|
|
Price: "1.2",
|
|
Stock: "123",
|
|
},
|
|
},
|
|
},
|
|
&BareStoreFoodInfo{
|
|
AppFoodCode: "23840",
|
|
Skus: []*BareStoreSkuInfo{
|
|
&BareStoreSkuInfo{
|
|
SkuID: "23840",
|
|
Stock: "123",
|
|
},
|
|
},
|
|
},
|
|
&BareStoreFoodInfo{
|
|
AppFoodCode: "2384999",
|
|
Skus: []*BareStoreSkuInfo{
|
|
&BareStoreSkuInfo{
|
|
SkuID: "2384999",
|
|
Stock: "123",
|
|
},
|
|
},
|
|
},
|
|
}, SellStatusOffline)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestRetailSellStatus(t *testing.T) {
|
|
result, err := api.RetailSellStatus(utils.GetUUID(), "10071426", []*BareStoreFoodInfo{
|
|
&BareStoreFoodInfo{
|
|
AppFoodCode: "6092651",
|
|
Skus: []*BareStoreSkuInfo{
|
|
&BareStoreSkuInfo{
|
|
//SkuID: "22781",
|
|
//Price: "18.7",
|
|
//Stock: "0",
|
|
},
|
|
},
|
|
},
|
|
}, SellStatusOffline)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestRetailSellStatus2(t *testing.T) {
|
|
result, err := api.RetailSellStatus2(utils.GetUUID(), "10071426", []map[string]string{{"app_spu_code": "6092651"}}, SellStatusOffline)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
//根据分类id查询属性列表
|
|
func TestCategoryAttrList(t *testing.T) {
|
|
//result, err := api.CategoryAttrList(200002680)
|
|
result, err := api.CategoryAttrList(200005790)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
//特殊属性查询
|
|
func TestCategoryAttrValueList(t *testing.T) {
|
|
result, err := api.CategoryAttrValueList(1200000088, "海天")
|
|
if len(result) > 0 {
|
|
fmt.Println("jejeje")
|
|
}
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestRetailRecommendTag(t *testing.T) {
|
|
result, err := api.RetailRecommendTag("长豆角", "", 0, 1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if result == nil {
|
|
t.Fatal("should have items")
|
|
}
|
|
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)
|
|
}
|
|
}
|
|
} else if strings.Contains(v, "】") {
|
|
for _, v3 := range strings.Split(v, "】") {
|
|
if strings.TrimSpace(v3) == "" {
|
|
continue
|
|
}
|
|
if strings.TrimSpace(v3) != "" {
|
|
cc = append(cc, v3)
|
|
}
|
|
}
|
|
} else {
|
|
cc = append(cc, v)
|
|
}
|
|
}
|
|
|
|
fmt.Println("len-======", len(cc))
|
|
globals.SugarLogger.Debugf("cc %s", utils.Format4Output(cc, false))
|
|
}
|