调整接口
This commit is contained in:
parent
4dc75a0459
commit
82f2a92dfd
|
|
@ -17,7 +17,7 @@ import java.util.Map;
|
||||||
public class IndexController {
|
public class IndexController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
IIndexService IIndexService;
|
IIndexService iIndexService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 首页
|
* 首页
|
||||||
|
|
@ -27,7 +27,7 @@ public class IndexController {
|
||||||
*/
|
*/
|
||||||
@GetMapping("/index")
|
@GetMapping("/index")
|
||||||
public Object index() {
|
public Object index() {
|
||||||
Map<String, Object> detail = IIndexService.index();
|
Map<String, Object> detail = iIndexService.index();
|
||||||
return AjaxResult.success(detail);
|
return AjaxResult.success(detail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -40,7 +40,7 @@ public class IndexController {
|
||||||
*/
|
*/
|
||||||
@GetMapping("/decorate")
|
@GetMapping("/decorate")
|
||||||
public Object decorate(@Validated @IDMust() @RequestParam("id") Integer id) {
|
public Object decorate(@Validated @IDMust() @RequestParam("id") Integer id) {
|
||||||
Map<String, Object> detail = IIndexService.decorate(id);
|
Map<String, Object> detail = iIndexService.decorate(id);
|
||||||
return AjaxResult.success(detail);
|
return AjaxResult.success(detail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -52,6 +52,8 @@ public class IndexController {
|
||||||
*/
|
*/
|
||||||
@GetMapping("/config")
|
@GetMapping("/config")
|
||||||
public Object config() {
|
public Object config() {
|
||||||
return AjaxResult.success();
|
Map<String, Object> map = iIndexService.config();
|
||||||
|
return AjaxResult.success(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,28 +39,13 @@ public class IndexServiceImpl implements IIndexService {
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> index() {
|
public Map<String, Object> index() {
|
||||||
Map<String, Object> response = new LinkedHashMap<>();
|
Map<String, Object> response = new LinkedHashMap<>();
|
||||||
|
|
||||||
DecoratePage decoratePage = decoratePageMapper.selectOne(
|
DecoratePage decoratePage = decoratePageMapper.selectOne(
|
||||||
new QueryWrapper<DecoratePage>()
|
new QueryWrapper<DecoratePage>()
|
||||||
.eq("id", 1)
|
.eq("id", 1)
|
||||||
.last("limit 1"));
|
.last("limit 1"));
|
||||||
|
|
||||||
List<Map<String, String>> tabs = new LinkedList<>();
|
response.put("domain", UrlUtil.domain());
|
||||||
List<DecorateTabbar> decorateTabbars = decorateTabbarMapper.selectList(new QueryWrapper<DecorateTabbar>().orderByAsc("id"));
|
|
||||||
for (DecorateTabbar tab: decorateTabbars) {
|
|
||||||
Map<String, String> map = new LinkedHashMap<>();
|
|
||||||
map.put("name", tab.getName());
|
|
||||||
map.put("selected", UrlUtil.toAbsoluteUrl(tab.getSelected()));
|
|
||||||
map.put("unselected", UrlUtil.toAbsoluteUrl(tab.getUnselected()));
|
|
||||||
map.put("link", tab.getLink());
|
|
||||||
tabs.add(map);
|
|
||||||
}
|
|
||||||
|
|
||||||
String tabbarStyle = ConfigUtil.get("tabbar", "style", "{}");
|
|
||||||
|
|
||||||
response.put("pages", decoratePage.getPageData());
|
response.put("pages", decoratePage.getPageData());
|
||||||
response.put("style", ToolsUtil.jsonToMap(tabbarStyle));
|
|
||||||
response.put("tabbar", tabs);
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -95,7 +80,24 @@ public class IndexServiceImpl implements IIndexService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> config() {
|
public Map<String, Object> config() {
|
||||||
return null;
|
Map<String, Object> response = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
List<Map<String, String>> tabs = new LinkedList<>();
|
||||||
|
List<DecorateTabbar> decorateTabbars = decorateTabbarMapper.selectList(new QueryWrapper<DecorateTabbar>().orderByAsc("id"));
|
||||||
|
for (DecorateTabbar tab: decorateTabbars) {
|
||||||
|
Map<String, String> map = new LinkedHashMap<>();
|
||||||
|
map.put("name", tab.getName());
|
||||||
|
map.put("selected", UrlUtil.toAbsoluteUrl(tab.getSelected()));
|
||||||
|
map.put("unselected", UrlUtil.toAbsoluteUrl(tab.getUnselected()));
|
||||||
|
map.put("link", tab.getLink());
|
||||||
|
tabs.add(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
String tabbarStyle = ConfigUtil.get("tabbar", "style", "{}");
|
||||||
|
response.put("domain", UrlUtil.domain());
|
||||||
|
response.put("style", ToolsUtil.jsonToMap(tabbarStyle));
|
||||||
|
response.put("tabbar", tabs);
|
||||||
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue