1.【修复】定时任务刷新本地缓存时,无租户上线文,导致查询报错

2. member 模块,统一使用 member 前缀
3. 修改 Spring Security logout 配置,支持多用户类型的退出
This commit is contained in:
YunaiV
2022-01-29 14:05:06 +08:00
parent 6aca4ae9fd
commit cee7e50720
18 changed files with 63 additions and 55 deletions

View File

@ -1,5 +1,5 @@
### 请求 /login 接口 => 成功
POST {{userApi}}/login
POST {{userApi}}/member/login
Content-Type: application/json
tenant-id: {{userTenentId}}
@ -9,8 +9,9 @@ tenant-id: {{userTenentId}}
}
### 请求 /send-sms-code 接口 => 成功
POST {{userServerUrl}}/send-sms-code
POST {{userApi}}/member/send-sms-code
Content-Type: application/json
tenant-id: {{userTenentId}}
{
"mobile": "15601691399",
@ -18,8 +19,9 @@ Content-Type: application/json
}
### 请求 /sms-login 接口 => 成功
POST {{userServerUrl}}/sms-login
POST {{userApi}}/member/sms-login
Content-Type: application/json
tenant-id: {{userTenentId}}
{
"mobile": "15601691301",
@ -27,6 +29,7 @@ Content-Type: application/json
}
### 请求 /logout 接口 => 成功
POST {{userServerUrl}}/logout
POST {{userApi}}/member/logout
Content-Type: application/json
Authorization: Bearer c1b76bdaf2c146c581caa4d7fd81ee66
tenant-id: {{userTenentId}}

View File

@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.member.controller.app.auth.vo.*;
import cn.iocoder.yudao.module.member.service.auth.AuthService;
import cn.iocoder.yudao.module.member.service.sms.SysSmsCodeService;
@ -13,6 +14,7 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -26,7 +28,7 @@ import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUti
@Api(tags = "APP 端 - 认证")
@RestController
@RequestMapping("/")
@RequestMapping("/member/")
@Validated
@Slf4j
public class AppAuthController {
@ -39,6 +41,9 @@ public class AppAuthController {
@Resource
private SysSocialCoreService socialService;
@Resource
private LogoutSuccessHandler logoutSuccessHandler;
@PostMapping("/login")
@ApiOperation("使用手机 + 密码登录")
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志

View File

@ -0,0 +1,2 @@
### 请求 /login 接口 => 成功
GET {{userServerUrl}}/wx/mp/get-jsapi-ticket

View File

@ -0,0 +1,37 @@
package cn.iocoder.yudao.module.member.controller.app.weixin;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.bean.WxJsapiSignature;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Api(tags = "微信公众号")
@RestController
@RequestMapping("/member/wx-mp")
@Validated
@Slf4j
public class AppWxMpController {
@Resource
private WxMpService mpService;
@PostMapping("/create-jsapi-signature")
@ApiOperation(value = "创建微信 JS SDK 初始化所需的签名",
notes = "参考 https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html 文档")
public CommonResult<WxJsapiSignature> createJsapiSignature(@RequestParam("url") String url) throws WxErrorException {
return success(mpService.createJsapiSignature(url));
}
}

View File

@ -16,7 +16,7 @@ import java.util.Date;
*
* @author 芋道源码
*/
@TableName(value = "mbr_user", autoResultMap = true)
@TableName(value = "member_user", autoResultMap = true)
@Data
@EqualsAndHashCode(callSuper = true)
@Builder

View File

@ -4,6 +4,6 @@
* 2. redisRedis 的 CRUD 操作
* 3. mysqlMySQL 的 CRUD 操作
*
* 其中MySQL 的表以 mbr_ 作为前缀
* 其中MySQL 的表以 member_ 作为前缀
*/
package cn.iocoder.yudao.module.member.dal;

View File

@ -1 +1,8 @@
/**
* member 模块,我们放会员业务。
* 例如说:会员中心等等
*
* 1. Controller URL以 /member/ 开头,避免和其它 Module 冲突
* 2. DataObject 表名:以 member_ 开头,方便在数据库中区分
*/
package cn.iocoder.yudao.module.member;

View File

@ -1,2 +1,2 @@
-- mbr 开头的 DB
DELETE FROM "mbr_user";
DELETE FROM "member_user";

View File

@ -1,5 +1,5 @@
-- mbr 开头的 DB
CREATE TABLE IF NOT EXISTS "mbr_user" (
CREATE TABLE IF NOT EXISTS "member_user" (
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '编号',
"nickname" varchar(30) NOT NULL DEFAULT '' COMMENT '用户昵称',
"avatar" varchar(255) NOT NULL DEFAULT '' COMMENT '头像',