lianghanqiang 4 жил өмнө
parent
commit
ca214cdc3f

+ 3 - 3
src/main/java/org/springblade/gateway/client_gateway/controller/ClientUserController.java

@@ -1,5 +1,6 @@
 package org.springblade.gateway.client_gateway.controller;
 
+import cn.hutool.core.lang.Assert;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -41,9 +42,8 @@ public class ClientUserController {
 			user.setNickName(loginDto.getNickName());
 			user.setOpenid(loginDto.getOpenid());
 			user.setSex(StringUtil.isBlank(loginDto.getGender())? "0":loginDto.getGender());
-			if(!loginUserService.save(user)){
-				throw new ServiceException(ResCode.PAY_SCENE_ERROR);
-			}
+			Assert.isTrue(loginUserService.save(user),()->{	throw new ServiceException(ResCode.PAY_SCENE_ERROR);
+			});
 		}
 		return R.data(user);
 	}

+ 5 - 4
src/main/java/org/springblade/gateway/shop_gateway/controller/AppAccountController.java

@@ -40,8 +40,8 @@ public class AppAccountController {
 	public R login(@RequestBody Account account) throws ServiceException  {
 
 		Account user = accountService.getOne(new QueryWrapper<Account>().lambda().eq(Account::getPhone, account.getPhone()));
-		Assert.isNull(user,() ->{throw new ServiceException(ResCode.USER_NOT_FOUNT);});
-		Assert.isFalse(Objects.equals(user.getSecret(), DigestUtil.hex(account.getSecret())),() -> {
+		Assert.notNull(user,() ->{throw new ServiceException(ResCode.USER_NOT_FOUNT);});
+		Assert.isTrue(Objects.equals(user.getSecret(), DigestUtil.hex(account.getSecret())),() -> {
 			throw new ServiceException(ResCode.USER_PWS_ERROR);
 		});
 		return R.data(user);
@@ -52,17 +52,18 @@ public class AppAccountController {
 	@SneakyThrows
 	public R register(@RequestBody AppAccountDto appAccountDto) {
 
-		Assert.isFalse(SmsUtil.validateMessage(null,appAccountDto.getSmsId(),appAccountDto.getValue(),appAccountDto.getPhone()),()->{
+		Assert.isTrue(SmsUtil.validateMessage(null,appAccountDto.getSmsId(),appAccountDto.getValue(),appAccountDto.getPhone()),()->{
 			throw new ServiceException(ResCode.VALIDATE_FAIL);
 		});
 		Account account = new Account();
 		BeanUtil.copyProperties(appAccountDto,account);
 		account.setSecret(DigestUtil.hex(account.getSecret()));
-		Assert.isFalse(accountService.saveOrUpdate(account),()->{
+		Assert.isTrue(accountService.saveOrUpdate(account),()->{
 			throw new ServiceException(ResCode.SHOP_REGISTER_ERROR);
 		});
 
 		return R.data(account);
 
 	}
+
 }