/*
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
|
*
|
* https://www.mall4j.com/
|
*
|
* 未经允许,不可做商业用途!
|
*
|
* 版权所有,侵权必究!
|
*/
|
package com.yami.shop.api.controller;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.yami.shop.bean.enums.WebConfigTypeEnum;
|
import com.yami.shop.bean.model.WebConfig;
|
import com.yami.shop.common.annotation.SysLog;
|
import com.yami.shop.common.bean.SysUpgradeInfo;
|
import com.yami.shop.common.response.ServerResponseEntity;
|
import com.yami.shop.service.SysConfigService;
|
import com.yami.shop.service.SysUpgradeInfoService;
|
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.Operation;
|
import lombok.AllArgsConstructor;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import java.util.List;
|
|
/**
|
* @author SJL
|
* @date 2021-02-20 09:44:42
|
*/
|
@RestController
|
@AllArgsConstructor
|
@RequestMapping("/webConfig")
|
@Tag(name = "网站配置接口")
|
public class WebConfigController {
|
|
private final SysConfigService sysConfigService;
|
@Autowired
|
private SysUpgradeInfoService sysUpgradeInfoService;
|
|
@GetMapping("/getPcWebConfig")
|
@Operation(summary = "获取当前激活的PC端网站配置")
|
public ServerResponseEntity<WebConfig> getWebConfig() {
|
return ServerResponseEntity.success(sysConfigService.getSysConfigObject(WebConfigTypeEnum.PC.value(), WebConfig.class));
|
}
|
|
@GetMapping("/getUniWebConfig")
|
@Operation(summary = "获取当前激活的H5端网站配置")
|
public ServerResponseEntity<WebConfig> getUniWebConfig() {
|
return ServerResponseEntity.success(sysConfigService.getSysConfigObject(WebConfigTypeEnum.H5.value(), WebConfig.class));
|
}
|
|
@GetMapping("/getStationWebConfig")
|
@Operation(summary = "获取自提点端网站配置")
|
public ServerResponseEntity<WebConfig> getStationWebConfig() {
|
return ServerResponseEntity.success(sysConfigService.getSysConfigObject(WebConfigTypeEnum.STATION.value(), WebConfig.class));
|
|
}
|
|
@SysLog("获取配置信息")
|
@GetMapping("/info/{key}")
|
@Operation(summary = "获取配置信息" , description = "获取配置信息")
|
@Parameter(name = "key", description = "参数名" )
|
public ServerResponseEntity<String> info(@PathVariable("key") String key) {
|
return ServerResponseEntity.success(sysConfigService.getValue(key));
|
}
|
|
@GetMapping("/getReleaseInfo" )
|
@Operation(summary = "查询最新升级公告" , description = "查询最新升级公告")
|
public ServerResponseEntity<SysUpgradeInfo> getReleaseInfo() {
|
List<SysUpgradeInfo> sysUpgradeInfos= sysUpgradeInfoService.list(
|
new LambdaQueryWrapper<SysUpgradeInfo>().orderByDesc(SysUpgradeInfo::getReleaseTime)
|
);
|
return ServerResponseEntity.success(sysUpgradeInfos.get(0));
|
}
|
}
|