推送账单时,推送到主店
This commit is contained in:
@@ -785,7 +785,7 @@ func UpdateStore(ctx *jxcontext.Context, storeID int, payload map[string]interfa
|
||||
}
|
||||
if valid["linkStoreID"] != nil {
|
||||
linkStoreID := int(utils.Interface2Int64WithDefault(valid["linkStoreID"], 0))
|
||||
linkStoreID, err = getRealLinkStoreID(linkStoreID)
|
||||
linkStoreID, err = dao.GetRealLinkStoreID(db, linkStoreID)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@@ -1038,7 +1038,7 @@ func CreateStore(ctx *jxcontext.Context, storeExt *StoreExt, userName string) (i
|
||||
return 0, err
|
||||
}
|
||||
}
|
||||
realLinkStoreID, err := getRealLinkStoreID(storeExt.LinkStoreID)
|
||||
realLinkStoreID, err := dao.GetRealLinkStoreID(db, storeExt.LinkStoreID)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
@@ -1085,21 +1085,6 @@ func CreateStore(ctx *jxcontext.Context, storeExt *StoreExt, userName string) (i
|
||||
return 0, err
|
||||
}
|
||||
|
||||
func getRealLinkStoreID(linkStoreID int) (realLinkStoreID int, err error) {
|
||||
if linkStoreID != 0 {
|
||||
store := &model.Store{}
|
||||
store.ID = linkStoreID
|
||||
if err = dao.GetEntity(dao.GetDB(), store); err == nil {
|
||||
if store.LinkStoreID != 0 {
|
||||
realLinkStoreID = store.LinkStoreID
|
||||
} else {
|
||||
realLinkStoreID = linkStoreID
|
||||
}
|
||||
}
|
||||
}
|
||||
return realLinkStoreID, err
|
||||
}
|
||||
|
||||
func GetStoreVendorMaps(ctx *jxcontext.Context, db *dao.DaoDB, storeID int, vendorID int) (storeMaps []*model.StoreMap, err error) {
|
||||
cond := map[string]interface{}{
|
||||
model.FieldStoreID: storeID,
|
||||
|
||||
@@ -56,7 +56,8 @@ func SendFilesToStores(ctx *jxcontext.Context, files []*multipart.FileHeader, ti
|
||||
func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
fileInfo := batchItemList[0].(*tUploadFileInfo)
|
||||
fileHeader := fileInfo.FileHeader
|
||||
storeID := fileInfo.StoreID
|
||||
db := dao.GetDB()
|
||||
storeID, _ := dao.GetRealLinkStoreID(db, fileInfo.StoreID)
|
||||
file, err := fileHeader.Open()
|
||||
globals.SugarLogger.Debugf("SendFilesToStores upload file:%s", fileHeader.Filename)
|
||||
if err == nil {
|
||||
@@ -70,7 +71,6 @@ func SendFilesToStores(ctx *jxcontext.Context, files []*multipart.FileHeader, ti
|
||||
}
|
||||
file.Close()
|
||||
if err == nil {
|
||||
db := dao.GetDB()
|
||||
billRec := &legacymodel.StoreBill{
|
||||
Date: time.Now(),
|
||||
Url: strings.Replace(jxutils.ComposeQiniuResURL(ret.Key), "http://", "https://", -1),
|
||||
|
||||
@@ -699,3 +699,19 @@ func GetStoreLinkStores(db *DaoDB, storeID int) (storeList []*model.Store, err e
|
||||
err = GetRows(db, &storeList, sql, sqlParams...)
|
||||
return storeList, err
|
||||
}
|
||||
|
||||
func GetRealLinkStoreID(db *DaoDB, linkStoreID int) (realLinkStoreID int, err error) {
|
||||
realLinkStoreID = linkStoreID
|
||||
if linkStoreID != 0 {
|
||||
store := &model.Store{}
|
||||
store.ID = linkStoreID
|
||||
if err = GetEntity(db, store); err == nil {
|
||||
if store.LinkStoreID != 0 {
|
||||
realLinkStoreID = store.LinkStoreID
|
||||
} else {
|
||||
realLinkStoreID = linkStoreID
|
||||
}
|
||||
}
|
||||
}
|
||||
return realLinkStoreID, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user