ソースを参照

fix 去掉万能验证码

zoujiajian 2 年 前
コミット
ff9884bd7f

+ 1 - 1
netflix-common/src/main/java/com/cyksj/common/constant/Constant.java

@@ -164,7 +164,7 @@ public interface Constant {
 
 	String ORDER_MSG_FIRST_NOTIFY = "%s购买成功,收藏官网https://nf.video/ 合租账号就上银河录像局【银河录像局】";
 
-	String LOGIN_CODE = "yhc@36";
+	//String LOGIN_CODE = "yhc@36";
 
 	//PS AI,POE会员
 	List<Long> DOWN_GOODS_PAY = List.of(33l, 35l);

+ 3 - 5
netflix-service/src/main/java/com/cyksj/service/cps/shop/YhShopManageServiceImpl.java

@@ -133,11 +133,9 @@ public class YhShopManageServiceImpl implements YhShopManageService{
 			}
 			CACHE_LOGIN_KEY += email;
 		}
-		if (!code.equals(Constant.LOGIN_CODE)) {
-			String cache_code = String.valueOf(redisService.get(CACHE_LOGIN_KEY));
-			if (StrUtil.isBlank(cache_code) || !cache_code.equals(code)) {
-				throw BusinessRuntimeException.getInstance("验证码错误");
-			}
+		String cache_code = String.valueOf(redisService.get(CACHE_LOGIN_KEY));
+		if (StrUtil.isBlank(cache_code) || !cache_code.equals(code)) {
+			throw BusinessRuntimeException.getInstance("验证码错误");
 		}
 		User user = userMapper.selectOne(Wrappers.lambdaQuery(User.class)
 				.eq(StrUtil.isNotBlank(phone), User::getLoginPhone, phone)

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

@@ -368,21 +368,19 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 			if (StrUtil.hasEmpty(loginReq.getPhone(), loginReq.getCode())) {
 				throw BusinessRuntimeException.getInstance("请输入对应信息");
 			}
-			if (!Constant.LOGIN_CODE.equals(loginReq.getCode())) {
-				DateTime now = DateTime.now();
-				PhoneCode phoneCode = phoneCodeMapper.selectOne(Wrappers.lambdaQuery(PhoneCode.class).eq(PhoneCode::getPhone, loginReq.getPhone()).last("limit 1"));
-				if (phoneCode == null || StrUtil.isEmpty(phoneCode.getCode())) {
-					throw BusinessRuntimeException.getInstance("请重新获取手机验证码");
-				}
-				//3分钟失效
-				Date updateTime = phoneCode.getUpdateTime();
-				DateTime afterFiveMinutes = DateUtil.offsetMinute(updateTime, 3);
-				if (now.isAfter(afterFiveMinutes)) {
-					throw BusinessRuntimeException.getInstance("手机验证码已失效,请重新获取");
-				}
-				if (!StrUtil.equals(loginReq.getCode(), phoneCode.getCode())) {
-					throw BusinessRuntimeException.getInstance("手机验证码错误,请重新输入");
-				}
+			DateTime now = DateTime.now();
+			PhoneCode phoneCode = phoneCodeMapper.selectOne(Wrappers.lambdaQuery(PhoneCode.class).eq(PhoneCode::getPhone, loginReq.getPhone()).last("limit 1"));
+			if (phoneCode == null || StrUtil.isEmpty(phoneCode.getCode())) {
+				throw BusinessRuntimeException.getInstance("请重新获取手机验证码");
+			}
+			//3分钟失效
+			Date updateTime = phoneCode.getUpdateTime();
+			DateTime afterFiveMinutes = DateUtil.offsetMinute(updateTime, 3);
+			if (now.isAfter(afterFiveMinutes)) {
+				throw BusinessRuntimeException.getInstance("手机验证码已失效,请重新获取");
+			}
+			if (!StrUtil.equals(loginReq.getCode(), phoneCode.getCode())) {
+				throw BusinessRuntimeException.getInstance("手机验证码错误,请重新输入");
 			}
 			wrapper.eq(User::getLoginPhone, loginReq.getPhone());
 		}
@@ -390,16 +388,14 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 			if (StrUtil.isEmpty(loginReq.getEmail())) {
 				throw BusinessRuntimeException.getInstance("邮箱不能为空");
 			}
-			if (!Constant.LOGIN_CODE.equals(loginReq.getCode())) {
-				String code = redisService.getStr(RedisService.key.EMAIL_CODE_KEY.getNameFormat(loginReq.getEmail()));
-				if (StrUtil.isEmpty(code)) {
-					throw BusinessRuntimeException.getInstance("邮箱验证码已失效,请重新获取");
-				}
-				if (!StrUtil.equals(loginReq.getCode(), code)) {
-					throw BusinessRuntimeException.getInstance("邮箱验证码错误,请重新输入");
-				}
-				redisService.del(RedisService.key.EMAIL_CODE_KEY.getNameFormat(loginReq.getEmail()));
+			String code = redisService.getStr(RedisService.key.EMAIL_CODE_KEY.getNameFormat(loginReq.getEmail()));
+			if (StrUtil.isEmpty(code)) {
+				throw BusinessRuntimeException.getInstance("邮箱验证码已失效,请重新获取");
+			}
+			if (!StrUtil.equals(loginReq.getCode(), code)) {
+				throw BusinessRuntimeException.getInstance("邮箱验证码错误,请重新输入");
 			}
+			redisService.del(RedisService.key.EMAIL_CODE_KEY.getNameFormat(loginReq.getEmail()));
 			wrapper.eq(User::getEmail, loginReq.getEmail());
 		}
 		if (loginReq.getType() == 3){

+ 1 - 1
netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/CmsGoodsDonCategoryController.java

@@ -196,7 +196,7 @@ public class CmsGoodsDonCategoryController {
 				.build());
 		all.forEach(data -> {
 			List<GoodsDonCategoryGoodsView> categoryGoodsViewList = beanSearcher.searchAll(GoodsDonCategoryGoodsView.class, MapUtils.
-					builder().put("category", String.format(" and gc.id = %s", data.getId()))
+					builder().field(GoodsDonCategoryGoodsView::getCategory, data.getId())
 					.field(GoodsDonCategoryGoodsView::getStatus, true).build());
 			data.setCategoryGoodsList(categoryGoodsViewList);
 		});

+ 1 - 0
netflix-web/src/main/java/com/cyksj/web/controller/manage/goods/shop/YhShopGoodsController.java

@@ -71,6 +71,7 @@ public class YhShopGoodsController {
 			sku.setUserId(userId);
 			sku.setYhsId(yhShop.getId());
 		});
+		yhShopGoodsSkuService.saveOrUpdateBatch(goodsSkus);
 		String yhShopCacheKey = RedisService.key.YH_HOME_PAGHE_CACHE_SHOP.getEnvName() + yhShop.getId() + "*";
 		Set<String> keys = redisService.keys(yhShopCacheKey);
 		redisService.del(keys.toArray(String[]::new));