linshi
This commit is contained in:
@@ -13,7 +13,6 @@ import (
|
||||
"github.com/360EntSecGroup-Skylar/excelize"
|
||||
"github.com/qiniu/api.v7/storage"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/dadaapi"
|
||||
"git.rosy.net.cn/baseapi/platformapi/jdapi"
|
||||
"git.rosy.net.cn/baseapi/platformapi/mtwmapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
@@ -1585,18 +1584,34 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) {
|
||||
// fmt.Println("updateList2", utils.Format4Output(updateList, false))
|
||||
// fmt.Println("deleteList2", deleteList)
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
db = dao.GetDB()
|
||||
storeSkus []*model.StoreSkuBind
|
||||
)
|
||||
list, err := dao.GetStoreCourierList(db, nil, []int{model.VendorIDDada}, model.StoreStatusAll, model.StoreAuditStatusAll)
|
||||
for _, v := range list {
|
||||
sd, _ := api.DadaAPI.ShopDetail(v.VendorStoreID)
|
||||
if !strings.Contains(sd.StationName, globals.StoreName) {
|
||||
shopInfo := &dadaapi.ShopInfo{
|
||||
OriginShopID: v.VendorStoreID,
|
||||
StationName: globals.StoreName + "-" + sd.StationName,
|
||||
}
|
||||
api.DadaAPI.ShopUpdate(shopInfo)
|
||||
sql := `
|
||||
SELECT a.* FROM store_sku_bind a,store b
|
||||
WHERE a.store_id = b.id AND b.deleted_at = '1970-01-01 00:00:00' AND a.status = 1 AND a.unit_price = 100
|
||||
AND a.deleted_at = '1970-01-01 00:00:00'
|
||||
AND a.sku_id NOT IN (34268,6045545,29401,6039481,29285,29286,29287,6040945,6040963,31737,33465,6045629,34989,6043733)
|
||||
`
|
||||
err = dao.GetRows(db, &storeSkus, sql, nil)
|
||||
for _, v := range storeSkus {
|
||||
var unitPrice = 0
|
||||
his, _ := dao.GetStoreSkuHistory(db, []int{v.StoreID}, []int{v.SkuID}, model.StoreAuditStatusAll, utils.Time2Date(utils.Str2Time("2020-08-09 00:00:00")))
|
||||
if len(his) == 0 {
|
||||
p, _ := dao.GetPriceReferSnapshotNoPage(db, []int{0}, []int{v.SkuID}, nil, utils.Time2Date(time.Now().AddDate(0, 0, -1)))
|
||||
unitPrice = p[0].MidUnitPrice
|
||||
} else {
|
||||
unitPrice = his[0].UnitPrice
|
||||
}
|
||||
skus, _ := dao.GetSkus(db, []int{v.SkuID}, nil, nil, nil, nil)
|
||||
var skuBindInfos []*cms.StoreSkuBindInfo
|
||||
skuBindInfo := &cms.StoreSkuBindInfo{
|
||||
StoreID: v.StoreID,
|
||||
NameID: skus[0].NameID,
|
||||
UnitPrice: unitPrice,
|
||||
}
|
||||
skuBindInfos = append(skuBindInfos, skuBindInfo)
|
||||
cms.UpdateStoresSkusByBind(ctx, nil, skuBindInfos, true, true, false)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user