优化代码
This commit is contained in:
parent
cd5756e785
commit
da953520cb
@ -52,6 +52,9 @@ public class Constant {
|
|||||||
public static final Integer USER_NORMAL = 0;
|
public static final Integer USER_NORMAL = 0;
|
||||||
public static final Integer USER_BANNER = 1;
|
public static final Integer USER_BANNER = 1;
|
||||||
|
|
||||||
|
public static final String USER_BANNER_MSG = "该账号已被禁用";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -101,8 +101,8 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserDao, AppUserEntity> i
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void ban(Integer id) {
|
public void ban(Integer id) {
|
||||||
Integer status = this.lambdaQuery().eq(AppUserEntity::getUid, id).one().getStatus();
|
Integer status = this.lambdaQuery().eq(AppUserEntity::getUid, id).one().getStatus();
|
||||||
if (status.equals(Constant.USER_BANNER)) {
|
if(status.equals(Constant.USER_BANNER)){
|
||||||
throw new LinfengException("该用户已被禁用");
|
throw new LinfengException(Constant.USER_BANNER_MSG);
|
||||||
}
|
}
|
||||||
this.lambdaUpdate()
|
this.lambdaUpdate()
|
||||||
.set(AppUserEntity::getStatus, Constant.USER_BANNER)
|
.set(AppUserEntity::getStatus, Constant.USER_BANNER)
|
||||||
@ -116,7 +116,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserDao, AppUserEntity> i
|
|||||||
public void openBan(Integer id) {
|
public void openBan(Integer id) {
|
||||||
Integer status = this.lambdaQuery().eq(AppUserEntity::getUid, id).one().getStatus();
|
Integer status = this.lambdaQuery().eq(AppUserEntity::getUid, id).one().getStatus();
|
||||||
if (status.equals(Constant.USER_NORMAL)) {
|
if (status.equals(Constant.USER_NORMAL)) {
|
||||||
throw new LinfengException("该用户已解除禁用");
|
throw new LinfengException(Constant.USER_BANNER_MSG);
|
||||||
}
|
}
|
||||||
boolean update = this.lambdaUpdate()
|
boolean update = this.lambdaUpdate()
|
||||||
.set(AppUserEntity::getStatus, Constant.USER_NORMAL)
|
.set(AppUserEntity::getStatus, Constant.USER_NORMAL)
|
||||||
@ -165,7 +165,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserDao, AppUserEntity> i
|
|||||||
if (ObjectUtil.isNotNull(appUserEntity)) {
|
if (ObjectUtil.isNotNull(appUserEntity)) {
|
||||||
//登录
|
//登录
|
||||||
if (appUserEntity.getStatus().equals(Constant.USER_BANNER)) {
|
if (appUserEntity.getStatus().equals(Constant.USER_BANNER)) {
|
||||||
throw new LinfengException("该账户已被禁用");
|
throw new LinfengException(Constant.USER_BANNER_MSG);
|
||||||
}
|
}
|
||||||
return appUserEntity.getUid();
|
return appUserEntity.getUid();
|
||||||
} else {
|
} else {
|
||||||
@ -330,8 +330,8 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserDao, AppUserEntity> i
|
|||||||
.eq(AppUserEntity::getOpenid, openId)
|
.eq(AppUserEntity::getOpenid, openId)
|
||||||
.one();
|
.one();
|
||||||
if (ObjectUtil.isNotNull(user)) {
|
if (ObjectUtil.isNotNull(user)) {
|
||||||
if (user.getStatus() .equals(Constant.USER_BANNER)) {
|
if(user.getStatus().equals(Constant.USER_BANNER)){
|
||||||
throw new LinfengException("该账户已被禁用");
|
throw new LinfengException(Constant.USER_BANNER_MSG);
|
||||||
}
|
}
|
||||||
//其他业务todo
|
//其他业务todo
|
||||||
return user.getUid();
|
return user.getUid();
|
||||||
|
@ -202,7 +202,7 @@ public class PostServiceImpl extends ServiceImpl<PostDao, PostEntity> implements
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void addComment(AddCommentForm request, AppUserEntity user) {
|
public void addComment(AddCommentForm request, AppUserEntity user) {
|
||||||
if(user.getStatus().equals(Constant.USER_BANNER)){
|
if(user.getStatus().equals(Constant.USER_BANNER)){
|
||||||
throw new LinfengException("您的账号已被禁用!");
|
throw new LinfengException(Constant.USER_BANNER_MSG);
|
||||||
}
|
}
|
||||||
|
|
||||||
CommentEntity commentEntity=new CommentEntity();
|
CommentEntity commentEntity=new CommentEntity();
|
||||||
@ -217,8 +217,8 @@ public class PostServiceImpl extends ServiceImpl<PostDao, PostEntity> implements
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Integer addPost(AddPostForm request, AppUserEntity user) {
|
public Integer addPost(AddPostForm request, AppUserEntity user) {
|
||||||
if(user.getStatus()!=0){
|
if(user.getStatus().equals(Constant.USER_BANNER)){
|
||||||
throw new LinfengException("您的账号已被禁用");
|
throw new LinfengException(Constant.USER_BANNER_MSG);
|
||||||
}
|
}
|
||||||
PostEntity post=new PostEntity();
|
PostEntity post=new PostEntity();
|
||||||
BeanUtils.copyProperties(request,post);
|
BeanUtils.copyProperties(request,post);
|
||||||
|
@ -35,7 +35,7 @@ public class AppSystemConfigController {
|
|||||||
|
|
||||||
|
|
||||||
@ApiOperation("logo配置")
|
@ApiOperation("logo配置")
|
||||||
@GetMapping("/miniConfig")
|
@GetMapping("/config")
|
||||||
public R miniConfig(){
|
public R miniConfig(){
|
||||||
SystemEntity system = systemService.miniConfig();
|
SystemEntity system = systemService.miniConfig();
|
||||||
return R.ok().put("logo",system.getIntro());
|
return R.ok().put("logo",system.getIntro());
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
getSysInfo() {
|
getSysInfo() {
|
||||||
this.$H.get("system/miniConfig").then(res => {
|
this.$H.get("system/config").then(res => {
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
this.logo = res.logo;
|
this.logo = res.logo;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
getSysInfo() {
|
getSysInfo() {
|
||||||
this.$H.get("system/miniConfig").then(res => {
|
this.$H.get("system/config").then(res => {
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
this.logo = res.logo;
|
this.logo = res.logo;
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
getSysInfo() {
|
getSysInfo() {
|
||||||
this.$H.get('system/miniConfig').then(res => {
|
this.$H.get('system/config').then(res => {
|
||||||
this.shareCover = res.logo;
|
this.shareCover = res.logo;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user