public JsonResult Create(JMP.Model.MonitorChannel model)
        {
            object retJson = new { success = 0, msg = "操作失败" };
            var    bll     = new MonitorChannel();
            var    xgzfc   = "";


            if (model.a_id > 0)
            {
                // 修改通道监控
                var modComplaint      = bll.GetModel(model.a_id);
                var modComplaintClone = modComplaint.Clone();
                modComplaint.ChannelId = model.ChannelId;
                modComplaint.a_type    = model.a_type;

                // model.a_datetime = modComplaint.a_datetime;
                // model.a_state = modComplaint.a_state;
                // model.ChannelId = modComplaint.ChannelId;
                modComplaint.Threshold = model.Threshold / 100;
                if (model.StartDay != -1 && model.EndDay != -1 && model.DayMinute != 0)
                {
                    modComplaint.a_time_range += model.StartDay + "-" + model.EndDay + ":" + model.DayMinute + "_";
                }
                if (model.StartNight != -1 && model.EndNight != -1 && model.NightMinute != 0)
                {
                    modComplaint.a_time_range += model.StartNight + "-" + model.EndNight + ":" + model.NightMinute;
                }
                if (model.OtherMinte != 0)
                {
                    modComplaint.a_time_range += "_100:" + model.OtherMinte;
                }
                var exitmod = bll.GetModelByTD(model.ChannelId, model.a_type);
                if (exitmod != null && model.a_id != exitmod.a_id)
                {
                    retJson = new { success = 0, msg = "此通道监控已存在" };
                    return(Json(retJson));
                }
                var monitorList = modComplaint.a_time_range.ParseAppMonitorTimeRangeTo24Hours();
                AddMonitorMinuteDetails(modComplaint.ChannelId, modComplaint.a_type, monitorList);
                if (bll.Update(modComplaint))
                {
                    Logger.ModifyLog("修改通道监控信息", modComplaintClone, model);

                    retJson = new { success = 1, msg = "修改成功" };
                }
                else
                {
                    retJson = new { success = 0, msg = "修改失败" };
                }
            }
            else
            {
                model.a_datetime = DateTime.Now;
                model.a_state    = 1;
                if (model.StartDay != -1 && model.EndDay != -1 && model.DayMinute != 0)
                {
                    model.a_time_range += model.StartDay + "-" + model.EndDay + ":" + model.DayMinute + "_";
                }
                if (model.StartNight != -1 && model.EndNight != -1 && model.NightMinute != 0)
                {
                    model.a_time_range += model.StartNight + "-" + model.EndNight + ":" + model.NightMinute;
                }
                if (model.OtherMinte == 0)
                {
                    model.a_time_range += "_100:" + 5;
                }
                else
                {
                    model.a_time_range += "_100:" + model.OtherMinte;
                }
                var monitorList = model.a_time_range.ParseAppMonitorTimeRangeTo24Hours();
                model.Threshold = model.Threshold / 100;
                var appidList = model.a_appidList.Split(',');
                foreach (var i in appidList)
                {
                    var appId = int.Parse(i);
                    if (appId <= 0)
                    {
                        continue;
                    }
                    var exists = bll.Exists(appId, model.a_type);
                    if (exists)
                    {
                        retJson = new { success = 0, msg = "此通道监控已存在" };
                        continue;
                    }
                    model.ChannelId = appId;
                    var cg = bll.Add(model);
                    if (cg > 0)
                    {
                        AddMonitorMinuteDetails(model.ChannelId, model.a_type, monitorList);
                        Logger.CreateLog("添加通道监控信息", model);

                        retJson = new { success = 1, msg = "添加成功" };
                    }
                    else
                    {
                        retJson = new { success = 1, msg = "添加失败" };
                    }
                }
            }
            return(Json(retJson));
        }