zyp 1 week ago
parent
commit
81c5ae937e

+ 23 - 14
fs-service/src/main/java/com/fs/course/service/impl/FsUserCourseVideoServiceImpl.java

@@ -1191,21 +1191,25 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
 //            if (company.getCourseMiniAppId()==null){
 //                return R.error("销售公司参数错误,未绑定小程序");
 //            }
-            FsUserWx fsUserWx = fsUserWxService.selectByAppIdAndUserId(param.getAppId(),user.getUserId(),1);
-            if (fsUserWx ==null){
-                if (user.getCourseMaOpenId()==null){
-                    logger.error("zyp \n 【转账openId参数错误】:{}", user.getUserId());
-                    return R.error("openId参数错误");
-                }
-                packetParam.setOpenId(user.getCourseMaOpenId());
-                try {
-                    handleFsUserWx(user,param.getAppId());
-                }catch (Exception e){
-                    logger.error("zyp \n 【更新或插入用户与小程序的绑定关系失败】:{}", user.getUserId(),e);
-                }
-
+            if (user.getMpOpenId()!=null){
+                packetParam.setOpenId(user.getMpOpenId());
             }else {
-                packetParam.setOpenId(fsUserWx.getOpenId());
+                FsUserWx fsUserWx = fsUserWxService.selectByAppIdAndUserId(param.getAppId(),user.getUserId(),1);
+                if (fsUserWx ==null){
+                    if (user.getCourseMaOpenId()==null){
+                        logger.error("zyp \n 【转账openId参数错误】:{}", user.getUserId());
+                        return R.error("openId参数错误");
+                    }
+                    packetParam.setOpenId(user.getCourseMaOpenId());
+                    try {
+                        handleFsUserWx(user,param.getAppId());
+                    }catch (Exception e){
+                        logger.error("zyp \n 【更新或插入用户与小程序的绑定关系失败】:{}", user.getUserId(),e);
+                    }
+
+                }else {
+                    packetParam.setOpenId(fsUserWx.getOpenId());
+                }
             }
         }
         //判断服务号配置是否存在
@@ -1228,6 +1232,11 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
         //2025.6.19 红包金额为0的时候
         if (amount.compareTo(BigDecimal.ZERO)>0){
 
+            Company company = companyMapper.selectCompanyById(param.getCompanyId());
+            BigDecimal money = company.getMoney();
+            if (money.compareTo(BigDecimal.ZERO)<0) {
+                return R.error("服务商余额不足,请联系群主服务器充值!");
+            }
             // 发送红包
             R sendRedPacket = paymentService.sendRedPacket(packetParam);
             if (sendRedPacket.get("code").equals(200)) {