123
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package com.ruoyi.cai.controller.admin;
|
||||
|
||||
import com.ruoyi.cai.dto.admin.SystemConfigResponse;
|
||||
import com.ruoyi.cai.enums.SystemConfigEnum;
|
||||
import com.ruoyi.cai.manager.SystemConfigManager;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/cai/systemConfig")
|
||||
public class SystemConfigController {
|
||||
@Autowired
|
||||
private SystemConfigManager systemConfigManager;
|
||||
@GetMapping("/all")
|
||||
public R<List<SystemConfigResponse>> all(){
|
||||
List<SystemConfigResponse> responses = new ArrayList<>();
|
||||
Map<String, String> allSystemConfig = systemConfigManager.getAllSystemConfig();
|
||||
SystemConfigEnum[] values = SystemConfigEnum.values();
|
||||
for (SystemConfigEnum value : values) {
|
||||
SystemConfigResponse sys = new SystemConfigResponse();
|
||||
sys.setKey(value.getKey());
|
||||
sys.setValue(allSystemConfig.getOrDefault(value.getKey(),value.getDefaultValue()));
|
||||
sys.setDesc(value.getDesc());
|
||||
responses.add(sys);
|
||||
}
|
||||
return R.ok(responses);
|
||||
}
|
||||
|
||||
@GetMapping("/update")
|
||||
public R<Boolean> update(String key,String value){
|
||||
systemConfigManager.set(key,value);
|
||||
return R.ok(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.ruoyi.cai.dto.admin;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class SystemConfigResponse implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 823337632804304288L;
|
||||
private String key;
|
||||
private String desc;
|
||||
private String value;
|
||||
}
|
||||
@@ -9,9 +9,6 @@ import java.time.LocalDateTime;
|
||||
@Data
|
||||
@Schema(description = "用户列表返回")
|
||||
public class UserListVo extends UserBaseVo {
|
||||
/**
|
||||
* 最后在线时间
|
||||
*/
|
||||
@Schema(description = "最后在线时间")
|
||||
private LocalDateTime lastLiveTime;
|
||||
@Schema(description = "绑定时间")
|
||||
private LocalDateTime bindTime;
|
||||
}
|
||||
|
||||
@@ -98,4 +98,8 @@ public class SystemConfigManager {
|
||||
public void setSystemConfig(SystemConfigEnum systemConfig,String value){
|
||||
redisTemplate.opsForHash().put(RedisConstant.SYSTEM_CONFIG, systemConfig.name(),value);
|
||||
}
|
||||
|
||||
public void set(String key, String value) {
|
||||
redisTemplate.opsForHash().put(RedisConstant.SYSTEM_CONFIG, key,value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public interface UserInviteMapper extends BaseMapper<UserInvite> {
|
||||
|
||||
InviteCountDTO countInviteAndReward(@Param("userId") Long userId);
|
||||
|
||||
Page<UserListVo> inviteUserPage(@Param("build") Page<Object> build, @Param("userId") Long userId);
|
||||
Page<UserListVo> inviteUserPage(@Param("build") Page<Object> build, @Param("inviteId") Long inviteId);
|
||||
|
||||
Page<UserInviteAdminVo> pageAdmin(@Param("build") Page<Object> build, @Param("bo") UserInviteAdminVo bo);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ public interface UserInviteService extends IService<UserInvite> {
|
||||
|
||||
InviteHomeVo inviteHome(Long userId);
|
||||
|
||||
Page<UserListVo> inviteUserPage(PageQuery pageQuery, Long userId);
|
||||
Page<UserListVo> inviteUserPage(PageQuery pageQuery, Long inviteId);
|
||||
|
||||
Page<UserInviteAdminVo> pageAdmin(PageQuery pageQuery, UserInviteAdminVo bo);
|
||||
|
||||
|
||||
@@ -58,9 +58,12 @@ public class UserInviteServiceImpl extends ServiceImpl<UserInviteMapper, UserInv
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取我邀请的人
|
||||
*/
|
||||
@Override
|
||||
public Page<UserListVo> inviteUserPage(PageQuery pageQuery, Long userId) {
|
||||
return baseMapper.inviteUserPage(pageQuery.build(),userId);
|
||||
public Page<UserListVo> inviteUserPage(PageQuery pageQuery, Long inviteId) {
|
||||
return baseMapper.inviteUserPage(pageQuery.build(),inviteId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user