yzh
2022-05-23 41ecad7e49a93c493832282b5ecd6c69f464b648
web/web/Setting.aspx
@@ -1,207 +1,210 @@
<%@ Page Language="C#" masterpagefile="~/Main.master" AutoEventWireup="true" CodeFile="Setting.aspx.cs" Inherits="SettingPage" %>
<asp:Content ID="Content3" ContentPlaceHolderID="title" runat="Server">
    告警参数设置
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <script>
        $(function () {
            var setting = <%=Newtonsoft.Json.JsonConvert.SerializeObject(this.Setting) %>
            var smtpProfile = $.evalJSON(setting.SmtpProfile);
            var wxProfile =  $.evalJSON(setting.WxProfile);
            var sms57Profile =  $.evalJSON(setting.SmsProfile);
            $("#SmtpServer").val(smtpProfile.SmtpServer);
            $("#SmtpPort").val(smtpProfile.SmtpPort);
            $("#SmtpUsername").val(smtpProfile.Username);
            $("#SmtpPassword").val(smtpProfile.Password);
            $("#SmtpSenderAddress").val(smtpProfile.SenderAddress);
            $("#SmtpSSL").iCheck(smtpProfile.SSL ? "check": "uncheck");
            $("#WxAppID").val(wxProfile.AppID);
            $("#WxAppSecret").val(wxProfile.AppSecret);
            $("#WxMsgTemplateID").val(wxProfile.MsgTemplateID);
            $("#SmsUserID").val( sms57Profile.UserID);
            $("#SmsAccount").val(sms57Profile.Account );
            $("#SmsPassword").val(sms57Profile.Password );
            $("#SmsMTURL").val(sms57Profile.MTURL);
            $("#SmsExtNo").val(sms57Profile.ExtNo);
            $("#CmSegments").val(setting.CmSegments);
            $("#CuSegments").val(setting.CuSegments);
            $("#CtSegments").val(setting.CtSegments);
            $("#GwName").val(setting.GwName);
            $("#BlackMoContent").val(setting.BlackMoContent);
            $(".action-save").on("click", function () {
                smtpProfile.SmtpServer = $("#SmtpServer").val();
                smtpProfile.SmtpPort = $("#SmtpPort").val();
                smtpProfile.Username = $("#SmtpUsername").val();
                smtpProfile.Password = $("#SmtpPassword").val();
                smtpProfile.SenderAddress = $("#SmtpSenderAddress").val();
                smtpProfile.SSL = $("#SmtpSSL").is(":checked") ? 1 : 0;
                wxProfile.AppID = $("#WxAppID").val();
                wxProfile.AppSecret = $("#WxAppSecret").val();
                wxProfile.MsgTemplateID = $("#WxMsgTemplateID").val();
                sms57Profile.UserID = $("#SmsUserID").val();
                sms57Profile.Account = $("#SmsAccount").val();
                sms57Profile.Password = $("#SmsPassword").val();
                sms57Profile.MTURL = $("#SmsMTURL").val();
                sms57Profile.ExtNo = $("#SmsExtNo").val();
                $.ajax({
                    url: "setting.ashx",
                    method: "POST",
                    data: { action: "save",
                        "smsProfile": $.toJSON(sms57Profile),
                        "smtpProfile": $.toJSON(smtpProfile),
                        "wxProfile": $.toJSON(wxProfile),
                        "cmSegments":$("#CmSegments").val(),
                        "cuSegments":$("#CuSegments").val(),
                        "ctSegments":$("#CtSegments").val(),
                        "gwName":$("#GwName").val(),
                        "blackMoContent":$("#BlackMoContent").val()
                    },
                    success: function (result) {
                        if (result.OK) {
                            mytek.alert(result.Message,"success");
                        } else {
                            mytek.alert(result.Message,"warning");
                        }
                    }
                });
            });
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="content" runat="Server">
    <form name="DefaultForm" method="post" action="GwSpUpdate.aspx" id="DefaultForm"
    class="form-horizontal">
    <div class="col-sm-12">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                基础设置
            </div>
            <div class="ibox-content">
                <div class="form-group">
                    <label class="control-label">
                        网关显示名称
                    </label>
                    <div>
                        <input type="text" name="GwName" id="GwName" value="" class="form-control" />
                    </div>
                </div>
                <div class="form-group hide">
                    <label class="control-label">
                        版权信息
                    </label>
                    <div>
                        <input type="text" name="CopyRights" id="CopyRights" value="" class="form-control" />
                    </div>
                </div>
                <div class="form-group hide">
                    <label class="control-label">
                        欢迎信息
                    </label>
                    <div>
                        <input type="text" name="WelcomeMessage" id="WelcomeMessage" value="" class="form-control" />
                    </div>
                </div>
                 <div class="form-group">
                    <label class="control-label">
                        手机上行自动加黑(多个上行内容之间用英文分号" ; "分割,内容中可以使用通配符" * ",每个 * 号代表0-10个字符)
                    </label>
                    <div>
                        <input type="text" value="" maxlength="1000" name="BlackMoContent" id="BlackMoContent" class="form-control" onkeyup="value=value.replace(/[^\a-\z\A-\Z0-9\u4E00-\u9FA5\*\;\ ]/g,'')"
                            onpaste="value=value.replace(/[^\a-\z\A-\Z0-9\u4E00-\u9FA5\*\;\ ]/g,'')" oncontextmenu = "value=value.replace(/[^\a-\z\A-\Z0-9\u4E00-\u9FA5\*\;\ ]/g,'')" />
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="col-sm-6 ">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                短信告警设置
            </div>
            <div class="ibox-content">
                <div class="form-group">
                    <label class="control-label">
                        USERID(接本SMGW网关平台,该值为0)</label>
                    <input type="text" value="" name="SmsUserID" id="SmsUserID" class="form-control" />
                </div>
                <div class="form-group">
                    <label class="control-label">
                        账号</label>
                    <input type="text" value="" name="SmsAccount" id="SmsAccount" class="form-control" />
                </div>
                <div class="form-group">
                    <label class="control-label">
                        密码</label>
                    <input type="password" value="" name="SmsPassword" id="SmsPassword" class="form-control" />
                </div>
                <div class="form-group">
                    <label class="control-label">
                        下发号码(或扩展码)</label>
                    <input type="text" value="" name="SmsExtNo" id="SmsExtNo" class="form-control" />
                </div>
                <div class="form-group">
                    <label class="control-label">
                        短信提交地址</label>
                    <input type="text" value="" name="SmsMTURL" id="SmsMTURL" class="form-control" />
                </div>
            </div>
        </div>
    </div>
    <div class="col-sm-6 ">
        <div class="ibox  float-e-margins">
            <div class="ibox-title">
                邮件告警设置
            </div>
            <div class="ibox-content">
                <div class="form-group ">
                    <label class="control-label">
                        SMTP服务器</label>
                    <input type="text" value="" name="SmtpServer" id="SmtpServer" class="form-control" />
                </div>
                <div class="form-group">
                    <label class="control-label">
                        SMTP端口</label>
                    <input type="text" value="" name="SmtpPort" id="SmtpPort" class="form-control" />
                </div>
                <div class="form-group">
                    <label class="control-label">
                        发送方邮件地址</label><input type="text" value="" name="SmtpSenderAddress" id="SmtpSenderAddress"
                            class="form-control" />
                </div>
                <div class="form-group">
                    <label class="control-label">
                        登录账号</label><input type="text" value="" name="SmtpUsername" id="SmtpUsername" class="form-control" />
                </div>
                <div class="form-group ">
                    <label class="control-label">
                        登录密码</label>
                    <input type="password" value="" name="SmtpPassword" id="SmtpPassword" class="form-control" />
                </div>
                <div class="form-group ">
                    <label class="control-label">
                        是否支持SSL</label>
                    <input type="checkbox" value="" name="SmtpSSL" id="SmtpSSL" class="form-control icheck-me" />
                </div>
            </div>
        </div>
    </div>
    <div class="ibox">
        <div class="ibox-content">
            <input class="action-save btn btn-primary pull-right" value="保存" type="button" />
        </div>
    </div>
    </form>
</asp:Content>
<%@ Page Language="C#" masterpagefile="~/Main.master" AutoEventWireup="true" CodeFile="Setting.aspx.cs" Inherits="SettingPage" %>
<asp:Content ID="Content3" ContentPlaceHolderID="title" runat="Server">
    告警参数设置
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <script>
        $(function () {
            var setting = <%=Newtonsoft.Json.JsonConvert.SerializeObject(this.Setting) %>
            var smtpProfile = $.evalJSON(setting.SmtpProfile);
            var wxProfile =  $.evalJSON(setting.WxProfile);
            var sms57Profile =  $.evalJSON(setting.SmsProfile);
            $("#SmtpServer").val(smtpProfile.SmtpServer);
            $("#SmtpPort").val(smtpProfile.SmtpPort);
            $("#SmtpUsername").val(smtpProfile.Username);
            $("#SmtpPassword").val(smtpProfile.Password);
            $("#SmtpSenderAddress").val(smtpProfile.SenderAddress);
            $("#SmtpSSL").iCheck(smtpProfile.SSL ? "check": "uncheck");
            $("#WxAppID").val(wxProfile.AppID);
            $("#WxAppSecret").val(wxProfile.AppSecret);
            $("#WxMsgTemplateID").val(wxProfile.MsgTemplateID);
            $("#SmsUserID").val( sms57Profile.UserID);
            $("#SmsAccount").val(sms57Profile.Account );
            $("#SmsPassword").val(sms57Profile.Password );
            $("#SmsMTURL").val(sms57Profile.MTURL);
            $("#SmsExtNo").val(sms57Profile.ExtNo);
            $("#CmSegments").val(setting.CmSegments);
            $("#CuSegments").val(setting.CuSegments);
            $("#CtSegments").val(setting.CtSegments);
            $("#GwName").val(setting.GwName);
            $("#BlackMoContent").val(setting.BlackMoContent);
            $(".action-save").on("click", function () {
                smtpProfile.SmtpServer = $("#SmtpServer").val();
                smtpProfile.SmtpPort = $("#SmtpPort").val();
                smtpProfile.Username = $("#SmtpUsername").val();
                smtpProfile.Password = $("#SmtpPassword").val();
                smtpProfile.SenderAddress = $("#SmtpSenderAddress").val();
                smtpProfile.SSL = $("#SmtpSSL").is(":checked") ? 1 : 0;
                wxProfile.AppID = $("#WxAppID").val();
                wxProfile.AppSecret = $("#WxAppSecret").val();
                wxProfile.MsgTemplateID = $("#WxMsgTemplateID").val();
                sms57Profile.UserID = $("#SmsUserID").val();
                sms57Profile.Account = $("#SmsAccount").val();
                sms57Profile.Password = $("#SmsPassword").val();
                sms57Profile.MTURL = $("#SmsMTURL").val();
                sms57Profile.ExtNo = $("#SmsExtNo").val();
                $.ajax({
                    url: "setting.ashx",
                    method: "POST",
                    data: { action: "save",
                        "smsProfile": $.toJSON(sms57Profile),
                        "smtpProfile": $.toJSON(smtpProfile),
                        "wxProfile": $.toJSON(wxProfile),
                        "cmSegments":$("#CmSegments").val(),
                        "cuSegments":$("#CuSegments").val(),
                        "ctSegments":$("#CtSegments").val(),
                        "gwName":$("#GwName").val(),
                        "blackMoContent":$("#BlackMoContent").val()
                    },
                    success: function (result) {
                        if (result.OK) {
                            mytek.alert(result.Message,"success");
                        } else {
                            mytek.alert(result.Message,"warning");
                        }
                    }
                });
            });
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="content" runat="Server">
    <form name="DefaultForm" method="post" action="GwSpUpdate.aspx" id="DefaultForm"
    class="form-horizontal">
    <div class="col-sm-12">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                基础设置
            </div>
            <div class="ibox-content">
                <div class="form-group">
                    <label class="control-label">
                        网关显示名称
                    </label>
                    <div>
                        <input type="text" name="GwName" id="GwName" value="" class="form-control" />
                    </div>
                </div>
                <div class="form-group hide">
                    <label class="control-label">
                        版权信息
                    </label>
                    <div>
                        <input type="text" name="CopyRights" id="CopyRights" value="" class="form-control" />
                    </div>
                </div>
                <div class="form-group hide">
                    <label class="control-label">
                        欢迎信息
                    </label>
                    <div>
                        <input type="text" name="WelcomeMessage" id="WelcomeMessage" value="" class="form-control" />
                    </div>
                </div>
                 <div class="form-group">
                    <label class="control-label">
                        手机上行自动加黑(多个上行内容之间用英文分号" ; "分割,内容中可以使用通配符" * ",每个 * 号代表0-10个字符)
                    </label>
                    <div>
                        <input type="text" value="" maxlength="1000" name="BlackMoContent" id="BlackMoContent" class="form-control" onkeyup="value=value.replace(/[^\a-\z\A-\Z0-9\u4E00-\u9FA5\*\;\ ]/g,'')"
                            onpaste="value=value.replace(/[^\a-\z\A-\Z0-9\u4E00-\u9FA5\*\;\ ]/g,'')" oncontextmenu = "value=value.replace(/[^\a-\z\A-\Z0-9\u4E00-\u9FA5\*\;\ ]/g,'')" />
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="col-sm-6 ">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                短信告警设置
            </div>
            <div class="ibox-content">
                <div class="form-group">
                    <label class="control-label">
                        USERID(接本SMGW网关平台,该值为0)</label>
                    <input type="text" value="" name="SmsUserID" id="SmsUserID" class="form-control" />
                </div>
                <div class="form-group">
                    <label class="control-label">
                        账号</label>
                    <input type="text" value="" name="SmsAccount" id="SmsAccount" class="form-control" />
                </div>
                <div class="form-group">
                    <label class="control-label">
                        密码</label>
                    <input type="password" value="" name="SmsPassword" id="SmsPassword" class="form-control" />
                </div>
                <div class="form-group">
                    <label class="control-label">
                        下发号码(或扩展码)</label>
                    <input type="text" value="" name="SmsExtNo" id="SmsExtNo" class="form-control" />
                </div>
                <div class="form-group">
                    <label class="control-label">
                        短信提交地址</label>
                    <input type="text" value="" name="SmsMTURL" id="SmsMTURL" class="form-control" />
                </div>
            </div>
        </div>
    </div>
    <div class="col-sm-6 ">
        <div class="ibox  float-e-margins">
            <div class="ibox-title">
                邮件告警设置
            </div>
            <div class="ibox-content">
                <div class="form-group ">
                    <label class="control-label">
                        SMTP服务器</label>
                    <input type="text" value="" name="SmtpServer" id="SmtpServer" class="form-control" />
                </div>
                <div class="form-group">
                    <label class="control-label">
                        SMTP端口</label>
                    <input type="text" value="" name="SmtpPort" id="SmtpPort" class="form-control" />
                </div>
                <div class="form-group">
                    <label class="control-label">
                        发送方邮件地址</label><input type="text" value="" name="SmtpSenderAddress" id="SmtpSenderAddress"
                            class="form-control" />
                </div>
                <div class="form-group">
                    <label class="control-label">
                        登录账号</label><input type="text" value="" name="SmtpUsername" id="SmtpUsername" class="form-control" />
                </div>
                <div class="form-group ">
                    <label class="control-label">
                        登录密码</label>
                    <input type="password" value="" name="SmtpPassword" id="SmtpPassword" class="form-control" />
                </div>
                <div class="form-group ">
                    <label class="control-label">
                        是否支持SSL</label>
                    <input type="checkbox" value="" name="SmtpSSL" id="SmtpSSL" class="form-control icheck-me" />
                </div>
            </div>
        </div>
    </div>
    <div class="ibox">
        <div class="ibox-content">
            <input class="action-save btn btn-primary pull-right" value="保存" type="button" />
        </div>
    </div>
    </form>
</asp:Content>