目錄
前言
心智圖
表結構
對應的枚舉
 
首頁 微信小程式 微信開發 ASP.NET MVC5+EF6+EasyUI 後台管理系統微信公眾平台開發

ASP.NET MVC5+EF6+EasyUI 後台管理系統微信公眾平台開發

Mar 08, 2017 pm 04:24 PM
微信開發

前言

回顧上一節,我們熟悉的了解了訊息的請求和回應,這一節我們來建立資料庫的表,表的設計蠻複雜

你也可以依照自己所分析的情形結構來建表

必須非常熟悉表的結果才能運用這張表,這表表的情形涵蓋比較多

心智圖

我這個人比較喜歡用心智圖來分析和表達一些模型:

 ASP.NET MVC5+EF6+EasyUI 后台管理系统微信公众平台开发

表結構

根據心智圖,我們可以建立的表可以是3張表:訊息表,規則表,類型表

訊息表:實際的訊息

規則表:文字、圖文、語音等

類型表:文字、圖文、語音(預設回复,訂閱回复)

也可以是兩張表:規製表,訊息表(+一個類型欄位)

我這裡只設計一張表:訊息表(+一個規則欄位+一個類型欄位)

設計表結構與個人的平時習慣有關係,我還是喜歡簡單的東西,別為了設計而去專門設計,這樣只會增加系統的複雜度


CREATE TABLE [dbo].[WC_MessageResponse](    [Id] [varchar](50) NOT NULL,              --主键        
    [OfficalAccountId] [varchar](50) NULL,    --所属公众号
    [MessageRule] [int] NULL,                 --消息规则(枚举)
    [Category] [int] NULL,                    --类型(枚举)
    [MatchKey] [varchar](1000) NULL,          --关键字
    [TextContent] [varchar](max) NULL,        --文本内容
    [ImgTextContext] [varchar](max) NULL,     --图文文本内容
    [ImgTextUrl] [varchar](1000) NULL,        --图文图片URL
    [ImgTextLink] [varchar](1000) NULL,       --图文图片超链接
    [MeidaUrl] [varchar](1000) NULL,          --语音URL
    [MeidaLink] [varchar](1000) NULL,         --语音超链接
    [Enable] [bit] NOT NULL,                  --是否启用
    [IsDefault] [bit] NOT NULL,               --是否默认
    [Remark] [varchar](2000) NULL,            --说明
    [Sort] [int] NOT NULL,                    --排序
    [CreateTime] [datetime] NOT NULL,         --创建时间
    [CreateBy] [varchar](50) NOT NULL,        --创建人
    [ModifyTime] [datetime] NOT NULL,         --修改时间
    [ModifyBy] [varchar](50) NULL,            --修改人
 CONSTRAINT [PK_WC_MessageResponse] PRIMARY KEY CLUSTERED (    [Id] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]GOSET ANSI_PADDING OFFGOALTER TABLE [dbo].[WC_MessageResponse]  WITH CHECK ADD  CONSTRAINT [FK_WC_MessageResponse_WC_OfficalAcconts] FOREIGN KEY([OfficalAccountId])REFERENCES [dbo].[WC_OfficalAccounts] ([Id])ON DELETE CASCADEGOALTER TABLE [dbo].[WC_MessageResponse] CHECK CONSTRAINT [FK_WC_MessageResponse_WC_OfficalAcconts]GO
登入後複製


表對應了兩個列舉和關聯主表公眾號管理的主表


CREATE TABLE [dbo].[WC_OfficalAccounts](    [Id] [varchar](50) NOT NULL,            --主键
    [OfficalId] [varchar](200) NULL,        --公众号的唯一ID
    [OfficalName] [varchar](200) NOT NULL,    --公众号名称
    [OfficalCode] [varchar](200) NOT NULL,  --公众号帐号
    [OfficalPhoto] [varchar](1000) NULL,    --头像
    [OfficalKey] [varchar](500) NULL,        --EncodingAESKey
    [ApiUrl] [varchar](1000) NULL,            --我们的资源服务器
    [Token] [varchar](200) NULL,            --Token
    [AppId] [varchar](200) NULL,            --AppId
    [AppSecret] [varchar](200) NULL,        --Appsecret
    [AccessToken] [varchar](200) NULL,        --访问Token
    [Remark] [varchar](2000) NULL,            --说明
    [Enable] [bit] NOT NULL,                --是否启用
    [IsDefault] [bit] NOT NULL,                --是否为当前默认操作号
    [Category] [int] NOT NULL,                --类别(媒体号,企业号,个人号,开发测试号)
    [CreateTime] [datetime] NOT NULL,        --创建时间
    [CreateBy] [varchar](50) NOT NULL,        --创建人
    [ModifyTime] [datetime] NOT NULL,        --修改时间
    [ModifyBy] [varchar](50) NULL,            --修改人
 CONSTRAINT [PK_WC_OfficalAcconts] PRIMARY KEY CLUSTERED (    [Id] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]
登入後複製


公眾號管理在70節

對應的枚舉





##

 public enum WeChatReplyCategory
    {        //文本
        Text =1,        //图文
        Image =2,        //语音
        Voice =3,        //相等,用于回复关键字
        Equal=4,        //包含,用于回复关键字
        Contain = 5
    }    public enum WeChatRequestRuleEnum
    {        /// <summary>
        /// 默认回复,没有处理的        /// </summary>
        Default =0,        /// <summary>
        /// 关注回复        /// </summary>
        Subscriber =1,        /// <summary>
        /// 文本回复        /// </summary>
        Text =2,        /// <summary>
        /// 图片回复        /// </summary>
        Image =3,        /// <summary>
        /// 语音回复        /// </summary>
        Voice =4,        /// <summary>
        /// 视频回复        /// </summary>
        Video =5,        /// <summary>
        /// 超链接回复        /// </summary>
        Link =6,        /// <summary>
        /// LBS位置回复        /// </summary>
        Location =7,
    }
登入後複製

枚舉其實對應就是我省掉的其餘兩張表

到這裡,相信表的設計已經非常清晰

後台程式碼


增刪改查非常普通,

主要關注點在前端

,前端處理提交的訊息中,必須包含規則,類型,來指定訊息的最終表達

[HttpPost]
        [SupportFilter(ActionName = "Edit")]        public JsonResult PostData(WC_MessageResponseModel model)
        {
            WC_OfficalAccountsModel accountModel = account_BLL.GetCurrentAccount();            if (string.IsNullOrEmpty(model.Id))
            {
                model.Id = ResultHelper.NewId;
            }
            
            model.CreateBy = GetUserId();
            model.CreateTime = ResultHelper.NowTime;
            model.ModifyBy = GetUserId();
            model.ModifyTime = ResultHelper.NowTime;
            model.OfficalAccountId = accountModel.Id;
            model.Enable = true;
            model.IsDefault = true;            if (m_BLL.PostData(ref errors, model))
            {
                LogHandler.WriteServiceLog(GetUserId(), "Id" + model.Id + ",OfficalAccountId" + model.OfficalAccountId, "成功", "保存", "WC_MessageResponse");                return Json(JsonHandler.CreateMessage(1, Resource.SaveSucceed));
            }            else
            {                string ErrorCol = errors.Error;
                LogHandler.WriteServiceLog(GetUserId(), "Id" + model.Id + ",OfficalAccountId" + model.OfficalAccountId + "," + ErrorCol, "失败", "保存", "WC_MessageResponse");                return Json(JsonHandler.CreateMessage(0, Resource.SaveFail + ErrorCol));
            }

        }
登入後複製


Controller

public bool PostData(ref ValidationErrors errors, WC_MessageResponseModel model)
        {            try
            {

                WC_MessageResponse entity = new WC_MessageResponse();                if (IsExists(model.Id))
                {
                    entity = m_Rep.GetById(model.Id);
                }

                entity.Id = model.Id;
                entity.OfficalAccountId = model.OfficalAccountId;
                entity.MessageRule = model.MessageRule;
                entity.Category = model.Category;
                entity.MatchKey = model.MatchKey;
                entity.TextContent = model.TextContent;
                entity.ImgTextContext = model.ImgTextContext;
                entity.ImgTextUrl = model.ImgTextUrl;
                entity.ImgTextLink = model.ImgTextLink;
                entity.MeidaUrl = model.MeidaUrl;
                entity.Enable = model.Enable;
                entity.IsDefault = model.IsDefault;
                entity.Remark = model.Remark;
                entity.CreateTime = model.CreateTime;
                entity.CreateBy = model.CreateBy;
                entity.Sort = model.Sort;
                entity.ModifyTime = model.ModifyTime;
                entity.ModifyBy = model.ModifyBy;                if (m_Rep.PostData(entity))
                {                    return true;
                }                else
                {
                    errors.Add(Resource.NoDataChange);                    return false;
                }

            }            catch (Exception ex)
            {
                errors.Add(ex.Message);
                ExceptionHander.WriteException(ex);                return false;
            }
        }
登入後複製

##BLL

ASP.NET MVC5+EF6+EasyUI 后台管理系统微信公众平台开发

  public bool PostData(WC_MessageResponse model)
        {            //如果所有开关都关掉,证明不启用回复
            if (model.Category == null)
            {                return true;
            }            //全部设置为不默认
            ExecuteSqlCommand(string.Format("update [dbo].[WC_MessageResponse] set IsDefault=0 where OfficalAccountId =&#39;{0}&#39; and MessageRule={1}", model.OfficalAccountId, model.MessageRule));            //默认回复和订阅回复,且不是图文另外处理,因为他们有3种模式,但是只有一个是默认的
            if (model.Category!= (int)WeChatReplyCategory.Image && (model.MessageRule == (int)WeChatRequestRuleEnum.Default || model.MessageRule == (int)WeChatRequestRuleEnum.Subscriber))
            {                //查看数据库是否存在数据
                var entity = Context.WC_MessageResponse.Where(p => p.OfficalAccountId == model.OfficalAccountId && p.MessageRule == model.MessageRule && p.Category == model.Category).FirstOrDefault();                if (entity != null)
                {                    //删除原来的                    Context.WC_MessageResponse.Remove(entity);
                }
            }            //全部设置为默认
            ExecuteSqlCommand(string.Format("update [dbo].[WC_MessageResponse] set IsDefault=1 where OfficalAccountId =&#39;{0}&#39; and MessageRule={1} and Category={2}", model.OfficalAccountId, model.MessageRule,model.Category));            //修改
            if(IsExist(model.Id))
            {
               Context.Entry<WC_MessageResponse>(model).State = EntityState.Modified;               return Edit(model);
            }            else { 
               return Create(model);
            }
        }
登入後複製

ASP.NET MVC5+EF6+EasyUI 后台管理系统微信公众平台开发DAL

DAL層有必要來說明一下


預設回復和關注回復有3種類型:文本,圖文,語音(但是只能有一種,所以有IsDefault字段來表明執行哪種回复)所以這兩個規則必須另外處理,看DAL的程式碼執行的SQL語句便明白。

所以我們盡情的設計前端吧!

前端如何設計?

我們來看一個心智圖:

 

前端完整程式碼

<style>
    .formtable td {
        vertical-align: top;
        padding: 10px;
    }

    .formtable th {
        text-align: left;
        padding: 10px;
        height: 30px;
    }

    .formtablenormal {
        width: 500px;
    }

        .formtablenormal th {
            border: 0px;
            text-align: right;
        }

        .formtablenormal td {
            border: 0px;
            vertical-align: middle;
        }</style>
<script>    //1文本2图文3语音
    var Category = {
        Text: 1,
        Image: 2,
        Voice: 3,
        Equal: 4,
        Contain: 5
    };    //    var RequestRule = {
        Default: 0,
        Subscriber: 1,
        Text: 2,
        Image: 3,
        Voice: 4,
        Video: 5,
        Link: 6,
        Location: 7
    };

    function initDefault() {
        $(&#39;#swText0&#39;).switchbutton({
            onChange: function(checked) {                if (checked) {
                    $(&#39;#swImage0&#39;).switchbutton("uncheck");
                    $(&#39;#swVoice0&#39;).switchbutton("uncheck");
                    $("#p01").show();
                    $("#p02,#p03").hide();
                    $("#Category").val(Category.Text);
                }
            }
        });
        $(&#39;#swImage0&#39;).switchbutton({
            onChange: function(checked) {                if (checked) {
                    $(&#39;#swVoice0&#39;).switchbutton("uncheck");
                    $(&#39;#swText0&#39;).switchbutton("uncheck");
                    $("#p02").show();
                    $("#p01,#p03").hide();
                    $("#Category").val(Category.Image);
                    $("#List0").datagrid("resize");
                }
            }
        });
        $(&#39;#swVoice0&#39;).switchbutton({
            onChange: function(checked) {                if (checked) {
                    $(&#39;#swImage0&#39;).switchbutton("uncheck");
                    $(&#39;#swText0&#39;).switchbutton("uncheck");
                    $("#p03").show();
                    $("#p01,#p02").hide();
                    $("#Category").val(Category.Voice);
                }
            }
        });        //文本
        $.post(&#39;@Url.Action("GetList")&#39;, {
            page: 1,
            rows: 1,
            category: Category.Text,
            messageRule: RequestRule.Default
        },
        function(data) {            var rows = data.rows;            for (var i = 0; i < rows.length; i++) {                if (rows[i].Category == Category.Text) {
                    $("#Text0").val(rows[i].TextContent);                    if (rows[i].IsDefault) {
                        $(&#39;#swText0&#39;).switchbutton("check");
                        $(&#39;#swImage0&#39;).switchbutton("uncheck");
                        $(&#39;#swVoice0&#39;).switchbutton("uncheck");
                    }
                }
            }
        });        //语音
        $.post(&#39;@Url.Action("GetList")&#39;, {
            page: 1,
            rows: 1,
            category: Category.Voice,
            messageRule: RequestRule.Default
        },
       function (data) {           var rows = data.rows;           for (var i = 0; i < rows.length; i++) {               if (rows[i].Category == Category.Voice) {
                   $("#VoiceTitle0").val(rows[i].TextContent);
                   $("#VoiceContent0").val(rows[i].Remark);
                   $("#VoiceUrl0").val(rows[i].MeidaUrl);                   if (rows[i].IsDefault) {
                       $(&#39;#swVoice0&#39;).switchbutton("check");
                       $(&#39;#swText0&#39;).switchbutton("uncheck");
                       $(&#39;#swImage0&#39;).switchbutton("uncheck");
                   }
               }
           }
       });

        $(&#39;#List0&#39;).datagrid({
            url: &#39;@Url.Action("GetList")?messageRule=&#39; + RequestRule.Default + &#39;&category=&#39; + Category.Image,
            width: SetGridWidthSub(40),
            methord: &#39;post&#39;,
            height: SetGridHeightSub(175),
            fitColumns: true,
            sortName: &#39;Sort&#39;,
            sortOrder: &#39;asc&#39;,
            idField: &#39;Id&#39;,
            pageSize: 15,
            pageList: [15, 20, 30, 40, 50],
            pagination: true,
            striped: true,            //奇偶行是否区分
            singleSelect: true,
            onLoadSuccess: function (data) {                if (data.rows.length > 0)
                {                    if (data.rows[0].IsDefault) {
                        $(&#39;#swImage0&#39;).switchbutton("check");
                        $(&#39;#swText0&#39;).switchbutton("uncheck");
                        $(&#39;#swVoice0&#39;).switchbutton("uncheck");
                        $("#Category").val(Category.Image);
                    }
                }
            },            //单选模式            //rownumbers: true,//行号            columns: [[{
                field: &#39;Id&#39;,
                title: &#39;Id&#39;,
                width: 80,
                hidden: true
            },
            {
                field: &#39;TextContent&#39;,
                title: &#39;标题&#39;,
                width: 80,
                sortable: true
            },
            {
                field: &#39;ImgTextUrl&#39;,
                title: &#39;图片&#39;,
                width: 50,
                sortable: true,
                align: &#39;center&#39;, formatter: function (value) { return "<img width=&#39;80&#39; height=&#39;80&#39; src=&#39;" + value + "&#39;/>" }
            },
            {
                field: &#39;ImgTextLink&#39;,
                title: &#39;超链接&#39;,
                width: 80,
                sortable: true
            },
            {
                field: &#39;ImgTextContext&#39;,
                title: &#39;回复内容&#39;,
                width: 180,
                sortable: true
            },

            ]]
        });

        $("#btnCreate02").unbind().click(function () {
            $("#modalwindow0").window({
                title: &#39;@Resource.Create&#39;,
                width: 700,
                height: 500,
                iconCls: &#39;fa fa-plus&#39;
            }).window(&#39;open&#39;);
        });

       

        $("#btnSava01").unbind().click(function() {            //默认回复
            $("#MessageRule").val(RequestRule.Default);            if ($.trim($("#Text0").val())=="")
            {
                $.messager.alert(&#39;@Resource.Tip&#39;, &#39;内容必须填写!&#39;, &#39;warning&#39;);                return;
            }
            $("#TextContent").val($.trim($("#Text0").val()));            if ($("#form").valid()) {
                $.ajax({
                    url: "@Url.Action("PostData")",
                    type: "Post",
                    data: $("#form").serialize(),
                dataType: "json",
                success: function(data) {
                    $.messageBox5s(&#39;@Resource.Tip&#39;, data.message);
                }
            });
        }
        });




        $("#btnSava02").unbind().click(function () {            if ($.trim($("#ImageTitle0").val()) == "") {
                $.messager.alert(&#39;@Resource.Tip&#39;, &#39;标题必须填写!&#39;, &#39;warning&#39;);                return;
            }            if ($.trim($("#ImageUrl0").val()) == "") {
                $.messager.alert(&#39;@Resource.Tip&#39;, &#39;图片必须上传!&#39;, &#39;warning&#39;);                return;
            }            if ($.trim($("#Sort0").val()) == "") {
                $.messager.alert(&#39;@Resource.Tip&#39;, &#39;排序必须填写!&#39;, &#39;warning&#39;);                return;
            }            //图文回复
            $("#MessageRule").val(RequestRule.Default);
            $("#TextContent").val($("#ImageTitle0").val());
            $("#ImgTextUrl").val($("#ImageUrl0").val());
            $("#ImgTextContext").val($("#ImageContent0").val());
            $("#ImgTextLink").val($("#ImageLink0").val());
            $("#Sort").val($("#Sort0").val());           

            if ($("#form").valid()) {
                $.ajax({
                    url: "@Url.Action("PostData")",
                    type: "Post",
                data: $("#form").serialize(),
                dataType: "json",
                success: function(data) {                    if (data.type == 1) {
                        $("#Id").val("");
                        $("#List0").datagrid(&#39;reload&#39;);
                        $("#modalwindow0").window(&#39;close&#39;);
                        $("#ImageTitle0").val("");
                        $("#form02 img").attr("src", "/Content/Images/NotPic.jpg");
                        $("#ImageContent0").val("");
                        $("#ImageLink0").val("");
                        $("#Sort0").val(0);
                        $(&#39;#FileUpload02&#39;).val(&#39;&#39;);
                    }
                    $.messageBox5s(&#39;@Resource.Tip&#39;, data.message);
                }
            });
        }
        });
        $("#btnSava03").unbind().click(function() {            //默认回复
            $("#MessageRule").val(RequestRule.Default);            if ($.trim($("#Text0").val())=="")
            {                if ($.trim($("#VoiceTitle0").val()) == "") {
                    $.messager.alert(&#39;@Resource.Tip&#39;, &#39;标题必须填写!&#39;, &#39;warning&#39;);                    return;
                }                if ($.trim($("#VoiceUrl0").val()) == "") {
                    $.messager.alert(&#39;@Resource.Tip&#39;, &#39;必须上传语音!&#39;, &#39;warning&#39;);                    return;
                }
                $("#TextContent").val($("#VoiceTitle0").val());
                $("#MeidaUrl").val($("#VoiceUrl0").val());
                $("#Remark").val($("#VoiceContent0").val());
            }            if ($("#form").valid()) {
                $.ajax({
                    url: "@Url.Action("PostData")",
                    type: "Post",
                data: $("#form").serialize(),
                dataType: "json",
                success: function(data) {
                    $.messageBox5s(&#39;@Resource.Tip&#39;, data.message);
                }
            });
        }
        });
    }

    function initSubscriber() {
         $(&#39;#swText1&#39;).switchbutton({
            onChange: function(checked) {                if (checked) {
                    $(&#39;#swImage1&#39;).switchbutton("uncheck");
                    $(&#39;#swVoice1&#39;).switchbutton("uncheck");
                    $("#p11").show();
                    $("#p12,#p13").hide();
                    $("#Category").val(Category.Text);
                }
            }
        });
        $(&#39;#swImage1&#39;).switchbutton({
            onChange: function(checked) {                if (checked) {
                    $(&#39;#swVoice1&#39;).switchbutton("uncheck");
                    $(&#39;#swText1&#39;).switchbutton("uncheck");
                    $("#p12").show();
                    $("#p11,#p13").hide();
                    $("#Category").val(Category.Image);
                    $("#List1").datagrid("resize");
                }
            }
        });
        $(&#39;#swVoice1&#39;).switchbutton({
            onChange: function(checked) {                if (checked) {
                    $(&#39;#swImage1&#39;).switchbutton("uncheck");
                    $(&#39;#swText1&#39;).switchbutton("uncheck");
                    $("#p13").show();
                    $("#p11,#p12").hide();
                    $("#Category").val(Category.Voice);
                }
            }
        });        //文本
        $.post(&#39;@Url.Action("GetList")&#39;, {
            page: 1,
            rows: 1,
            category: Category.Text,
            messageRule: RequestRule.Subscriber
        },
        function(data) {            var rows = data.rows;            for (var i = 0; i < rows.length; i++) {                if (rows[i].Category == Category.Text) {
                    $("#Text1").val(rows[i].TextContent);                    if (rows[i].IsDefault) {
                        $(&#39;#swText1&#39;).switchbutton("check");
                        $(&#39;#swImage1&#39;).switchbutton("uncheck");
                        $(&#39;#swVoice1&#39;).switchbutton("uncheck");
                    }
                }
            }
        });        //语音
        $.post(&#39;@Url.Action("GetList")&#39;, {
            page: 1,
            rows: 1,
            category: Category.Voice,
            messageRule: RequestRule.Subscriber
        },
       function (data) {           var rows = data.rows;           for (var i = 0; i < rows.length; i++) {               if (rows[i].Category == Category.Voice) {
                   $("#VoiceTitle1").val(rows[i].TextContent);
                   $("#VoiceContent1").val(rows[i].Remark);                   if (rows[i].IsDefault) {
                       $(&#39;#swVoice1&#39;).switchbutton("check");
                       $(&#39;#swText1&#39;).switchbutton("uncheck");
                       $(&#39;#swImage1&#39;).switchbutton("uncheck");
                   }
               }
           }
       });

        $(&#39;#List1&#39;).datagrid({
            url: &#39;@Url.Action("GetList")?messageRule=&#39; + RequestRule.Subscriber + &#39;&category=&#39; + Category.Image,
            width: SetGridWidthSub(40),
            methord: &#39;post&#39;,
            height: SetGridHeightSub(175),
            fitColumns: true,
            sortName: &#39;Sort&#39;,
            sortOrder: &#39;asc&#39;,
            idField: &#39;Id&#39;,
            pageSize: 15,
            pageList: [15, 20, 30, 40, 50],
            pagination: true,
            striped: true,            //奇偶行是否区分
            singleSelect: true,
            onLoadSuccess: function (data) {                if (data.rows.length > 0)
                {                    if (data.rows[0].IsDefault) {
                        $(&#39;#swImage1&#39;).switchbutton("check");
                        $(&#39;#swText1&#39;).switchbutton("uncheck");
                        $(&#39;#swVoice1&#39;).switchbutton("uncheck");
                    }
                }
            },            //单选模式            //rownumbers: true,//行号            columns: [[{
                field: &#39;Id&#39;,
                title: &#39;Id&#39;,
                width: 80,
                hidden: true
            },
            {
                field: &#39;TextContent&#39;,
                title: &#39;标题&#39;,
                width: 80,
                sortable: true
            },
            {
                field: &#39;ImgTextUrl&#39;,
                title: &#39;图片&#39;,
                width: 50,
                sortable: true,
                align: &#39;center&#39;, formatter: function (value) { return "<img width=&#39;80&#39; height=&#39;80&#39; src=&#39;" + value + "&#39;/>" }
            },
            {
                field: &#39;ImgTextLink&#39;,
                title: &#39;超链接&#39;,
                width: 80,
                sortable: true
            },
            {
                field: &#39;ImgTextContext&#39;,
                title: &#39;回复内容&#39;,
                width: 180,
                sortable: true
            },

            ]]
        });

        $("#btnCreate12").unbind().click(function () {
            $("#modalwindow1").window({
                title: &#39;@Resource.Create&#39;,
                width: 700,
                height: 500,
                iconCls: &#39;fa fa-plus&#39;
            }).window(&#39;open&#39;);
        });
      

        $("#btnSava11").unbind().click(function() {            //默认回复
            $("#MessageRule").val(RequestRule.Subscriber);            if ($.trim($("#Text1").val())=="")
            {
                $.messager.alert(&#39;@Resource.Tip&#39;, &#39;内容必须填写!&#39;, &#39;warning&#39;);                return;
            }
            $("#TextContent").val($.trim($("#Text1").val()));            if ($("#form").valid()) {
                $.ajax({
                    url: "@Url.Action("PostData")",
                    type: "Post",
                    data: $("#form").serialize(),
                dataType: "json",
                success: function(data) {
                    $.messageBox5s(&#39;@Resource.Tip&#39;, data.message);
                }
            });
        }
        });

        $("#btnSava12").unbind().click(function () {            if ($.trim($("#ImageTitle1").val()) == "") {
                $.messager.alert(&#39;@Resource.Tip&#39;, &#39;标题必须填写!&#39;, &#39;warning&#39;);                return;
            }            if ($.trim($("#ImageUrl1").val()) == "") {
                $.messager.alert(&#39;@Resource.Tip&#39;, &#39;图片必须上传!&#39;, &#39;warning&#39;);                return;
            }            if ($.trim($("#Sort1").val()) == "") {
                $.messager.alert(&#39;@Resource.Tip&#39;, &#39;排序必须填写!&#39;, &#39;warning&#39;);                return;
            }            //图文回复
            $("#MessageRule").val(RequestRule.Subscriber);
            $("#TextContent").val($("#ImageTitle1").val());
            $("#ImgTextUrl").val($("#ImageUrl1").val());
            $("#ImgTextContext").val($("#ImageContent1").val());
            $("#ImgTextLink").val($("#ImageLink1").val());
            $("#Sort").val($("#Sort1").val());           
            if ($("#form").valid()) {
                $.ajax({
                    url: "@Url.Action("PostData")",
                    type: "Post",
                data: $("#form").serialize(),
                dataType: "json",
                success: function(data) {                    if (data.type == 1) {
                        $("#Id").val("");
                        $("#List1").datagrid(&#39;reload&#39;);
                        $("#modalwindow1").window(&#39;close&#39;);
                        $("#ImageTitle1").val("");
                        $("#form12 img").attr("src", "/Content/Images/NotPic.jpg");
                        $("#ImageContent1").val("");
                        $("#ImageLink1").val("");
                        $("#Sort1").val(0);
                        $(&#39;#FileUpload12&#39;).val(&#39;&#39;);
                    }
                    $.messageBox5s(&#39;@Resource.Tip&#39;, data.message);
                }
            });
        }
        });
        $("#btnSava13").unbind().click(function() {            //默认回复
            $("#MessageRule").val(RequestRule.Subscriber);            if ($.trim($("#Text1").val())=="")
            {                if ($.trim($("#VoiceTitle1").val()) == "") {
                    $.messager.alert(&#39;@Resource.Tip&#39;, &#39;标题必须填写!&#39;, &#39;warning&#39;);                    return;
                }                if ($.trim($("#VoiceUrl1").val()) == "") {
                    $.messager.alert(&#39;@Resource.Tip&#39;, &#39;必须上传语音!&#39;, &#39;warning&#39;);                    return;
                }
                $("#TextContent").val($("#VoiceTitle1").val());
                $("#MeidaUrl").val($("#VoiceUrl1").val());
                $("#Remark").val($("#VoiceContent1").val());
            }            if ($("#form").valid()) {
                $.ajax({
                    url: "@Url.Action("PostData")",
                    type: "Post",
                data: $("#form").serialize(),
                dataType: "json",
                success: function(data) {
                    $.messageBox5s(&#39;@Resource.Tip&#39;, data.message);
                }
            });
        }
        });
    }

    function initText() {
        $("#Category").val(Category.Equal);
        $(&#39;#List2&#39;).datagrid({
            url: &#39;@Url.Action("GetList")?messageRule=&#39; + RequestRule.Text,
            width: SetGridWidthSub(40),
            methord: &#39;post&#39;,
            height: SetGridHeightSub(100),
            fitColumns: true,
            sortName: &#39;CreateTime&#39;,
            sortOrder: &#39;desc&#39;,
            idField: &#39;Id&#39;,
            pageSize: 15,
            pageList: [15, 20, 30, 40, 50],
            pagination: true,
            striped: true,            //奇偶行是否区分
            singleSelect: true,            //单选模式            //rownumbers: true,//行号            columns: [[{
                field: &#39;Id&#39;,
                title: &#39;Id&#39;,
                width: 80,
                hidden: true
            },
            {
                field: &#39;Category&#39;,
                title: &#39;Category&#39;,
                width: 80,
                sortable: true,
                hidden: true
            },
            {
                field: &#39;MatchKey&#39;,
                title: &#39;关键字&#39;,
                width: 80,
                sortable: true,
                formatter: function (value,row,index){                    if (row.Category == Category.Equal) {                        return "(完全匹配)" + value
                    } else {                        return "(模糊匹配)" + value
                    }
                }
            },
            {
                field: &#39;TextContent&#39;,
                title: &#39;回复内容&#39;,
                width: 80,
                sortable: true
            },

            ]]
        });

        $(&#39;#swMessageRule2&#39;).switchbutton({
            onChange: function(checked) {                if (checked) {
                    $("#Category").val(Category.Equal);
                } else {
                    $("#Category").val(Category.Contain);
                }
            }
        });
        $("#btnCreate2").unbind().click(function () {
            $("#modalwindow2").window({
                title: &#39;@Resource.Create&#39;,
                width: 700,
                height: 400,
                iconCls: &#39;fa fa-plus&#39;
            }).window(&#39;open&#39;);
        });

        $("#btnSava2").unbind().click(function () {            if ($.trim($("#TextMatchKey2").val()) == "") {
                $.messager.alert(&#39;@Resource.Tip&#39;, &#39;关键字必须填写!&#39;, &#39;warning&#39;);                return;
            }            if ($.trim($("#Text2").val()) == "") {
                $.messager.alert(&#39;@Resource.Tip&#39;, &#39;内容必须填写!&#39;, &#39;warning&#39;);                return;
            }            //文本回复
            $("#MessageRule").val(RequestRule.Text);
            $("#MatchKey").val($.trim($("#TextMatchKey2").val()));
            $("#TextContent").val($("#Text2").val());            if ($("#form").valid()) {
                $.ajax({
                    url: "@Url.Action("PostData")",
                    type: "Post",
                data: $("#form").serialize(),
                dataType: "json",
                success: function(data) {                    if (data.type == 1) {
                        $("#Id").val("");
                        $("#List2").datagrid(&#39;reload&#39;);
                        $("#modalwindow2").window(&#39;close&#39;);
                        $("#TextMatchKey2").val("");
                        $("#Text2").val("");
                    }
                    $.messageBox5s(&#39;@Resource.Tip&#39;, data.message);
                }
            });
        }
        });
    }


    function initImage() {
        $("#Category").val(Category.Equal);
        $(&#39;#List31&#39;).datagrid({
            url: &#39;@Url.Action("GetListProperty")?messageRule=&#39; + RequestRule.Image,
            width: 300,
            methord: &#39;post&#39;,
            height: SetGridHeightSub(100),
            fitColumns: true,
            sortName: &#39;CreateTime&#39;,
            sortOrder: &#39;desc&#39;,
            idField: &#39;Id&#39;,
            pageSize: 15,
            pageList: [15, 20, 30, 40, 50],
            pagination: true,
            striped: true,            //奇偶行是否区分
            singleSelect: true,
            onClickRow: function (index,data) {                var row = $(&#39;#List31&#39;).datagrid(&#39;getSelected&#39;);                if (row != null)
                {
                    $(&#39;#List3&#39;).datagrid({url:&#39;@Url.Action("GetList")?messageRule=&#39;+RequestRule.Image+&#39;&category=&#39;+row.Category+&#39;&matchKey=&#39;+row.MatchKey});
                }
            },            //单选模式            //rownumbers: true,//行号            columns: [[{
                field: &#39;Id&#39;,
                title: &#39;Id&#39;,
                width: 80,
                hidden: true
            },
            {
                field: &#39;Category&#39;,
                title: &#39;Category&#39;,
                width: 80,
                sortable: true,
                hidden: true
            },
            {
                field: &#39;MatchKey&#39;,
                title: &#39;关键字&#39;,
                width: 130,
                sortable: true,
                formatter: function (value, row, index) {                    if (row.Category == Category.Equal) {                        return "(完全匹配)" + value
                    } else {                        return "(模糊匹配)" + value
                    }
                }
            },
            {
                field: &#39;CreateTime&#39;,
                title: &#39;创建时间&#39;,
                width: 80,
                sortable: true
            },

            ]]
        }).datagrid(&#39;getPager&#39;).pagination({ showPageList: true, showRefresh: false, displayMsg: &#39;&#39; });


        $(&#39;#List3&#39;).datagrid({
            url:&#39;@Url.Action("GetList")?messageRule=&#39;+RequestRule.Image+&#39;&category=x&matchKey=x&#39;,
            width: SetGridWidthSub(340),
            methord: &#39;post&#39;,
            height: SetGridHeightSub(100),
            fitColumns: true,
            sortName: &#39;Sort&#39;,
            sortOrder: &#39;asc&#39;,
            idField: &#39;Id&#39;,
            pageSize: 15,
            pageList: [15, 20, 30, 40, 50],
            pagination: true,
            striped: true,            //奇偶行是否区分
            singleSelect: true,            //单选模式            //rownumbers: true,//行号            columns: [[{
                field: &#39;Id&#39;,
                title: &#39;Id&#39;,
                width: 80,
                hidden: true
            },
            {
                field: &#39;Category&#39;,
                title: &#39;Category&#39;,
                width: 80,
                sortable: true,
                hidden: true
            },
            {
                field: &#39;TextContent&#39;,
                title: &#39;标题&#39;,
                width: 80,
                sortable: true
            },
            {
                field: &#39;MatchKey&#39;,
                title: &#39;关键字&#39;,
                width: 80,
                sortable: true,
                formatter: function (value,row,index){                    if (row.Category == Category.Equal) {                        return "(完全匹配)" + value
                    } else {                        return "(模糊匹配)" + value
                    }
                }
            },
            {
                field: &#39;ImgTextUrl&#39;,
                title: &#39;图片&#39;,
                width: 50,
                sortable: true,
                align: &#39;center&#39;, formatter: function (value) { return "<img width=&#39;80&#39; height=&#39;80&#39; src=&#39;" + value + "&#39;/>" }
            },
            {
                field: &#39;ImgTextLink&#39;,
                title: &#39;超链接&#39;,
                width: 80,
                sortable: true
            },
            {
                field: &#39;ImgTextContext&#39;,
                title: &#39;回复内容&#39;,
                width: 180,
                sortable: true
            },
            {
                field: &#39;Sort&#39;,
                title: &#39;排序&#39;,
                width: 50,
                sortable: true
            },
            ]]
        });

        $(&#39;#swMessageRule3&#39;).switchbutton({
            onChange: function(checked) {                if (checked) {
                    $("#Category").val(Category.Equal);
                } else {
                    $("#Category").val(Category.Contain);
                }
            }
        });
        $("#btnCreate3").unbind().click(function () {
            $("#modalwindow3").window({
                title: &#39;@Resource.Create&#39;,
                width: 700,
                height: 550,
                iconCls: &#39;fa fa-plus&#39;
            }).window(&#39;open&#39;);
        });

     
        $("#btnSava3").unbind().click(function () {            if ($.trim($("#ImageTitle3").val()) == "") {
                $.messager.alert(&#39;@Resource.Tip&#39;, &#39;标题必须填写!&#39;, &#39;warning&#39;);                return;
            }            if ($.trim($("#TextMatchKey3").val()) == "") {
                $.messager.alert(&#39;@Resource.Tip&#39;, &#39;关键字必须填写!&#39;, &#39;warning&#39;);                return;
            }            if ($.trim($("#ImageUrl3").val()) == "") {
                $.messager.alert(&#39;@Resource.Tip&#39;, &#39;图片必须上传!&#39;, &#39;warning&#39;);                return;
            }            //图文回复
            $("#MessageRule").val(RequestRule.Image);
            $("#MatchKey").val($.trim($("#TextMatchKey3").val()));
            $("#TextContent").val($("#ImageTitle3").val());
            $("#ImgTextUrl").val($("#ImageUrl3").val());
            $("#ImgTextContext").val($("#ImageContent3").val());
            $("#ImgTextLink").val($("#ImageLink3").val());
            $("#Sort").val($("#Sort3").val());            if ($("#form").valid()) {
                $.ajax({
                    url: "@Url.Action("PostData")",
                    type: "Post",
                data: $("#form").serialize(),
                dataType: "json",
                success: function(data) {                    if (data.type == 1) {
                        $("#Id").val("");
                        $("#List3").datagrid(&#39;reload&#39;);
                        $("#List31").datagrid(&#39;reload&#39;);
                        $("#modalwindow3").window(&#39;close&#39;);
                        $("#ImageTitle3").val("");
                        $("#form3 img").attr("src", "/Content/Images/NotPic.jpg");
                        $("#ImageContent3").val("");
                        $("#ImageLink3").val("");
                        $("#Sort3").val(0);
                        $(&#39;#FileUpload3&#39;).val(&#39;&#39;);
                        $("#TextMatchKey3").val(&#39;&#39;);
                    }
                    $.messageBox5s(&#39;@Resource.Tip&#39;, data.message);
                }
            });
        }
        });
    }

    function initVoice() {
        $("#Category").val(Category.Equal);
        $(&#39;#List4&#39;).datagrid({
            url: &#39;@Url.Action("GetList")?messageRule=&#39; + RequestRule.Voice,
            width: SetGridWidthSub(40),
            methord: &#39;post&#39;,
            height: SetGridHeightSub(100),
            fitColumns: true,
            sortName: &#39;CreateTime&#39;,
            sortOrder: &#39;desc&#39;,
            idField: &#39;Id&#39;,
            pageSize: 15,
            pageList: [15, 20, 30, 40, 50],
            pagination: true,
            striped: true,            //奇偶行是否区分
            singleSelect: true,            //单选模式            //rownumbers: true,//行号            columns: [[{
                field: &#39;Id&#39;,
                title: &#39;Id&#39;,
                width: 80,
                hidden: true
            },
            {
                field: &#39;Category&#39;,
                title: &#39;Category&#39;,
                width: 80,
                sortable: true,
                hidden: true
            },
            {
                field: &#39;TextContent&#39;,
                title: &#39;标题&#39;,
                width: 80,
                sortable: true
            },
            {
                field: &#39;MatchKey&#39;,
                title: &#39;关键字&#39;,
                width: 80,
                sortable: true,
                formatter: function (value,row,index){                    if (row.Category == Category.Equal) {                        return "(完全匹配)" + value
                    } else {                        return "(模糊匹配)" + value
                    }
                }
            },
            {
                field: &#39;MeidaUrl&#39;,
                title: &#39;语音&#39;,
                width: 80,
                sortable: true,
                align: &#39;center&#39;, formatter: function (value) { return "<img width=&#39;80&#39; height=&#39;80&#39; src=&#39;" + value + "&#39;/>" }
            },
            {
                field: &#39;ImgTextLink&#39;,
                title: &#39;超链接&#39;,
                width: 80,
                sortable: true
            },
            {
                field: &#39;ImgTextContext&#39;,
                title: &#39;回复内容&#39;,
                width: 80,
                sortable: true
            },

            ]]
        });

        $(&#39;#swMessageRule4&#39;).switchbutton({
            onChange: function(checked) {                if (checked) {
                    $("#Category").val(Category.Equal);
                } else {
                    $("#Category").val(Category.Contain);
                }
            }
        });
        $("#btnCreate4").unbind().click(function() {
            $("#modalwindow4").window({
                title: &#39;@Resource.Create&#39;,
                width: 700,
                height: 500,
                iconCls: &#39;fa fa-plus&#39;
            }).window(&#39;open&#39;);
        });

    
        $("#btnSava4").unbind().click(function () {            if ($.trim($("#VoiceTitle4").val()) == "") {
                $.messager.alert(&#39;@Resource.Tip&#39;, &#39;标题必须填写!&#39;, &#39;warning&#39;);                return;
            }            if ($.trim($("#TextMatchKey4").val()) == "") {
                $.messager.alert(&#39;@Resource.Tip&#39;, &#39;关键字必须填写!&#39;, &#39;warning&#39;);                return;
            }            if ($.trim($("#VoiceUrl4").val()) == "") {
                $.messager.alert(&#39;@Resource.Tip&#39;, &#39;必须上传语音!&#39;, &#39;warning&#39;);                return;
            }            //图文回复
            $("#MessageRule").val(RequestRule.Voice);
            $("#MatchKey").val($("#TextMatchKey4").val());
            $("#TextContent").val($("#VoiceTitle4").val());
            $("#MeidaUrl").val($("#VoiceUrl4").val());
            $("#Remark").val($("#VoiceContent4").val());            if ($("#form").valid()) {
                $.ajax({
                    url: "@Url.Action("PostData")",
                    type: "Post",
                data: $("#form").serialize(),
                dataType: "json",
                success: function(data) {                    if (data.type == 1) {
                        $("#Id").val("");
                        $("#List4").datagrid(&#39;reload&#39;);
                        $("#modalwindow4").window(&#39;close&#39;);
                        $("#TextMatchKey4").val("");
                        $("#VoiceTitle4").val("");
                        $("#VoiceUrl4").val("");
                        $("#VoiceContent4").val("");
                        $("#FileUpload4").val("");
                        $("#form3 img").attr("src", "/Content/Images/NotPic.jpg");
                    }
                    $.messageBox5s(&#39;@Resource.Tip&#39;, data.message);
                }
            });
        }
        });
    }
    $(function() {
        $(&#39;#tt&#39;).tabs({
            justified: true,
            width: &#39;100%&#39;,
            height: $(window).height() - 20
        });
        $(&#39;#tt&#39;).tabs({
            onSelect: function(title, index) {                switch (index) {                    case RequestRule.Default:
                        initDefault();                        break;                    case RequestRule.Subscriber:
                        initSubscriber();                        break;                    case RequestRule.Text:
                        initText();                        break;                    case RequestRule.Image:
                        initImage();                        break;                    case RequestRule.Voice:
                        initVoice();                        break;
                }
            }
        });        //初始化第一个标签        initDefault();        //自动宽高        $(window).resize(function() {
            $(&#39;#tt&#39;).tabs({
                height:$(window).height() - 20
            });            //$(&#39;#List2&#39;).datagrid(&#39;resize&#39;, {            //    width: SetGridWidthSub(40),            //    height: SetGridHeightSub(100)            //});
        });
    });
    $(function () {
        $(&#39;input.textbox&#39;).validatebox().bind(&#39;blur&#39;, function () {
            $(this).validatebox(&#39;enableValidation&#39;).validatebox(&#39;validate&#39;);
        });
    })</script>
<form id="form" method="post">
    <input type="hidden" id="Id" name="Id" />
    <input type="hidden" id="MessageRule" name="MessageRule" />
    <input type="hidden" id="Category" name="Category" />
    <input type="hidden" id="MatchKey" name="MatchKey" />
    <input type="hidden" id="TextContent" name="TextContent" />
    <input type="hidden" id="ImgTextContext" name="ImgTextContext" />
    <input type="hidden" id="ImgTextUrl" name="ImgTextUrl" />
    <input type="hidden" id="ImgTextLink" name="ImgTextLink" />
    <input type="hidden" id="MeidaUrl" name="MeidaUrl" />
    <input type="hidden" id="MeidaLink" name="MeidaLink" />
    <input type="hidden" id="Remark" name="Remark" />
    <input type="hidden" id="Sort" name="Sort" value="0" />
    <input type="hidden" id="CreateTime" name="CreateTime" />
    <input type="hidden" id="CreateBy" name="CreateBy" />
    <input type="hidden" id="ModifyTime" name="ModifyTime" />
    <input type="hidden" id="ModifyBy" name="ModifyBy" />
</form>
<p style="padding:10px;">
        <p id="tt" class="easyui-tabs">
            <p title="默认回复"> 
                <table class="formtable" style="height:45px; line-height:45px; width:100%; border-bottom:1px solid #e7eaec">
                    <tr>
                        <td style="width:100px;">
                            文本: @Html.SwitchButtonByEdit("swText0", false)                        </td>
                        <td style="width:100px;">
                            图文: @Html.SwitchButtonByEdit("swImage0", false)                        </td>
                        <td style="width:100px;">
                            语音: @Html.SwitchButtonByEdit("swVoice0", false)                        </td>
                        <td></td>
                        <td style="width:300px;">
                                <p class="color-green">当前操作公众号:<span id="CurrentOfficalAccount">@ViewBag.CurrentOfficalAcount</span></p>
                        </td>
                    </tr>
                </table>
                <p id="p01" class="displaynone">
                    <p class="mvctool bgb">
                        @Html.ToolButton("btnSava01", "fa fa-plus", "提交保存", ref perm, "Edit", false)                    </p>
                    <textarea id="Text0" style="width: 300px;height: 330px; margin:20px;"></textarea>
                    </p>
                <p id="p02" class="displaynone">
                    <p class="mvctool bgb">
                        @Html.ToolButton("btnCreate02", "fa fa-search", "添加回复", ref perm, "Edit", false)                    </p>
                    <p id="modalwindow0" class="easyui-window" style="width:600px; height:550px;" data-options="modal:true,closed: true,minimizable:false,shadow:false">
                        <p class="mvctool bgb">
                            @Html.ToolButton("btnSava02", "fa fa-search", "提交保存", ref perm, "Edit", false)                        </p>
                        <table class="formtablenormal">
                            <tr><th>标题: </th><td><input type="text" id="ImageTitle0" class="textbox" data-options="required:true" /></td></tr>
                            <tr>
                                <th>图片: </th>
                                <td>
                                    <form id="form02" method="post">
                                        <input type="hidden" name="ImageUrl0" id="ImageUrl0" />
                                        <img class="expic" src="/Content/Images/NotPic.jpg" />
                                        <br />
                                        <a href="javascript:$(&#39;#FileUpload02&#39;).trigger(&#39;click&#39;);" class="files">@Resource.Browse</a>
                                        <input type="file" id="FileUpload02" class="displaynone" name="FileUpload02" onchange="Upload(&#39;SingleFile&#39;, &#39;ImageUrl0&#39;, &#39;FileUpload02&#39;, &#39;1&#39;, &#39;1&#39;, &#39;#form02&#39;);" />
                                        <span class="uploading">@Resource.Uploading</span>
                                    </form>
                            </tr>
                            <tr><th>内容: </th><td><textarea id="ImageContent0" style="width: 300px; height: 100px;"></textarea></td></tr>
                            <tr><th>链接: </th><td><input type="text" id="ImageLink0" /></td></tr>
                            <tr><th>排序: </th><td><input type="number" id="Sort0" value="0" /></td></tr>
                        </table>

                    </p>
                    <p style="padding:10px;">
                        <table id="List0"></table>
                    </p>   
                </p>
                            
                <p id="p03" class="displaynone">
                    <p class="mvctool bgb">
                        @Html.ToolButton("btnSava03", "fa fa-plus", "提交保存", ref perm, "Edit", false)                    </p>
                                <table class="formtablenormal" style="margin:20px;">
                                    <tr><th>标题: </th><td><input type="text" id="VoiceTitle0" /></td></tr>
                                    <tr><th>语音: </th><td>
                                                         <form id="form03" method="post">
                                                             <input type="text" name="VoiceUrl0" class="left" id="VoiceUrl0" />
                                                             <a href="javascript:$(&#39;#FileUpload03&#39;).trigger(&#39;click&#39;);" class="files">@Resource.Browse</a>
                                                             <input type="file" accept="audio/mpeg" id="FileUpload03" class="displaynone" name="FileUpload03" onchange="Upload(&#39;SingleFile&#39;, &#39;VoiceUrl0&#39;, &#39;FileUpload03&#39;, &#39;&#39;, &#39;&#39;, &#39;#form03&#39;);" />
                                                             <span class="uploading">@Resource.Uploading</span>
                                                         </form>
                                        </td></tr>
                                    <tr><th>描述: </th><td><textarea id="VoiceContent0" style="width:335px; height:300px;"></textarea></td></tr>
                                </table>
                 </p>       
            </p>
            <p title="关注时回复" >
                <table class="formtable" style="height:45px; line-height:45px; width:100%; border-bottom:1px solid #e7eaec">
                    <tr>
                        <td style="width:100px;">
                            文本: @Html.SwitchButtonByEdit("swText1", false)                        </td>
                        <td style="width:100px;">
                            图文: @Html.SwitchButtonByEdit("swImage1", false)                        </td>
                        <td style="width:100px;">
                            语音: @Html.SwitchButtonByEdit("swVoice1", false)                        </td>
                        <td></td>
                        <td style="width:300px;">
                            <p class="color-green">当前操作公众号:<span id="CurrentOfficalAccount">@ViewBag.CurrentOfficalAcount</span></p>
                        </td>
                    </tr>
                </table>
                <p id="p11" class="displaynone">
                    <p class="mvctool bgb">
                        @Html.ToolButton("btnSava11", "fa fa-plus", "提交保存", ref perm, "Edit", false)                    </p>
                    <textarea id="Text1" style="width: 300px;height: 330px; margin:20px;"></textarea>
                </p>
                <p id="p12" class="displaynone">
                    <p class="mvctool bgb">
                        @Html.ToolButton("btnCreate12", "fa fa-search", "添加回复", ref perm, "Edit", false)
                        @Html.ToolButton("btnEdit12", "fa fa-search", "编辑", ref perm, "Edit", true)
                        @Html.ToolButton("btnDelete12", "fa fa-search", "删除", ref perm, "Delete", false)                    </p>
                    <p id="modalwindow1" class="easyui-window" style="width:600px; height:550px;" data-options="modal:true,closed: true,minimizable:false,shadow:false">
                        <p class="mvctool bgb">
                            @Html.ToolButton("btnSava12", "fa fa-search", "提交保存", ref perm, "Edit", false)                            
                        </p>
                        <table class="formtablenormal">
                            <tr><th>标题: </th><td><input type="text" id="ImageTitle1" class="textbox" data-options="required:true" /></td></tr>
                            <tr>
                                <th>图片: </th>
                                <td>
                                    <form id="form12" method="post">
                                        <input type="hidden" name="ImageUrl1" id="ImageUrl1" />
                                        <img class="expic" src="/Content/Images/NotPic.jpg" />
                                        <br />
                                        <a href="javascript:$(&#39;#FileUpload12&#39;).trigger(&#39;click&#39;);" class="files">@Resource.Browse</a>
                                        <input type="file" id="FileUpload12" class="displaynone" name="FileUpload12" onchange="Upload(&#39;SingleFile&#39;, &#39;ImageUrl1&#39;, &#39;FileUpload12&#39;, &#39;1&#39;, &#39;1&#39;, &#39;#form12&#39;);" />
                                        <span class="uploading">@Resource.Uploading</span>
                                    </form>
                            </tr>
                            <tr><th>内容: </th><td><textarea id="ImageContent1" style="width: 300px; height: 100px;"></textarea></td></tr>
                            <tr><th>链接: </th><td><input type="text" id="ImageLink1" /></td></tr>
                            <tr><th>排序: </th><td><input type="number" id="Sort1" value="0" /></td></tr>
                        </table>

                    </p>
                    <p style="padding:10px;">
                        <table id="List1"></table>
                    </p>
                </p>

                <p id="p13" class="displaynone">
                    <p class="mvctool bgb">
                        @Html.ToolButton("btnSava13", "fa fa-plus", "提交保存", ref perm, "Edit", false)                    </p>
                    <table class="formtablenormal" style="margin:20px;">
                        <tr><th>标题: </th><td><input type="text" id="VoiceTitle1" /></td></tr>
                        <tr>
                            <th>语音: </th>
                            <td>
                                <form id="form13" method="post">
                                    <input type="text" name="VoiceUrl1" class="left" id="VoiceUrl0" />
                                    <a href="javascript:$(&#39;#FileUpload13&#39;).trigger(&#39;click&#39;);" class="files">@Resource.Browse</a>
                                    <input type="file" accept="audio/mpeg" id="FileUpload13" class="displaynone" name="FileUpload13" onchange="Upload(&#39;SingleFile&#39;, &#39;VoiceUrl1&#39;, &#39;FileUpload13&#39;, &#39;&#39;, &#39;&#39;, &#39;#form13&#39;);" />
                                    <span class="uploading">@Resource.Uploading</span>
                                </form>
                            </td>
                        </tr>
                        <tr><th>描述: </th><td><textarea id="VoiceContent1" style="width:335px; height:300px;"></textarea></td></tr>
                    </table>
                </p>  
            </p>

            <p title="文本回复" style="padding:10px">
                <p class="mvctool ">
                    @Html.ToolButton("btnCreate2", "fa fa-search", "添加回复", ref perm, "Edit", true)
                    @Html.ToolButton("btnEdit2", "fa fa-search", "编辑", ref perm, "Edit", true)
                    @Html.ToolButton("btnDelete2", "fa fa-search", "删除", ref perm, "Delete", false)                    <p class="rightp color-green">
                        当前操作公众号: <span id="CurrentOfficalAccount">@ViewBag.CurrentOfficalAcount</span>
                    </p>
                </p>
                <p id="modalwindow2"
                        class="easyui-window"
                        style="width:600px; height:500px;" data-options="modal:true,closed: true,minimizable:false,shadow:false">
                    <p class="mvctool bgb">
                        @Html.ToolButton("btnSava2", "fa fa-search", "提交保存", ref perm, "Edit", false)                        <p class="rightp color-green">
                            当前操作公众号: <span id="CurrentOfficalAccount">@ViewBag.CurrentOfficalAcount</span>
                        </p>
                    </p>
                    <table class="formtablenormal">
                        <tr>
                            <th>关键字: </th>
                            <td>
                                <input type="text" id="TextMatchKey2" />
                            </td>
                        </tr>
                        <tr>
                            <th>规则: </th>
                            <td>
                                @Html.SwitchButtonByEdit("swMessageRule2", true, "模糊匹配(关键字包含内容) ", "完全匹配(内容与关键字完全匹配)", "280")                            </td>
                        </tr>
                        <tr>
                            <th>内容: </th>
                            <td>
                                <textarea id="Text2" style="width: 280px;height:200px"></textarea>
                            </td>
                        </tr>
                    </table>
                </p>
                <table id="List2"></table>
               
            </p>

            <p title="图片回复" style="padding:10px">
                <p class="mvctool">
                    @Html.ToolButton("btnCreate3", "fa fa-search", "添加回复", ref perm, "Edit", true)
                    @Html.ToolButton("btnEdit3", "fa fa-search", "编辑", ref perm, "Edit", true)
                    @Html.ToolButton("btnDelete3", "fa fa-search", "删除", ref perm, "Delete", false)                    <p class="rightp color-green">
                        当前操作公众号: <span id="CurrentOfficalAccount">@ViewBag.CurrentOfficalAcount</span>
                    </p>
                </p>
                <p id="modalwindow3" class="easyui-window" style="width:600px; height:550px;" data-options="modal:true,closed: true,minimizable:false,shadow:false">
                    <p class="mvctool bgb">
                        @Html.ToolButton("btnSava3", "fa fa-search", "提交保存", ref perm, "Edit", false)                        <p class="rightp color-green">
                            当前操作公众号: <span id="CurrentOfficalAccount">@ViewBag.CurrentOfficalAcount</span>
                        </p>
                    </p>
                    <table class="formtablenormal">
                        <tr><th>标题: </th><td><input type="text" id="ImageTitle3" /></td></tr>
                        <tr>
                            <th>关键字: </th>
                            <td>
                                <input type="text" id="TextMatchKey3" />
                            </td>
                        </tr>
                        <tr>
                            <th>规则: </th>
                            <td>
                                @Html.SwitchButtonByEdit("swMessageRule3", true, "模糊匹配(关键字包含内容) ", "完全匹配(内容与关键字完全匹配)", "280")                            </td>
                        </tr>
                        <tr>
                            <th>图片: </th>
                            <td>
                                <form id="form3" method="post">
                                    <input type="hidden" name="ImageUrl3" id="ImageUrl3" />
                                    <img class="expic" src="/Content/Images/NotPic.jpg" />
                                    <br />
                                    <a href="javascript:$(&#39;#FileUpload3&#39;).trigger(&#39;click&#39;);" class="files">@Resource.Browse</a>
                                    <input type="file" id="FileUpload3" class="displaynone" name="FileUpload3" onchange="Upload(&#39;SingleFile&#39;, &#39;ImageUrl3&#39;, &#39;FileUpload3&#39;, &#39;1&#39;, &#39;1&#39;, &#39;#form3&#39;);" />
                                    <span class="uploading">@Resource.Uploading</span>
                                </form>
                            </td>
                        </tr>
                        <tr><th>内容: </th><td><textarea id="ImageContent3" style="width: 300px; height: 80px;"></textarea></td></tr>
                        <tr><th>链接: </th><td><input type="text" id="ImageLink3" /></td></tr>
                        <tr><th>排序: </th><td><input type="number" id="Sort3" value="0" /></td></tr>
                    </table>
                  
                </p>
                <table><tr><td><table id="List31"></table></td><td> </td><td><table id="List3"></table></td></tr></table>
               
            </p>

            <p title="语音回复" style="padding:10px">
                <p class="mvctool ">
                    @Html.ToolButton("btnCreate4", "fa fa-search", "添加回复", ref perm, "Edit", false)
                    @Html.ToolButton("btnEdit4", "fa fa-search", "编辑", ref perm, "Edit", true)
                    @Html.ToolButton("btnDelete4", "fa fa-search", "删除", ref perm, "Delete", false)                    <p class="rightp color-green">
                        当前操作公众号: <span id="CurrentOfficalAccount">@ViewBag.CurrentOfficalAcount</span>
                    </p>
                </p>
                <p id="modalwindow4"
                     class="easyui-window"
                     style="width:600px; height:500px;" data-options="modal:true,closed: true,minimizable:false,shadow:false">
                    <p class="mvctool bgb">
                        @Html.ToolButton("btnSava4", "fa fa-search", "提交保存", ref perm, "Edit", false)                        <p class="rightp color-green">
                            当前操作公众号: <span id="CurrentOfficalAccount">@ViewBag.CurrentOfficalAcount</span>
                        </p>
                    </p>
                    <table class="formtablenormal">
                        <tr><th>标题: </th><td><input type="text" id="VoiceTitle4" /></td></tr>
                        <tr>
                            <th>关键字: </th>
                            <td>
                                <input type="text" id="TextMatchKey4" />
                            </td>
                        </tr>
                        <tr>
                            <th>规则: </th>
                            <td>
                                @Html.SwitchButtonByEdit("swMessageRule4", true, "模糊匹配(关键字包含内容) ", "完全匹配(内容与关键字完全匹配)", "280")                            </td>
                        </tr>
                        <tr>
                            <th>语音: </th>
                            <td>
                                <form id="form4" method="post">
                                    <input type="text" class="left" name="VoiceUrl4" id="VoiceUrl4" />
                                    <a href="javascript:$(&#39;#FileUpload4&#39;).trigger(&#39;click&#39;);" class="files">@Resource.Browse</a>
                                    <input type="file" id="FileUpload4" accept="audio/mpeg" class="displaynone" name="FileUpload4" onchange="Upload(&#39;SingleFile&#39;, &#39;VoiceUrl4&#39;, &#39;FileUpload4&#39;, &#39;&#39;, &#39;&#39;, &#39;#form4&#39;);" />
                                    <span class="uploading">@Resource.Uploading</span>
                                </form>
                               
                            </td>
                        </tr>
                        <tr><th>描述: </th><td><textarea id="VoiceContent4" style="width: 300px; height: 100px;"></textarea></td></tr>
                       
                    </table>

                </p>
                <table id="List4"></table>
            </p>
            @*<p title="视频回复"
                 style="padding:10px">
            </p>*@
            @*<p title="链接回复"
                 styIe="padding:10px">
            </p>
            <p title="LBS位置回复"
                 style="padding:10px">
            </p>*@        </p>
    </p>
登入後複製

View Code

利用前端的心智圖,來快速理解前端程式碼,和應用於實際######總結###### #訊息的管理是非常有技巧的一件事######1.訊息在沒有任務回复的情況下,我們應該啟用默認回复,要不用戶會得不到回應,丟失體驗#### ##2.關鍵字的設計通常是一環扣一環,是有引導作用的######   例如:關鍵字:(我要)   回覆: 按1加入獲得禮品一份,按2直接獲得50元######    關鍵字:(1)       回覆: 按3取得鐵觀音茶一份,按4獲得普洱茶######    關鍵字:(3或4)  回覆:請回覆您的回覆地址和電話及收件人######   這樣我們將獲得系統與用戶之間的完整對話,當然我們也要對用戶最後的資訊進行處理###

以上是ASP.NET MVC5+EF6+EasyUI 後台管理系統微信公眾平台開發的詳細內容。更多資訊請關注PHP中文網其他相關文章!

本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

PHP微信開發:如何實作訊息加密解密 PHP微信開發:如何實作訊息加密解密 May 13, 2023 am 11:40 AM

PHP是一種開源的腳本語言,廣泛應用於網頁開發和伺服器端編程,尤其在微信開發中得到了廣泛的應用。如今,越來越多的企業和開發者開始使用PHP進行微信開發,因為它成為了真正的易學易用的開發語言。在微信開發中,訊息的加密和解密是一個非常重要的問題,因為它們涉及資料的安全性。對於沒有加密和解密方式的消息,駭客可以輕鬆取得其中的數據,對用戶造成威脅

用PHP開發微信群發工具 用PHP開發微信群發工具 May 13, 2023 pm 05:00 PM

隨著微信的普及,越來越多的企業開始將其作為行銷工具。而微信群發功能,則是企業進行微信行銷的重要手段之一。但是,如果只依靠手動發送,對於行銷人員來說是一件極為費時費力的工作。所以,開發一款微信群發工具就顯得格外重要。本文將介紹如何使用PHP開發微信群發工具。一、準備工作開發微信群發工具,我們需要掌握以下幾個技術點:PHP基礎知識微信公眾平台開發開發工具:Sub

PHP微信開發:如何實現使用者標籤管理 PHP微信開發:如何實現使用者標籤管理 May 13, 2023 pm 04:31 PM

在微信公眾號開發中,使用者標籤管理是一個非常重要的功能,可以讓開發者更了解和管理自己的使用者。本篇文章將介紹如何使用PHP實作微信使用者標籤管理功能。一、取得微信用戶openid在使用微信用戶標籤管理功能之前,我們首先需要取得用戶的openid。在微信公眾號開發中,透過使用者授權的方式取得openid是比較常見的做法。在使用者授權完成後,我們可以透過以下程式碼取得用

PHP微信開發:如何實作群發訊息傳送記錄 PHP微信開發:如何實作群發訊息傳送記錄 May 13, 2023 pm 04:31 PM

隨著微信成為了人們生活中越來越重要的通訊工具,其敏捷的訊息傳遞功能迅速受到廣大企業和個人的青睞。對企業而言,將微信發展為一個行銷平台已經成為趨勢,而微信開發的重要性也逐漸凸顯。在其中,群發功能更是被廣泛使用,那麼,作為PHP程式設計師,如何實現群發訊息發送記錄呢?以下將為大家簡單介紹一下。 1.了解微信公眾號相關開發知識在了解如何實現群發訊息發送記錄之前,我

使用PHP實現微信公眾號開發的步驟 使用PHP實現微信公眾號開發的步驟 Jun 27, 2023 pm 12:26 PM

如何使用PHP實現微信公眾號開發微信公眾號已經成為了許多企業推廣和互動的重要管道,而PHP作為常用的Web語言,也可以用來進行微信公眾號的開發。本文將介紹使用PHP實現微信公眾號開發的具體步驟。第一步:取得微信公眾號的開發者帳號在開始微信公眾號開發之前,需要先去申請一個微信公眾號的開發者帳號。具體的註冊流程可參考微信公眾平台的官方網

PHP微信開發:如何實現投票功能 PHP微信開發:如何實現投票功能 May 14, 2023 am 11:21 AM

在微信公眾號開發中,投票功能經常被運用。投票功能是讓使用者快速參與互動的好方式,也是舉辦活動和調查意見的重要工具。本文將為您介紹如何使用PHP實作微信投票功能。在取得微信公眾號授權首先,你需要取得微信公眾號的授權。在微信公眾平台上,你需要設定微信公眾號碼的api地址、官方帳號和公眾號碼對應的token。在我們使用PHP語言開發的過程中,我們需要使用微信官方提供的PH

PHP微信開發:如何實現客服聊天視窗管理 PHP微信開發:如何實現客服聊天視窗管理 May 13, 2023 pm 05:51 PM

微信是目前全球用戶規模最大的社群平台之一,隨著行動網路的普及,越來越多的企業開始意識到微信行銷的重要性。在進行微信行銷時,客服服務是至關重要的一環。為了更好地管理客服聊天窗口,我們可以藉助PHP語言進行微信開發。一、PHP微信開發簡介PHP是一種開源的伺服器端腳本語言,廣泛用於Web開發領域。結合微信公眾平台提供的開發接口,我們可以使用PHP語言進行微信

如何使用PHP進行微信開發? 如何使用PHP進行微信開發? May 21, 2023 am 08:37 AM

隨著網路和行動智慧型裝置的發展,微信成為了社交和行銷領域不可或缺的一部分。在這個越來越數位化的時代,如何使用PHP進行微信開發已經成為了許多開發者的關注點。本文主要介紹如何使用PHP進行微信發展的相關知識點,以及其中的一些技巧和注意事項。一、開發環境準備在進行微信開發之前,首先需要準備好對應的開發環境。具體來說,需要安裝PHP的運作環境,以及微信公眾平台提

See all articles