blob: 185c3214e99b5f638df6a264d0094c0cb0eb605e [file] [log] [blame]
Edwardsamaxlcba512d2025-06-09 21:17:29 +08001package com.pt.service;
2
3import com.pt.entity.TorrentMeta;
4import com.pt.repository.TorrentMetaRepository;
5import org.springframework.beans.factory.annotation.Autowired;
6import org.springframework.stereotype.Service;
7
8import java.time.LocalDateTime;
9
10@Service
11public class TorrentMetaService {
12
13 @Autowired
14 private TorrentMetaRepository torrentMetaRepository;
15
16 public void save(TorrentMeta torrentMeta) {
17 // 这里可以添加保存逻辑,比如调用repository的save方法
18 // torrentMetaRepository.save(torrentMeta);
19 System.out.println("Saving TorrentMeta: " + torrentMeta);
20 }
21
22 public void save(String infoHash, String name, long size) {
23 TorrentMeta torrentMeta = new TorrentMeta();
24 torrentMeta.setInfoHash(infoHash);
25 torrentMeta.setFilename(name);
26 torrentMeta.setSize(size);
27 torrentMeta.setUploadTime(LocalDateTime.now());
28 torrentMetaRepository.save(torrentMeta);
29 }
30}