zoujiajian 11 bulan lalu
induk
melakukan
94410e69b6

+ 5 - 0
netflix-dao/src/main/java/com/cyksj/model/dto/AuthRedirect.java

@@ -94,4 +94,9 @@ public class AuthRedirect {
      * 是否是cc普通推广
      */
     private Boolean cgTj;
+
+    /**
+     * 是否是nano注册登录
+     */
+    private Boolean isNano = false;
 }

+ 5 - 0
netflix-dao/src/main/java/com/cyksj/model/dto/GzhBodyDto.java

@@ -107,4 +107,9 @@ public class GzhBodyDto {
 	 * 是否是cc普通推广
 	 */
 	private Boolean cgTj;
+
+	/**
+	 * 是否是nano注册登录
+	 */
+	private Boolean isNano = false;
 }

+ 5 - 0
netflix-dao/src/main/java/com/cyksj/model/request/LoginReq.java

@@ -79,4 +79,9 @@ public class LoginReq {
 	 * 是否是cc普通推广
 	 */
 	private Boolean cgTj;
+
+	/**
+	 * 是否是nano注册登录
+	 */
+	private Boolean isNano = false;
 }

+ 15 - 15
netflix-service/src/main/java/com/cyksj/service/gzh/factory/EventMsgService.java

@@ -282,7 +282,7 @@ public class EventMsgService implements GzhMsgService {
 				}
 			}
 			//查找渠道是否有设置了对应的claude code优惠码
-			handlerSpecialPopularize(sharedId, dsPopularizeId, user, isNewUser);
+			handlerSpecialPopularize(sharedId, dsPopularizeId, user, isNewUser, gzhDto.getIsNano());
 			//每日活跃记录
 			userLoginRecordService.saveUserLoginDayRecord(user.getId());
 			//是否是大学生快递站进来的用户
@@ -390,7 +390,7 @@ public class EventMsgService implements GzhMsgService {
 	/**
 	 * 查找渠道是否有设置了对应的claude code优惠码
 	 */
-	public void handlerSpecialPopularize(Long sharedId, Long dsPopularizeId, User user, Boolean isNewUser) {
+	public void handlerSpecialPopularize(Long sharedId, Long dsPopularizeId, User user, Boolean isNewUser, Boolean isNano) {
 		if (!isNewUser) {
 			return;
 		}
@@ -442,21 +442,21 @@ public class EventMsgService implements GzhMsgService {
 					Integer selectCount = couponDistributePopularizeMapper.selectCount(Wrappers.lambdaQuery(CouponDistributePopularize.class).eq(CouponDistributePopularize::getDistributeId, userDistribute.getId()).eq(CouponDistributePopularize::getDeleted, Boolean.TRUE).eq(CouponDistributePopularize::getCouponId, Constant.DISTRIBUTE_NANO_COUPON_ID));
 					if (selectCount > 0) {
 						//设置了 直接发送优惠券
-						Boolean b = couponCommonService.sendCouponToUser(user.getId(), Constant.DISTRIBUTE_NANO_COUPON_ID, 0l, 0l, dsPopularizeId, CouponUser.Channel.manual);
-						if (!b) {
+						couponCommonService.sendCouponToUser(user.getId(), Constant.DISTRIBUTE_NANO_COUPON_ID, 0l, 0l, dsPopularizeId, CouponUser.Channel.manual);
+					}
+				}
+
+				if (isNano != null && isNano) {
+					if (redisService.setNx(RedisService.key.NANO_TY_DAY_CARD_KEY.getName() + user.getId(), user.getId(), RedisService.key.NANO_TY_DAY_CARD_KEY.getTimeout())) {
+						Integer receiveRecord = nanoUserTrialReceiveRecordMapper.selectCount(Wrappers.lambdaQuery(NanoUserTrialReceiveRecord.class).eq(NanoUserTrialReceiveRecord::getUserId, user.getId()));
+						if (receiveRecord > 0) {
 							return;
 						}
-						if (redisService.setNx(RedisService.key.NANO_TY_DAY_CARD_KEY.getName() + user.getId(), user.getId(), RedisService.key.NANO_TY_DAY_CARD_KEY.getTimeout())) {
-							Integer receiveRecord = nanoUserTrialReceiveRecordMapper.selectCount(Wrappers.lambdaQuery(NanoUserTrialReceiveRecord.class).eq(NanoUserTrialReceiveRecord::getUserId, user.getId()));
-							if (receiveRecord > 0) {
-								return;
-							}
-							//发送nano 体验卡
-							Long relationId = groupRelationFrontService.getTrialTicketByUserIdAndGoodsId(user.getId(), Constant.DISTRIBUTE_NANO_TRIAL_SKU_ID, 1);
-							recordReceiveNanoRecord(user.getId(), relationId);
-							//创建nano user
-							createNanoUser(user.getId(), relationId, goodsDonSkuMapper.selectById(Constant.DISTRIBUTE_NANO_TRIAL_SKU_ID));
-						}
+						//发送nano 体验卡
+						Long relationId = groupRelationFrontService.getTrialTicketByUserIdAndGoodsId(user.getId(), Constant.DISTRIBUTE_NANO_TRIAL_SKU_ID, 1);
+						recordReceiveNanoRecord(user.getId(), relationId);
+						//创建nano user
+						createNanoUser(user.getId(), relationId, goodsDonSkuMapper.selectById(Constant.DISTRIBUTE_NANO_TRIAL_SKU_ID));
 					}
 				}
 			}

+ 18 - 18
netflix-service/src/main/java/com/cyksj/service/user/impl/UserServiceImpl.java

@@ -173,6 +173,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 		String callback = re.getCk();
 		String callbackType = re.getCt();
 		String customId = re.getCd();
+		Boolean isNano = re.getIsNano();
 
 		final String unionid = info.getUnionid();
 		if (StrUtil.isEmpty(unionid)) {
@@ -255,7 +256,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 			equipDistributeService.saveDistributionInvitation(sharedId, isNewUser, user.getId());
 		}
 		//处理特殊推广
-		handlerSpecialPopularize(sharedId, dsPopularizeId, user, isNewUser);
+		handlerSpecialPopularize(sharedId, dsPopularizeId, user, isNewUser, isNano);
 		//每日活跃记录
 		userLoginRecordService.saveUserLoginDayRecord(user.getId());
 		//是否是大学生快递站进来的用户
@@ -606,7 +607,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 			equipDistributeService.saveDistributionInvitation(sharedId, isNewUser, user.getId());
 		}
 		//查找渠道是否有设置了对应的claude code优惠码
-		handlerSpecialPopularize(sharedId, dsPopularizeId, user, isNewUser);
+		handlerSpecialPopularize(sharedId, dsPopularizeId, user, isNewUser, loginReq.getIsNano());
 
 		//每日活跃记录
 		userLoginRecordService.saveUserLoginDayRecord(user.getId());
@@ -950,7 +951,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 	/**
 	 * 查找渠道是否有设置了对应的claude code优惠码
 	 */
-	public void handlerSpecialPopularize(Long sharedId, Long dsPopularizeId, User user, Boolean isNewUser) {
+	public void handlerSpecialPopularize(Long sharedId, Long dsPopularizeId, User user, Boolean isNewUser, Boolean isNano) {
 		if (!isNewUser) {
 			return;
 		}
@@ -1002,22 +1003,21 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 					Integer selectCount = couponDistributePopularizeMapper.selectCount(Wrappers.lambdaQuery(CouponDistributePopularize.class).eq(CouponDistributePopularize::getDistributeId, userDistribute.getId()).eq(CouponDistributePopularize::getDeleted, Boolean.TRUE).eq(CouponDistributePopularize::getCouponId, Constant.DISTRIBUTE_NANO_COUPON_ID));
 					if (selectCount > 0) {
 						//设置了 直接发送优惠券
-						Boolean b = couponCommonService.sendCouponToUser(user.getId(), Constant.DISTRIBUTE_NANO_COUPON_ID, 0l, 0l, dsPopularizeId, CouponUser.Channel.manual);
-						if (!b) {
-							return;
-						}
-						if (redisService.setNx(RedisService.key.NANO_TY_DAY_CARD_KEY.getName() + user.getId(), user.getId(), RedisService.key.NANO_TY_DAY_CARD_KEY.getTimeout())) {
-							Integer receiveRecord = nanoUserTrialReceiveRecordMapper.selectCount(Wrappers.lambdaQuery(NanoUserTrialReceiveRecord.class).eq(NanoUserTrialReceiveRecord::getUserId, user.getId()));
-							if (receiveRecord > 0) {
-								return;
-							}
-							//发送nano 体验卡
-							Long relationId = groupRelationFrontService.getTrialTicketByUserIdAndGoodsId(user.getId(), Constant.DISTRIBUTE_NANO_TRIAL_SKU_ID, 1);
-							recordReceiveNanoRecord(user.getId(), relationId);
-							//创建nano user
-							createNanoUser(user.getId(), relationId, goodsDonSkuMapper.selectById(Constant.DISTRIBUTE_NANO_TRIAL_SKU_ID));
-						}
+						couponCommonService.sendCouponToUser(user.getId(), Constant.DISTRIBUTE_NANO_COUPON_ID, 0l, 0l, dsPopularizeId, CouponUser.Channel.manual);
+					}
+				}
+			}
+			if (isNano != null && isNano) {
+				if (redisService.setNx(RedisService.key.NANO_TY_DAY_CARD_KEY.getName() + user.getId(), user.getId(), RedisService.key.NANO_TY_DAY_CARD_KEY.getTimeout())) {
+					Integer receiveRecord = nanoUserTrialReceiveRecordMapper.selectCount(Wrappers.lambdaQuery(NanoUserTrialReceiveRecord.class).eq(NanoUserTrialReceiveRecord::getUserId, user.getId()));
+					if (receiveRecord > 0) {
+						return;
 					}
+					//发送nano 体验卡
+					Long relationId = groupRelationFrontService.getTrialTicketByUserIdAndGoodsId(user.getId(), Constant.DISTRIBUTE_NANO_TRIAL_SKU_ID, 1);
+					recordReceiveNanoRecord(user.getId(), relationId);
+					//创建nano user
+					createNanoUser(user.getId(), relationId, goodsDonSkuMapper.selectById(Constant.DISTRIBUTE_NANO_TRIAL_SKU_ID));
 				}
 			}
 		}

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

@@ -94,7 +94,7 @@ public class AuthorizationController {
     private final TemplateCommonService templateCommonService;
 
     @GetMapping(value = "/weChat")
-    public void base(String url, String dsCode, Long sharedId, Integer dsType, Long popularizeId, String authType, String callbackType, String callback, String customId, Integer cst, Integer cmt, Boolean cgTj, HttpServletResponse response) throws Exception {
+    public void base(String url, String dsCode, Long sharedId, Integer dsType, Long popularizeId, String authType, String callbackType, String callback, String customId, Integer cst, Integer cmt, Boolean cgTj, Boolean isNano, HttpServletResponse response) throws Exception {
         log.info("微信授权转跳. url: {},authType:{}", url, authType);
         if (StrUtil.isBlank(url)) {
             url = "https://nf.video/";
@@ -115,6 +115,7 @@ public class AuthorizationController {
                 .setCt(callbackType)
                 .setCst(cst)
                 .setCgTj(cgTj)
+                .setIsNano(isNano)
                 .setCmt(cmt);
         String state = Codec.DoBase64.custom().setData(Jsons.toJson(redirect)).encodeAsText();
 
@@ -346,14 +347,15 @@ public class AuthorizationController {
      * 网页扫描微信公众号二维码 临时凭证ticket  关注后登录
      */
     @GetMapping("/wx/gzh/login/qrCode")
-    public Result<WxGzhQrCodeTicketRep> getWxGzhQrCode(Long sharedId, Integer dsType, Long popularizeId, String dsCode, String callbackType, String callback, String customId, Integer cmt, Boolean cgTj) throws Exception {
+    public Result<WxGzhQrCodeTicketRep> getWxGzhQrCode(Long sharedId, Integer dsType, Long popularizeId, String dsCode, String callbackType, String callback, String customId, Integer cmt, Boolean cgTj, Boolean isNano) throws Exception {
         //获取gzh带参数的二维码
         GzhBodyDto gzhBodyDto = new GzhBodyDto().setSharedId(sharedId).setDsType(dsType).setPid(popularizeId).setDsCode(dsCode)
                 .setCk(callback)
                 .setCt(callbackType)
                 .setCd(customId)
                 .setCmt(cmt)
-                .setCgTj(cgTj);
+                .setCgTj(cgTj)
+                .setIsNano(isNano);
         WxGzhQrCodeTicketRep result = weChatService.getWxGzhQrCode(gzhBodyDto);
         return GatewayResponse.SUCCESS.newBuilder().toResult(result);
     }