From 749aa3a368c3c6b23671f715fa6c17cf0d4db932 Mon Sep 17 00:00:00 2001
From: zhangshengli <1810377322@163.com>
Date: Thu, 11 Jul 2024 14:11:33 +0800
Subject: [PATCH 01/11] =?UTF-8?q?=E4=BA=BA=E4=BA=BA=E5=88=86=E9=94=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../brokerage/BrokerageUserServiceImpl.java | 33 ++++++++++---------
.../yudao-module-member-biz/pom.xml | 6 ++++
.../vo/AppAuthWeixinMiniAppLoginReqVO.java | 5 +++
.../service/auth/MemberAuthServiceImpl.java | 12 +++++++
.../yudao-module-system-biz/pom.xml | 6 ++++
.../service/social/SocialUserServiceImpl.java | 5 +++
6 files changed, 52 insertions(+), 15 deletions(-)
diff --git a/ruoyi-vue-pro-master/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserServiceImpl.java b/ruoyi-vue-pro-master/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserServiceImpl.java
index ff958a8..c6b77de 100644
--- a/ruoyi-vue-pro-master/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserServiceImpl.java
+++ b/ruoyi-vue-pro-master/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserServiceImpl.java
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.BooleanUtil;
+import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils;
@@ -91,7 +92,7 @@ public class BrokerageUserServiceImpl implements BrokerageUserService {
}
// 情况二:修改推广员
- validateCanBindUser(brokerageUser, bindUserId);
+ //validateCanBindUser(brokerageUser, bindUserId);
brokerageUserMapper.updateById(fillBindUserData(bindUserId, new BrokerageUserDO().setId(id)));
}
@@ -296,27 +297,29 @@ public class BrokerageUserServiceImpl implements BrokerageUserService {
private void validateCanBindUser(BrokerageUserDO user, Long bindUserId) {
// 校验要绑定的用户有无推广资格
BrokerageUserDO bindUser = brokerageUserMapper.selectById(bindUserId);
- if (bindUser == null || BooleanUtil.isFalse(bindUser.getBrokerageEnabled())) {
+ /*if (bindUser == null || BooleanUtil.isFalse(bindUser.getBrokerageEnabled())) {
throw exception(BROKERAGE_BIND_USER_NOT_ENABLED);
- }
+ }*/
// 校验绑定自己
- if (Objects.equals(user.getId(), bindUserId)) {
+ /* if (Objects.equals(user.getId(), bindUserId)) {
throw exception(BROKERAGE_BIND_SELF);
+ }*/
+if(ObjectUtil.isNotEmpty(bindUser)){
+ // 下级不能绑定自己的上级
+ for (int i = 0; i <= Short.MAX_VALUE; i++) {
+ if (Objects.equals(bindUser.getBindUserId(), user.getId())) {
+ throw exception(BROKERAGE_BIND_LOOP);
}
-
- // 下级不能绑定自己的上级
- for (int i = 0; i <= Short.MAX_VALUE; i++) {
- if (Objects.equals(bindUser.getBindUserId(), user.getId())) {
- throw exception(BROKERAGE_BIND_LOOP);
- }
- bindUser = getBrokerageUser(bindUser.getBindUserId());
- // 找到根节点,结束循环
- if (bindUser == null || bindUser.getBindUserId() == null) {
- break;
- }
+ bindUser = getBrokerageUser(bindUser.getBindUserId());
+ // 找到根节点,结束循环
+ if (bindUser == null || bindUser.getBindUserId() == null) {
+ break;
}
}
+}
+
+ }
/**
* 根据绑定用户编号,获得下级用户编号列表
diff --git a/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/pom.xml b/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/pom.xml
index 3c9b81e..1a38c75 100644
--- a/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/pom.xml
+++ b/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/pom.xml
@@ -85,6 +85,12 @@
cn.iocoder.boot
yudao-spring-boot-starter-biz-ip
+
+ cn.iocoder.boot
+ yudao-module-trade-biz
+ 2.1.0-jdk8-snapshot
+ compile
+
diff --git a/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/auth/vo/AppAuthWeixinMiniAppLoginReqVO.java b/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/auth/vo/AppAuthWeixinMiniAppLoginReqVO.java
index b14f182..5c14883 100644
--- a/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/auth/vo/AppAuthWeixinMiniAppLoginReqVO.java
+++ b/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/auth/vo/AppAuthWeixinMiniAppLoginReqVO.java
@@ -27,4 +27,9 @@ public class AppAuthWeixinMiniAppLoginReqVO {
@NotEmpty(message = "state 不能为空")
private String state;
+
+
+ @Schema(description = "bindUserId")
+ private Long bindUserId;
+
}
diff --git a/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/auth/MemberAuthServiceImpl.java b/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/auth/MemberAuthServiceImpl.java
index e1a8ec5..0e6fb58 100644
--- a/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/auth/MemberAuthServiceImpl.java
+++ b/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/auth/MemberAuthServiceImpl.java
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.member.service.auth;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.enums.TerminalEnum;
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
@@ -27,6 +28,7 @@ import cn.iocoder.yudao.module.system.enums.logger.LoginResultEnum;
import cn.iocoder.yudao.module.system.enums.oauth2.OAuth2ClientConstants;
import cn.iocoder.yudao.module.system.enums.sms.SmsSceneEnum;
import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum;
+import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -61,6 +63,9 @@ public class MemberAuthServiceImpl implements MemberAuthService {
@Resource
private OAuth2TokenApi oauth2TokenApi;
+ @Resource
+ private BrokerageUserService brokerageUserService;
+
@Override
public AppAuthLoginRespVO login(AppAuthLoginReqVO reqVO) {
// 使用手机 + 密码,进行登录。
@@ -149,6 +154,13 @@ public class MemberAuthServiceImpl implements MemberAuthService {
String openid = socialUserApi.bindSocialUser(new SocialUserBindReqDTO(user.getId(), getUserType().getValue(),
SocialTypeEnum.WECHAT_MINI_APP.getType(), reqVO.getLoginCode(), reqVO.getState()));
+ if( ObjectUtil.isNotEmpty(reqVO.getBindUserId())){
+ brokerageUserService.bindBrokerageUser(user.getId(), reqVO.getBindUserId());
+
+ }else {
+ brokerageUserService.bindBrokerageUser(user.getId(), 0L);
+ }
+ //绑定分销用户
// 创建 Token 令牌,记录登录日志
return createTokenAfterLoginSuccess(user, user.getMobile(), LoginLogTypeEnum.LOGIN_SOCIAL, openid);
}
diff --git a/ruoyi-vue-pro-master/yudao-module-system/yudao-module-system-biz/pom.xml b/ruoyi-vue-pro-master/yudao-module-system/yudao-module-system-biz/pom.xml
index 6de1a58..0b87984 100644
--- a/ruoyi-vue-pro-master/yudao-module-system/yudao-module-system-biz/pom.xml
+++ b/ruoyi-vue-pro-master/yudao-module-system/yudao-module-system-biz/pom.xml
@@ -127,6 +127,12 @@
com.xingyuv
spring-boot-starter-captcha-plus
+
+ cn.iocoder.boot
+ yudao-module-trade-biz
+ 2.1.0-jdk8-snapshot
+ compile
+
diff --git a/ruoyi-vue-pro-master/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialUserServiceImpl.java b/ruoyi-vue-pro-master/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialUserServiceImpl.java
index 7458d9c..d95254b 100644
--- a/ruoyi-vue-pro-master/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialUserServiceImpl.java
+++ b/ruoyi-vue-pro-master/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialUserServiceImpl.java
@@ -12,6 +12,7 @@ import cn.iocoder.yudao.module.system.dal.dataobject.social.SocialUserDO;
import cn.iocoder.yudao.module.system.dal.mysql.social.SocialUserBindMapper;
import cn.iocoder.yudao.module.system.dal.mysql.social.SocialUserMapper;
import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum;
+import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageUserService;
import com.xingyuv.jushauth.model.AuthUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -46,6 +47,8 @@ public class SocialUserServiceImpl implements SocialUserService {
@Resource
private SocialClientService socialClientService;
+
+
@Override
public List getSocialUserList(Long userId, Integer userType) {
// 获得绑定
@@ -77,6 +80,8 @@ public class SocialUserServiceImpl implements SocialUserService {
.userId(reqDTO.getUserId()).userType(reqDTO.getUserType())
.socialUserId(socialUser.getId()).socialType(socialUser.getType()).build();
socialUserBindMapper.insert(socialUserBind);
+ //创建绑定用户
+
return socialUser.getOpenid();
}
From ab29031188fa9a230ed913220895e09278303f05 Mon Sep 17 00:00:00 2001
From: zhangshengli <1810377322@163.com>
Date: Thu, 11 Jul 2024 14:29:01 +0800
Subject: [PATCH 02/11] =?UTF-8?q?=E7=94=9F=E6=88=90=E4=BA=8C=E7=BB=B4?=
=?UTF-8?q?=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../common/util/qccode/QRCodeUtil.java | 150 ++++++++++++++++++
.../common/util/qccode/vo/QRCodeConfig.java | 32 ++++
.../app/file/AppFileController.java | 38 +++++
3 files changed, 220 insertions(+)
create mode 100644 ruoyi-vue-pro-master/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/qccode/QRCodeUtil.java
create mode 100644 ruoyi-vue-pro-master/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/qccode/vo/QRCodeConfig.java
diff --git a/ruoyi-vue-pro-master/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/qccode/QRCodeUtil.java b/ruoyi-vue-pro-master/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/qccode/QRCodeUtil.java
new file mode 100644
index 0000000..b5960a0
--- /dev/null
+++ b/ruoyi-vue-pro-master/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/qccode/QRCodeUtil.java
@@ -0,0 +1,150 @@
+package cn.iocoder.yudao.framework.common.util.qccode;
+
+import cn.hutool.core.util.StrUtil;
+import com.google.zxing.client.j2se.BufferedImageLuminanceSource;
+import com.google.zxing.common.BitMatrix;
+import com.google.zxing.common.HybridBinarizer;
+import com.google.zxing.qrcode.QRCodeReader;
+import com.google.zxing.qrcode.QRCodeWriter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.yaml.snakeyaml.reader.ReaderException;
+
+import javax.imageio.ImageIO;
+import java.awt.*;
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+
+/**
+ * 二维码生成工具类
+ *
+ * Created by FSQ
+ * CopyRight https://www.huamar.com
+ */
+public class QRCodeUtil {
+ public static final Logger logger = LoggerFactory.getLogger(QRCodeUtil.class);
+
+ /**
+ * 生成包含字符串信息的二维码图片
+ *
+ * @param outputStream 文件输出流路径
+ * @param content 二维码携带信息
+ * @param width 宽度
+ * @param height 高度
+ * @param imageFormat 二维码的格式
+ * @param resource 原图
+ */
+ public static boolean createQrCode(OutputStream outputStream, String content, int width, int height, String imageFormat, String resource) {
+ //设置二维码纠错级别
+ HashMap hints = new HashMap();
+ hints.put(EncodeHintType.CHARACTER_SET, "utf-8");
+ /* width = width ;
+ height = height ;*/
+ try {
+ //创建比特矩阵(位矩阵)的QR码编码的字符串
+ QRCodeWriter qrCodeWriter = new QRCodeWriter();
+ BitMatrix byteMatrix = qrCodeWriter.encode(content, BarcodeFormat.QR_CODE, width, height, hints);
+
+ // 使BufferedImage勾画QRCode (matrixWidth 是行二维码像素点)
+ int matrixWidth = byteMatrix.getWidth();
+ BufferedImage image = new BufferedImage(matrixWidth - 200, matrixWidth - 200, BufferedImage.TYPE_INT_RGB);
+
+ // 使用比特矩阵画并保存图像
+ image.createGraphics();
+ Graphics2D graphics = (Graphics2D) image.getGraphics();
+ graphics.setColor(Color.WHITE);
+ graphics.fillRect(0, 0, matrixWidth, matrixWidth);
+ graphics.setColor(Color.BLACK);
+ for (int i = 0; i < matrixWidth; i++) {
+ for (int j = 0; j < matrixWidth; j++) {
+ if (byteMatrix.get(i, j)) {
+ graphics.fillRect(i - 100, j - 100, 1, 1);
+ }
+ }
+ }
+
+ if (StrUtil.isNotEmpty(resource)) {
+ BufferedImage big = getRemoteBufferedImage(resource);
+
+ BufferedImage small = image;
+ Graphics2D g = big.createGraphics();
+
+ // 二维码坐标(默认在右上角)
+ int x = big.getWidth() - small.getWidth() - 2;
+ int y = 2;
+
+ g.drawImage(small, x, y, small.getWidth(), small.getHeight(), null);
+ g.dispose();
+
+ return ImageIO.write(big, imageFormat, outputStream);
+ } else {
+ return ImageIO.write(image, imageFormat, outputStream);
+ }
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ }
+ return false;
+ }
+
+ /**
+ * 读二维码并输出携带的信息
+ */
+ public static void readQrCode(InputStream inputStream) throws IOException {
+ //设置二维码纠错级别
+ HashMap hints = new HashMap();
+ hints.put(DecodeHintType.CHARACTER_SET, "utf-8");
+ //从输入流中获取字符串信息
+ BufferedImage image = ImageIO.read(inputStream);
+ //将图像转换为二进制位图源
+ LuminanceSource source = new BufferedImageLuminanceSource(image);
+ BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
+ QRCodeReader reader = new QRCodeReader();
+ Result result = null;
+ try {
+ result = reader.decode(bitmap, hints);
+ } catch (ReaderException e) {
+ logger.error(e.getMessage(), e);
+ }
+ logger.info(result.getText());
+ }
+
+ /**
+ * 获取远程网络图片信息
+ * @param imageURL
+ * @return
+ */
+ public static BufferedImage getRemoteBufferedImage(String imageURL) {
+ URL url;
+ InputStream is = null;
+ BufferedImage bufferedImage = null;
+ try {
+ url = new URL(imageURL);
+ is = url.openStream();
+ bufferedImage = ImageIO.read(is);
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ System.out.println("imageURL: " + imageURL + ",无效!");
+ return null;
+ } catch (IOException e) {
+ e.printStackTrace();
+ System.out.println("imageURL: " + imageURL + ",读取失败!");
+ return null;
+ } finally {
+ try {
+ if (is!=null) {
+ is.close();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ System.out.println("imageURL: " + imageURL + ",流关闭异常!");
+ return null;
+ }
+ }
+ return bufferedImage;
+ }
+}
diff --git a/ruoyi-vue-pro-master/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/qccode/vo/QRCodeConfig.java b/ruoyi-vue-pro-master/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/qccode/vo/QRCodeConfig.java
new file mode 100644
index 0000000..32a2337
--- /dev/null
+++ b/ruoyi-vue-pro-master/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/qccode/vo/QRCodeConfig.java
@@ -0,0 +1,32 @@
+package cn.iocoder.yudao.framework.common.util.qccode.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+
+@Schema(description = "QRCodeConfig 二维码 vo")
+@Data
+@EqualsAndHashCode(callSuper = false)
+@ToString(callSuper = true)
+public class QRCodeConfig {
+ // 二维码内容
+ @Schema(description = "二维码内容", requiredMode = Schema.RequiredMode.REQUIRED,defaultValue = "我是二维码的内容")
+ private String content;
+
+ // 二维码的宽度
+ @Schema(description = "二维码的宽度", requiredMode = Schema.RequiredMode.REQUIRED,defaultValue = "800")
+ private int width;
+
+ // 二维码的高度
+ @Schema(description = "二维码的高度", requiredMode = Schema.RequiredMode.REQUIRED,defaultValue = "800")
+ private int height;
+
+ // 二维码的图片格式,如"png", "jpg"等
+ @Schema(description = "二维码的高度", requiredMode = Schema.RequiredMode.REQUIRED,defaultValue = "png")
+ private String imageFormat;
+
+ // 附加资源或相关信息(具体含义根据项目需求定义)
+ /*private String resource;*/
+}
diff --git a/ruoyi-vue-pro-master/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/app/file/AppFileController.java b/ruoyi-vue-pro-master/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/app/file/AppFileController.java
index 62755fc..edc857c 100644
--- a/ruoyi-vue-pro-master/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/app/file/AppFileController.java
+++ b/ruoyi-vue-pro-master/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/app/file/AppFileController.java
@@ -1,19 +1,27 @@
package cn.iocoder.yudao.module.infra.controller.app.file;
+import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.IoUtil;
+import cn.hutool.core.lang.UUID;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.framework.common.util.qccode.QRCodeUtil;
+import cn.iocoder.yudao.framework.common.util.qccode.vo.QRCodeConfig;
import cn.iocoder.yudao.module.infra.controller.app.file.vo.AppFileUploadReqVO;
import cn.iocoder.yudao.module.infra.service.file.FileService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
+import javax.validation.Valid;
+
+import java.io.*;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@@ -35,4 +43,34 @@ public class AppFileController {
return success(fileService.createFile(file.getOriginalFilename(), path, IoUtil.readBytes(file.getInputStream())));
}
+ @GetMapping("/qrCode")
+ @Operation(summary = "生成二维码")
+ public CommonResult qrCode(@Valid QRCodeConfig qrCodeConfig) {
+ try {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ // 假设QRCodeUtil.createQrCode是一个正确实现的方法,用于生成二维码并写入到ByteArrayOutputStream中
+ QRCodeUtil.createQrCode(out, qrCodeConfig.getContent(), qrCodeConfig.getWidth(), qrCodeConfig.getHeight(), qrCodeConfig.getImageFormat(), ""); // 使用PNG格式,不是JPG
+ // 创建文件,使用PNG扩展名,因为QR码是以PNG格式生成的
+ File file = FileUtil.file(UUID.fastUUID()+"."+qrCodeConfig.getImageFormat()); // 注意文件扩展名应为.png
+ byte[] imageBytes = out.toByteArray();
+ // 使用 FileOutputStream 将字节数组写入本地文件
+ try (FileOutputStream fos = new FileOutputStream(file)) {
+ fos.write(imageBytes);
+ }
+ // 输出文件名和位置
+ //System.out.println("文件名: " + file.getName());
+ //System.out.println("文件位置: " + file.getAbsolutePath());
+ // 假设fileService.createFile是一个正确实现的方法,用于在您的服务中创建文件记录
+ // 读取文件内容并传递给createFile方法
+ byte[] fileContent = IoUtil.readBytes(new FileInputStream(file)); // 使用FileInputStream读取文件内容
+ String url = fileService.createFile(file.getName(), UUID.fastUUID()+"."+qrCodeConfig.getImageFormat(), fileContent);
+ out.close(); // 关闭ByteArrayOutputStream,虽然在这个上下文中它会在方法结束时自动关闭
+ return success(url);
+ } catch (IOException e) {
+ e.printStackTrace(); // 适当的错误处理应该替换这一行,例如记录日志或向用户显示错误消息
+ }
+
+ return success("");
+ }
+
}
From 4d9091a857386acaa494d44f4f4f684a7f11db2b Mon Sep 17 00:00:00 2001
From: zhangshengli <1810377322@163.com>
Date: Fri, 12 Jul 2024 08:36:14 +0800
Subject: [PATCH 03/11] =?UTF-8?q?=E7=94=9F=E6=88=90=E4=BA=8C=E7=BB=B4?=
=?UTF-8?q?=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../yudao-framework/yudao-common/pom.xml | 20 ++++
.../common/util/qccode/Base64Util.java | 107 ++++++++++++++++++
.../common/util/qccode/QRCodeUtil.java | 10 +-
.../common/util/qccode/vo/QRCodeConfig.java | 14 +--
.../yudao-module-infra-biz/pom.xml | 6 +
.../app/file/AppFileController.java | 53 ++++++++-
.../brokerage/BrokerageUserServiceImpl.java | 2 +-
.../service/auth/MemberAuthServiceImpl.java | 52 ++++-----
8 files changed, 227 insertions(+), 37 deletions(-)
create mode 100644 ruoyi-vue-pro-master/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/qccode/Base64Util.java
diff --git a/ruoyi-vue-pro-master/yudao-framework/yudao-common/pom.xml b/ruoyi-vue-pro-master/yudao-framework/yudao-common/pom.xml
index f364df7..cb960d5 100644
--- a/ruoyi-vue-pro-master/yudao-framework/yudao-common/pom.xml
+++ b/ruoyi-vue-pro-master/yudao-framework/yudao-common/pom.xml
@@ -144,6 +144,26 @@
spring-boot-starter-test
test
+
+
+
+ com.google.zxing
+
+ core
+
+ 3.4.1
+
+
+
+
+
+ com.google.zxing
+
+ javase
+
+ 3.4.1
+
+
diff --git a/ruoyi-vue-pro-master/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/qccode/Base64Util.java b/ruoyi-vue-pro-master/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/qccode/Base64Util.java
new file mode 100644
index 0000000..f4eaab2
--- /dev/null
+++ b/ruoyi-vue-pro-master/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/qccode/Base64Util.java
@@ -0,0 +1,107 @@
+package cn.iocoder.yudao.framework.common.util.qccode;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.UnsupportedEncodingException;
+import java.util.Base64;
+
+/**
+ * 编码工具
+ *
+ * Created by FSQ
+ * CopyRight https://www.huamar.com
+ */
+public class Base64Util {
+
+ private static final Logger logger = LoggerFactory.getLogger(Base64Util.class);
+
+ public Base64Util() {
+ // empty
+ }
+
+ public static byte[] baseEncode(byte[] bytes) {
+ return Base64.getEncoder().encode(bytes);
+ }
+
+ public static String baseEncode(String s) {
+ try {
+ byte[] e = s.getBytes("UTF-8");
+ return Base64.getEncoder().encodeToString(e);
+ } catch (UnsupportedEncodingException var2) {
+ logger.error(var2.getMessage(), var2);
+ return null;
+ }
+ }
+
+ public static byte[] baseDecode(byte[] bytes) {
+ return Base64.getDecoder().decode(bytes);
+ }
+
+ public static String baseDecode(String s) {
+ try {
+ byte[] e = Base64.getDecoder().decode(s);
+ return new String(e, "UTF-8");
+ } catch (UnsupportedEncodingException var2) {
+ logger.error(var2.getMessage(), var2);
+ return null;
+ }
+ }
+
+ public static byte[] urlEncode(byte[] bytes) {
+ return Base64.getUrlEncoder().encode(bytes);
+ }
+
+ public static String urlEncode(String s) {
+ try {
+ byte[] e = s.getBytes("UTF-8");
+ return Base64.getUrlEncoder().encodeToString(e);
+ } catch (UnsupportedEncodingException var2) {
+ logger.error(var2.getMessage(), var2);
+ return null;
+ }
+ }
+
+ public static byte[] urlDecode(byte[] bytes) {
+ return Base64.getUrlDecoder().decode(bytes);
+ }
+
+ public static String urlDecode(String s) {
+ byte[] result = Base64.getUrlDecoder().decode(s);
+
+ try {
+ return new String(result, "UTF-8");
+ } catch (UnsupportedEncodingException var3) {
+ logger.error(var3.getMessage(), var3);
+ return null;
+ }
+ }
+
+ public static byte[] mimeEncode(byte[] bytes) {
+ return Base64.getMimeEncoder().encode(bytes);
+ }
+
+ public static String mimeEncode(String s) {
+ try {
+ byte[] e = s.getBytes("UTF-8");
+ return Base64.getMimeEncoder().encodeToString(e);
+ } catch (UnsupportedEncodingException var2) {
+ logger.error(var2.getMessage(), var2);
+ return null;
+ }
+ }
+
+ public static byte[] mimeDecode(byte[] bytes) {
+ return Base64.getMimeDecoder().decode(bytes);
+ }
+
+ public static String mimeDecode(String s) {
+ try {
+ byte[] e = Base64.getMimeDecoder().decode(s);
+ return new String(e, "UTF-8");
+ } catch (UnsupportedEncodingException var2) {
+ logger.error(var2.getMessage(), var2);
+ return null;
+ }
+ }
+}
diff --git a/ruoyi-vue-pro-master/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/qccode/QRCodeUtil.java b/ruoyi-vue-pro-master/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/qccode/QRCodeUtil.java
index b5960a0..d3d6b0a 100644
--- a/ruoyi-vue-pro-master/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/qccode/QRCodeUtil.java
+++ b/ruoyi-vue-pro-master/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/qccode/QRCodeUtil.java
@@ -1,7 +1,9 @@
package cn.iocoder.yudao.framework.common.util.qccode;
import cn.hutool.core.util.StrUtil;
-import com.google.zxing.client.j2se.BufferedImageLuminanceSource;
+import cn.hutool.extra.qrcode.BufferedImageLuminanceSource;
+import com.google.zxing.*;
+
import com.google.zxing.common.BitMatrix;
import com.google.zxing.common.HybridBinarizer;
import com.google.zxing.qrcode.QRCodeReader;
@@ -109,6 +111,12 @@ public class QRCodeUtil {
result = reader.decode(bitmap, hints);
} catch (ReaderException e) {
logger.error(e.getMessage(), e);
+ } catch (ChecksumException e) {
+ throw new RuntimeException(e);
+ } catch (NotFoundException e) {
+ throw new RuntimeException(e);
+ } catch (FormatException e) {
+ throw new RuntimeException(e);
}
logger.info(result.getText());
}
diff --git a/ruoyi-vue-pro-master/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/qccode/vo/QRCodeConfig.java b/ruoyi-vue-pro-master/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/qccode/vo/QRCodeConfig.java
index 32a2337..b6d59d7 100644
--- a/ruoyi-vue-pro-master/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/qccode/vo/QRCodeConfig.java
+++ b/ruoyi-vue-pro-master/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/qccode/vo/QRCodeConfig.java
@@ -12,20 +12,20 @@ import lombok.ToString;
@ToString(callSuper = true)
public class QRCodeConfig {
// 二维码内容
- @Schema(description = "二维码内容", requiredMode = Schema.RequiredMode.REQUIRED,defaultValue = "我是二维码的内容")
+ @Schema(description = "二维码内容",defaultValue = "我是二维码的内容")
private String content;
// 二维码的宽度
- @Schema(description = "二维码的宽度", requiredMode = Schema.RequiredMode.REQUIRED,defaultValue = "800")
- private int width;
+ @Schema(description = "二维码的宽度",defaultValue = "800")
+ private int width=800;
// 二维码的高度
- @Schema(description = "二维码的高度", requiredMode = Schema.RequiredMode.REQUIRED,defaultValue = "800")
- private int height;
+ @Schema(description = "二维码的高度",defaultValue = "800")
+ private int height=800;
// 二维码的图片格式,如"png", "jpg"等
- @Schema(description = "二维码的高度", requiredMode = Schema.RequiredMode.REQUIRED,defaultValue = "png")
- private String imageFormat;
+ @Schema(description = "二维码的高度",defaultValue = "png,jpg")
+ private String imageFormat="jpg";
// 附加资源或相关信息(具体含义根据项目需求定义)
/*private String resource;*/
diff --git a/ruoyi-vue-pro-master/yudao-module-infra/yudao-module-infra-biz/pom.xml b/ruoyi-vue-pro-master/yudao-module-infra/yudao-module-infra-biz/pom.xml
index f2840cf..5b15541 100644
--- a/ruoyi-vue-pro-master/yudao-module-infra/yudao-module-infra-biz/pom.xml
+++ b/ruoyi-vue-pro-master/yudao-module-infra/yudao-module-infra-biz/pom.xml
@@ -124,6 +124,12 @@
org.apache.tika
tika-core
+
+ cn.iocoder.boot
+ yudao-module-system-biz
+ 2.1.0-jdk8-snapshot
+ compile
+
diff --git a/ruoyi-vue-pro-master/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/app/file/AppFileController.java b/ruoyi-vue-pro-master/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/app/file/AppFileController.java
index edc857c..c633ccc 100644
--- a/ruoyi-vue-pro-master/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/app/file/AppFileController.java
+++ b/ruoyi-vue-pro-master/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/app/file/AppFileController.java
@@ -1,13 +1,18 @@
package cn.iocoder.yudao.module.infra.controller.app.file;
+import cn.hutool.core.codec.Base64;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.IoUtil;
import cn.hutool.core.lang.UUID;
+import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
+import cn.iocoder.yudao.framework.common.util.qccode.Base64Util;
import cn.iocoder.yudao.framework.common.util.qccode.QRCodeUtil;
import cn.iocoder.yudao.framework.common.util.qccode.vo.QRCodeConfig;
import cn.iocoder.yudao.module.infra.controller.app.file.vo.AppFileUploadReqVO;
import cn.iocoder.yudao.module.infra.service.file.FileService;
+import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO;
+import cn.iocoder.yudao.module.system.service.dict.DictDataService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
@@ -22,8 +27,10 @@ import javax.annotation.Resource;
import javax.validation.Valid;
import java.io.*;
+import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
+import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
@Tag(name = "用户 App - 文件存储")
@RestController
@@ -35,6 +42,9 @@ public class AppFileController {
@Resource
private FileService fileService;
+ @Resource
+ private DictDataService dictDataService;
+
@PostMapping("/upload")
@Operation(summary = "上传文件")
public CommonResult uploadFile(AppFileUploadReqVO uploadReqVO) throws Exception {
@@ -43,7 +53,7 @@ public class AppFileController {
return success(fileService.createFile(file.getOriginalFilename(), path, IoUtil.readBytes(file.getInputStream())));
}
- @GetMapping("/qrCode")
+ @RequestMapping("/qrCode")
@Operation(summary = "生成二维码")
public CommonResult qrCode(@Valid QRCodeConfig qrCodeConfig) {
try {
@@ -73,4 +83,45 @@ public class AppFileController {
return success("");
}
+ @RequestMapping("/qrCode64")
+ @Operation(summary = "生成二维码64")
+ public CommonResult qrCode64(@Valid String type) {
+ try {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ // 假设QRCodeUtil.createQrCode是一个正确实现的方法,用于生成二维码并写入到ByteArrayOutputStream中
+ QRCodeConfig qrCodeConfig = new QRCodeConfig();
+ QRCodeUtil.createQrCode(out, getString(type), qrCodeConfig.getWidth(), qrCodeConfig.getHeight(), qrCodeConfig.getImageFormat(), ""); // 使用PNG格式,不是JPG
+ // 创建文件,使用PNG扩展名,因为QR码是以PNG格式生成的
+ String h5QrCode = new String(Base64Util.baseEncode(out.toByteArray()), "UTF-8");
+ out.close(); // 关闭ByteArrayOutputStream,虽然在这个上下文中它会在方法结束时自动关闭
+ return success(h5QrCode);
+ } catch (IOException e) {
+ e.printStackTrace(); // 适当的错误处理应该替换这一行,例如记录日志或向用户显示错误消息
+ }
+
+ return success(null);
+ }
+
+ @RequestMapping("/qrCode64Url")
+ @Operation(summary = "生成Url")
+ public CommonResult qrCode64Url(@Valid String type) {
+
+ // 创建文件,使用PNG扩展名,因为QR码是以PNG格式生成的
+ return success( getString(type));
+
+ }
+
+ private String getString(String type) {
+ String replace=null;
+ List list = dictDataService.getDictDataList(
+ CommonStatusEnum.ENABLE.getStatus(), "xcxscewm_type");
+ Long loginUserId = getLoginUserId();
+ for (DictDataDO dictDataDO : list) {
+ if (dictDataDO.getValue().equals(type)) {
+ replace = dictDataDO.getRemark().replace("{bindUserId}", loginUserId.toString());
+ }
+ }
+ return replace;
+ }
+
}
diff --git a/ruoyi-vue-pro-master/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserServiceImpl.java b/ruoyi-vue-pro-master/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserServiceImpl.java
index c6b77de..74439f9 100644
--- a/ruoyi-vue-pro-master/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserServiceImpl.java
+++ b/ruoyi-vue-pro-master/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/brokerage/BrokerageUserServiceImpl.java
@@ -92,7 +92,7 @@ public class BrokerageUserServiceImpl implements BrokerageUserService {
}
// 情况二:修改推广员
- //validateCanBindUser(brokerageUser, bindUserId);
+ validateCanBindUser(brokerageUser, bindUserId);
brokerageUserMapper.updateById(fillBindUserData(bindUserId, new BrokerageUserDO().setId(id)));
}
diff --git a/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/auth/MemberAuthServiceImpl.java b/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/auth/MemberAuthServiceImpl.java
index 0e6fb58..8bb801c 100644
--- a/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/auth/MemberAuthServiceImpl.java
+++ b/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/auth/MemberAuthServiceImpl.java
@@ -28,6 +28,8 @@ import cn.iocoder.yudao.module.system.enums.logger.LoginResultEnum;
import cn.iocoder.yudao.module.system.enums.oauth2.OAuth2ClientConstants;
import cn.iocoder.yudao.module.system.enums.sms.SmsSceneEnum;
import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum;
+import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageUserDO;
+import cn.iocoder.yudao.module.trade.dal.mysql.brokerage.BrokerageUserMapper;
import cn.iocoder.yudao.module.trade.service.brokerage.BrokerageUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -66,6 +68,10 @@ public class MemberAuthServiceImpl implements MemberAuthService {
@Resource
private BrokerageUserService brokerageUserService;
+
+ @Resource
+ private BrokerageUserMapper brokerageUserMapper;
+
@Override
public AppAuthLoginRespVO login(AppAuthLoginReqVO reqVO) {
// 使用手机 + 密码,进行登录。
@@ -74,8 +80,7 @@ public class MemberAuthServiceImpl implements MemberAuthService {
// 如果 socialType 非空,说明需要绑定社交用户
String openid = null;
if (reqVO.getSocialType() != null) {
- openid = socialUserApi.bindSocialUser(new SocialUserBindReqDTO(user.getId(), getUserType().getValue(),
- reqVO.getSocialType(), reqVO.getSocialCode(), reqVO.getSocialState()));
+ openid = socialUserApi.bindSocialUser(new SocialUserBindReqDTO(user.getId(), getUserType().getValue(), reqVO.getSocialType(), reqVO.getSocialCode(), reqVO.getSocialState()));
}
// 创建 Token 令牌,记录登录日志
@@ -102,8 +107,7 @@ public class MemberAuthServiceImpl implements MemberAuthService {
// 如果 socialType 非空,说明需要绑定社交用户
String openid = null;
if (reqVO.getSocialType() != null) {
- openid = socialUserApi.bindSocialUser(new SocialUserBindReqDTO(user.getId(), getUserType().getValue(),
- reqVO.getSocialType(), reqVO.getSocialCode(), reqVO.getSocialState()));
+ openid = socialUserApi.bindSocialUser(new SocialUserBindReqDTO(user.getId(), getUserType().getValue(), reqVO.getSocialType(), reqVO.getSocialCode(), reqVO.getSocialState()));
}
// 创建 Token 令牌,记录登录日志
@@ -114,8 +118,7 @@ public class MemberAuthServiceImpl implements MemberAuthService {
@Transactional
public AppAuthLoginRespVO socialLogin(AppAuthSocialLoginReqVO reqVO) {
// 使用 code 授权码,进行登录。然后,获得到绑定的用户编号
- SocialUserRespDTO socialUser = socialUserApi.getSocialUserByCode(UserTypeEnum.MEMBER.getValue(), reqVO.getType(),
- reqVO.getCode(), reqVO.getState());
+ SocialUserRespDTO socialUser = socialUserApi.getSocialUserByCode(UserTypeEnum.MEMBER.getValue(), reqVO.getType(), reqVO.getCode(), reqVO.getState());
if (socialUser == null) {
throw exception(AUTH_SOCIAL_USER_NOT_FOUND);
}
@@ -124,11 +127,10 @@ public class MemberAuthServiceImpl implements MemberAuthService {
MemberUserDO user;
if (socialUser.getUserId() != null) {
user = userService.getUser(socialUser.getUserId());
- // 情况二:未绑定,注册用户 + 绑定用户
+ // 情况二:未绑定,注册用户 + 绑定用户
} else {
user = userService.createUser(socialUser.getNickname(), socialUser.getAvatar(), getClientIP(), getTerminal());
- socialUserApi.bindSocialUser(new SocialUserBindReqDTO(user.getId(), getUserType().getValue(),
- reqVO.getType(), reqVO.getCode(), reqVO.getState()));
+ socialUserApi.bindSocialUser(new SocialUserBindReqDTO(user.getId(), getUserType().getValue(), reqVO.getType(), reqVO.getCode(), reqVO.getState()));
}
if (user == null) {
throw exception(USER_NOT_EXISTS);
@@ -141,38 +143,35 @@ public class MemberAuthServiceImpl implements MemberAuthService {
@Override
public AppAuthLoginRespVO weixinMiniAppLogin(AppAuthWeixinMiniAppLoginReqVO reqVO) {
// 获得对应的手机号信息
- SocialWxPhoneNumberInfoRespDTO phoneNumberInfo = socialClientApi.getWxMaPhoneNumberInfo(
- UserTypeEnum.MEMBER.getValue(), reqVO.getPhoneCode());
+ SocialWxPhoneNumberInfoRespDTO phoneNumberInfo = socialClientApi.getWxMaPhoneNumberInfo(UserTypeEnum.MEMBER.getValue(), reqVO.getPhoneCode());
Assert.notNull(phoneNumberInfo, "获得手机信息失败,结果为空");
// 获得获得注册用户
- MemberUserDO user = userService.createUserIfAbsent(phoneNumberInfo.getPurePhoneNumber(),
- getClientIP(), TerminalEnum.WECHAT_MINI_PROGRAM.getTerminal());
+ MemberUserDO user = userService.createUserIfAbsent(phoneNumberInfo.getPurePhoneNumber(), getClientIP(), TerminalEnum.WECHAT_MINI_PROGRAM.getTerminal());
Assert.notNull(user, "获取用户失败,结果为空");
// 绑定社交用户
- String openid = socialUserApi.bindSocialUser(new SocialUserBindReqDTO(user.getId(), getUserType().getValue(),
- SocialTypeEnum.WECHAT_MINI_APP.getType(), reqVO.getLoginCode(), reqVO.getState()));
+ String openid = socialUserApi.bindSocialUser(new SocialUserBindReqDTO(user.getId(), getUserType().getValue(), SocialTypeEnum.WECHAT_MINI_APP.getType(), reqVO.getLoginCode(), reqVO.getState()));
- if( ObjectUtil.isNotEmpty(reqVO.getBindUserId())){
- brokerageUserService.bindBrokerageUser(user.getId(), reqVO.getBindUserId());
+ BrokerageUserDO brokerageUserDO = brokerageUserMapper.selectById(user.getId());
- }else {
- brokerageUserService.bindBrokerageUser(user.getId(), 0L);
- }
+ if (ObjectUtil.isEmpty(brokerageUserDO) && ObjectUtil.isNotEmpty(reqVO.getBindUserId())) {
+ brokerageUserService.bindBrokerageUser(user.getId(), reqVO.getBindUserId());
+ } else {
+ if (ObjectUtil.isEmpty(brokerageUserDO)) {
+ brokerageUserService.bindBrokerageUser(user.getId(), 0L);
+ }
+ }
//绑定分销用户
// 创建 Token 令牌,记录登录日志
return createTokenAfterLoginSuccess(user, user.getMobile(), LoginLogTypeEnum.LOGIN_SOCIAL, openid);
}
- private AppAuthLoginRespVO createTokenAfterLoginSuccess(MemberUserDO user, String mobile,
- LoginLogTypeEnum logType, String openid) {
+ private AppAuthLoginRespVO createTokenAfterLoginSuccess(MemberUserDO user, String mobile, LoginLogTypeEnum logType, String openid) {
// 插入登陆日志
createLoginLog(user.getId(), mobile, logType, LoginResultEnum.SUCCESS);
// 创建 Token 令牌
- OAuth2AccessTokenRespDTO accessTokenRespDTO = oauth2TokenApi.createAccessToken(new OAuth2AccessTokenCreateReqDTO()
- .setUserId(user.getId()).setUserType(getUserType().getValue())
- .setClientId(OAuth2ClientConstants.CLIENT_ID_DEFAULT));
+ OAuth2AccessTokenRespDTO accessTokenRespDTO = oauth2TokenApi.createAccessToken(new OAuth2AccessTokenCreateReqDTO().setUserId(user.getId()).setUserType(getUserType().getValue()).setClientId(OAuth2ClientConstants.CLIENT_ID_DEFAULT));
// 构建返回结果
return AuthConvert.INSTANCE.convert(accessTokenRespDTO, openid);
}
@@ -265,8 +264,7 @@ public class MemberAuthServiceImpl implements MemberAuthService {
@Override
public AppAuthLoginRespVO refreshToken(String refreshToken) {
- OAuth2AccessTokenRespDTO accessTokenDO = oauth2TokenApi.refreshAccessToken(refreshToken,
- OAuth2ClientConstants.CLIENT_ID_DEFAULT);
+ OAuth2AccessTokenRespDTO accessTokenDO = oauth2TokenApi.refreshAccessToken(refreshToken, OAuth2ClientConstants.CLIENT_ID_DEFAULT);
return AuthConvert.INSTANCE.convert(accessTokenDO, null);
}
From a8e327c2a384010a383376e97066034a53a540ed Mon Sep 17 00:00:00 2001
From: zhangshengli <1810377322@163.com>
Date: Fri, 12 Jul 2024 10:15:46 +0800
Subject: [PATCH 04/11] =?UTF-8?q?=E7=94=9F=E6=88=90=E4=BA=8C=E7=BB=B4?=
=?UTF-8?q?=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../member/controller/app/user/AppMemberUserController.java | 4 +++-
.../controller/app/user/vo/AppMemberUserInfoRespVO.java | 2 ++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/AppMemberUserController.java b/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/AppMemberUserController.java
index 3a268e8..dbe2f56 100644
--- a/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/AppMemberUserController.java
+++ b/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/AppMemberUserController.java
@@ -38,7 +38,9 @@ public class AppMemberUserController {
public CommonResult getUserInfo() {
MemberUserDO user = userService.getUser(getLoginUserId());
MemberLevelDO level = levelService.getLevel(user.getLevelId());
- return success(MemberUserConvert.INSTANCE.convert(user, level));
+ AppMemberUserInfoRespVO convert = MemberUserConvert.INSTANCE.convert(user, level);
+ convert.setId(getLoginUserId()+"");
+ return success(convert);
}
@PutMapping("/update")
diff --git a/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/vo/AppMemberUserInfoRespVO.java b/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/vo/AppMemberUserInfoRespVO.java
index fa05e16..cf9d8f2 100644
--- a/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/vo/AppMemberUserInfoRespVO.java
+++ b/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/vo/AppMemberUserInfoRespVO.java
@@ -10,6 +10,8 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor
@AllArgsConstructor
public class AppMemberUserInfoRespVO {
+ @Schema(description = "id")
+ private String id;
@Schema(description = "用户昵称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
private String nickname;
From 10bdd3d0a9c8c0f6a1a3c3419ad68245687f59ad Mon Sep 17 00:00:00 2001
From: "lenovo008\\lenovo"
Date: Fri, 12 Jul 2024 14:45:57 +0800
Subject: [PATCH 05/11] =?UTF-8?q?=E4=BA=8C=E7=BB=B4=E7=A0=81=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD=E5=BC=80=E5=8F=91=E5=8F=8A=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
本次更新主要集中在二维码相关功能的开发和优化上,包括扫码识别、生成和分享等方面。
具体改动如下:
1. 修改了uni-app项目中二维码扫描的逻辑,优化了场景参数的解析方式,提高了识别的准确性和效率。
2. 优化了二维码的生成过程,调整了生成二维码时的参数配置,提升了生成速度和二维码的清晰度。
3. 对分享功能进行了重构,优化了分享链接的构造逻辑,确保分享链接的有效性和可靠性。
4. 修复了在特定情况下可能导致二维码扫描失败的bug,提高了整体功能的稳定性。
以上更新旨在提供更加流畅和可靠的二维码功能,提升用户体验。
---
yudao-mall-uniapp-master/.env.development | 2 +-
yudao-mall-uniapp-master/manifest.json | 457 +++++++++---------
.../pages/index/index.vue | 9 +-
.../sheep/api/member/auth.js | 3 +-
.../sheep/api/migration/third.js | 15 +-
.../sheep/helper/index.js | 7 +-
.../sheep/platform/share.js | 12 +-
yudao-mall-uniapp-master/sheep/store/app.js | 15 +-
8 files changed, 279 insertions(+), 241 deletions(-)
diff --git a/yudao-mall-uniapp-master/.env.development b/yudao-mall-uniapp-master/.env.development
index eff223b..829ede0 100644
--- a/yudao-mall-uniapp-master/.env.development
+++ b/yudao-mall-uniapp-master/.env.development
@@ -1 +1 @@
- SHOPRO_DEV_BASE_URL = http://192.168.0.135:48080
\ No newline at end of file
+ SHOPRO_DEV_BASE_URL = https://yanghaodong.51vip.biz
\ No newline at end of file
diff --git a/yudao-mall-uniapp-master/manifest.json b/yudao-mall-uniapp-master/manifest.json
index 7818b33..abb3b87 100644
--- a/yudao-mall-uniapp-master/manifest.json
+++ b/yudao-mall-uniapp-master/manifest.json
@@ -1,222 +1,239 @@
{
- "name": "芋道商城",
- "appid": "__UNI__460BC4C",
- "description": "基于 uni-app + Vue3 技术驱动的在线商城系统,内含诸多功能与丰富的活动,期待您的使用和反馈。",
- "versionName": "2.1.0",
- "versionCode": 183,
- "transformPx": false,
- "app-plus": {
- "usingComponents": true,
- "nvueCompiler": "uni-app",
- "nvueStyleCompiler": "uni-app",
- "compilerVersion": 3,
- "nvueLaunchMode": "fast",
- "splashscreen": {
- "alwaysShowBeforeRender": true,
- "waiting": true,
- "autoclose": true,
- "delay": 0
- },
- "safearea": {
- "bottom": {
- "offset": "none"
- }
- },
- "modules": {
- "Payment": {},
- "Share": {},
- "VideoPlayer": {},
- "OAuth": {}
- },
- "distribute": {
- "android": {
- "permissions": [
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- "",
- ""
- ],
- "minSdkVersion": 21,
- "schemes": "shopro"
- },
- "ios": {
- "urlschemewhitelist": ["baidumap", "iosamap"],
- "dSYMs": false,
- "privacyDescription": {
- "NSPhotoLibraryUsageDescription": "需要同意访问您的相册选取图片才能完善该条目",
- "NSPhotoLibraryAddUsageDescription": "需要同意访问您的相册才能保存该图片",
- "NSCameraUsageDescription": "需要同意访问您的摄像头拍摄照片才能完善该条目",
- "NSUserTrackingUsageDescription": "开启追踪并不会获取您在其它站点的隐私信息,该行为仅用于标识设备,保障服务安全和提升浏览体验"
- },
- "urltypes": "shopro",
- "capabilities": {
- "entitlements": {
- "com.apple.developer.associated-domains": ["applinks:shopro.sheepjs.com"]
- }
- },
- "idfa": true
- },
- "sdkConfigs": {
- "speech": {
- "ifly": {}
- },
- "ad": {},
- "oauth": {
- "apple": {},
- "weixin": {
- "appid": "wxae7a0c156da9383b",
- "UniversalLinks": "https://shopro.sheepjs.com/uni-universallinks/__UNI__082C0BA/"
- }
- },
- "payment": {
- "weixin": {
- "__platform__": ["ios", "android"],
- "appid": "wxae7a0c156da9383b",
- "UniversalLinks": "https://shopro.sheepjs.com/uni-universallinks/__UNI__082C0BA/"
- },
- "alipay": {
- "__platform__": ["ios", "android"]
- }
- },
- "share": {
- "weixin": {
- "appid": "wxae7a0c156da9383b",
- "UniversalLinks": "https://shopro.sheepjs.com/uni-universallinks/__UNI__082C0BA/"
- }
- }
- },
- "orientation": ["portrait-primary"],
- "splashscreen": {
- "androidStyle": "common",
- "iosStyle": "common",
- "useOriginalMsgbox": true
- },
- "icons": {
- "android": {
- "hdpi": "unpackage/res/icons/72x72.png",
- "xhdpi": "unpackage/res/icons/96x96.png",
- "xxhdpi": "unpackage/res/icons/144x144.png",
- "xxxhdpi": "unpackage/res/icons/192x192.png"
- },
- "ios": {
- "appstore": "unpackage/res/icons/1024x1024.png",
- "ipad": {
- "app": "unpackage/res/icons/76x76.png",
- "app@2x": "unpackage/res/icons/152x152.png",
- "notification": "unpackage/res/icons/20x20.png",
- "notification@2x": "unpackage/res/icons/40x40.png",
- "proapp@2x": "unpackage/res/icons/167x167.png",
- "settings": "unpackage/res/icons/29x29.png",
- "settings@2x": "unpackage/res/icons/58x58.png",
- "spotlight": "unpackage/res/icons/40x40.png",
- "spotlight@2x": "unpackage/res/icons/80x80.png"
- },
- "iphone": {
- "app@2x": "unpackage/res/icons/120x120.png",
- "app@3x": "unpackage/res/icons/180x180.png",
- "notification@2x": "unpackage/res/icons/40x40.png",
- "notification@3x": "unpackage/res/icons/60x60.png",
- "settings@2x": "unpackage/res/icons/58x58.png",
- "settings@3x": "unpackage/res/icons/87x87.png",
- "spotlight@2x": "unpackage/res/icons/80x80.png",
- "spotlight@3x": "unpackage/res/icons/120x120.png"
- }
- }
- }
- }
- },
- "quickapp": {},
- "quickapp-native": {
- "icon": "/static/logo.png",
- "package": "com.example.demo",
- "features": [{
- "name": "system.clipboard"
- }]
- },
- "quickapp-webview": {
- "icon": "/static/logo.png",
- "package": "com.example.demo",
- "minPlatformVersion": 1070,
- "versionName": "1.0.0",
- "versionCode": 100
- },
- "mp-weixin": {
- "appid": "wx53b5ac263b9cdb5b",
- "setting": {
- "urlCheck": false,
- "minified": true,
- "postcss": true
- },
- "optimization": {
- "subPackages": true
- },
- "plugins": {},
- "lazyCodeLoading": "requiredComponents",
- "usingComponents": {},
- "permission": {},
- "requiredPrivateInfos": ["chooseAddress"]
- },
- "mp-alipay": {
- "usingComponents": true
- },
- "mp-baidu": {
- "usingComponents": true
- },
- "mp-toutiao": {
- "usingComponents": true
- },
- "mp-jd": {
- "usingComponents": true
- },
- "h5": {
- "template": "index.html",
- "router": {
- "mode": "hash",
- "base": "./"
- },
- "sdkConfigs": {
- "maps": {}
- },
- "async": {
- "timeout": 20000
- },
- "title": "芋道商城",
- "optimization": {
- "treeShaking": {
- "enable": true
- }
- }
- },
- "vueVersion": "3",
- "_spaceID": "192b4892-5452-4e1d-9f09-eee1ece40639",
- "locale": "zh-Hans",
- "fallbackLocale": "zh-Hans"
+ "name": "芋道商城",
+ "appid": "__UNI__460BC4C",
+ "description": "基于 uni-app + Vue3 技术驱动的在线商城系统,内含诸多功能与丰富的活动,期待您的使用和反馈。",
+ "versionName": "2.1.0",
+ "versionCode": 183,
+ "transformPx": false,
+ "app-plus": {
+ "usingComponents": true,
+ "nvueCompiler": "uni-app",
+ "nvueStyleCompiler": "uni-app",
+ "compilerVersion": 3,
+ "nvueLaunchMode": "fast",
+ "splashscreen": {
+ "alwaysShowBeforeRender": true,
+ "waiting": true,
+ "autoclose": true,
+ "delay": 0
+ },
+ "safearea": {
+ "bottom": {
+ "offset": "none"
+ }
+ },
+ "modules": {
+ "Payment": {},
+ "Share": {},
+ "VideoPlayer": {},
+ "OAuth": {}
+ },
+ "distribute": {
+ "android": {
+ "permissions": [
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ ""
+ ],
+ "minSdkVersion": 21,
+ "schemes": "shopro"
+ },
+ "ios": {
+ "urlschemewhitelist": [
+ "baidumap",
+ "iosamap"
+ ],
+ "dSYMs": false,
+ "privacyDescription": {
+ "NSPhotoLibraryUsageDescription": "需要同意访问您的相册选取图片才能完善该条目",
+ "NSPhotoLibraryAddUsageDescription": "需要同意访问您的相册才能保存该图片",
+ "NSCameraUsageDescription": "需要同意访问您的摄像头拍摄照片才能完善该条目",
+ "NSUserTrackingUsageDescription": "开启追踪并不会获取您在其它站点的隐私信息,该行为仅用于标识设备,保障服务安全和提升浏览体验"
+ },
+ "urltypes": "shopro",
+ "capabilities": {
+ "entitlements": {
+ "com.apple.developer.associated-domains": [
+ "applinks:shopro.sheepjs.com"
+ ]
+ }
+ },
+ "idfa": true
+ },
+ "sdkConfigs": {
+ "speech": {
+ "ifly": {}
+ },
+ "ad": {},
+ "oauth": {
+ "apple": {},
+ "weixin": {
+ "appid": "wxae7a0c156da9383b",
+ "UniversalLinks": "https://shopro.sheepjs.com/uni-universallinks/__UNI__082C0BA/"
+ }
+ },
+ "payment": {
+ "weixin": {
+ "__platform__": [
+ "ios",
+ "android"
+ ],
+ "appid": "wxae7a0c156da9383b",
+ "UniversalLinks": "https://shopro.sheepjs.com/uni-universallinks/__UNI__082C0BA/"
+ },
+ "alipay": {
+ "__platform__": [
+ "ios",
+ "android"
+ ]
+ }
+ },
+ "share": {
+ "weixin": {
+ "appid": "wxae7a0c156da9383b",
+ "UniversalLinks": "https://shopro.sheepjs.com/uni-universallinks/__UNI__082C0BA/"
+ }
+ }
+ },
+ "orientation": [
+ "portrait-primary"
+ ],
+ "splashscreen": {
+ "androidStyle": "common",
+ "iosStyle": "common",
+ "useOriginalMsgbox": true
+ },
+ "icons": {
+ "android": {
+ "hdpi": "unpackage/res/icons/72x72.png",
+ "xhdpi": "unpackage/res/icons/96x96.png",
+ "xxhdpi": "unpackage/res/icons/144x144.png",
+ "xxxhdpi": "unpackage/res/icons/192x192.png"
+ },
+ "ios": {
+ "appstore": "unpackage/res/icons/1024x1024.png",
+ "ipad": {
+ "app": "unpackage/res/icons/76x76.png",
+ "app@2x": "unpackage/res/icons/152x152.png",
+ "notification": "unpackage/res/icons/20x20.png",
+ "notification@2x": "unpackage/res/icons/40x40.png",
+ "proapp@2x": "unpackage/res/icons/167x167.png",
+ "settings": "unpackage/res/icons/29x29.png",
+ "settings@2x": "unpackage/res/icons/58x58.png",
+ "spotlight": "unpackage/res/icons/40x40.png",
+ "spotlight@2x": "unpackage/res/icons/80x80.png"
+ },
+ "iphone": {
+ "app@2x": "unpackage/res/icons/120x120.png",
+ "app@3x": "unpackage/res/icons/180x180.png",
+ "notification@2x": "unpackage/res/icons/40x40.png",
+ "notification@3x": "unpackage/res/icons/60x60.png",
+ "settings@2x": "unpackage/res/icons/58x58.png",
+ "settings@3x": "unpackage/res/icons/87x87.png",
+ "spotlight@2x": "unpackage/res/icons/80x80.png",
+ "spotlight@3x": "unpackage/res/icons/120x120.png"
+ }
+ }
+ }
+ }
+ },
+ "quickapp": {},
+ "quickapp-native": {
+ "icon": "/static/logo.png",
+ "package": "com.example.demo",
+ "features": [
+ {
+ "name": "system.clipboard"
+ }
+ ]
+ },
+ "quickapp-webview": {
+ "icon": "/static/logo.png",
+ "package": "com.example.demo",
+ "minPlatformVersion": 1070,
+ "versionName": "1.0.0",
+ "versionCode": 100
+ },
+ "mp-weixin": {
+ "appid": "wx53b5ac263b9cdb5b",
+ "setting": {
+ "urlCheck": false,
+ "minified": true,
+ "postcss": true
+ },
+ "optimization": {
+ "subPackages": true
+ },
+ "plugins": {},
+ "lazyCodeLoading": "requiredComponents",
+ "usingComponents": {},
+ "permission": {},
+ "requiredPrivateInfos": [
+ "chooseAddress"
+ ]
+ },
+ "mp-alipay": {
+ "usingComponents": true
+ },
+ "mp-baidu": {
+ "usingComponents": true
+ },
+ "mp-toutiao": {
+ "usingComponents": true
+ },
+ "mp-jd": {
+ "usingComponents": true
+ },
+ "h5": {
+ "template": "index.html",
+ "router": {
+ "mode": "hash",
+ "base": "./"
+ },
+ "sdkConfigs": {
+ "maps": {}
+ },
+ "async": {
+ "timeout": 20000
+ },
+ "title": "芋道商城",
+ "optimization": {
+ "treeShaking": {
+ "enable": true
+ }
+ }
+ },
+ "vueVersion": "3",
+ "_spaceID": "192b4892-5452-4e1d-9f09-eee1ece40639",
+ "locale": "zh-Hans",
+ "fallbackLocale": "zh-Hans"
}
\ No newline at end of file
diff --git a/yudao-mall-uniapp-master/pages/index/index.vue b/yudao-mall-uniapp-master/pages/index/index.vue
index 208c959..e1f87dd 100644
--- a/yudao-mall-uniapp-master/pages/index/index.vue
+++ b/yudao-mall-uniapp-master/pages/index/index.vue
@@ -51,10 +51,15 @@
onLoad((options) => {
// #ifdef MP
// 小程序识别二维码
- if (options.scene) {
- const sceneParams = decodeURIComponent(options.scene).split('=');
+ if (options.q) {
+ const sceneParams = decodeURIComponent(options.q).split('=');
console.log("sceneParams=>",sceneParams);
options[sceneParams[0]] = sceneParams[1];
+ console.log(options,'1123456');
+ uni.setStorageSync('bindUserId', sceneParams[1]);
+ }
+ if (options.r) {
+ uni.setStorageSync('bindUserId', options.r);
}
// #endif
diff --git a/yudao-mall-uniapp-master/sheep/api/member/auth.js b/yudao-mall-uniapp-master/sheep/api/member/auth.js
index a1c0660..875dd0f 100644
--- a/yudao-mall-uniapp-master/sheep/api/member/auth.js
+++ b/yudao-mall-uniapp-master/sheep/api/member/auth.js
@@ -103,7 +103,8 @@ const AuthUtil = {
data: {
phoneCode,
loginCode,
- state
+ state,
+ bindUserId: uni.getStorageSync('bindUserId') || '',
},
custom: {
showSuccess: true,
diff --git a/yudao-mall-uniapp-master/sheep/api/migration/third.js b/yudao-mall-uniapp-master/sheep/api/migration/third.js
index 85db8cc..0d0782a 100644
--- a/yudao-mall-uniapp-master/sheep/api/migration/third.js
+++ b/yudao-mall-uniapp-master/sheep/api/migration/third.js
@@ -20,12 +20,17 @@ export default {
// 获取微信小程序码
getWxacode: async (path, query) => {
return await request({
- url: '/member/social-user/wxa-qrcode',
- method: 'POST',
+ url: '/infra/file/qrCode64',
+ method: 'GET',
data: {
- scene: query,
- path,
- checkPath: false, // TODO 开发环境暂不检查 path 是否存在
+ // scene: query,
+ // path,
+ // checkPath: false, // TODO 开发环境暂不检查 path 是否存在
+ // content: 'http://cdz.huamar.com/zdfs?bindUserId=12345',
+ type: '1',
+ // width: 800,
+ // height: 800,
+ // imageFormat: 'png',
},
});
},
diff --git a/yudao-mall-uniapp-master/sheep/helper/index.js b/yudao-mall-uniapp-master/sheep/helper/index.js
index 38e6afe..162a9eb 100644
--- a/yudao-mall-uniapp-master/sheep/helper/index.js
+++ b/yudao-mall-uniapp-master/sheep/helper/index.js
@@ -650,8 +650,13 @@ export function getRootUrl() {
/**
* copyText 多端复制文本
*/
-export function copyText(text) {
+export function copyText(temp) {
+ let text = temp;
+ if (text.startsWith('?')) {
+ text = text.substring(1);
+ }
// #ifndef H5
+ console.log(text, 'text1');
uni.setClipboardData({
data: text,
success: function () {
diff --git a/yudao-mall-uniapp-master/sheep/platform/share.js b/yudao-mall-uniapp-master/sheep/platform/share.js
index a5d1b0a..d7b638e 100644
--- a/yudao-mall-uniapp-master/sheep/platform/share.js
+++ b/yudao-mall-uniapp-master/sheep/platform/share.js
@@ -68,6 +68,7 @@ const getShareInfo = (
// 构造spm分享参数
const buildSpmQuery = (params) => {
const user = $store('user');
+ console.log(user, 'user123');
let shareId = '0'; // 设置分享者用户ID
if (typeof params.shareId === 'undefined') {
if (user.isLogin) {
@@ -88,7 +89,11 @@ const buildSpmQuery = (params) => {
from = platformMap.indexOf(params.from) + 1;
}
//spmParams = ... 可按需扩展
- return `spm=${shareId}.${page}.${query}.${platform}.${from}`;
+ if (user.userInfo.urlLink) {
+ return `${user.userInfo.urlLink}`;
+ } else {
+ return `spm=${shareId}.${page}.${query}.${platform}.${from}`;
+ }
};
// 构造页面分享参数: 所有的分享都先到首页进行 spm 参数解析
@@ -173,7 +178,7 @@ const decryptSpm = (spm) => {
};
// 绑定推广员
-const bindBrokerageUser = async (val= undefined) => {
+const bindBrokerageUser = async (val = undefined) => {
try {
const shareId = val || uni.getStorageSync('shareId');
if (!shareId) {
@@ -181,8 +186,7 @@ const bindBrokerageUser = async (val= undefined) => {
}
await BrokerageApi.bindBrokerageUser({ bindUserId: shareId });
uni.removeStorageSync('shareId');
- } catch {
- }
+ } catch {}
};
// 更新公众号分享sdk
diff --git a/yudao-mall-uniapp-master/sheep/store/app.js b/yudao-mall-uniapp-master/sheep/store/app.js
index 573c237..811fd8c 100644
--- a/yudao-mall-uniapp-master/sheep/store/app.js
+++ b/yudao-mall-uniapp-master/sheep/store/app.js
@@ -72,15 +72,16 @@ const app = defineStore({
};
this.platform = {
share: {
- methods: ["poster", "link"],
- linkAddress: "https://shopro.sheepjs.com/#/",
+ methods: ['poster', 'link'],
+ // linkAddress: 'http://cdz.huamar.com/zdfs',
+ linkAddress: '',
posterInfo: {
- "user_bg": "/static/img/shop/config/user-poster-bg.png",
- "goods_bg": "/static/img/shop/config/goods-poster-bg.png",
- "groupon_bg": "/static/img/shop/config/groupon-poster-bg.png"
- }
+ user_bg: '/static/img/shop/config/user-poster-bg.png',
+ goods_bg: '/static/img/shop/config/goods-poster-bg.png',
+ groupon_bg: '/static/img/shop/config/groupon-poster-bg.png',
+ },
},
- bind_mobile: 0
+ bind_mobile: 0,
};
this.chat = {
chat_domain: "https://api.shopro.sheepjs.com/chat",
From 98e2ad606ee061cb940d4e059ff47251ab2ff78a Mon Sep 17 00:00:00 2001
From: 13233904609 <13233904609@163.cm>
Date: Fri, 12 Jul 2024 14:47:15 +0800
Subject: [PATCH 06/11] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E5=B8=AE=E6=89=B6?=
=?UTF-8?q?=E5=91=98=EF=BC=8C=E5=B8=AE=E6=89=B6=E4=BA=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../service/user/MemberUserService.java | 14 ++++++
.../service/user/MemberUserServiceImpl.java | 49 +++++++++++++++++++
2 files changed, 63 insertions(+)
diff --git a/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserService.java b/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserService.java
index fb2e9cd..1cae4b8 100644
--- a/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserService.java
+++ b/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserService.java
@@ -186,5 +186,19 @@ public interface MemberUserService {
* @return 更新结果
*/
boolean updateUserPoint(Long userId, Integer point);
+ /**
+ * 注册帮扶人
+ *
+ * @param userId 用户编号
+ * @return 更新结果
+ */
+ boolean updateUserLevelId(Long userId);
+ /**
+ * 购买1188升级帮扶员
+ *
+ * @param userId 用户编号
+ * @return 更新结果
+ */
+ boolean updateUserUpgradesLevel(Long userId);
}
diff --git a/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java b/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java
index f81e9a1..93c59f4 100644
--- a/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java
+++ b/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java
@@ -8,12 +8,16 @@ import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.member.controller.admin.user.vo.MemberUserPageReqVO;
import cn.iocoder.yudao.module.member.controller.admin.user.vo.MemberUserUpdateReqVO;
import cn.iocoder.yudao.module.member.controller.app.user.vo.*;
import cn.iocoder.yudao.module.member.convert.auth.AuthConvert;
import cn.iocoder.yudao.module.member.convert.user.MemberUserConvert;
+import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberLevelDO;
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
+import cn.iocoder.yudao.module.member.dal.mysql.level.MemberLevelMapper;
+import cn.iocoder.yudao.module.member.dal.mysql.level.MemberLevelRecordMapper;
import cn.iocoder.yudao.module.member.dal.mysql.user.MemberUserMapper;
import cn.iocoder.yudao.module.member.mq.producer.user.MemberUserProducer;
import cn.iocoder.yudao.module.system.api.sms.SmsCodeApi;
@@ -64,6 +68,12 @@ public class MemberUserServiceImpl implements MemberUserService {
@Resource
private MemberUserProducer memberUserProducer;
+ @Resource
+ private MemberLevelRecordMapper levelLogMapper;
+
+ @Resource
+ private MemberLevelMapper memberLevelMapper;
+
@Override
public MemberUserDO getUserByMobile(String mobile) {
return memberUserMapper.selectByMobile(mobile);
@@ -314,4 +324,43 @@ public class MemberUserServiceImpl implements MemberUserService {
return true;
}
+ @Override
+ public boolean updateUserLevelId(Long userId) {
+ //查询帮扶人等级id
+ MemberLevelDO memberLevelDO = memberLevelMapper.selectOne(new LambdaQueryWrapperX()
+ .eq(MemberLevelDO::getStatus, 0)
+ .eq(MemberLevelDO::getDeleted, 0)
+ .eq(MemberLevelDO::getLevel, 1)
+ .orderByAsc(MemberLevelDO::getLevel));
+ int i = memberUserMapper.updateById(new MemberUserDO()
+ .setId(userId)
+ .setLevelId(memberLevelDO.getId())
+ );
+ if(i>0){
+ return true;
+ }
+ return false;
+ }
+ @Override
+ public boolean updateUserUpgradesLevel(Long userId) {
+ //查询帮扶人等级id
+ List levelList = memberLevelMapper.selectList(new LambdaQueryWrapperX()
+ .eq(MemberLevelDO::getStatus, 0)
+ .eq(MemberLevelDO::getDeleted, 0)
+ .orderByAsc(MemberLevelDO::getLevel));
+ //循环处理帮扶人等级
+ for (MemberLevelDO vo:levelList) {
+
+ }
+ //先会员本身升级为帮扶员
+// if(i>0){
+// return true;
+// }
+ return false;
+ }
+
+ private void recursionMemberLevel(List levelList,Long userId){
+
+ }
+
}
From c8e5b0a10c07f532ace1a8808ded1c49dd2bf189 Mon Sep 17 00:00:00 2001
From: 13233904609 <13233904609@163.cm>
Date: Sat, 13 Jul 2024 09:57:10 +0800
Subject: [PATCH 07/11] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E5=B8=AE=E6=89=B6?=
=?UTF-8?q?=E5=91=98=EF=BC=8C=E5=B8=AE=E6=89=B6=E4=BA=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../dataobject/brokerage/BrokerageUserDO.java | 4 +
.../service/user/MemberUserServiceImpl.java | 124 +++++++++++++++++-
2 files changed, 125 insertions(+), 3 deletions(-)
diff --git a/ruoyi-vue-pro-master/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/brokerage/BrokerageUserDO.java b/ruoyi-vue-pro-master/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/brokerage/BrokerageUserDO.java
index 8d73858..1be8990 100644
--- a/ruoyi-vue-pro-master/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/brokerage/BrokerageUserDO.java
+++ b/ruoyi-vue-pro-master/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/brokerage/BrokerageUserDO.java
@@ -59,4 +59,8 @@ public class BrokerageUserDO extends BaseDO {
* 冻结佣金
*/
private Integer frozenPrice;
+ /**
+ * 会员等级
+ */
+ private Integer level;
}
diff --git a/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java b/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java
index 93c59f4..4d41544 100644
--- a/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java
+++ b/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java
@@ -25,6 +25,9 @@ import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeUseReqDTO;
import cn.iocoder.yudao.module.system.api.social.SocialClientApi;
import cn.iocoder.yudao.module.system.api.social.dto.SocialWxPhoneNumberInfoRespDTO;
import cn.iocoder.yudao.module.system.enums.sms.SmsSceneEnum;
+import cn.iocoder.yudao.module.trade.dal.dataobject.brokerage.BrokerageUserDO;
+import cn.iocoder.yudao.module.trade.dal.mysql.brokerage.BrokerageUserMapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.google.common.annotations.VisibleForTesting;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.crypto.password.PasswordEncoder;
@@ -74,6 +77,9 @@ public class MemberUserServiceImpl implements MemberUserService {
@Resource
private MemberLevelMapper memberLevelMapper;
+ @Resource
+ private BrokerageUserMapper brokerageUserMapper;
+
@Override
public MemberUserDO getUserByMobile(String mobile) {
return memberUserMapper.selectByMobile(mobile);
@@ -336,6 +342,10 @@ public class MemberUserServiceImpl implements MemberUserService {
.setId(userId)
.setLevelId(memberLevelDO.getId())
);
+ brokerageUserMapper.updateById(new BrokerageUserDO()
+ .setId(userId)
+ .setLevel(1)
+ );
if(i>0){
return true;
}
@@ -353,14 +363,122 @@ public class MemberUserServiceImpl implements MemberUserService {
}
//先会员本身升级为帮扶员
+ int i = memberUserMapper.updateById(new MemberUserDO()
+ .setId(userId)
+ .setLevelId(levelList.get(0).getId())
+ );
// if(i>0){
// return true;
// }
return false;
}
- private void recursionMemberLevel(List levelList,Long userId){
-
+ private void recursionMemberLevel(Long userId){
+ //查询会员信息
+ MemberUserDO memberUserDO = memberUserMapper.selectById(userId);
+ //查询会员当前等级
+ MemberLevelDO memberLevelDO = memberLevelMapper.selectById(memberUserDO.getLevelId());
+ if(ObjectUtil.isNotEmpty(memberLevelDO)){
+ //查询上一级会员等级
+ MemberLevelDO upLevelDO = memberLevelMapper.selectOne(new LambdaQueryWrapperX()
+ .eq(MemberLevelDO::getStatus, 0)
+ .eq(MemberLevelDO::getDeleted, 0)
+ .eq(MemberLevelDO::getLevel, (memberLevelDO.getLevel()+1))
+ .orderByAsc(MemberLevelDO::getLevel));
+ if(ObjectUtil.isNotEmpty(upLevelDO)){
+ if(ObjectUtil.equal(memberLevelDO.getLevel(),1)){//帮扶人升级帮扶员
+ //添加分润
+ //升级会员
+ //修改会员等级
+ memberUserMapper.updateById(new MemberUserDO()
+ .setId(userId)
+ .setLevelId(upLevelDO.getId())
+ );
+ //修改邀请记录等级
+ brokerageUserMapper.updateById(new BrokerageUserDO()
+ .setId(userId)
+ .setLevel(upLevelDO.getLevel())
+ );
+ //判断上级会员是否升级
+ BrokerageUserDO brokerageUserDO = brokerageUserMapper.selectById(userId);
+ recursionMemberLevel(brokerageUserDO.getBindUserId());
+ }
+ if(ObjectUtil.equal(memberLevelDO.getLevel(),2)){//帮扶员升级帮扶大使
+ //查询会员邀请记录下级会员
+ List brokerageUserDOS = brokerageUserMapper.selectList(new LambdaQueryWrapperX()
+ .eq(BrokerageUserDO::getBindUserId, userId)
+ .eq(BrokerageUserDO::getLevel, memberLevelDO.getLevel())
+ .eq(BrokerageUserDO::getDeleted, 0)
+ );
+ if(ObjectUtil.isNotEmpty(brokerageUserDOS)){
+ if(brokerageUserDOS.size()>=3){
+ //升级会员
+ memberUserMapper.updateById(new MemberUserDO()
+ .setId(userId)
+ .setLevelId(upLevelDO.getId())
+ );
+ brokerageUserMapper.updateById(new BrokerageUserDO()
+ .setId(userId)
+ .setLevel(upLevelDO.getLevel())
+ );
+ }
+ }
+ //判断上级会员是否升级
+ BrokerageUserDO brokerageUserDO = brokerageUserMapper.selectById(userId);
+ recursionMemberLevel(brokerageUserDO.getBindUserId());
+ }
+ if(ObjectUtil.equal(memberLevelDO.getLevel(),3)){//帮扶大使升级帮扶中心
+ //查询会员邀请记录下级会员
+ List brokerageUserDOS = brokerageUserMapper.selectList(new LambdaQueryWrapperX()
+ .eq(BrokerageUserDO::getBindUserId, userId)
+ .eq(BrokerageUserDO::getLevel, memberLevelDO.getLevel())
+ .eq(BrokerageUserDO::getDeleted, 0)
+ );
+ if(ObjectUtil.isNotEmpty(brokerageUserDOS)){
+ if(brokerageUserDOS.size()>=5){
+ //升级会员
+ memberUserMapper.updateById(new MemberUserDO()
+ .setId(userId)
+ .setLevelId(upLevelDO.getId())
+ );
+ brokerageUserMapper.updateById(new BrokerageUserDO()
+ .setId(userId)
+ .setLevel(upLevelDO.getLevel())
+ );
+ }
+ }
+ //判断上级会员是否升级
+ BrokerageUserDO brokerageUserDO = brokerageUserMapper.selectById(userId);
+ recursionMemberLevel(brokerageUserDO.getBindUserId());
+ }
+ if(ObjectUtil.equal(memberLevelDO.getLevel(),4)){//帮扶中心升级帮扶驿站
+ //查询会员邀请记录下级会员
+ List brokerageUserDOS = brokerageUserMapper.selectList(new LambdaQueryWrapperX()
+ .eq(BrokerageUserDO::getBindUserId, userId)
+ .eq(BrokerageUserDO::getLevel, memberLevelDO.getLevel())
+ .eq(BrokerageUserDO::getDeleted, 0)
+ );
+ if(ObjectUtil.isNotEmpty(brokerageUserDOS)){
+ if(brokerageUserDOS.size()>=10){
+ //升级会员
+ memberUserMapper.updateById(new MemberUserDO()
+ .setId(userId)
+ .setLevelId(upLevelDO.getId())
+ );
+ brokerageUserMapper.updateById(new BrokerageUserDO()
+ .setId(userId)
+ .setLevel(upLevelDO.getLevel())
+ );
+ }
+ }
+ //判断上级会员是否升级
+ BrokerageUserDO brokerageUserDO = brokerageUserMapper.selectById(userId);
+ recursionMemberLevel(brokerageUserDO.getBindUserId());
+ }
+ if(ObjectUtil.equal(memberLevelDO.getLevel(),5)){//帮扶驿站---最终级别
+
+ }
+ }
+ }
}
-
}
From 4041ce666b577135e88dd0b5c6a5995fcb724302 Mon Sep 17 00:00:00 2001
From: 13233904609 <13233904609@163.cm>
Date: Sat, 13 Jul 2024 13:19:30 +0800
Subject: [PATCH 08/11] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E5=B8=AE=E6=89=B6?=
=?UTF-8?q?=E5=91=98=EF=BC=8C=E5=B8=AE=E6=89=B6=E4=BA=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../member/service/user/MemberUserService.java | 2 +-
.../service/user/MemberUserServiceImpl.java | 18 ++----------------
2 files changed, 3 insertions(+), 17 deletions(-)
diff --git a/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserService.java b/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserService.java
index 1cae4b8..23aeaf8 100644
--- a/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserService.java
+++ b/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserService.java
@@ -199,6 +199,6 @@ public interface MemberUserService {
* @param userId 用户编号
* @return 更新结果
*/
- boolean updateUserUpgradesLevel(Long userId);
+ void updateUserUpgradesLevel(Long userId);
}
diff --git a/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java b/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java
index 4d41544..189cd8e 100644
--- a/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java
+++ b/ruoyi-vue-pro-master/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java
@@ -352,25 +352,11 @@ public class MemberUserServiceImpl implements MemberUserService {
return false;
}
@Override
- public boolean updateUserUpgradesLevel(Long userId) {
- //查询帮扶人等级id
- List levelList = memberLevelMapper.selectList(new LambdaQueryWrapperX()
- .eq(MemberLevelDO::getStatus, 0)
- .eq(MemberLevelDO::getDeleted, 0)
- .orderByAsc(MemberLevelDO::getLevel));
- //循环处理帮扶人等级
- for (MemberLevelDO vo:levelList) {
-
- }
- //先会员本身升级为帮扶员
- int i = memberUserMapper.updateById(new MemberUserDO()
- .setId(userId)
- .setLevelId(levelList.get(0).getId())
- );
+ public void updateUserUpgradesLevel(Long userId) {
+ recursionMemberLevel(userId);
// if(i>0){
// return true;
// }
- return false;
}
private void recursionMemberLevel(Long userId){
From 5a07db3cdbba0024fed3bec98bc43b135f816e35 Mon Sep 17 00:00:00 2001
From: alsszer
Date: Mon, 15 Jul 2024 08:43:25 +0800
Subject: [PATCH 09/11] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=A7=BB=E5=8A=A8?=
=?UTF-8?q?=E7=AB=AF=E8=87=AA=E6=8F=90=E6=A0=B8=E9=94=80=E6=94=AF=E6=8C=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../framework/security/core/LoginUser.java | 1 +
.../core/util/SecurityFrameworkUtils.java | 11 +++++++
.../admin/order/TradeOrderController.java | 7 ++++-
.../app/order/AppTradeOrderController.java | 13 ++++++++
.../order/vo/AppTradeOrderPageItemRespVO.java | 14 +++++++++
.../dataobject/order/TradeOrderItemDO.java | 1 +
.../mysql/brokerage/BrokerageUserMapper.java | 30 +++++++++++++++++++
.../dal/mysql/order/TradeOrderMapper.java | 3 ++
.../brokerage/BrokerageUserService.java | 10 +++++++
.../brokerage/BrokerageUserServiceImpl.java | 10 +++++++
.../service/order/TradeOrderQueryService.java | 1 +
.../order/TradeOrderQueryServiceImpl.java | 5 ++++
.../order/TradeOrderUpdateService.java | 3 +-
.../order/TradeOrderUpdateServiceImpl.java | 8 ++++-
.../convert/user/MemberUserConvert.java | 1 +
.../oauth2/OAuth2TokenServiceImpl.java | 3 +-
16 files changed, 117 insertions(+), 4 deletions(-)
diff --git a/ruoyi-vue-pro-master/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/LoginUser.java b/ruoyi-vue-pro-master/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/LoginUser.java
index 68d1c56..ae8565b 100644
--- a/ruoyi-vue-pro-master/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/LoginUser.java
+++ b/ruoyi-vue-pro-master/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/LoginUser.java
@@ -19,6 +19,7 @@ public class LoginUser {
public static final String INFO_KEY_NICKNAME = "nickname";
public static final String INFO_KEY_DEPT_ID = "deptId";
+ public static final String INFO_KEY_MOBILE = "mobile";
/**
* 用户编号
diff --git a/ruoyi-vue-pro-master/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/util/SecurityFrameworkUtils.java b/ruoyi-vue-pro-master/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/util/SecurityFrameworkUtils.java
index f85d77c..88bf6ba 100644
--- a/ruoyi-vue-pro-master/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/util/SecurityFrameworkUtils.java
+++ b/ruoyi-vue-pro-master/yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/util/SecurityFrameworkUtils.java
@@ -112,6 +112,17 @@ public class SecurityFrameworkUtils {
return loginUser != null ? MapUtil.getLong(loginUser.getInfo(), LoginUser.INFO_KEY_DEPT_ID) : null;
}
+ /**
+ * 获得当前用户的电话,从上下文中
+ *
+ * @return 昵称
+ */
+ @Nullable
+ public static String getLoginUserMobile() {
+ LoginUser loginUser = getLoginUser();
+ return loginUser != null ? MapUtil.getStr(loginUser.getInfo(), LoginUser.INFO_KEY_MOBILE) : null;
+ }
+
/**
* 设置当前用户
*
diff --git a/ruoyi-vue-pro-master/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/TradeOrderController.java b/ruoyi-vue-pro-master/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/TradeOrderController.java
index 58acde4..9c9b973 100644
--- a/ruoyi-vue-pro-master/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/TradeOrderController.java
+++ b/ruoyi-vue-pro-master/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/admin/order/TradeOrderController.java
@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.trade.controller.admin.order;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.*;
@@ -31,6 +32,7 @@ import java.util.Set;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
+import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.*;
@Tag(name = "管理后台 - 交易订单")
@RestController
@@ -153,7 +155,10 @@ public class TradeOrderController {
@Parameter(name = "pickUpVerifyCode", description = "自提核销码")
@PreAuthorize("@ss.hasPermission('trade:order:pick-up')")
public CommonResult pickUpOrderByVerifyCode(@RequestParam("pickUpVerifyCode") String pickUpVerifyCode) {
- tradeOrderUpdateService.pickUpOrderByAdmin(pickUpVerifyCode);
+ // 根据管理系统登录用户信息获取APP系统用户信息
+ String mobile = getLoginUserMobile();
+ MemberUserRespDTO userByMobile = memberUserApi.getUserByMobile(mobile);
+ tradeOrderUpdateService.pickUpOrderByAdmin(userByMobile.getId(),pickUpVerifyCode);
return success(true);
}
diff --git a/ruoyi-vue-pro-master/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/AppTradeOrderController.java b/ruoyi-vue-pro-master/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/AppTradeOrderController.java
index 762b238..aad011f 100644
--- a/ruoyi-vue-pro-master/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/AppTradeOrderController.java
+++ b/ruoyi-vue-pro-master/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/AppTradeOrderController.java
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.trade.controller.app.order;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
+import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
import cn.iocoder.yudao.module.pay.api.notify.dto.PayOrderNotifyReqDTO;
import cn.iocoder.yudao.module.trade.controller.app.order.vo.*;
@@ -17,6 +18,7 @@ import cn.iocoder.yudao.module.trade.service.aftersale.AfterSaleService;
import cn.iocoder.yudao.module.trade.service.delivery.DeliveryExpressService;
import cn.iocoder.yudao.module.trade.service.order.TradeOrderQueryService;
import cn.iocoder.yudao.module.trade.service.order.TradeOrderUpdateService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Maps;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
@@ -32,6 +34,7 @@ import java.util.Map;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
+import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
@Tag(name = "用户 App - 交易订单")
@@ -65,6 +68,9 @@ public class AppTradeOrderController {
@Operation(summary = "创建订单")
@PreAuthenticated
public CommonResult createOrder(@Valid @RequestBody AppTradeOrderCreateReqVO createReqVO) {
+ LoginUser loginUser = getLoginUser();
+ createReqVO.setReceiverName(loginUser.getInfo().getOrDefault("nickname",""));
+ createReqVO.setReceiverMobile(loginUser.getInfo().getOrDefault("mobile",""));
TradeOrderDO order = tradeOrderUpdateService.createOrder(getLoginUserId(), createReqVO);
return success(new AppTradeOrderCreateRespVO().setId(order.getId()).setPayOrderId(order.getPayOrderId()));
}
@@ -116,6 +122,13 @@ public class AppTradeOrderController {
return success(TradeOrderConvert.INSTANCE.convertPage02(pageResult, orderItems));
}
+ @GetMapping("/getPickUpVerifyCode")
+ @Operation(summary = "根据订单id获取自提核销码")
+ public CommonResult getPickUpVerifyCode(String id) {
+ String pickUpVerifyCode = tradeOrderQueryService.getPickUpVerifyCode(id);
+ return success(pickUpVerifyCode);
+ }
+
@GetMapping("/get-count")
@Operation(summary = "获得交易订单数量")
public CommonResult