aa
This commit is contained in:
@@ -5275,3 +5275,63 @@ func DeleteActStoreSkuBind(ctx *jxcontext.Context, db *dao.DaoDB, actID int, act
|
||||
dao.Commit(db)
|
||||
return originSyncStatus, err
|
||||
}
|
||||
|
||||
func GetVendorStoreSkus(ctx *jxcontext.Context, storeID, vendorID int) (err error) {
|
||||
type SpecialtyStoreSkus struct {
|
||||
Upc int `json:"商品upc码"`
|
||||
SkuName string `json:"商品名"`
|
||||
Unit int `json:"单位"`
|
||||
Weight float64 `json:"重量(g)"`
|
||||
Price float64 `json:"售价"`
|
||||
}
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
specialtyStoreSkus []*SpecialtyStoreSkus
|
||||
excelTitle = []string{
|
||||
"商品upc码",
|
||||
"商品名",
|
||||
"单位",
|
||||
"重量(g)",
|
||||
"售价",
|
||||
}
|
||||
sheetList []*excel.Obj2ExcelSheetConfig
|
||||
downloadURL, fileName string
|
||||
)
|
||||
storeDetail, err := dao.GetStoreDetail(db, storeID, vendorID, "")
|
||||
if err != nil || storeDetail == nil {
|
||||
return err
|
||||
}
|
||||
if partner.IsMultiStore(vendorID) {
|
||||
// handler := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.IPurchasePlatformStoreSkuHandler)
|
||||
// skuBareInfoList, _ := handler.GetStoreSkusBareInfo(ctx, storeDetail.VendorOrgCode, nil, storeID, storeDetail.VendorStoreID, nil)
|
||||
return fmt.Errorf("暂不支持京东!")
|
||||
} else {
|
||||
handler := partner.GetPurchasePlatformFromVendorID(vendorID).(partner.ISingleStoreStoreSkuHandler)
|
||||
skuList, _ := handler.GetStoreSkusFullInfo(ctx, nil, storeID, storeDetail.VendorStoreID, nil)
|
||||
for _, sku := range skuList {
|
||||
if sku.SkuList[0].IsSpecialty == model.YES {
|
||||
specialtyStoreSku := &SpecialtyStoreSkus{}
|
||||
specialtyStoreSkus = append(specialtyStoreSkus, specialtyStoreSku)
|
||||
}
|
||||
}
|
||||
}
|
||||
excelConf := &excel.Obj2ExcelSheetConfig{
|
||||
Title: "sheet1",
|
||||
Data: specialtyStoreSkus,
|
||||
CaptionList: excelTitle,
|
||||
}
|
||||
sheetList = append(sheetList, excelConf)
|
||||
if excelConf != nil {
|
||||
downloadURL, fileName, err = jxutils.UploadExeclAndPushMsg(sheetList, "平台门店标品")
|
||||
} else {
|
||||
baseapi.SugarLogger.Debug("WriteToExcel: dataSuccess is nil!")
|
||||
}
|
||||
if err != nil {
|
||||
baseapi.SugarLogger.Errorf("WriteToExcel:upload %s , %s failed error:%v", fileName, err)
|
||||
} else {
|
||||
noticeMsg := fmt.Sprintf("[详情点我]%s/billshow/?normal=true&path=%s \n", globals.BackstageHost, downloadURL)
|
||||
ddmsg.SendUserMessage(dingdingapi.MsgTyeText, ctx.GetUserID(), "异步任务完成", noticeMsg)
|
||||
baseapi.SugarLogger.Debug("WriteToExcel: dataSuccess downloadURL: [%v]", downloadURL)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user