|
|
@@ -1,6 +1,7 @@
|
|
|
package com.fs.app.controller.store;
|
|
|
|
|
|
|
|
|
+import cn.binarywang.wx.miniapp.api.WxMaService;
|
|
|
import cn.hutool.core.img.ImgUtil;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.io.resource.ResourceUtil;
|
|
|
@@ -15,6 +16,7 @@ import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.core.domain.ResponseResult;
|
|
|
import com.fs.common.exception.CustomException;
|
|
|
import com.fs.common.param.BaseQueryParam;
|
|
|
+import com.fs.core.config.WxMaConfiguration;
|
|
|
import com.fs.course.param.newfs.FsUserCourseBeMemberParam;
|
|
|
import com.fs.course.service.IFsUserCourseVideoService;
|
|
|
import com.fs.hisStore.domain.FsStoreOrderScrm;
|
|
|
@@ -28,6 +30,7 @@ import com.fs.hisStore.vo.FsStoreProductRelationQueryVO;
|
|
|
import com.fs.hisStore.vo.FsUserExtractVO;
|
|
|
import com.fs.hisStore.vo.FsUserTuiVO;
|
|
|
import com.fs.utils.FileCacheService;
|
|
|
+import com.fs.wx.miniapp.config.WxMaProperties;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.google.zxing.BarcodeFormat;
|
|
|
@@ -54,10 +57,7 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.validation.Valid;
|
|
|
import java.awt.*;
|
|
|
import java.awt.image.BufferedImage;
|
|
|
-import java.io.File;
|
|
|
-import java.io.FileInputStream;
|
|
|
-import java.io.IOException;
|
|
|
-import java.io.InputStream;
|
|
|
+import java.io.*;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.net.URL;
|
|
|
import java.util.HashMap;
|
|
|
@@ -95,7 +95,8 @@ public class UserScrmController extends AppBaseController {
|
|
|
private IFsUserScrmService fsUserService;
|
|
|
@Autowired
|
|
|
private FileCacheService fileCacheService;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private WxMaProperties maProperties;
|
|
|
/**
|
|
|
* 获取用户信息
|
|
|
* @param request
|
|
|
@@ -228,12 +229,21 @@ public class UserScrmController extends AppBaseController {
|
|
|
});
|
|
|
CompletableFuture<BufferedImage> qrFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
try {
|
|
|
- log.info("开始生成二维码");
|
|
|
- String qrContent = fsConfig.getUrl() + "/distribution?userCode=" + user.getUserCode();
|
|
|
- log.info("生成二维码内容: {}", qrContent);
|
|
|
+ // 改为小程序码生成
|
|
|
+ WxMaService wxService = WxMaConfiguration.getMaService(maProperties.getConfigs().get(0).getAppid());
|
|
|
+ byte[] qrCodeBytes = wxService.getQrcodeService().createWxaCodeUnlimitBytes(
|
|
|
+ user.getUserCode(), // scene - 分销用户码
|
|
|
+ "pages/pages_company/distribution", // page - 目标页面(需要你确认)
|
|
|
+ true, // checkPath - 检查页面是否存在
|
|
|
+ "release", // envVersion - 版本(release/trial/develop)
|
|
|
+ 300, // width - 宽度
|
|
|
+ true, // autoColor - 自动配置线条颜色
|
|
|
+ null, // lineColor - 线条颜色(null使用默认)
|
|
|
+ false // isHyaline - 是否需要透明底色
|
|
|
+ );
|
|
|
+
|
|
|
+ return ImageIO.read(new ByteArrayInputStream(qrCodeBytes));
|
|
|
|
|
|
- // 直接生成BufferedImage,不保存临时文件
|
|
|
- return QrCodeUtil.generate(qrContent, 300, 300);
|
|
|
} catch (Exception e) {
|
|
|
log.error("生成二维码失败: {}", e.getMessage(), e);
|
|
|
throw new RuntimeException("生成二维码失败", e);
|
|
|
@@ -521,7 +531,7 @@ public class UserScrmController extends AppBaseController {
|
|
|
|
|
|
@Login
|
|
|
@ApiOperation("绑定推广员")
|
|
|
- @PostMapping("/bindPromoter")
|
|
|
+ @GetMapping("/bindPromoter")
|
|
|
public R bindPromoter(@RequestBody FsUserBindPromoterParam param, HttpServletRequest request){
|
|
|
log.info("绑定推广员 参数: {}",param);
|
|
|
|
|
|
@@ -535,7 +545,6 @@ public class UserScrmController extends AppBaseController {
|
|
|
userMap.setSpreadUserId(tuiUser.getUserId());
|
|
|
userService.updateFsUser(userMap);
|
|
|
return R.ok("绑定成功");
|
|
|
-
|
|
|
}
|
|
|
else{
|
|
|
return R.error("邀请码不存在");
|