ready link import fx 1
This commit is contained in:
parent
5240988a3a
commit
1a571193de
|
|
@ -106,9 +106,20 @@ func DeleteProducts(db *gorm.DB) error {
|
|||
defer cancel()
|
||||
//qb := "DELETE FROM products WHERE id NOT IN (select product_id as id from wishlist) AND id NOT IN (select product_id as id from order_items) AND id NOT IN (select parent_id as idfrom order_items);"
|
||||
qb := "DELETE p FROM products p LEFT JOIN order_items oi ON p.id = oi.product_id LEFT JOIN order_items op ON p.id = op.parent_id WHERE oi.id IS NULL AND op.id IS NULL;"
|
||||
return db.WithContext(ctx).Exec(qb).Error
|
||||
db.WithContext(ctx).Exec(qb)
|
||||
db.WithContext(ctx).Exec("UPDATE product_flat set sku=concat(sku,\"-ordered\"), status=0")
|
||||
db.WithContext(ctx).Exec("UPDATE products set sku=concat(sku,\"-ordered\")")
|
||||
return db.Error
|
||||
}
|
||||
|
||||
//func DisableProducts (db *gorm.DB) error {
|
||||
// ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
|
||||
// defer cancel()
|
||||
// db.WithContext(ctx).Exec("UPDATE product_flat set sku=concat(sku,\"-ordered\"), status=0")
|
||||
// db.WithContext(ctx).Exec("UPDATE products set sku=concat(sku,\"-ordered\")")
|
||||
// return db.Error
|
||||
//}
|
||||
|
||||
func Flush() error {
|
||||
_, err := helper.SendRequest("GET", os.Getenv("scout_flash"), nil, "")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue