This commit is contained in:
邹宗楠
2024-09-29 14:15:21 +08:00
parent 754ff9f9cf
commit 710d57d4e5

View File

@@ -11,10 +11,13 @@ import (
func GetBadCommentOrderId(jxStoreId int, startTime, endTime time.Time, foodNameList []string) (string, error) {
sqlParams := []interface{}{}
sql := `
SELECT count(vendor_order_id) count,vendor_order_id FROM
order_sku_financial WHERE jx_store_id = ? AND created_at >= ? AND created_at <= ? AND name IN (` + dao.GenQuestionMarks(len(foodNameList)) + `) AND is_afs_order = 0 AND vendor_id = 1 GROUP BY vendor_order_id LIMIT 0, 1000`
SELECT count(s.vendor_order_id) count,s.vendor_order_id FROM goods_order g
LEFT JOIN order_sku s ON g.vendor_order_id = s.vendor_order_id
WHERE g.jx_store_id = ? AND g.vendor_id = ? AND g.order_created_at >= ? AND g.order_created_at <= ? AND s.sku_name IN (` + dao.GenQuestionMarks(len(foodNameList)) + `) GROUP BY s.vendor_order_id LIMIT 0, 1000
`
sqlParams = append(sqlParams, []interface{}{
jxStoreId,
model.VendorIDMTWM,
startTime,
endTime,
foodNameList,
@@ -37,10 +40,10 @@ func GetBadCommentOrderId(jxStoreId int, startTime, endTime time.Time, foodNameL
}
}
sql2 := `SELECT * FROM order_sku_financial WHERE vendor_order_id = ? AND is_afs_order = 0 AND vendor_id = 1 `
sql2 := `SELECT * FROM order_sku WHERE vendor_order_id = ?`
mathProbability := make(map[string]float64, 0)
for _, v := range vendorOrderIdList {
skuFinancial := make([]*model.OrderSkuFinancial, 0, 0)
skuFinancial := make([]*model.OrderSku, 0, 0)
if err := GetRows(GetDB(), &skuFinancial, sql2, []interface{}{v}...); err != nil {
continue
}
@@ -48,7 +51,7 @@ func GetBadCommentOrderId(jxStoreId int, startTime, endTime time.Time, foodNameL
var skuMatchingCount int = 0
for _, sf := range skuFinancial {
for _, fnl := range foodNameList {
if sf.Name == fnl {
if sf.SkuName == fnl {
skuMatchingCount += 1
}
}