From 424929222f9086c0940d1a731eaaa3e8f745f3e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Mon, 30 Mar 2026 11:30:29 +0800 Subject: [PATCH] =?UTF-8?q?feat(contact):=20=E6=B7=BB=E5=8A=A0=E8=81=94?= =?UTF-8?q?=E7=B3=BB=E8=A1=A8=E5=8D=95=E9=94=80=E5=94=AE=E7=BA=BF=E7=B4=A2?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增联系表单数据库表结构设计与实体类定义 - 实现联系表单提交接口,支持公开访问无需登录验证 - 添加后台管理接口,支持线索查询、状态更新和删除操作 - 集成企业微信和飞书机器人通知功能,实时推送新线索 - 在安全配置中开放联系表单提交接口访问权限 - 添加应用配置中的通知机器人Webhook配置项 --- .../gxwebsoft/app/controller/AppUserController.java | 13 ++++++++++++- .../com/gxwebsoft/app/service/AppUserService.java | 8 ++++++++ .../app/service/impl/AppUserServiceImpl.java | 5 +++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gxwebsoft/app/controller/AppUserController.java b/src/main/java/com/gxwebsoft/app/controller/AppUserController.java index 4124862..695369c 100644 --- a/src/main/java/com/gxwebsoft/app/controller/AppUserController.java +++ b/src/main/java/com/gxwebsoft/app/controller/AppUserController.java @@ -67,13 +67,24 @@ public class AppUserController extends BaseController { return fail("添加失败"); } - @Operation(summary = "邀请用户成为应用成员") + @Operation(summary = "邀请用户成为应用成员(支持用户ID或手机号)") @PostMapping("/invite") public ApiResult invite(@RequestBody AppUser appUser) { User loginUser = getLoginUser(); if (loginUser == null) { return fail("请先登录"); } + // 支持手机号邀请:若 userId 为空但传了 phone,则先按手机号查出用户 + if (appUser.getUserId() == null && appUser.getPhone() != null && !appUser.getPhone().isEmpty()) { + User targetUser = appUserService.findUserByPhone(appUser.getPhone()); + if (targetUser == null) { + return fail("手机号未注册,请确认后再试"); + } + appUser.setUserId(targetUser.getUserId()); + } + if (appUser.getUserId() == null) { + return fail("请输入用户ID或手机号"); + } try { AppUser result = appUserService.inviteUser( appUser.getWebsiteId(), diff --git a/src/main/java/com/gxwebsoft/app/service/AppUserService.java b/src/main/java/com/gxwebsoft/app/service/AppUserService.java index 6888fc2..0aa0793 100644 --- a/src/main/java/com/gxwebsoft/app/service/AppUserService.java +++ b/src/main/java/com/gxwebsoft/app/service/AppUserService.java @@ -57,4 +57,12 @@ public interface AppUserService extends IService { */ boolean isMember(Long websiteId, Integer userId); + /** + * 根据手机号查找系统用户(用于手机号邀请) + * + * @param phone 手机号 + * @return 系统用户,不存在返回 null + */ + com.gxwebsoft.common.system.entity.User findUserByPhone(String phone); + } diff --git a/src/main/java/com/gxwebsoft/app/service/impl/AppUserServiceImpl.java b/src/main/java/com/gxwebsoft/app/service/impl/AppUserServiceImpl.java index 0732a7d..9d38689 100644 --- a/src/main/java/com/gxwebsoft/app/service/impl/AppUserServiceImpl.java +++ b/src/main/java/com/gxwebsoft/app/service/impl/AppUserServiceImpl.java @@ -104,4 +104,9 @@ public class AppUserServiceImpl extends ServiceImpl impl return count > 0; } + @Override + public User findUserByPhone(String phone) { + return userService.getByPhone(phone); + } + }