自动关注
This commit is contained in:
@@ -1052,7 +1052,7 @@ func GetWayBillByOrderID(db *DaoDB, orderStatus, vendorID, waybillVendorID int,
|
||||
return wayBillList, err
|
||||
}
|
||||
|
||||
func GetOrdersSupplement(db *DaoDB, storIDs, vendorIDs []int, vendorOrderID string, fromTime, toTime time.Time, status, stype, offset, pageSize int) (orderSupplementFee []*model.OrderSupplementFee, totalCount int, err error) {
|
||||
func GetOrdersSupplement(db *DaoDB, storIDs, vendorIDs []int, vendorOrderID string, fromTime, toTime time.Time, status, stype, IsReverse, offset, pageSize int) (orderSupplementFee []*model.OrderSupplementFee, totalCount int, err error) {
|
||||
sql := `
|
||||
SELECT SQL_CALC_FOUND_ROWS *
|
||||
FROM order_supplement_fee
|
||||
@@ -1075,7 +1075,7 @@ func GetOrdersSupplement(db *DaoDB, storIDs, vendorIDs []int, vendorOrderID stri
|
||||
sqlParams = append(sqlParams, storIDs)
|
||||
}
|
||||
if len(vendorIDs) > 0 {
|
||||
sql += " AND store_id IN (" + GenQuestionMarks(len(vendorIDs)) + ")"
|
||||
sql += " AND vendor_id IN (" + GenQuestionMarks(len(vendorIDs)) + ")"
|
||||
sqlParams = append(sqlParams, vendorIDs)
|
||||
}
|
||||
if vendorOrderID != "" {
|
||||
@@ -1090,6 +1090,11 @@ func GetOrdersSupplement(db *DaoDB, storIDs, vendorIDs []int, vendorOrderID stri
|
||||
sql += " AND type = ?"
|
||||
sqlParams = append(sqlParams, stype)
|
||||
}
|
||||
if IsReverse == -1 {
|
||||
sql += " AND link_id = 0"
|
||||
} else if IsReverse == 1 {
|
||||
sql += " AND link_id <> 0"
|
||||
}
|
||||
sql += `
|
||||
LIMIT ? OFFSET ?`
|
||||
sqlParams = append(sqlParams, pageSize, offset)
|
||||
|
||||
@@ -1188,7 +1188,7 @@ func RefershStoreSkusMidPrice(db *DaoDB, storeIDs []int) (count int64, err error
|
||||
UPDATE store_sku_bind a
|
||||
JOIN store d ON d.id = a.store_id
|
||||
JOIN price_refer_snapshot b ON a.sku_id = b.sku_id AND b.snapshot_at = ? AND d.city_code = b.city_code
|
||||
SET a.price = (b.mid_price*IF(d.pay_percentage=0,100,d.pay_percentage))/100
|
||||
SET a.unit_price = (b.mid_unit_price*IF(d.pay_percentage < 50,70,d.pay_percentage))/100
|
||||
WHERE 1=1
|
||||
`
|
||||
sqlParams := []interface{}{
|
||||
@@ -1199,7 +1199,7 @@ func RefershStoreSkusMidPrice(db *DaoDB, storeIDs []int) (count int64, err error
|
||||
sqlParams = append(sqlParams, storeIDs)
|
||||
}
|
||||
sql += `
|
||||
AND (a.price/IF(d.pay_percentage=0,100,d.pay_percentage))*100 > b.mid_price
|
||||
AND (a.price/IF(d.pay_percentage < 50,70,d.pay_percentage))*100 > b.mid_price
|
||||
AND a.deleted_at = ?
|
||||
AND a.status = ?
|
||||
`
|
||||
@@ -1370,6 +1370,7 @@ func GetStoreSkuBindByNameID(db *DaoDB, storeID, nameID, status int) (storeSkuBi
|
||||
func GetPriceReferUnitPrice(db *DaoDB, cityCode int, nameID int, snapDate time.Time) (result *PriceReferSnapshotExt, err error) {
|
||||
var (
|
||||
pRefer []*PriceReferSnapshotExt
|
||||
priceRefer = &PriceReferSnapshotExt{}
|
||||
minUnitPrice int
|
||||
maxUnitPrice int
|
||||
midUnitPrice int
|
||||
@@ -1426,10 +1427,35 @@ func GetPriceReferUnitPrice(db *DaoDB, cityCode int, nameID int, snapDate time.T
|
||||
midUnitPrice += midPrice
|
||||
avgUnitPrice += avgPrice
|
||||
}
|
||||
result.MinUnitPrice = minUnitPrice / len(pRefer)
|
||||
result.MaxUnitPrice = maxUnitPrice / len(pRefer)
|
||||
result.AvgUnitPrice = avgUnitPrice / len(pRefer)
|
||||
result.MidUnitPrice = midUnitPrice / len(pRefer)
|
||||
priceRefer.MinUnitPrice = minUnitPrice / len(pRefer)
|
||||
priceRefer.MaxUnitPrice = maxUnitPrice / len(pRefer)
|
||||
priceRefer.AvgUnitPrice = avgUnitPrice / len(pRefer)
|
||||
priceRefer.MidUnitPrice = midUnitPrice / len(pRefer)
|
||||
}
|
||||
return result, err
|
||||
return priceRefer, err
|
||||
}
|
||||
|
||||
func GetStoreSkusAndSkuName(db *DaoDB, storeIDs, skuIDs []int) (storeSkuNameExt []*StoreSkuNameExt, err error) {
|
||||
sql := `
|
||||
SELECT a.*,c.id
|
||||
FROM store_sku_bind a
|
||||
JOIN sku b ON b.id = a.sku_id AND b.deleted_at = ?
|
||||
JOIN sku_name c ON c.id = b.name_id AND c.deleted_at = ?
|
||||
WHERE a.deleted_at = ?
|
||||
`
|
||||
sqlParams := []interface{}{
|
||||
utils.DefaultTimeValue,
|
||||
utils.DefaultTimeValue,
|
||||
utils.DefaultTimeValue,
|
||||
}
|
||||
if len(storeIDs) > 0 {
|
||||
sql += " AND a.store_id IN (" + GenQuestionMarks(len(storeIDs)) + ")"
|
||||
sqlParams = append(sqlParams, storeIDs)
|
||||
}
|
||||
if len(skuIDs) > 0 {
|
||||
sql += " AND a.sku_id IN (" + GenQuestionMarks(len(skuIDs)) + ")"
|
||||
sqlParams = append(sqlParams, skuIDs)
|
||||
}
|
||||
err = GetRows(db, &storeSkuNameExt, sql, sqlParams...)
|
||||
return storeSkuNameExt, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user