|
@@ -0,0 +1,68 @@
|
|
|
+package com.citu.module.menduner.reward.controller.app.member;
|
|
|
+
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import com.citu.framework.common.pojo.CommonResult;
|
|
|
+import com.citu.framework.security.core.util.SecurityFrameworkUtils;
|
|
|
+import com.citu.module.menduner.reward.controller.base.auth.vo.AppAuthLoginReqVO;
|
|
|
+import com.citu.module.menduner.reward.controller.base.auth.vo.AppAuthLoginRespVO;
|
|
|
+import com.citu.module.menduner.reward.controller.base.auth.vo.AppAuthSmsLoginReqVO;
|
|
|
+import com.citu.module.menduner.reward.service.auth.MendunerMemberAuthService;
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import javax.annotation.security.PermitAll;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.validation.Valid;
|
|
|
+
|
|
|
+import static com.citu.framework.common.pojo.CommonResult.success;
|
|
|
+
|
|
|
+@Tag(name = "用户 APP - 认证")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/member/auth")
|
|
|
+@Validated
|
|
|
+@Slf4j
|
|
|
+public class AuthController {
|
|
|
+
|
|
|
+
|
|
|
+ private MendunerMemberAuthService authService;
|
|
|
+
|
|
|
+ // ========== 短信登录相关 ==========
|
|
|
+
|
|
|
+ @PostMapping("/sms-login")
|
|
|
+ @Operation(summary = "使用手机 + 验证码登录")
|
|
|
+ public CommonResult<AppAuthLoginRespVO> smsLogin(@RequestBody @Valid AppAuthSmsLoginReqVO reqVO) {
|
|
|
+ return success(authService.smsLogin(reqVO));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/login")
|
|
|
+ @Operation(summary = "使用手机 + 密码登录")
|
|
|
+ public CommonResult<AppAuthLoginRespVO> login(@RequestBody @Valid AppAuthLoginReqVO reqVO) {
|
|
|
+ return success(authService.login(reqVO));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+// @PostMapping("/logout")
|
|
|
+// @PermitAll
|
|
|
+// @Operation(summary = "登出系统")
|
|
|
+// public CommonResult<Boolean> logout(HttpServletRequest request) {
|
|
|
+// String token = SecurityFrameworkUtils.obtainAuthorization(request,
|
|
|
+// securityProperties.getTokenHeader(), securityProperties.getTokenParameter());
|
|
|
+// if (StrUtil.isNotBlank(token)) {
|
|
|
+// authService.logout(token);
|
|
|
+// }
|
|
|
+// return success(true);
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ public void setAuthService(MendunerMemberAuthService authService) {
|
|
|
+ this.authService = authService;
|
|
|
+ }
|
|
|
+}
|