增加渠道设置

This commit is contained in:
TinyAnts 2022-08-26 14:43:27 +08:00
parent f5814b242a
commit 00a9b9ede0
6 changed files with 115 additions and 12 deletions

View File

@ -19,7 +19,7 @@ public class H5Controller {
IChannelH5Service iChannelH5Service;
/**
* H5渠道置详情
* H5渠道置详情
*
* @author fzr
* @return Object
@ -31,13 +31,13 @@ public class H5Controller {
}
/**
* H5渠道置保存
* H5渠道置保存
*
* @author fzr
* @param param 参数
* @return Object
*/
@Log(title = "H5渠道保存")
@Log(title = "H5渠道设置保存")
@PostMapping("/save")
public Object save(@RequestBody Map<String, String> param) {
iChannelH5Service.save(param);

View File

@ -19,7 +19,7 @@ public class MpController {
IChannelMpService iChannelMpService;
/**
* 微信小程序渠道置详情
* 微信小程序渠道置详情
*
* @author fzr
* @return Object
@ -31,13 +31,13 @@ public class MpController {
}
/**
* 微信小程序渠道置保存
* 微信小程序渠道置保存
*
* @author fzr
* @param param 参数
* @return Object
*/
@Log(title = "微信小程序渠道保存")
@Log(title = "微信小程序渠道设置保存")
@PostMapping("/save")
public Object save(@RequestBody Map<String, String> param) {
iChannelMpService.save(param);

View File

@ -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.IChannelOaService;
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/oa")
public class OaController {
@Resource
IChannelOaService iChannelOaService;
/**
* 公众号渠道设置详情
*
* @author fzr
* @return Object
*/
@GetMapping("/detail")
public Object detail() {
Map<String, Object> map = iChannelOaService.detail();
return AjaxResult.success(map);
}
/**
* 公众号渠道设置保存
*
* @author fzr
* @param param 参数
* @return Object
*/
@Log(title = "公众号渠道设置保存")
@PostMapping("/save")
public Object save(@RequestBody Map<String, String> param) {
iChannelOaService.save(param);
return AjaxResult.success();
}
}

View File

@ -20,7 +20,7 @@ public class WxController {
IChannelWxService iChannelWxService;
/**
* H5渠道配置详情
* 开放平台渠道设置详情
*
* @author fzr
* @return Object
@ -32,13 +32,13 @@ public class WxController {
}
/**
* H5渠道配置保存
* 开放平台渠道设置保存
*
* @author fzr
* @param param 参数
* @return Object
*/
@Log(title = "微信开放平台渠道保存")
@Log(title = "开放平台渠道设置保存")
@PostMapping("/save")
public Object save(@RequestBody Map<String, String> param) {
iChannelWxService.save(param);

View File

@ -1,4 +1,25 @@
package com.mdd.admin.service.channel;
import java.util.Map;
/**
* 公众号渠道设置服务接口类
*/
public interface IChannelOaService {
/**
* 公众号设置详情
*
* @author fzr
* @return Map<String, String>
*/
Map<String, Object> detail();
/**
* 公众号设置保存
*
* @author fzr
*/
void save(Map<String, String> param);
}

View File

@ -1,4 +1,50 @@
package com.mdd.admin.service.channel.impl;
public class ChannelOaServiceImpl {
import com.mdd.admin.service.channel.IChannelOaService;
import com.mdd.common.utils.ConfigUtil;
import com.mdd.common.utils.UrlUtil;
import org.springframework.stereotype.Service;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 公众号渠道设置服务实现类
*/
@Service
public class ChannelOaServiceImpl implements IChannelOaService {
/**
* 公众号渠道设置详情
*
* @author fzr
* @return Map<String, Object>
*/
@Override
public Map<String, Object> detail() {
Map<String, String> config = ConfigUtil.get("oa_channel");
Map<String, Object> map = new LinkedHashMap<>();
map.put("name", config.getOrDefault("name", ""));
map.put("primaryId", config.getOrDefault("primaryId", ""));
map.put("qrCode", UrlUtil.toAbsoluteUrl(config.getOrDefault("qrCode", "")));
map.put("appId", config.getOrDefault("appId", ""));
map.put("appSecret", config.getOrDefault("appSecret", ""));
return map;
}
/**
* 公众号渠道设置保存
*
* @author fzr
* @param param 参数
*/
@Override
public void save(Map<String, String> param) {
ConfigUtil.set("mp_channel", "name", param.getOrDefault("name", ""));
ConfigUtil.set("mp_channel", "primaryId", param.getOrDefault("primaryId", ""));
ConfigUtil.set("mp_channel", "qrCode", UrlUtil.toRelativeUrl(param.getOrDefault("qrCode", "")));
ConfigUtil.set("mp_channel", "appId", param.getOrDefault("appId", ""));
ConfigUtil.set("mp_channel", "appSecret", param.getOrDefault("appSecret", ""));
}
}