增加登录设置接口
This commit is contained in:
parent
b87ea37bb3
commit
c006488a4a
|
|
@ -1,22 +1,42 @@
|
|||
package com.mdd.admin.controller.setting;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.mdd.admin.service.setting.ISettingLoginService;
|
||||
import com.mdd.common.core.AjaxResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController("settingLoginController")
|
||||
@RequestMapping("api/setting/login")
|
||||
public class LoginController {
|
||||
|
||||
@Resource
|
||||
ISettingLoginService iSettingLoginService;
|
||||
|
||||
/**
|
||||
* 登录设置详情
|
||||
*
|
||||
* @author fzr
|
||||
* @return Object
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
public Object detail() {
|
||||
return null;
|
||||
Map<String, Object> map = iSettingLoginService.detail();
|
||||
return AjaxResult.success(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录设置保存
|
||||
*
|
||||
* @author fzr
|
||||
* @param params 参数
|
||||
* @return Object
|
||||
*/
|
||||
@PostMapping("/save")
|
||||
public Object save() {
|
||||
return null;
|
||||
public Object save(@RequestBody Map<String, String> params) {
|
||||
iSettingLoginService.save(params);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
package com.mdd.admin.service.setting;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 登录设置服务接口类
|
||||
*/
|
||||
public interface ISettingLoginService {
|
||||
|
||||
/**
|
||||
* 登录设置详情
|
||||
*
|
||||
* @author fzr
|
||||
* @return Map<String, String>
|
||||
*/
|
||||
Map<String, Object> detail();
|
||||
|
||||
/**
|
||||
* 登录设置保存
|
||||
*
|
||||
* @author fzr
|
||||
* @param params 参数
|
||||
*/
|
||||
void save(Map<String, String> params);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
package com.mdd.admin.service.setting;
|
||||
|
||||
public interface ISettingSearchService {
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
package com.mdd.admin.service.setting;
|
||||
|
||||
public interface ISettingUserService {
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
package com.mdd.admin.service.setting.impl;
|
||||
|
||||
import com.mdd.admin.service.setting.ISettingLoginService;
|
||||
import com.mdd.common.utils.ArrayUtil;
|
||||
import com.mdd.common.utils.ConfigUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 登录设置服务接口类
|
||||
*/
|
||||
@Service
|
||||
public class SettingLoginServiceImpl implements ISettingLoginService {
|
||||
|
||||
/**
|
||||
* 登录设置详情
|
||||
*
|
||||
* @author fzr
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> detail() {
|
||||
Map<String, String> config = ConfigUtil.get("login");
|
||||
Map<String, Object> response = new LinkedHashMap<>();
|
||||
// 登录方式
|
||||
response.put("loginWay", ArrayUtil.stringToListAsInt(config.getOrDefault("loginWay", ""), ","));
|
||||
// 强制绑定手机
|
||||
response.put("forceBindMobile", Integer.parseInt(config.getOrDefault("forceBindMobile", "0")));
|
||||
// 是否开启协议
|
||||
response.put("openAgreement", Integer.parseInt(config.getOrDefault("openAgreement", "0")));
|
||||
// 第三方的登录
|
||||
response.put("openOtherAuth", Integer.parseInt(config.getOrDefault("openOtherAuth", "0")));
|
||||
// 自动登录授权
|
||||
response.put("autoLoginAuth", ArrayUtil.stringToListAsInt(config.getOrDefault("autoLoginAuth", ""), ","));
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录设置保存
|
||||
*
|
||||
* @author fzr
|
||||
* @param params 参数
|
||||
*/
|
||||
@Override
|
||||
public void save(Map<String, String> params) {
|
||||
ConfigUtil.set("login", "loginWay", params.getOrDefault("loginWay", ""));
|
||||
ConfigUtil.set("login", "forceBindMobile", params.getOrDefault("forceBindMobile", "0"));
|
||||
ConfigUtil.set("login", "openAgreement", params.getOrDefault("openAgreement", "0"));
|
||||
ConfigUtil.set("login", "openOtherAuth", params.getOrDefault("openOtherAuth", "0"));
|
||||
ConfigUtil.set("login", "autoLoginAuth", params.getOrDefault("autoLoginAuth", ""));
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue