星球建交,主界面优化
Change-Id: I96def66123d096ba266e6f5c52c21f8f9d936c04
diff --git a/Redis-x64-5.0.14.1/dump.rdb b/Redis-x64-5.0.14.1/dump.rdb
index f40c53c..af89adb 100644
--- a/Redis-x64-5.0.14.1/dump.rdb
+++ b/Redis-x64-5.0.14.1/dump.rdb
Binary files differ
diff --git a/download/avatar/2025/05/27/blob_20250527203945A001.png b/download/avatar/2025/05/27/blob_20250527203945A001.png
new file mode 100644
index 0000000..587fe45
--- /dev/null
+++ b/download/avatar/2025/05/27/blob_20250527203945A001.png
Binary files differ
diff --git a/download/avatar/2025/05/27/blob_20250527204239A002.png b/download/avatar/2025/05/27/blob_20250527204239A002.png
new file mode 100644
index 0000000..960f08b
--- /dev/null
+++ b/download/avatar/2025/05/27/blob_20250527204239A002.png
Binary files differ
diff --git a/download/avatar/2025/05/27/blob_20250527205919A003.png b/download/avatar/2025/05/27/blob_20250527205919A003.png
new file mode 100644
index 0000000..23aea8f
--- /dev/null
+++ b/download/avatar/2025/05/27/blob_20250527205919A003.png
Binary files differ
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/Server/planet/IPlanetService.java b/ruoyi-admin/src/main/java/com/ruoyi/web/Server/planet/IPlanetService.java
new file mode 100644
index 0000000..0bab702
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/Server/planet/IPlanetService.java
@@ -0,0 +1,23 @@
+package com.ruoyi.web.Server.planet;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.web.domain.planet.Planet;
+import com.ruoyi.web.domain.planet.UserPlanet;
+import com.ruoyi.web.mapper.planet.PlanetMapper;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
+public interface IPlanetService{
+ List<Planet> getPlanetList(Long pageNum, Long pageSize);
+ List<UserPlanet> getUserPlanetList();
+ Planet getPlanetById(Long id);
+ Planet uploadPlanetFile(MultipartFile file);
+ void updatePlanet(Planet planet);
+
+ void updateUserPlanet(UserPlanet userPlanet);
+
+ void deletePlanets(List<Long> ids);
+ UserPlanet getUserPlanetByUserId(Long userId);
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/Server/planet/PlanetServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/web/Server/planet/PlanetServiceImpl.java
new file mode 100644
index 0000000..6af3739
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/Server/planet/PlanetServiceImpl.java
@@ -0,0 +1,72 @@
+package com.ruoyi.web.Server.planet;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.file.FileUploadUtils;
+import com.ruoyi.web.domain.planet.Planet;
+import com.ruoyi.web.domain.planet.UserPlanet;
+import com.ruoyi.web.mapper.planet.PlanetMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+import java.util.List;
+
+@Service
+public class PlanetServiceImpl extends ServiceImpl<PlanetMapper, Planet> implements IPlanetService {
+ @Autowired
+ private PlanetMapper planetMapper;
+
+ @Override
+ public List<Planet> getPlanetList(Long pageNum, Long pageSize) {
+ System.out.println("########################");
+ return planetMapper.selectPlanetList((pageNum-1)*pageSize, pageSize);
+ }
+
+ @Override
+ public List<UserPlanet> getUserPlanetList() {
+ return planetMapper.selectUserPlanetList();
+ }
+
+ @Override
+ public Planet getPlanetById(Long id) {
+ return planetMapper.selectPlanetById(id);
+ }
+
+ @Override
+ public Planet uploadPlanetFile(MultipartFile file) {
+ String fileName = null;
+ try {
+ fileName = FileUploadUtils.upload(file);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ Planet planet = new Planet();
+ planet.setName(fileName);
+ planet.setFilename(fileName);
+ planet.setCreateTime(DateUtils.getNowDate());
+ planetMapper.insertPlanet(planet);
+ return planet;
+ }
+
+ @Override
+ public void updatePlanet(Planet planet) {
+ planetMapper.updatePlanet(planet);
+ }
+
+ @Override
+ public void updateUserPlanet(UserPlanet userPlanet) {
+ planetMapper.updateUserPlanet(userPlanet);
+ }
+
+ @Override
+ public void deletePlanets(List<Long> ids) {
+ planetMapper.deletePlanetsByIds(ids);
+ }
+
+ @Override
+ public UserPlanet getUserPlanetByUserId(Long userId) {
+ return planetMapper.selectUserPlanetByUserId(userId);
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/planet/Controller.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/planet/Controller.java
new file mode 100644
index 0000000..7b03fb0
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/planet/Controller.java
@@ -0,0 +1,112 @@
+package com.ruoyi.web.controller.planet;
+
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.web.controller.common.base.PageUtil;
+import com.ruoyi.web.controller.common.base.Result;
+import com.ruoyi.web.domain.planet.Planet;
+import com.ruoyi.web.domain.planet.UserPlanet;
+import com.ruoyi.web.Server.planet.IPlanetService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * @program: ThunderHubServer
+ * @description: 后端API控制器,处理星球相关请求
+ * @author: Yumaoo
+ * @create: 2025-06-08 17:23
+ **/
+@RestController
+@RequestMapping("/planets")
+public class Controller {
+ @Autowired
+ private IPlanetService planetService;
+
+ /**
+ * 分页查询星球列表
+ */
+ @GetMapping("/list")
+ public Result getPlanetList(@RequestParam(defaultValue = "1") Long pageNum,
+ @RequestParam(defaultValue = "10") Long pageSize) {
+ List<Planet> list = planetService.getPlanetList(pageNum, pageSize);
+ System.out.println("########################");
+ System.out.println(list);
+ return Result.ok(list, PageUtil.getPage(list));
+ }
+
+ /**
+ * 获取星球详情
+ */
+ @GetMapping("/info/{id}")
+ public AjaxResult getPlanetInfo(@PathVariable String id) {
+ // 前端支持字符串ID,后端统一转为Long类型
+ return AjaxResult.success(planetService.getPlanetById(Long.valueOf(id)));
+ }
+
+ /**
+ * 上传星球文件
+ */
+ @PostMapping("/upload")
+ public AjaxResult uploadPlanetFile(@RequestParam("file") MultipartFile file) {
+ Planet planet = planetService.uploadPlanetFile(file);
+ return AjaxResult.success(planet);
+ }
+
+ /**
+ * 获取用户星球信息
+ */
+ @GetMapping("/user")
+ public AjaxResult getUserPlanet(@RequestParam Long userId) {
+ return AjaxResult.success(planetService.getUserPlanetByUserId(userId));
+ }
+
+ /**
+ * 随机获得用户和绑定的星球
+ */
+ @GetMapping("/random")
+ public Result getRandomUserPlanets() {
+ List<UserPlanet> list = planetService.getUserPlanetList();
+ System.out.println("########################");
+ System.out.println(list);
+ List<UserPlanet> result;
+ if (list.size() <= 3) {
+ result = new ArrayList<>(list);
+ } else {
+ List<UserPlanet> shuffledList = new ArrayList<>(list);
+ Collections.shuffle(shuffledList);
+ result = shuffledList.subList(0, 3);
+ }
+ return Result.ok(result, PageUtil.getPage(list));
+ }
+
+ /**
+ * 更新星球信息
+ */
+ @PostMapping("/update")
+ public AjaxResult updatePlanet(@RequestBody Planet planet) {
+ planetService.updatePlanet(planet);
+ return AjaxResult.success();
+ }
+ @PostMapping("/updateUserPlanet")
+ public AjaxResult updateUserPlanet(@RequestBody UserPlanet userPlanet) {
+ userPlanet.setUpdateTime(new java.util.Date());
+ System.out.println("##########");
+ System.out.println(userPlanet);
+ planetService.updateUserPlanet(userPlanet);
+ return AjaxResult.success();
+ }
+
+ /**
+ * 删除星球
+ */
+ @PostMapping("/delete")
+ public AjaxResult deletePlanet(@RequestBody List<Long> ids) {
+ // 强制类型转换以适配服务层接口
+ planetService.deletePlanets((java.util.List<Long>) ids);
+ return AjaxResult.success();
+ }
+}
\ No newline at end of file
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/domain/planet/Planet.java b/ruoyi-admin/src/main/java/com/ruoyi/web/domain/planet/Planet.java
new file mode 100644
index 0000000..e3a4abe
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/domain/planet/Planet.java
@@ -0,0 +1,39 @@
+package com.ruoyi.web.domain.planet;
+
+import com.ruoyi.common.core.domain.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+/**
+ * @program: ThunderHubServer
+ * @description: Planet entity class mapping to the database table
+ * @author: Yumaoo
+ * @create: 2025-06-08 17:19
+ **/
+@EqualsAndHashCode(callSuper = true)
+@Setter
+@Getter
+@Data
+
+public class Planet extends BaseEntity {
+ private Integer planetId;
+ private String name;
+ private String filename;
+ private String description;
+ private Date createTime;
+
+ @Override
+ public String toString() {
+ return "Planet{" +
+ "planetId=" + planetId +
+ ", name='" + name + '\'' +
+ ", filename='" + filename + '\'' +
+ ", description='" + description + '\'' +
+ ", createTime=" + createTime +
+ '}';
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/domain/planet/UserPlanet.java b/ruoyi-admin/src/main/java/com/ruoyi/web/domain/planet/UserPlanet.java
new file mode 100644
index 0000000..dd90640
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/domain/planet/UserPlanet.java
@@ -0,0 +1,34 @@
+package com.ruoyi.web.domain.planet;
+
+import com.ruoyi.common.core.domain.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+/**
+ * @program: ThunderHubServer
+ * @description: UserPlanet entity class mapping to the user_planet table
+ * @author: Yumaoo
+ * @create: 2025-06-08 17:21
+ **/
+@EqualsAndHashCode(callSuper = true)
+@Setter
+@Getter
+@Data
+public class UserPlanet extends BaseEntity {
+ private Integer userId;
+ private Integer planetId;
+ private Date updateTime;
+
+ @Override
+ public String toString() {
+ return "UserPlanet{" +
+ "userId=" + userId +
+ ", planetId=" + planetId +
+ ", updateTime=" + updateTime +
+ '}';
+ }
+}
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/mapper/planet/PlanetMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/web/mapper/planet/PlanetMapper.java
new file mode 100644
index 0000000..ba09798
--- /dev/null
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/mapper/planet/PlanetMapper.java
@@ -0,0 +1,23 @@
+package com.ruoyi.web.mapper.planet;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.common.core.page.PageDomain;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.web.domain.planet.Planet;
+import com.ruoyi.web.domain.planet.UserPlanet;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+@Mapper
+public interface PlanetMapper extends BaseMapper<Planet> {
+ List<Planet> selectPlanetList(@Param("offset") Long offset, @Param("pageSize") Long pageSize);
+ Planet selectPlanetById(Long id);
+ void insertPlanet(Planet planet);
+ void updatePlanet(Planet planet);
+ void updateUserPlanet(UserPlanet user);
+ void deletePlanetsByIds(List<Long> ids);
+ UserPlanet selectUserPlanetByUserId(Long userId);
+
+ List<UserPlanet> selectUserPlanetList();
+}
diff --git a/ruoyi-admin/src/main/resources/mapper/planet/PlanetMapper.xml.xml b/ruoyi-admin/src/main/resources/mapper/planet/PlanetMapper.xml.xml
new file mode 100644
index 0000000..30b0a2f
--- /dev/null
+++ b/ruoyi-admin/src/main/resources/mapper/planet/PlanetMapper.xml.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.web.mapper.planet.PlanetMapper">
+ <resultMap id="PlanetResult" type="com.ruoyi.web.domain.planet.Planet">
+ <id property="planetId" column="planet_id"/>
+ <result property="name" column="name"/>
+ <result property="filename" column="filename"/>
+ <result property="description" column="description"/>
+ <result property="createTime" column="create_time"/>
+ </resultMap>
+ <resultMap id="UserPlanetResult" type="com.ruoyi.web.domain.planet.UserPlanet">
+ <id property="userId" column="user_id"/>
+ <result property="planetId" column="planet_id"/>
+ <result property="updateTime" column="update_time"/>
+ </resultMap>
+ <select id="selectPlanetList" parameterType="com.ruoyi.web.domain.planet.Planet" resultMap="PlanetResult">
+ SELECT * FROM planets
+ <where>
+ <!-- 可选条件 -->
+ </where>
+ LIMIT #{pageSize} OFFSET #{offset}
+ </select>
+ <select id="selectPlanetById" parameterType="com.ruoyi.web.domain.planet.Planet" resultMap="PlanetResult">
+ SELECT * FROM planets WHERE planet_id = #{id}
+ </select>
+ <insert id="insertPlanet">
+ INSERT INTO planets (name, filename, description, create_time)
+ VALUES (#{name}, #{filename}, #{description}, #{createTime})
+ </insert>
+ <update id="updatePlanet">
+ UPDATE planets
+ SET name = #{name},
+ filename = #{filename},
+ description = #{description}
+ WHERE planet_id = #{planetId}
+ </update>
+ <update id="updateUserPlanet">
+ UPDATE user_planet
+ SET planet_id = #{planetId}
+ WHERE user_id = #{userId}
+ </update>
+ <delete id="deletePlanetsByIds">
+ DELETE FROM planets WHERE planet_id IN
+ <foreach item="id" collection="ids" open="(" separator="," close=")">
+ #{id}
+ </foreach>
+ </delete>
+ <select id="selectUserPlanetByUserId" resultMap="UserPlanetResult">
+ SELECT * FROM user_planet WHERE user_id = #{userId}
+ </select>
+ <select id="selectUserPlanetList" parameterType="com.ruoyi.web.domain.planet.UserPlanet" resultMap="UserPlanetResult">
+ SELECT * FROM user_planet
+ </select>
+</mapper>
\ No newline at end of file
diff --git a/uploads/075367d2-fb8f-4633-a8e9-1868d0fb6972.pdf b/uploads/075367d2-fb8f-4633-a8e9-1868d0fb6972.pdf
new file mode 100644
index 0000000..684cf36
--- /dev/null
+++ b/uploads/075367d2-fb8f-4633-a8e9-1868d0fb6972.pdf
Binary files differ
diff --git a/uploads/2d051319-dc5b-4ae4-b353-f5cdba22b540.pdf b/uploads/2d051319-dc5b-4ae4-b353-f5cdba22b540.pdf
new file mode 100644
index 0000000..684cf36
--- /dev/null
+++ b/uploads/2d051319-dc5b-4ae4-b353-f5cdba22b540.pdf
Binary files differ
diff --git a/uploads/3191dff5-fa07-4708-bcf8-f547ccea1eab.pdf b/uploads/3191dff5-fa07-4708-bcf8-f547ccea1eab.pdf
new file mode 100644
index 0000000..684cf36
--- /dev/null
+++ b/uploads/3191dff5-fa07-4708-bcf8-f547ccea1eab.pdf
Binary files differ
diff --git a/uploads/5e06d4e6-8371-4a9d-b521-9d41f08e746b.pdf b/uploads/5e06d4e6-8371-4a9d-b521-9d41f08e746b.pdf
new file mode 100644
index 0000000..684cf36
--- /dev/null
+++ b/uploads/5e06d4e6-8371-4a9d-b521-9d41f08e746b.pdf
Binary files differ
diff --git a/uploads/b99bd55f-3e67-4ae3-b6d3-6e139dd171ef.pdf b/uploads/b99bd55f-3e67-4ae3-b6d3-6e139dd171ef.pdf
new file mode 100644
index 0000000..684cf36
--- /dev/null
+++ b/uploads/b99bd55f-3e67-4ae3-b6d3-6e139dd171ef.pdf
Binary files differ
diff --git a/uploads/c5f6c743-a8d1-470e-8dd9-0664f01ca1ff.pdf b/uploads/c5f6c743-a8d1-470e-8dd9-0664f01ca1ff.pdf
new file mode 100644
index 0000000..684cf36
--- /dev/null
+++ b/uploads/c5f6c743-a8d1-470e-8dd9-0664f01ca1ff.pdf
Binary files differ