紫微斗数结果页分享功能样式优化

- 参考八字结果页的分享功能样式
- 分享按钮固定在页面底部
- 添加渐变背景和阴影效果
- 优化页面底部padding,避免内容被遮挡
This commit is contained in:
H1d3rOne committed 2026-03-08 19:23:08 +08:00
1 parent 24eab9cb67
commit 869ffb58c6
17 files changed
+1086 -29

No files matched your search

@@ -0,0 +1,76 @@
package xuan.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import xuan.entity.ShareRecord;
import xuan.repository.ShareRecordRepository;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
@RestController
@RequestMapping("/api/share")
public class ShareController {
@Autowired
private ShareRecordRepository shareRecordRepository;
@PostMapping("/create")
public Map<String, Object> createShare(@RequestBody Map<String, Object> params) {
Map<String, Object> result = new HashMap<>();
try {
String type = (String) params.get("type");
String resultData = (String) params.get("resultData");
String name = (String) params.get("name");
ShareRecord shareRecord = new ShareRecord();
shareRecord.setShareId(UUID.randomUUID().toString().replace("-", "").substring(0, 16));
shareRecord.setType(type);
shareRecord.setResultData(resultData);
shareRecord.setName(name);
shareRecordRepository.save(shareRecord);
result.put("success", true);
result.put("shareId", shareRecord.getShareId());
result.put("message", "分享链接创建成功");
} catch (Exception e) {
result.put("success", false);
result.put("error", "创建分享链接失败:" + e.getMessage());
}
return result;
}
@GetMapping("/view/{shareId}")
public Map<String, Object> viewShare(@PathVariable String shareId) {
Map<String, Object> result = new HashMap<>();
try {
ShareRecord shareRecord = shareRecordRepository.findByShareId(shareId)
.orElse(null);
if (shareRecord == null) {
result.put("success", false);
result.put("error", "分享链接不存在或已过期");
return result;
}
if (shareRecord.getExpireTime() != null && shareRecord.getExpireTime().before(new java.util.Date())) {
result.put("success", false);
result.put("error", "分享链接已过期");
return result;
}
result.put("success", true);
result.put("data", shareRecord);
} catch (Exception e) {
result.put("success", false);
result.put("error", "获取分享数据失败:" + e.getMessage());
}
return result;
}
}