feat: add refund statuses

This commit is contained in:
Rogee
2025-05-06 20:23:06 +08:00
parent b7ebdf1ce6
commit 41cdc821da
13 changed files with 266 additions and 114 deletions

View File

@@ -448,3 +448,21 @@ func (m *usersModel) BuyPosts(ctx context.Context, userID, postID, price int64)
}
return nil
}
func (m *usersModel) RevokePosts(ctx context.Context, userID, postID int64) error {
tbl := table.UserPosts
stmt := tbl.
DELETE().
WHERE(
tbl.UserID.EQ(Int64(userID)).AND(
tbl.PostID.EQ(Int64(postID)),
),
)
m.log.Infof("sql: %s", stmt.DebugSql())
if _, err := stmt.ExecContext(ctx, db); err != nil {
m.log.Errorf("error revoking user post: %v", err)
return err
}
return nil
}