diff --git a/iot-dao/iot-data-model/src/main/java/cc/iotkit/model/wx/XcxLoginBody.java b/iot-module/iot-system/src/main/java/cc/iotkit/system/dto/bo/XcxLoginBo.java similarity index 85% rename from iot-dao/iot-data-model/src/main/java/cc/iotkit/model/wx/XcxLoginBody.java rename to iot-module/iot-system/src/main/java/cc/iotkit/system/dto/bo/XcxLoginBo.java index 79481bd8..04a7ca60 100644 --- a/iot-dao/iot-data-model/src/main/java/cc/iotkit/model/wx/XcxLoginBody.java +++ b/iot-module/iot-system/src/main/java/cc/iotkit/system/dto/bo/XcxLoginBo.java @@ -1,4 +1,4 @@ -package cc.iotkit.model.wx; +package cc.iotkit.system.dto.bo; import jakarta.validation.constraints.NotBlank; import lombok.Data; @@ -10,7 +10,7 @@ import lombok.Data; */ @Data -public class XcxLoginBody { +public class XcxLoginBo { /** * appId diff --git a/iot-dao/iot-data-model/src/main/java/cc/iotkit/model/wx/XcxLoginUser.java b/iot-module/iot-system/src/main/java/cc/iotkit/system/dto/bo/XcxLoginUserBo.java similarity index 82% rename from iot-dao/iot-data-model/src/main/java/cc/iotkit/model/wx/XcxLoginUser.java rename to iot-module/iot-system/src/main/java/cc/iotkit/system/dto/bo/XcxLoginUserBo.java index 6b8d0bcd..42cae49e 100644 --- a/iot-dao/iot-data-model/src/main/java/cc/iotkit/model/wx/XcxLoginUser.java +++ b/iot-module/iot-system/src/main/java/cc/iotkit/system/dto/bo/XcxLoginUserBo.java @@ -1,4 +1,4 @@ -package cc.iotkit.model.wx; +package cc.iotkit.system.dto.bo; import cc.iotkit.common.model.LoginUser; import lombok.Data; @@ -14,7 +14,7 @@ import lombok.NoArgsConstructor; @Data @EqualsAndHashCode(callSuper = true) @NoArgsConstructor -public class XcxLoginUser extends LoginUser { +public class XcxLoginUserBo extends LoginUser { private static final long serialVersionUID = 1L; diff --git a/iot-starter/src/main/java/cc/iotkit/web/controller/AuthController.java b/iot-starter/src/main/java/cc/iotkit/web/controller/AuthController.java index 260f7d72..f1af21c9 100644 --- a/iot-starter/src/main/java/cc/iotkit/web/controller/AuthController.java +++ b/iot-starter/src/main/java/cc/iotkit/web/controller/AuthController.java @@ -7,6 +7,7 @@ import cc.iotkit.common.utils.StringUtils; import cc.iotkit.system.dto.LoginBody; import cc.iotkit.system.dto.RegisterBody; import cc.iotkit.system.dto.bo.SysTenantBo; +import cc.iotkit.system.dto.bo.XcxLoginBo; import cc.iotkit.system.dto.vo.SysTenantVo; import cc.iotkit.system.service.ISysConfigService; import cc.iotkit.system.service.ISysTenantService; @@ -59,7 +60,7 @@ public class AuthController { @ApiOperation("登录") @PostMapping("/login") public LoginVo login(@Validated @RequestBody Request body) { - LoginBody loginBody=body.getData(); + LoginBody loginBody = body.getData(); LoginVo loginVo = new LoginVo(); // 生成令牌 String token = loginService.login( @@ -73,15 +74,16 @@ public class AuthController { /** * 小程序登录(示例) * - * @param xcxCode 小程序code + * @param body 小程序appid,code * @return 结果 */ @ApiOperation("小程序登录") @PostMapping("/xcxLogin") - public LoginVo xcxLogin(@NotBlank(message = "{xcx.appId.not.blank}") String appId,@NotBlank(message = "{xcx.code.not.blank}") String xcxCode) { + public LoginVo xcxLogin(@Validated @RequestBody Request body) { LoginVo loginVo = new LoginVo(); + XcxLoginBo data = body.getData(); // 生成令牌 - String token = loginService.xcxLogin(appId,xcxCode); + String token = loginService.xcxLogin(data.getAppId(), data.getCode()); loginVo.setToken(token); return loginVo; } diff --git a/iot-starter/src/main/java/cc/iotkit/web/service/SysLoginService.java b/iot-starter/src/main/java/cc/iotkit/web/service/SysLoginService.java index 9e8b1a69..63e2faf8 100644 --- a/iot-starter/src/main/java/cc/iotkit/web/service/SysLoginService.java +++ b/iot-starter/src/main/java/cc/iotkit/web/service/SysLoginService.java @@ -25,7 +25,7 @@ import cc.iotkit.model.UserInfo; import cc.iotkit.model.space.Home; import cc.iotkit.model.space.Space; import cc.iotkit.model.system.SysUser; -import cc.iotkit.model.wx.XcxLoginUser; +import cc.iotkit.system.dto.bo.XcxLoginUserBo; import cc.iotkit.system.dto.vo.SysAppVo; import cc.iotkit.system.dto.vo.SysTenantVo; import cc.iotkit.system.dto.vo.SysUserVo; @@ -163,7 +163,7 @@ public class SysLoginService { // checkTenant(user.getTenantId()); // 此处可根据登录用户的数据不同 自行创建 loginUser - XcxLoginUser loginUser = new XcxLoginUser(); + XcxLoginUserBo loginUser = new XcxLoginUserBo(); loginUser.setUserId(user.getId()); loginUser.setUsername(user.getNickName()); loginUser.setUserType(UserType.APP_USER.getUserType());