Browse Source

fix 获取域名方式

zoujiajian 3 years ago
parent
commit
c20568a3b2

+ 4 - 4
netflix-service/src/main/java/com/cyksj/common/EnvCommonService.java

@@ -21,10 +21,10 @@ public class EnvCommonService {
 	@Value(value = "${spring.profiles.active}")
 	private String env;
 
+	@Value(value = "${wechat.domain}")
+	private String domain;
+
 	public String getHost() {
-		if ("dev".equals(env)) {
-			return "inside.yicanggongyi.com";
-		}
-		return "c.netflix.tw.cn";
+		return domain;
 	}
 }

+ 5 - 1
netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java

@@ -499,6 +499,10 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 			UserDistributeShared userDistributeShared = userDistributeSharedMapper.selectOne(Wrappers.lambdaQuery(UserDistributeShared.class).eq(UserDistributeShared::getUserId, user.getId()).last("limit 1"));
 			if (userDistributeShared != null) {
 				orderDon.setIsDistribute(true);
+				UserDistribute userDistribute = userDistributeMapper.selectOne(Wrappers.lambdaQuery(UserDistribute.class).eq(UserDistribute::getUserId, userDistributeShared.getSharedId()));
+				if (userDistribute != null) {
+					orderDon.setIsFixedDistribute(true);
+				}
 			}
 		}
 		this.saveOrUpdate(orderDon);
@@ -868,7 +872,7 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 		}
 		//回调地址
 		String host = envCommonService.getHost();
-		String notifyUrl = String.format("https://%s/8081/api/%s", host, BaseZfbConfig.notifyUrl);
+		String notifyUrl = String.format("%s%s", host, BaseZfbConfig.notifyUrl);
 		//去除返回地址
 //		String returnUrl = String.format("https://%s/%s", host, BaseZfbConfig.returnUrl);
 		alipayRequest.setNotifyUrl(notifyUrl);

+ 3 - 7
netflix-web/src/main/java/com/cyksj/web/controller/user/AuthorizationController.java

@@ -80,7 +80,7 @@ public class AuthorizationController {
 
     private final WxOpenPlatYHLXLoginConfig wxOpenPlatYHLXLoginConfig;
 
-    private EnvCommonService envCommonService;
+    private final EnvCommonService envCommonService;
 
     private final OrderDonService orderDonService;
 
@@ -246,12 +246,8 @@ public class AuthorizationController {
      */
     @GetMapping("/wx/login/redirect")
     public void wxLoginRedirect(String code, String state, HttpServletResponse response) throws Exception {
-        String env = envCommonService.getEnv();
-        String domain = "netflix.tw.cn";
-        if ("dev".equals(env)) {
-            domain = "inside.yicanggongyi.com";
-        }
-        String url = String.format("https://%/8081/api/weChat/baseRedirect?code=%s&state=%s", domain, code, state);
+        String domain = envCommonService.getHost();
+        String url = String.format("%sweChat/baseRedirect?code=%s&state=%s", domain, code, state);
         response.sendRedirect(url);
     }
 

+ 2 - 1
netflix-web/src/main/java/com/cyksj/web/controller/user/DistributePopularizeController.java

@@ -108,8 +108,9 @@ public class DistributePopularizeController {
 		Long userId = StpUserUtil.getLoginIdAsLong();
 		DistributePopularizeView distributePopularizeView = new DistributePopularizeView();
 		String domain = envCommonService.getHost();
+		String domainSub = domain.substring(0, domain.indexOf("8081"));
 //		distributePopularizeView.setUrl(String.format("https://%s/8081/api/auth/weChat?url=https://%s/yinhe/web&sharedId=%s", domain, domain, userId));
-		distributePopularizeView.setUrl(String.format("https://%s/yinhe/web?sharedId=%s", domain, userId));
+		distributePopularizeView.setUrl(String.format("%syinhe/web?sharedId=%s", domainSub, userId));
 		distributePopularizeView.setUrlCode(QrCodeUtil.generateAsBase64(distributePopularizeView.getUrl(), QrConfig.create(), "png"));
 		User user = userMapper.selectById(userId);
 		distributePopularizeView.setGotPoints(user.getPoints());