终极测试

This commit is contained in:
苏尹岚
2020-05-20 18:19:27 +08:00
parent 8fb9734692
commit 9b9d5c413f
2 changed files with 37 additions and 30 deletions

View File

@@ -229,7 +229,7 @@ func (v *VendorSync) SyncStore2(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs
var failedList []*partner.StoreSkuInfoWithErr
handler := v.GetStoreHandler(loopMapInfo.VendorID)
if handler != nil {
if len(loopMapInfo.StoreMapList) > 0 {
if len(loopMapInfo.StoreMapList) > 1 {
loopStoreTask := tasksch.NewParallelTask(fmt.Sprintf("处理平台%s", model.VendorChineseNames[loopMapInfo.VendorID]), tasksch.NewParallelConfig().SetIsContinueWhenError(true), ctx,
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
var resultList []interface{}
@@ -272,25 +272,43 @@ func (v *VendorSync) SyncStore2(ctx *jxcontext.Context, db *dao.DaoDB, vendorIDs
}, loopMapInfo.StoreMapList)
t.AddChild(loopStoreTask).Run()
resultList, err = loopStoreTask.GetResult(0)
} else {
var resultList []interface{}
db2 := db
var vendorStoreID string
storeMap := loopMapInfo.StoreMapList[0]
if model.IsSyncStatusNew(storeMap.SyncStatus) {
if vendorStoreID, err = handler.CreateStore2(db2, storeMap.StoreID, userName); err == nil {
resultList = append(resultList, 1)
} else {
failedList = putils.GetErrMsg2FailedSingleList(nil, err, storeMap.StoreID, model.VendorChineseNames[storeMap.VendorID], "创建门店")
}
} else if model.IsSyncStatusDelete(storeMap.SyncStatus) {
if err = handler.DeleteStore(db2, storeMap.StoreID, userName); err == nil {
resultList = append(resultList, 1)
} else {
failedList = putils.GetErrMsg2FailedSingleList(nil, err, storeMap.StoreID, model.VendorChineseNames[storeMap.VendorID], "删除门店")
}
} else {
if err = handler.UpdateStore(db, storeMap.StoreID, userName); err == nil {
storeMap.SyncStatus = 0
_, err = dao.UpdateEntity(db, storeMap, model.FieldSyncStatus)
} else {
failedList = putils.GetErrMsg2FailedSingleList(nil, err, storeMap.StoreID, model.VendorChineseNames[storeMap.VendorID], "更新门店")
}
}
if err == nil {
resultList = []interface{}{1}
if model.IsSyncStatusNew(storeMap.SyncStatus) {
storeMap.VendorStoreID = vendorStoreID
storeMap.SyncStatus = 0
_, err = dao.UpdateEntity(db, storeMap, "VendorStoreID", model.FieldSyncStatus)
} else {
storeMap.SyncStatus = 0
_, err = dao.UpdateEntity(db, storeMap, model.FieldSyncStatus)
}
}
}
// else {
// storeMap := loopMapInfo.StoreMapList[0]
// if model.IsSyncStatusNew(storeMap.SyncStatus) {
// } else if model.IsSyncStatusDelete(storeMap.SyncStatus) {
// } else {
// if err = handler.UpdateStore(db, storeMap.StoreID, userName); err == nil {
// storeMap.SyncStatus = 0
// _, err = dao.UpdateEntity(db, storeMap, model.FieldSyncStatus)
// } else {
// failedList = putils.GetErrMsg2FailedSingleList(nil, err, storeMap.StoreID, model.VendorChineseNames[storeMap.VendorID], "更新门店")
// }
// }
// if err == nil {
// resultList = []interface{}{1}
// }
// }
err = partner.AddVendorInfo2Err(err, loopMapInfo.VendorID)
}
if len(failedList) > 0 {

View File

@@ -67,20 +67,9 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
Name: "thor",
Value: "80FAF09E9A09B6E618A68057BDFCFCB8C86E8252DC9F7D3B34572625904FBA0AB6BF053A5325612EC0407791BB05F5301356E71E8B282C40C06D0B5DF3439DEECB102A78FAFF7AC0FC4E2D1FA8DD8BBAE1A011E50B5C74F1870AD982D7BF453F470F31F2241B73AC4C25485025C2ABEBC8A538AF7257824D2FAEE300A1435175B0B451FB5C19B78D729FC83152CA3BAF",
}
c1 := &http.Cookie{
Name: "_base_",
Value: "YKH2KDFHMOZBLCUV7NSRBWQUJPBI7JIMU5R3EFJ5UDHJ5LCU7R2NILKK5UJ6GLA2RGYT464UKXAI4Z6HPCTN4UQM3WHVQ4ENFP57OC2DC7JQLRXRUO5PW6B77O6UXAZ4TCNE6YVKRXISVLBYGYO44RCDDPWDA4AEL7ZLXI2SG4SOQWCP5WPWO6EFS7HEHMRWVKBRVHB33TFD4SMNBHRJCTDFHU6SZXCZD6RFXX2OORYGL5H2GYF2IIH2KKD4T72IR4F577G2E5II2OMMXYF2GDYNTS7WGAUXFEWRJ3CTKDBDWMHUKJQF4ZFOTNBBYBIZRXZYERXXIG6ASILBDT4U2UVRXFS7RJGNGDTM3G7CBNYDPXFCM2ZMCS474KZ44S5F",
}
c2 := &http.Cookie{
Name: "_vender_new_",
Value: "GI63BGTJFDBQ46CD7JXUX3HEPM4P5LEA3TJTFGW4ZGGIVOLTPK5T25EXTBLCENPUTR7E2I23YDFQ4ARO6JW3NHSWBDE73RTUKJTADIPFPLYFE3ARGJUBPHWUIONS72KRQOZC5P7PB4VPPLRHGEP7L3Z5K62L2E2MGTWHFJRQ3CAVBDYVW2Z4J6U73HW4BKKOCDAH5T6OJJKWKLBZFOTI7342QSL7YQ2E3I4T777RNZF23XGOTCP3D4INHNO5MNKT3XJZQBVHWUVZYQUXCK5QQTKWADKQUCYV3JRY6YAYOD7Z5IIKGNLREQTCPO7SYGSIS655JUGOUILFLXVZE6KCFG7ZTPRUD6VPE4KCIE4PV5UJFFDEEZPVS27H5WWUSI734NA7VLZHCQSBHD5PNCJJIZBGL4F5C5EQN5GDFEW6QKUCCZAY7XTGOTMC53TFUYERGNIH2RBULZ7UTZH5GU3TC6RWFI2QL4QTAIARA6GNVXENEOYIPZEHN222YDAJX5OBBEECAMAPNKZ3XNF5CNGDJ3DSU2ZLOCAKLFPCYTIIWPPJMCQ636F5464HS4OVFPFNIDW4OCE23JRPYP5FAL6TKHPAC3H3ZRU7WA5GKJJKBZUGIX7NEO4LZB7FJ3RZZZH3UHPQMNILD5DT2V7HVCUOVNOFBFMTROLMGF26RIU3MLWUSQCHHHZQ",
}
request.AddCookie(c)
request.AddCookie(c1)
request.AddCookie(c2)
client := &http.Client{}
fmt.Println("test1", request.URL)
fmt.Println("test1", utils.Format4Output(request, false))
response, _ := client.Do(request)
defer response.Body.Close()
bodyData, _ := ioutil.ReadAll(response.Body)