tongz
This commit is contained in:
@@ -19,7 +19,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】Controller
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-08-23
|
||||
*/
|
||||
@@ -77,7 +77,7 @@ public class NotificationsController extends BaseController
|
||||
recordsService.bind(id, shopUsers);
|
||||
return AjaxResult.success("绑定用户成功");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取通知已绑定的用户列表
|
||||
*/
|
||||
@@ -86,7 +86,7 @@ public class NotificationsController extends BaseController
|
||||
List<ShopUser> list = recordsService.getBindUsers(id);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 发布通知
|
||||
*/
|
||||
@@ -95,6 +95,12 @@ public class NotificationsController extends BaseController
|
||||
public AjaxResult publish(@PathVariable("id") Long id) {
|
||||
return notificationsService.publishNotification(id);
|
||||
}
|
||||
// 发送全部
|
||||
@Log(title = "发送全部通知", businessType = BusinessType.OTHER)
|
||||
@PostMapping("/sendAll/{id}")
|
||||
public AjaxResult sendAll(@PathVariable("id") Long id) {
|
||||
return notificationsService.publishSendAll(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
|
||||
@@ -35,9 +35,9 @@ public class ClientShopUserController {
|
||||
* 获取验证码
|
||||
*/
|
||||
@PostMapping("/getCode")
|
||||
public AjaxResult getCode(@RequestBody ShopUser shopUser){
|
||||
public AjaxResult getCode(@RequestBody ShopUser shopUser) {
|
||||
String result = aliConfigService.sendMsg(shopUser);
|
||||
if (result != null){
|
||||
if (result != null) {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.error("发送验证码失败");
|
||||
@@ -49,13 +49,14 @@ public class ClientShopUserController {
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/shopLogin")
|
||||
public AjaxResult shopLogin(@RequestBody ShopUserResq userResq)
|
||||
{
|
||||
public AjaxResult shopLogin(@RequestBody ShopUserResq userResq) {
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ShopUser shopUser = shopUserService.login(userResq);
|
||||
if (shopUser == null || shopUser.getMsg() != null){
|
||||
return new AjaxResult(999,"登录失败");
|
||||
}else {
|
||||
if (shopUser == null) {
|
||||
return new AjaxResult(999, "登录失败");
|
||||
} else if (shopUser.getMsg() != null) {
|
||||
return new AjaxResult(999, shopUser.getMsg());
|
||||
} else {
|
||||
// 生成令牌
|
||||
String token = loginService.shopUserLogin(shopUser.getUsername(), shopUser.getPassword());
|
||||
ajax.put("data", shopUser);
|
||||
@@ -66,14 +67,15 @@ public class ClientShopUserController {
|
||||
|
||||
/**
|
||||
* 修改个人信息
|
||||
*
|
||||
* @param shopUser 个人信息
|
||||
* @return 成功
|
||||
*/
|
||||
@PostMapping("/updateUser")
|
||||
public AjaxResult modifyUserInfo(@RequestBody ShopUser shopUser){
|
||||
public AjaxResult modifyUserInfo(@RequestBody ShopUser shopUser) {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
if (userId == null) {
|
||||
return AjaxResult.error(401,"用户未登录");
|
||||
return AjaxResult.error(401, "用户未登录");
|
||||
}
|
||||
shopUser.setUserId(userId);
|
||||
return AjaxResult.success(shopUserService.modifyUser(shopUser));
|
||||
@@ -81,6 +83,7 @@ public class ClientShopUserController {
|
||||
|
||||
/**
|
||||
* 获取个人信息
|
||||
*
|
||||
* @return 个人信息
|
||||
*/
|
||||
@GetMapping("/getUserInfo")
|
||||
@@ -88,23 +91,24 @@ public class ClientShopUserController {
|
||||
// 获取当前登录用户名
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
if (userId == null) {
|
||||
return AjaxResult.error(401,"用户未登录");
|
||||
return AjaxResult.error(401, "用户未登录");
|
||||
}
|
||||
|
||||
|
||||
// 根据用户ID查询完整的用户信息
|
||||
ShopUser shopUser = iShopUserService.selectShopUserByUserId(userId);
|
||||
if (shopUser == null) {
|
||||
return AjaxResult.error("未找到用户信息");
|
||||
}
|
||||
|
||||
|
||||
// 出于安全考虑,清除敏感信息
|
||||
shopUser.setPassword(null);
|
||||
|
||||
|
||||
return AjaxResult.success(shopUser);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据用户ID获取个人信息
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 个人信息
|
||||
*/
|
||||
@@ -113,20 +117,19 @@ public class ClientShopUserController {
|
||||
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
|
||||
@@ -134,17 +137,17 @@ public class ClientShopUserController {
|
||||
// 检查是否已经登录
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
if (userId == null) {
|
||||
return AjaxResult.error(401,"用户未登录");
|
||||
return AjaxResult.error(401, "用户未登录");
|
||||
}
|
||||
// 1. 处理文件上传
|
||||
if (file != null && !file.isEmpty()) {
|
||||
// 保存文件逻辑
|
||||
String url = AliConfig.ossUp("user/", file.getOriginalFilename(), file.getInputStream());
|
||||
Map<String,Object> head = new HashMap<>();
|
||||
head.put("headImg",url);
|
||||
Map<String, Object> head = new HashMap<>();
|
||||
head.put("headImg", url);
|
||||
return AjaxResult.success("请求成功", head);
|
||||
}
|
||||
return AjaxResult.error("文件不能为空");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user