增加微信开放平台配置接口
This commit is contained in:
parent
77c4ef41ae
commit
f5814b242a
|
|
@ -1,7 +1,13 @@
|
|||
package com.mdd.admin.controller.channel;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.mdd.admin.config.aop.Log;
|
||||
import com.mdd.admin.service.channel.IChannelH5Service;
|
||||
import com.mdd.admin.service.channel.IChannelWxService;
|
||||
import com.mdd.common.core.AjaxResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 微信开发平台渠道设置
|
||||
|
|
@ -9,4 +15,34 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
@RestController
|
||||
@RequestMapping("api/channel/wx")
|
||||
public class WxController {
|
||||
|
||||
@Resource
|
||||
IChannelWxService iChannelWxService;
|
||||
|
||||
/**
|
||||
* H5渠道配置详情
|
||||
*
|
||||
* @author fzr
|
||||
* @return Object
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
public Object detail() {
|
||||
Map<String, Object> map = iChannelWxService.detail();
|
||||
return AjaxResult.success(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* H5渠道配置保存
|
||||
*
|
||||
* @author fzr
|
||||
* @param param 参数
|
||||
* @return Object
|
||||
*/
|
||||
@Log(title = "微信开放平台渠道保存")
|
||||
@PostMapping("/save")
|
||||
public Object save(@RequestBody Map<String, String> param) {
|
||||
iChannelWxService.save(param);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,25 @@
|
|||
package com.mdd.admin.service.channel;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 微信开放平台设置服务接口类
|
||||
*/
|
||||
public interface IChannelWxService {
|
||||
|
||||
/**
|
||||
* 微信开放平台设置详情
|
||||
*
|
||||
* @author fzr
|
||||
* @return Map<String, String>
|
||||
*/
|
||||
Map<String, Object> detail();
|
||||
|
||||
/**
|
||||
* 微信开放平台设置保存
|
||||
*
|
||||
* @author fzr
|
||||
*/
|
||||
void save(Map<String, String> param);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,43 @@
|
|||
package com.mdd.admin.service.channel.impl;
|
||||
|
||||
public class ChannelWxServiceImpl {
|
||||
import com.mdd.admin.service.channel.IChannelWxService;
|
||||
import com.mdd.common.utils.ConfigUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 微信开放平台设置服务实现类
|
||||
*/
|
||||
@Service
|
||||
public class ChannelWxServiceImpl implements IChannelWxService {
|
||||
|
||||
/**
|
||||
* 微信开放平台设置详情
|
||||
*
|
||||
* @author fzr
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> detail() {
|
||||
Map<String, String> config = ConfigUtil.get("wx_channel");
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("appId", config.getOrDefault("appId", "0"));
|
||||
map.put("appSecret", config.getOrDefault("appSecret", "0"));
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信开放平台设置保存
|
||||
*
|
||||
* @author fzr
|
||||
* @param param 参数
|
||||
*/
|
||||
@Override
|
||||
public void save(Map<String, String> param) {
|
||||
ConfigUtil.set("wx_channel", "appId", param.getOrDefault("appId", ""));
|
||||
ConfigUtil.set("wx_channel", "appSecret", param.getOrDefault("appSecret", ""));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue