feat 修改拿取最低价的逻辑
All checks were successful
Build image / build (push) Successful in 1m29s

This commit is contained in:
timerzz 2024-09-30 22:24:04 +08:00
parent ee35af9328
commit 895b86e38a

View File

@ -259,6 +259,12 @@ func (c *Controller) PullArticle(sArticle v2.SellerArticle) error {
return item.BiddingType == c.bidType
})
if !exist {
// 没有拿到对应类型的价格,那就拿一个最低的
lowest = lo.MinBy(resp.Items, func(item1, item2 dw_sdk.LowestPriceItem) bool {
return item1.LowestPrice < item2.LowestPrice && item1.LowestPrice > 0
})
}
if lowest.LowestPrice == 0 {
// 没有拿到价格将exclude设置为true如果后面要拉取需要手动打开
sArticle.Exclude = true
return c.storage.SellerArticle().Upsert(sArticle)