Pārlūkot izejas kodu

bugfix:处理bug赠券通知

penghao 1 dienu atpakaļ
vecāks
revīzija
84ce632631

+ 12 - 1
alien-store/src/main/java/shop/alien/store/service/impl/LifeDiscountCouponStoreFriendServiceImpl.java

@@ -203,9 +203,20 @@ public class LifeDiscountCouponStoreFriendServiceImpl extends ServiceImpl<LifeDi
                     StoreUser friendStoreUser = storeUserList.get(0);
                     String friendPhone = friendStoreUser.getPhone();
                     if(StringUtils.isNotEmpty(friendPhone)){
+                        // 获取发送优惠券的店铺名称
+                        String storeName = userLoginInfo.getUserName(); // 默认使用用户名
+                        // 根据当前登录用户ID查询店铺用户信息
+                        StoreUser currentStoreUser = storeUserMapper.selectById(userLoginInfo.getUserId());
+                        if (currentStoreUser != null && currentStoreUser.getStoreId() != null) {
+                            // 根据storeId查询店铺信息,获取店铺名称
+                            StoreInfo currentStoreInfo = storeInfoMapper.selectById(currentStoreUser.getStoreId());
+                            if (currentStoreInfo != null && currentStoreInfo.getStoreName() != null) {
+                                storeName = currentStoreInfo.getStoreName();
+                            }
+                        }
                         // 发送好友优惠券通知
                         LifeNotice lifeMessage = new LifeNotice();
-                        String text = "您的好友"+userLoginInfo.getUserName()+"送了您"+couponDto.getSingleQty()+"张店铺优惠券,快去使用吧!";
+                        String text = "您的好友"+storeName+"送了您"+couponDto.getSingleQty()+"张店铺优惠券,快去使用吧!";
                         JSONObject jsonObject = new JSONObject();
                         jsonObject.put("message", text);
                         lifeMessage.setReceiverId("store_"+friendPhone);