add gateway reload

This commit is contained in:
东煌 2020-08-26 17:42:22 +08:00
parent 226cdd6cce
commit f60a0d129e
7 changed files with 70 additions and 7 deletions

View File

@ -77,10 +77,23 @@
<groupId>com.wacai.tigon</groupId>
<artifactId>tigon-web-controller</artifactId>
</dependency>
<dependency>
<groupId>com.pudonghot.yo</groupId>
<artifactId>yo-fsesl-api</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-dependencies-zookeeper</artifactId>
<type>pom</type>
</dependency>
<!-- Provided Dependencies -->
<dependency>
<groupId>org.projectlombok</groupId>

View File

@ -1,19 +1,26 @@
package com.pudonghot.yo.cms.controller;
import com.pudonghot.yo.cms.form.create.CreateFormGateway;
import lombok.extern.slf4j.Slf4j;
import com.wacai.tigon.form.FormList;
import org.springframework.util.Assert;
import com.pudonghot.yo.model.domain.Gateway;
import com.wacai.tigon.web.annotation.ListApi;
import org.springframework.stereotype.Controller;
import org.freeswitch.esl.client.EslClientApi;
import com.wacai.tigon.web.annotation.FilterCol;
import org.springframework.stereotype.Controller;
import com.wacai.tigon.web.controller.BaseCrudController;
import org.springframework.web.bind.annotation.RequestMapping;
import com.pudonghot.yo.cms.form.create.CreateFormGateway;
import com.pudonghot.yo.cms.form.update.UpdateFormGateway;
import org.springframework.web.bind.annotation.PostMapping;
import org.freeswitch.esl.client.transport.message.Message;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired;
/**
* @author Donghuang <br>
* Nov 01, 2019 22:53:11
*/
@Slf4j
@Controller
@ListApi(searchCols = {
Gateway.NAME,
@ -29,4 +36,17 @@ public class GatewayController
FormList,
CreateFormGateway,
UpdateFormGateway> {
@Autowired
private EslClientApi clientApi;
@PostMapping("/reload-mod-sofia")
public void reloadModSofia() {
final Message resp = clientApi.api("reload", "mod_sofia");
Assert.state(resp.isReplyOk(),
() -> {
log.error("Reload mod sofia failed [{}] [{}].",
resp.getHeaders(), resp.getBody());
return "Reload mod_sofia failed";
});
}
}

View File

@ -8,9 +8,6 @@ spring.servlet.multipart.max-file-size=256MB
spring.servlet.multipart.max-request-size=256MB
site.context-path=
# Feign
feign.client.config.default.logger-level=full
# Datasource
yo.datasource.url=jdbc:mysql://localhost/yoqw?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
yo.datasource.username=yoqw
@ -42,3 +39,9 @@ tigon.shiro.filter-chain=${site.context-path}/auth/login=anon \
yo.cms.sound.store-dir=/Users/chyxion/cms-sound
yo.cms.sound.base-path=http://localhost:8180/sound/file/
# Dubbo
## Dubbo Registry
dubbo.registry.address=zookeeper://localhost:2181
dubbo.registry.file=${user.home}/dubbo-cache/${spring.application.name}/dubbo.cache

View File

@ -1,7 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:dubbo="http://dubbo.apache.org/schema/dubbo"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
http://www.springframework.org/schema/beans/spring-beans.xsd
http://dubbo.apache.org/schema/dubbo
http://dubbo.apache.org/schema/dubbo/dubbo.xsd">
<dubbo:reference id="eslClientApi"
interface="org.freeswitch.esl.client.EslClientApi"
cluster="broadcast"
/>
</beans>

View File

@ -3,4 +3,15 @@ import BaseListRoute from './../base-list';
export default BaseListRoute.extend({
perm: 'PERM_VIEW_GATEWAY_LIST',
breadcrumbs: [{text: '网关列表'}],
actions: {
reloadModSofia() {
const me = this;
me.get('dialog').confirm('确认要重新加载网关配置么,请谨慎操作!', () => {
me.get('service').ajaxPost('reload-mod-sofia')
.then(() => {
me.get('message').alert('重新加载网关配置成功');
});
});
}
}
});

View File

@ -8,6 +8,14 @@
{{/link-to}}
</li>
{{/has-perm}}
{{#has-perm 'PERM_VIEW_GATEWAY_RELOAD'}}
<li>
{{#a-btn click=(route-action 'reloadModSofia')}}
<i class="ace-icon fa fa-gears bigger-120"></i>
重新加载网关
{{/a-btn}}
</li>
{{/has-perm}}
{{/grid-header}}
<div class="widget-body">