个人中心优化,增加上传头像接口
This commit is contained in:
@@ -4,14 +4,17 @@ import com.ruoyi.common.constant.Constants;
|
|||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.domain.entity.ShopUser;
|
import com.ruoyi.common.core.domain.entity.ShopUser;
|
||||||
import com.ruoyi.common.core.domain.entity.ShopUserResq;
|
import com.ruoyi.common.core.domain.entity.ShopUserResq;
|
||||||
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
import com.ruoyi.framework.web.service.SysLoginService;
|
import com.ruoyi.framework.web.service.SysLoginService;
|
||||||
|
import com.ruoyi.system.config.AliConfig;
|
||||||
import com.ruoyi.system.service.AliConfigService;
|
import com.ruoyi.system.service.AliConfigService;
|
||||||
|
import com.ruoyi.system.service.IShopUserService;
|
||||||
import com.ruoyi.system.service.ShopUserService;
|
import com.ruoyi.system.service.ShopUserService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import java.io.IOException;
|
||||||
|
|
||||||
@RequestMapping("/client")
|
@RequestMapping("/client")
|
||||||
@RestController
|
@RestController
|
||||||
@@ -23,7 +26,8 @@ public class ClientShopUserController {
|
|||||||
private AliConfigService aliConfigService;
|
private AliConfigService aliConfigService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ShopUserService shopUserService;
|
private ShopUserService shopUserService;
|
||||||
|
@Autowired
|
||||||
|
private IShopUserService iShopUserService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取验证码
|
* 获取验证码
|
||||||
@@ -65,10 +69,77 @@ public class ClientShopUserController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("/updateUser")
|
@PostMapping("/updateUser")
|
||||||
public AjaxResult modifyUserInfo(@RequestBody ShopUser shopUser){
|
public AjaxResult modifyUserInfo(@RequestBody ShopUser shopUser){
|
||||||
|
Long userId = SecurityUtils.getUserId();
|
||||||
|
if (userId == null) {
|
||||||
|
return AjaxResult.error("用户未登录");
|
||||||
|
}
|
||||||
|
shopUser.setUserId(userId);
|
||||||
return AjaxResult.success(shopUserService.modifyUser(shopUser));
|
return AjaxResult.success(shopUserService.modifyUser(shopUser));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取个人信息
|
||||||
|
* @return 个人信息
|
||||||
|
*/
|
||||||
|
@GetMapping("/getUserInfo")
|
||||||
|
public AjaxResult getUserInfo() {
|
||||||
|
// 获取当前登录用户名
|
||||||
|
Long userId = SecurityUtils.getUserId();
|
||||||
|
if (userId == null) {
|
||||||
|
return AjaxResult.error("用户未登录");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据用户ID查询完整的用户信息
|
||||||
|
ShopUser shopUser = iShopUserService.selectShopUserByUserId(userId);
|
||||||
|
if (shopUser == null) {
|
||||||
|
return AjaxResult.error("未找到用户信息");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 出于安全考虑,清除敏感信息
|
||||||
|
shopUser.setPassword(null);
|
||||||
|
|
||||||
|
return AjaxResult.success(shopUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户ID获取个人信息
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @return 个人信息
|
||||||
|
*/
|
||||||
|
@GetMapping("/getUserInfoById/{userId}")
|
||||||
|
public AjaxResult getUserInfoById(@PathVariable("userId") Long userId) {
|
||||||
|
if (userId == null) {
|
||||||
|
return AjaxResult.error("用户ID不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据用户ID查询完整的用户信息
|
||||||
|
ShopUser shopUser = iShopUserService.selectShopUserByUserId(userId);
|
||||||
|
if (shopUser == null) {
|
||||||
|
return AjaxResult.error("未找到用户信息");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 出于安全考虑,清除敏感信息
|
||||||
|
shopUser.setPassword(null);
|
||||||
|
|
||||||
|
return AjaxResult.success(shopUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/user/file")
|
||||||
|
public AjaxResult addConfigFile(
|
||||||
|
@RequestParam("file") MultipartFile file
|
||||||
|
) throws IOException {
|
||||||
|
// 检查是否已经登录
|
||||||
|
Long userId = SecurityUtils.getUserId();
|
||||||
|
if (userId == null) {
|
||||||
|
return AjaxResult.error("用户未登录");
|
||||||
|
}
|
||||||
|
// 1. 处理文件上传
|
||||||
|
if (file != null && !file.isEmpty()) {
|
||||||
|
// 保存文件逻辑
|
||||||
|
return AjaxResult.success("请求成功", AliConfig.ossUp("user/", file.getOriginalFilename(), file.getInputStream()));
|
||||||
|
}
|
||||||
|
return AjaxResult.error("文件不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -91,4 +91,7 @@ public class ShopUser {
|
|||||||
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date vipEndTime;
|
private Date vipEndTime;
|
||||||
|
|
||||||
|
// 简介
|
||||||
|
private String descinfo;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,14 @@ public interface IShopUserService
|
|||||||
*/
|
*/
|
||||||
public ShopUser selectShopUserById(String id);
|
public ShopUser selectShopUserById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户ID查询用户信息
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @return 用户信息
|
||||||
|
*/
|
||||||
|
public ShopUser selectShopUserByUserId(Long userId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询用户管理列表
|
* 查询用户管理列表
|
||||||
*
|
*
|
||||||
@@ -77,4 +85,4 @@ public interface IShopUserService
|
|||||||
* @return 用户标签列表(以分号分隔的字符串)
|
* @return 用户标签列表(以分号分隔的字符串)
|
||||||
*/
|
*/
|
||||||
public String getUserTags(String userId);
|
public String getUserTags(String userId);
|
||||||
}
|
}
|
||||||
@@ -38,6 +38,18 @@ public class ShopUserServiceImpl implements IShopUserService
|
|||||||
return shopUserMapper.selectShopUserById(id);
|
return shopUserMapper.selectShopUserById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户ID查询用户信息
|
||||||
|
*
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @return 用户信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ShopUser selectShopUserByUserId(Long userId)
|
||||||
|
{
|
||||||
|
return shopUserMapper.selectShopUserByUserId(userId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询用户管理列表
|
* 查询用户管理列表
|
||||||
*
|
*
|
||||||
@@ -190,4 +202,4 @@ public class ShopUserServiceImpl implements IShopUserService
|
|||||||
|
|
||||||
return tags.toString();
|
return tags.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -24,6 +24,7 @@
|
|||||||
<if test="headImg != null">head_img,</if>
|
<if test="headImg != null">head_img,</if>
|
||||||
<if test="vipStartTime != null">vip_start_time,</if>
|
<if test="vipStartTime != null">vip_start_time,</if>
|
||||||
<if test="vipEndTime != null">vip_end_time,</if>
|
<if test="vipEndTime != null">vip_end_time,</if>
|
||||||
|
<if test="descinfo != null">descinfo,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="userId != null">#{userId},</if>
|
<if test="userId != null">#{userId},</if>
|
||||||
@@ -43,6 +44,7 @@
|
|||||||
<if test="headImg != null">#{headImg},</if>
|
<if test="headImg != null">#{headImg},</if>
|
||||||
<if test="vipStartTime != null">#{vipStartTime},</if>
|
<if test="vipStartTime != null">#{vipStartTime},</if>
|
||||||
<if test="vipEndTime != null">#{vipEndTime},</if>
|
<if test="vipEndTime != null">#{vipEndTime},</if>
|
||||||
|
<if test="descinfo != null">#{descinfo},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@@ -66,10 +68,11 @@
|
|||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time" />
|
||||||
<result property="updateTime" column="update_time" />
|
<result property="updateTime" column="update_time" />
|
||||||
<result property="isDel" column="is_del" />
|
<result property="isDel" column="is_del" />
|
||||||
|
<result property="descinfo" column="descinfo" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectShopUserVo">
|
<sql id="selectShopUserVo">
|
||||||
select id, user_id, username, password,device_type,device_id, phone, nickname, sex, birthday, addr, register_time, status, vip, online, create_time, update_time, is_del,head_img,vip_end_time,vip_start_time from shop_user
|
select id, user_id, `descinfo`,username, password,device_type,device_id, phone, nickname, sex, birthday, addr, register_time, status, vip, online, create_time, update_time, is_del,head_img,vip_end_time,vip_start_time from shop_user
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectShopUserList" parameterType="ShopUser" resultMap="ShopUserResult">
|
<select id="selectShopUserList" parameterType="ShopUser" resultMap="ShopUserResult">
|
||||||
@@ -90,6 +93,8 @@
|
|||||||
<if test="isDel != null "> and is_del = #{isDel}</if>
|
<if test="isDel != null "> and is_del = #{isDel}</if>
|
||||||
<if test="vipStartTime != null"> and #{vipStartTime},</if>
|
<if test="vipStartTime != null"> and #{vipStartTime},</if>
|
||||||
<if test="vipEndTime != null"> and #{vipEndTime},</if>
|
<if test="vipEndTime != null"> and #{vipEndTime},</if>
|
||||||
|
<if test="descinfo != null"> and #{descinfo},</if>
|
||||||
|
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -130,6 +135,8 @@
|
|||||||
<if test="createTime != null">create_time,</if>
|
<if test="createTime != null">create_time,</if>
|
||||||
<if test="updateTime != null">update_time,</if>
|
<if test="updateTime != null">update_time,</if>
|
||||||
<if test="isDel != null">is_del,</if>
|
<if test="isDel != null">is_del,</if>
|
||||||
|
<if test="descinfo != null">descinfo,</if>
|
||||||
|
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="userId != null">#{userId},</if>
|
<if test="userId != null">#{userId},</if>
|
||||||
@@ -147,6 +154,7 @@
|
|||||||
<if test="createTime != null">#{createTime},</if>
|
<if test="createTime != null">#{createTime},</if>
|
||||||
<if test="updateTime != null">#{updateTime},</if>
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
<if test="isDel != null">#{isDel},</if>
|
<if test="isDel != null">#{isDel},</if>
|
||||||
|
<if test="descinfo != null">#{descinfo},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@@ -170,6 +178,7 @@
|
|||||||
<if test="isDel != null">is_del = #{isDel},</if>
|
<if test="isDel != null">is_del = #{isDel},</if>
|
||||||
<if test="vipStartTime != null"> vip_start_time = #{vipStartTime},</if>
|
<if test="vipStartTime != null"> vip_start_time = #{vipStartTime},</if>
|
||||||
<if test="vipEndTime != null"> vip_end_time = #{vipEndTime},</if>
|
<if test="vipEndTime != null"> vip_end_time = #{vipEndTime},</if>
|
||||||
|
<if test="descinfo != null"> vip_end_time = #{descinfo},</if>
|
||||||
</trim>
|
</trim>
|
||||||
where shop_user.user_id = #{userId}
|
where shop_user.user_id = #{userId}
|
||||||
</update>
|
</update>
|
||||||
|
|||||||
31
ruoyi-ui/src/api/feedback/clientFeedback.js
Normal file
31
ruoyi-ui/src/api/feedback/clientFeedback.js
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提交用户反馈
|
||||||
|
* @param {Object} data 反馈数据
|
||||||
|
* @param {String} data.feedbackContent 反馈内容 (必填)
|
||||||
|
* @param {String} data.userName 用户姓名
|
||||||
|
* @param {String} data.contactType 联系方式类型 (例如: "email", "phone", "wechat")
|
||||||
|
* @param {String} data.contactInfo 联系方式信息
|
||||||
|
* @param {String} data.attachmentPath 附件路径
|
||||||
|
* @returns {Promise}
|
||||||
|
*/
|
||||||
|
export function submitFeedback(data) {
|
||||||
|
return request({
|
||||||
|
url: '/client/feedback/submit',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户反馈详情
|
||||||
|
* @param {String} id 反馈ID
|
||||||
|
* @returns {Promise}
|
||||||
|
*/
|
||||||
|
export function getFeedbackDetail(id) {
|
||||||
|
return request({
|
||||||
|
url: '/client/feedback/detail/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user