yonghuiexcel
This commit is contained in:
@@ -215,7 +215,11 @@ func LoadExcelBinByYongHui(ctx *jxcontext.Context, reader io.Reader, isAsync, is
|
||||
isCompare, err = UpdateClassifyAndGetLastClassify()
|
||||
case 1:
|
||||
//获取微盟所有商品
|
||||
goodsList, err = GetWeiMobGoodsList()
|
||||
param := &weimobapi.QueryGoodsListParam{
|
||||
PageNum: 1,
|
||||
PageSize: jdapi.MaxSkuIDsCount4QueryListBySkuIds,
|
||||
}
|
||||
goodsList, err = GetWeiMobGoodsList(param)
|
||||
if err != nil {
|
||||
baseapi.SugarLogger.Errorf("GetWeiMobGoodsList error:%v", err)
|
||||
}
|
||||
@@ -490,11 +494,7 @@ func updateWeiMobGoods(costPrice, salePrice float64, unit string, isCompare bool
|
||||
return goodsID, skuMap, err
|
||||
}
|
||||
|
||||
func GetWeiMobGoodsList() (goodsList []*weimobapi.GoodsInfo, err error) {
|
||||
param := &weimobapi.QueryGoodsListParam{
|
||||
PageNum: 1,
|
||||
PageSize: jdapi.MaxSkuIDsCount4QueryListBySkuIds,
|
||||
}
|
||||
func GetWeiMobGoodsList(param *weimobapi.QueryGoodsListParam) (goodsList []*weimobapi.GoodsInfo, err error) {
|
||||
for {
|
||||
goodsInfoList, _, err := api.WeimobAPI.QueryGoodsList(param)
|
||||
if err != nil {
|
||||
@@ -694,7 +694,7 @@ func WriteToExcel(task *tasksch.SeqTask, dataSuccess []DataSuccess, dataFailed [
|
||||
if err != nil {
|
||||
baseapi.SugarLogger.Errorf("WriteToExcel:upload %s , %s failed error:%v", fileName1, fileName2, err)
|
||||
} else {
|
||||
noticeMsg := fmt.Sprintf("[详情点我]%s/billshow/?normal=true&path1=%s, path2=%s \n", globals.BackstageHost, downloadURL1, downloadURL2)
|
||||
noticeMsg := fmt.Sprintf("[详情点我]path1=%s, path2=%s \n", globals.BackstageHost, downloadURL1, downloadURL2)
|
||||
task.SetNoticeMsg(noticeMsg)
|
||||
baseapi.SugarLogger.Debugf("WriteToExcel:upload %s ,%s success, downloadURL1:%s ,downloadURL2:%s", fileName1, fileName2, downloadURL1, downloadURL2)
|
||||
}
|
||||
@@ -709,3 +709,48 @@ func UploadExeclAndPushMsg(sheetList []*excel.Obj2ExcelSheetConfig, name string)
|
||||
downloadURL, err = jxutils.UploadExportContent(excelBin, fileName)
|
||||
return downloadURL, fileName, err
|
||||
}
|
||||
|
||||
func UpdateJxPriceByWeimob(ctx *jxcontext.Context, storeIDs []int, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||
//获取微盟所有商品
|
||||
// param := &weimobapi.QueryGoodsListParam{
|
||||
// GoodsStatus: 0,
|
||||
// PageNum: 1,
|
||||
// PageSize: jdapi.MaxSkuIDsCount4QueryListBySkuIds,
|
||||
// }
|
||||
// goodsList, err := GetWeiMobGoodsList(param)
|
||||
// if err != nil {
|
||||
// baseapi.SugarLogger.Errorf("GetWeiMobGoodsList error:%v", err)
|
||||
// }
|
||||
// taskSeqFunc := func(task *tasksch.SeqTask, step int, params ...interface{}) (result interface{}, err error) {
|
||||
// switch step {
|
||||
// case 0:
|
||||
// taskFunc := func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
// v := batchItemList[0].(*weimobapi.GoodsInfo)
|
||||
// goodsDetail, err := api.WeimobAPI.QueryGoodsDetail(v.GoodsID)
|
||||
// if err != nil {
|
||||
// baseapi.SugarLogger.Errorf("QueryGoodsDetail error:%v", err)
|
||||
// }
|
||||
// storeSkuBindInfo := &cms.StoreSkuBindInfo{
|
||||
// NameID: goodsDetail.SkuMap.SingleSku.OuterSkuCode,
|
||||
// UnitPrice: goodsDetail.SkuMap.SingleSku.CostPrice,
|
||||
// }
|
||||
// retVal =
|
||||
// return retVal, err
|
||||
// }
|
||||
// taskParallel := tasksch.NewParallelTask("获取微盟商品", tasksch.NewParallelConfig().SetParallelCount(parallelCount), ctx, taskFunc, goodsList)
|
||||
// tasksch.HandleTask(taskParallel, task, true).Run()
|
||||
// _, err = taskParallel.GetResult(0)
|
||||
// case 1:
|
||||
// cms.UpdateStoresSkus(ctx, storeIDs, skuBindInfos, isAsync, isContinueWhenError)
|
||||
// }
|
||||
// }
|
||||
// taskSeq := tasksch.NewSeqTask2("根据微盟商品更新京西价", ctx, isContinueWhenError, taskSeqFunc, 2)
|
||||
// tasksch.HandleTask(taskSeq, nil, true).Run()
|
||||
// if !isAsync {
|
||||
// _, err = taskSeq.GetResult(0)
|
||||
// hint = "1"
|
||||
// } else {
|
||||
// hint = taskSeq.GetID()
|
||||
// }
|
||||
return hint, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user