Преглед изворни кода

益寿缘-App-优化App发红包参数配置

cgp пре 2 дана
родитељ
комит
514bfc06e1

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

@@ -1323,6 +1323,7 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
 
             return sendRedPacket;
         } else {
+            logger.error("红包发送结果:{}", sendRedPacket);
             return R.error("您对此次课程刚刚发起提现,请稍等几分钟再试");
         }
     }
@@ -3062,7 +3063,6 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
      * @return 处理结果
      */
     private R sendAppRedPacketRewardFsUser(FsCourseSendRewardUParam param, FsUser user, FsCourseWatchLog watchLog, FsUserCourseVideo video, CourseConfig config) {
-
         FsUserCoursePeriodDays periodDays = new FsUserCoursePeriodDays();
         periodDays.setVideoId(param.getVideoId());
         periodDays.setPeriodId(param.getPeriodId());
@@ -3102,7 +3102,6 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
 
         // 发送App红包
         R sendRedPacket = paymentService.sendRedPacketAppReward(packetParam);
-        log.info("App发放红包结果:"+sendRedPacket);
         if (sendRedPacket.get("code").equals(200)) {
             FsCourseRedPacketLog redPacketLog = new FsCourseRedPacketLog();
             TransferBillsResult transferBillsResult;
@@ -3136,7 +3135,8 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
 
             return sendRedPacket;
         } else {
-            return R.error("奖励发送失败,请联系客服");
+            log.error("App看课发放红包结果:"+sendRedPacket);
+            return R.error("App奖励发送失败,请稍后再试");
         }
 
 

+ 17 - 17
fs-service/src/main/java/com/fs/his/service/impl/FsStorePaymentServiceImpl.java

@@ -594,39 +594,39 @@ public class FsStorePaymentServiceImpl implements IFsStorePaymentService {
     @Override
     @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
     public R sendRedPacketAppReward(WxSendRedPacketParam param) {
-        String json;
         RedPacketConfig config = new RedPacketConfig();
-        // 根据红包模式获取配置
-        json = redisCache.getCacheObject("sys_config:redPacket.config.new");
-        if (StringUtil.isNullOrEmpty(json) || json.isEmpty()) {
-            json = configService.selectConfigByKey("redPacket.config");
-        }
-        config = JSONUtil.toBean(json, RedPacketConfig.class);
+        //益寿缘App发红包只绑定一个商户号 所以这里直接写固定值
+        config.setMiniappId("wxa8fd9e940628fef3");
+        config.setMchKey("zT2fG8kL9pQ3wE6rY1iO5mN7bV0cX4zJ");
+        config.setKeyPath("C:\\cert-1701206124\\apiclient_cert.p12");
+        config.setPrivateKeyPath("C:\\cert-1701206124\\apiclient_key.pem");
+        config.setPrivateCertPath("C:\\cert-1701206124\\apiclient_cert.pem");
+        config.setApiV3Key("hsA7fG3jK9pL2mN5bV0cX8qR4tY6iO1d");
+        config.setNotifyUrl("https://h5.ysya.top/app/wxpay/v3TransferNotify");
+        config.setNotifyUrlScrm(null);
+        config.setPublicKeyId(null);
+        config.setPublicKeyPath(null);
+        config.setIsNew(1);
         //获取App的appId
         config.setAppId(openProperties.getAppId());
-        config.setMchId("1701206124");//TODO 商户号,后续改成动态配置读取
+        config.setMchId("1701206124");
         logger.info("app发红包最终传参 {}", config);
-        // 根据 isNew 判断使用哪种发红包方式
-        R result;
-        if (config.getIsNew() != null && config.getIsNew() == 1) {
-            result = sendRedPacketV3Internal(param, config);
-        } else {
-            result = sendRedPacketLegacyInternal(param, config);
-        }
+
+        R result = sendRedPacketV3Internal(param, config);
 
         if (result.getMsg().equals("商家余额不足") && param.getRedPacketMode() == 1) {
             redisCache.incr("sys_config:redPacket.config.newCount",1L);
         }
         result.put("mchId", config.getMchId());
         result.put("isNew", config.getIsNew());
-        result.put("appId", param.getAppId());
+        result.put("appId", openProperties.getAppId());
         Object dataObj = result.get("data");
         if (dataObj instanceof TransferBillsResult) {
             TransferBillsResult transferResult = (TransferBillsResult) dataObj;
             // 显式将 packageInfo 放到顶层,确保能被正确序列化
             result.put("packageInfo", transferResult.getPackageInfo());
         }
-        logger.info("app发红包返回:{}", result);
+        logger.info("app发红包返回:{}", result);
         return result;
     }
 

+ 2 - 1
fs-service/src/main/java/com/fs/his/strategy/impl/FirstLoginRedPacketStrategy.java

@@ -76,7 +76,8 @@ public class FirstLoginRedPacketStrategy implements RewardStrategy {
                     appRewardCourseRedPacketLogMapper.insert(record);
                     return RewardResult.successWithExt(sendRedPacket);
                 } else {
-                    return RewardResult.fail("首次登录-弹窗红包-发放失败,请联系客服");
+                    log.error("首次登录-弹窗红包-发放失败: {}", sendRedPacket);
+                    return RewardResult.fail("首次登录-弹窗红包-发放失败,请稍后再试");
                 }
             }
             return RewardResult.fail("首次登录-弹窗红包-发放失败,用户不存在");

+ 2 - 1
fs-service/src/main/java/com/fs/his/strategy/impl/WatchCourseRedPacketStrategy.java

@@ -81,13 +81,14 @@ public class WatchCourseRedPacketStrategy implements RewardStrategy {
                     appRewardCourseRedPacketLogMapper.insert(record);
                     return RewardResult.successWithExt(sendRedPacket);
                 } else {
+                    log.error("App看课-弹窗红包-发放失败: {}", sendRedPacket);
                     return RewardResult.fail("App看课-弹窗红包-发放失败,请联系客服");
                 }
             }
             return RewardResult.success();
 
         } catch (Exception e) {
-            return RewardResult.fail("App看课-弹窗红包-发放失败,请联系客服");
+            return RewardResult.fail("App看课-弹窗红包-发放失败,请稍后再试");
         }
     }