🎨 新增清理机器人和定时设置免费定时任务

This commit is contained in:
2025-10-11 16:15:02 +08:00
parent 481635d333
commit 91ec3a2601
4 changed files with 79 additions and 0 deletions

8
task/setArticleFree.go Normal file
View File

@@ -0,0 +1,8 @@
package task
import "gorm.io/gorm"
// SetArticleFree 定时将到期的付费文章设置为免费
func SetArticleFree(db *gorm.DB) error {
return db.Exec("UPDATE `article` SET is_free = 1, price = 0 WHERE is_free = 0 AND `status` = 1").Error
}