You've already forked FrameTour-BE
feat(scenic-account): 添加景区账号激活/停用功能并优化登录验证
- 新增激活/停用景区账号的接口和相关逻辑 - 在登录时增加账号激活状态的验证 - 更新数据库表结构,添加 isActive 字段 - 优化 MyBatis 映射文件,支持新功能
This commit is contained in:
@@ -39,6 +39,13 @@ public class ScenicAccountController {
|
||||
return result > 0 ? ApiResponse.success("更新成功") : ApiResponse.fail("更新失败");
|
||||
}
|
||||
|
||||
// 激活/停用景区账号
|
||||
@PostMapping("/updateActiveStatus/{id}")
|
||||
public ApiResponse updateActiveStatus(@PathVariable Long id) {
|
||||
int result = service.updateActiveStatus(id);
|
||||
return result > 0 ? ApiResponse.success("操作成功") : ApiResponse.fail("操作失败");
|
||||
}
|
||||
|
||||
// 更新景区账号
|
||||
@PostMapping("/update")
|
||||
public ApiResponse updateScenicAccount(@RequestBody ScenicAccountEntity entity) {
|
||||
|
@@ -14,6 +14,7 @@ public interface ScenicAccountMapper {
|
||||
int update(ScenicAccountEntity scenicAccount);
|
||||
int deleteById(Long id);
|
||||
int updateStatus(Long id);
|
||||
int updateActiveStatus(Long id);
|
||||
int deleteByScenicId(Long scenicId);
|
||||
|
||||
ScenicAccountEntity findAccountById(String id);
|
||||
|
@@ -17,6 +17,7 @@ public class ScenicAccountEntity {
|
||||
private String account;
|
||||
private String password;
|
||||
private Integer status;
|
||||
private Integer isActive;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
}
|
||||
|
@@ -90,6 +90,9 @@ public class AppScenicServiceImpl implements AppScenicService {
|
||||
if (scenicAccount.getStatus() == 0) {
|
||||
return ApiResponse.fail("账号已被禁用");
|
||||
}
|
||||
if (scenicAccount.getIsActive() == null || scenicAccount.getIsActive() != 1) {
|
||||
return ApiResponse.fail("账号未激活");
|
||||
}
|
||||
if (!scenicAccount.getPassword().equals(scenicLoginReq.getPassword())) {
|
||||
return ApiResponse.fail("密码错误");
|
||||
}
|
||||
|
@@ -17,5 +17,7 @@ public interface ScenicAccountService {
|
||||
|
||||
int updateStatus(Long id);
|
||||
|
||||
int updateActiveStatus(Long id);
|
||||
|
||||
ScenicAccountEntity getScenicAccountByAccount(String account);
|
||||
}
|
@@ -72,6 +72,11 @@ public class ScenicAccountServiceImpl implements ScenicAccountService {
|
||||
return mapper.updateStatus(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateActiveStatus(Long id) {
|
||||
return mapper.updateActiveStatus(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScenicAccountEntity getScenicAccountByAccount(String account) {
|
||||
ScenicAccountEntity accountEntity = mapper.getByAccount(account);
|
||||
|
@@ -141,6 +141,6 @@ public class WxMpUtil {
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
generateWXAQRCode("wxe7ff26af70bfc37c", "5252fbbc68513bc77b7cc0052b9f9695", "trial", "pages/home/index?scenicId=3978838215909052416", "dhg_t.jpg");
|
||||
generateWXAQRCode("wxe7ff26af70bfc37c", "5252fbbc68513bc77b7cc0052b9f9695", "trial", "pages/home/index?scenicId=3930324797233434624&morphId=22", "zt_p_t.jpg");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user