public GroupNoticeInfo GetGroupNotice(string RequestingAgentID, UUID noticeID)
        {
            NoticeData data = m_Database.RetrieveNotice(noticeID);

            if (data == null)
            {
                return(null);
            }

            return(_NoticeDataToInfo(data));
        }
Esempio n. 2
0
    private IEnumerator DoWWW()
    {
        WWWForm form = new WWWForm();

        form.AddField("cmd", "getNotice");
        form.AddField("lang", "zh");

        WWW getData = new WWW(AppSettings.gameServerUrl, form);

        yield return(getData);

        if (getData.error == null)
        {
            string            jsonStr = getData.text;
            List <NoticeData> notices = NoticeData.listFromJson <NoticeData>(jsonStr);

            NoticeData data = notices[0];
            //var oneNotice = noticeList[0];
            //List<object> x = noticeList;

            /*
             * foreach (Dictionary<string, object> dict in noticeList)
             * {
             *      Debug.Log ("fail");
             * }
             */

            /*
             * foreach (var oneNotice in noticeList)
             * {
             *      Debug.Log(oneNotice.ToString());
             * }
             */

            Debug.Log(data.desc);
            Debug.Log(getData.error);

            //newVersionPanelFsm.SendEvent("Has New Version");
        }
        else
        {
            Debug.Log("success");
            Debug.Log(getData.text);

            /*
             * if (getData.text != "1")
             * {
             *      newVersionPanelFsm.SendEvent("Has New Version");
             *      appUrl = getData.text;
             * }
             */
        }
    }
Esempio n. 3
0
 public object GetAnnouncement([FromBody] JObject json)
 {
     try
     {
         string  res = json.Value <string>("json");
         dynamic dy  = JsonConvert.DeserializeObject <ExpandoObject>(res);
         //获取用户Id
         string userId = dy.userid;
         OperatorProvider.AppUserId = userId;  //设置当前用户
         Operator curUser = OperatorProvider.Provider.Current();
         if (null == curUser)
         {
             return(new { code = -1, count = 0, info = "请求失败,请登录!" });
         }
         string             id     = dy.data.AnnouncementId;//通知公告记录ID
         AnnouncementEntity entity = announcementbll.GetEntity(id);
         if (entity == null)
         {
             throw new ArgumentException("未找到信息");
         }
         //未开放
         //else
         //{
         //    if (entity.IsSend == "0")
         //    {
         //        //更改状态
         //        announcementbll.UpdateStatus(id);
         //    }
         //}
         string       jsondata = JsonConvert.SerializeObject(entity);
         NoticeData   model    = JsonConvert.DeserializeObject <NoticeData>(jsondata);
         List <Photo> pList    = new List <Photo>(); //附件
         DataTable    file     = fileInfoBLL.GetFiles(entity.Id);
         foreach (DataRow dr in file.Rows)
         {
             Photo p = new Photo();
             p.id       = dr["fileid"].ToString();
             p.filename = dr["filename"].ToString();
             p.fileurl  = dataitemdetailbll.GetItemValue("imgUrl") + dr["filepath"].ToString().Substring(1);
             pList.Add(p);
         }
         model.file = pList;
         JsonSerializerSettings settings = new JsonSerializerSettings
         {
             DateFormatString = "yyyy-MM-dd HH:mm", //格式化日期
         };
         return(new { code = 0, info = "获取数据成功", data = JObject.Parse(JsonConvert.SerializeObject(model, Formatting.None, settings)) });
     }
     catch (Exception ex)
     {
         return(new { Code = -1, Count = 0, Info = ex.Message });
     }
 }
Esempio n. 4
0
    private void onInitializeItemNotice(GameObject go, int dataindex)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("Activity_hotfix", "onInitializeItemNotice"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.Activity_hotfix",
                                                              "onInitializeItemNotice", null, go, dataindex);
            return;
        }

        Toggle toggle = go.GetComponent <Toggle>();

        toggle.group = toggleGroup;
        if (dataindex == 0)
        {
            toggle.isOn = true;

            if (go.transform.GetChild(0).gameObject.activeSelf)
            {
                go.transform.GetChild(0).gameObject.SetActive(false);
            }

            InitItemNotice(dataindex);
        }
        else
        {
            toggle.isOn = false;
        }

        toggle.onValueChanged.RemoveAllListeners();
        toggle.onValueChanged.AddListener((b) => OnNoticeToggleValueChange(go, b, dataindex));

        //设置数据
        NoticeData noticeData = noticeDatas[dataindex];

        go.transform.GetChild(2).GetComponent <Text>().text = noticeData.title;

        //设置小红点
        string s = PlayerPrefs.GetString(UserData.uid + "notice" + noticeDatas[dataindex].notice_id);

        if (string.IsNullOrEmpty(s))
        {
            go.transform.Find("RedPoint").gameObject.SetActive(true);
        }
        else
        {
            go.transform.Find("RedPoint").gameObject.SetActive(false);
        }
    }
    public NoticeData getNoticeDataById(int notice_id)
    {
        NoticeData noticeData = null;

        for (int i = 0; i < m_noticeDataList.Count; i++)
        {
            if (m_noticeDataList[i].notice_id == notice_id)
            {
                noticeData = m_noticeDataList[i];
                break;
            }
        }

        return(noticeData);
    }
Esempio n. 6
0
        private ExtendedGroupNoticeData _NoticeDataToData(NoticeData data)
        {
            ExtendedGroupNoticeData notice = new ExtendedGroupNoticeData();

            notice.FromName      = data.Data["FromName"];
            notice.NoticeID      = data.NoticeID;
            notice.Subject       = data.Data["Subject"];
            notice.Timestamp     = uint.Parse((string)data.Data["TMStamp"]);
            notice.HasAttachment = data.Data["HasAttachment"] == "1" ? true : false;
            if (notice.HasAttachment)
            {
                notice.AttachmentName    = data.Data["AttachmentName"];
                notice.AttachmentItemID  = new UUID(data.Data["AttachmentItemID"].ToString());
                notice.AttachmentType    = byte.Parse(data.Data["AttachmentType"].ToString());
                notice.AttachmentOwnerID = data.Data["AttachmentOwnerID"].ToString();
            }

            return(notice);
        }
Esempio n. 7
0
        public int insertNoticeBoardlData(string Notice_Id, string Notice_title, string Notice_text, string Notice_Date)
        {
            try
            {
                NoticeData tbl = new NoticeData();

                tbl.content_id    = Notice_Id;
                tbl.content_title = Notice_title;
                tbl.content_text  = Notice_text;
                tbl.content_date  = Notice_Date;


                int i = db.Insert(tbl);


                return(i);
            }
            catch (Exception ex)
            { return(0); }
        }
Esempio n. 8
0
    public void setNoticeId(int notice_id)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("NoticeDetailScript_hotfix", "setNoticeId"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.NoticeDetailScript_hotfix", "setNoticeId", null, notice_id);
            return;
        }

        m_noticeData = NoticelDataScript.getInstance().getNoticeDataById(notice_id);
        m_title.text = m_noticeData.title_limian;

        string content = m_noticeData.content.Replace("^", "\r\n");

        LogUtil.Log(content);
        m_content.text = content;

        //m_time.text = m_noticeData.start_time;
        m_from.text = m_noticeData.from;
    }
Esempio n. 9
0
        public App(string dbPath)
        {
            // 16.4.0.54
            //Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("MTM5OTI0QDMxMzYyZTM0MmUzMGM1OEFZTGR0VjdUZUw1RWl2WEJZSzBqQmRjMldPVzRkMFM2VGtRVGR2dkk9");

            //17.2.0.34
            Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("MTM5OTIzQDMxMzcyZTMyMmUzMGhGNUZBVnh1T3RBVFlBT0xpeHlrT01rRVRNSk1RMFgxbENSZlJWc0FxbjQ9");

            //set database path first, then retrieve main page
            CityRepo            = new CityRepository(dbPath);
            Notice_data         = new NoticeData(dbPath);
            Thread_data         = new ThreadData(dbPath);
            Thread_Comment_data = new ThreadCommentData(dbPath);
            Column_data         = new ColumnData(dbPath);
            Favorite_News_Data  = new FavoriteNewsDB(dbPath);
            newReportItem       = new NewRoportDB(dbPath);

            InitializeComponent();

            MainPage = new NavigationPage(new BlankPage());
        }
    public void setNoticeData(NoticeData noticeData)
    {
        // 优先使用热更新的代码
        if (ILRuntimeUtil.getInstance().checkDllClassHasFunc("Item_Notice_List_Script_hotfix", "setNoticeData"))
        {
            ILRuntimeUtil.getInstance().getAppDomain().Invoke("HotFix_Project.Item_Notice_List_Script_hotfix", "setNoticeData", null, noticeData);
            return;
        }

        m_noticeData = noticeData;

        {
            m_text_title.text = m_noticeData.title;
            m_text_time.text  = m_noticeData.start_time;

            // 已读
            if (m_noticeData.state == 1)
            {
                m_redPoint.transform.localScale = new Vector3(0, 0, 0);
            }
        }
    }
        private void CreateFaceLabel(NoticeData node)
        {
            var obj = ComplexObjectPool.NewObjectSync("UI/RechargeActivity/RechargeActivityIcon.prefab");

            if (obj == null)
            {
                return;
            }
            _mObj.Add(obj);
            var faceSprite   = obj.GetComponent <UISprite>();
            var objTransform = obj.transform;

            objTransform.SetParentEX(BackGround.transform);
            objTransform.localScale = Vector3.one;
            obj.SetActive(true);
            var faceWidth  = PicWidth;    //(int)(FontSize * 2.0f);
            var faceHeight = PicWidth;    // (int)(FontSize * 2.0f);

            faceSprite.width  = faceWidth;
            faceSprite.height = faceHeight;
            if (MaxLineWidth < mPositionX + faceWidth)
            {
                mPositionX  = (int)(FontSize * 0.5f);
                mPositionY -= mLineOffset + FontSize;
            }
            var picPos = mPositionY + (PicWidth - FontSize) / 2;
            var iconId = node.IconId;
            var tbFace = Table.GetIcon(iconId);

            if (tbFace == null)
            {
                return;
            }
            GameUtils.SetSpriteIcon(faceSprite, tbFace.Atlas, tbFace.Sprite);
            _mNeedSetLine = false;
            objTransform.localPosition = new Vector3(mPositionX, picPos, 0);
            //  Logger.Info("FaceLabel:{0},{1}", objTransform.localPosition.x, objTransform.localPosition.y);
            AddPositionX(faceWidth);
        }
        protected bool _AddNotice(UUID groupID, UUID noticeID, string fromName, string subject, string message,
                                  bool hasAttachment, byte attType, string attName, UUID attItemID, string attOwnerID)
        {
            NoticeData data = new NoticeData();

            data.GroupID               = groupID;
            data.NoticeID              = noticeID;
            data.Data                  = new Dictionary <string, string>();
            data.Data["FromName"]      = fromName;
            data.Data["Subject"]       = subject;
            data.Data["Message"]       = message;
            data.Data["HasAttachment"] = hasAttachment ? "1" : "0";
            if (hasAttachment)
            {
                data.Data["AttachmentType"]    = attType.ToString();
                data.Data["AttachmentName"]    = attName;
                data.Data["AttachmentItemID"]  = attItemID.ToString();
                data.Data["AttachmentOwnerID"] = attOwnerID;
            }
            data.Data["TMStamp"] = ((uint)Util.UnixTimeSinceEpoch()).ToString();

            return(m_Database.StoreNotice(data));
        }
Esempio n. 13
0
    public void OnClick()
    {
        if (NoticeModel.Instance.notices.Count == 0 && MFPDeviceAndroid.Instance.getNetWorkState() == MFPDeviceAndroid.NETWORK_STATE_NOT_CONNECTED)
        {
            fsm.SendEvent("Lives");
            noContentObj.SetActive(true);
            contentObj.SetActive(false);
            return;
        }

        noContentObj.SetActive(false);
        contentObj.SetActive(true);

        // Once click notice button, will send get notice service
        NoticeModel.Instance.hasGotNotice = false;

        GameObject noticeServiceObj = GameObject.Find("NoticeService");

        noticeServiceObj.SendMessage("getNoticeService");

        /*
         * Dictionary<string, object> data = new Dictionary<string, object> ();
         * data["cmd"] = "getNotice";
         * data["lang"] = "zh_cn";
         * HttpRequestService.sendRequest(data, new HttpRequestService.RequestSuccessDelegate(onGetNoticesSuccess), new HttpRequestService.RequestFailDelegate(onGetNoticesFail));
         */

        fsm.SendEvent("Lives");

        foreach (GameObject obj in noticeCellObjects)
        {
            obj.SetActive(false);
        }

        foreach (GameObject obj in buttonObjects)
        {
            obj.SetActive(false);
        }

        int i = 0;

        for (; NoticeModel.Instance.notices != null && i < NoticeModel.Instance.notices.Count; i++)
        {
            NoticeData oneNotice = NoticeModel.Instance.notices[i];

            if (i < noticeCellObjects.Count)
            {
                GameObject cellObj = noticeCellObjects[i];
                cellObj.SetActive(true);

                GameObject titleObj      = cellObj.transform.Find("TitleLabel").gameObject;
                UILabel    titleLabelCom = titleObj.GetComponent <UILabel>();
                titleLabelCom.text = oneNotice.title;

                GameObject infoObj      = cellObj.transform.Find("InfoLabel").gameObject;
                UILabel    infoLabelCom = infoObj.GetComponent <UILabel>();
                infoLabelCom.text = oneNotice.descWithLineChange;

                if (oneNotice.type == 2)
                {
                    buttonObjects[i].SetActive(true);

                    GameObject buttonLabelObj = buttonObjects[i].transform.Find("ButtonLabel").gameObject;
                    UILabel    buttonLabelCom = buttonLabelObj.GetComponent <UILabel>();
                    buttonLabelCom.text = oneNotice.btn_name;
                }
            }
        }

        for (; i < noticeCellObjects.Count; i++)
        {
            GameObject cellObj = noticeCellObjects[i];
            cellObj.SetActive(false);
        }

        /*
         * if (HttpRequestService.getUserID() != -1)
         * {
         *      GameObject uidLabelObj = GameObject.Find("MFP Notice Panel Portrait/UID Label");
         *      UILabel uiLabel = uidLabelObj.GetComponent<UILabel>();
         *      uiLabel.text = Language.Get("USER_ID_KEY") + HttpRequestService.getUserID().ToString();
         * }
         */
    }
Esempio n. 14
0
 public bool StoreNotice(NoticeData data)
 {
     return(false);
 }
        private void CreateTextLabel(NoticeData noticeNotice)
        {
            var value = noticeNotice.Content;
            var obj   = ComplexObjectPool.NewObjectSync("UI/RechargeActivity/RechargeActivityText.prefab");

            if (obj == null)
            {
                return;
            }
            _mObj.Add(obj);
            _mVarObjList.Add(new GameObjectType(obj, noticeNotice.Type));
            var objTransform = obj.transform;

            objTransform.SetParentEX(BackGround.transform);
            obj.SetActive(true);
            var label = obj.GetComponent <UILabel>();

            var sbstr = "";
            var text  = "";


            label.fontSize     = FontSize;
            NGUIText.fontSize  = label.fontSize;
            NGUIText.finalSize = label.fontSize;
            if (mPositionX > MaxLineWidth)
            {
                ChangeLine();
            }
            NGUIText.dynamicFont     = label.trueTypeFont;
            NGUIText.regionWidth     = MaxLineWidth - mPositionX;
            NGUIText.maxLines        = 10000;
            NGUIText.pixelDensity    = 1.0f;
            NGUIText.regionHeight    = 10000;
            NGUIText.finalLineHeight = label.fontSize;
            NGUIText.fontScale       = 1.0f;
            NGUIText.WrapText(value, out sbstr, false, true);
            var index = sbstr.IndexOf("\n");

            if (index > -1)
            {
                text = sbstr.Substring(0, index);
            }
            else
            {
                text = sbstr;
            }
            objTransform.localScale    = Vector3.one;
            objTransform.localPosition = new Vector3(mPositionX, mPositionY, 0);
            //Logger.Info("TextLabel:{0},{1},{2}", objTransform.localPosition.x, objTransform.localPosition.y,text);
            label.text = text;
            //positionX += label.width;
            AddPositionX(label.width);
            sbstr = sbstr.Remove(0, text.Length);
            if (sbstr.Length > 0)
            {
                ChangeLine();
                index = sbstr.IndexOf("\n");
                sbstr = sbstr.Substring(index + "\n".Length, sbstr.Length - "\n".Length);
                var notice = new NoticeData(eNoticeType.Text, -1, sbstr);
                CreateTextLabel(notice);
            }
        }
Esempio n. 16
0
 public bool StoreNotice(NoticeData data)
 {
     return(m_Notices.Store(data));
 }
Esempio n. 17
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json";

            string action = context.Request.QueryString["action"];

            if (string.Compare(action, "adminLogin", false) == 0)
            {
                int varifyCode = 0;
                if (int.TryParse(context.Request["captcha"], out varifyCode))
                {
                    string json = string.Empty;
                    Debug.Write(varifyCode);
                    int sCode = -1;
                    var o     = context.Session["varifyCode"];
                    if (o == null)
                    {
                        json = JsonConvert.SerializeObject(new { IsOk = "NoOk", Msg = "请刷新验证码再试" });
                        context.Response.Write(json);
                        return;
                    }
                    sCode = int.Parse(o.ToString());

                    if (sCode == varifyCode)
                    {
                        //验证用户名密码

                        FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, "admin", DateTime.Now, DateTime.Now.AddDays(1), false, "password", "/");
                        string     authticket            = FormsAuthentication.Encrypt(ticket);
                        HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, authticket);
                        cookie.Secure  = false;
                        cookie.Expires = ticket.Expiration;
                        cookie.Path    = FormsAuthentication.FormsCookiePath;
                        context.Response.Cookies.Add(cookie);

                        json = JsonConvert.SerializeObject(new { IsOk = "Ok" });
                        context.Response.Write(json);
                    }
                    else
                    {
                        json = JsonConvert.SerializeObject(new { IsOk = "NoOk", Msg = "验证码输入有误,请刷新验证码" });
                        context.Response.Write(json);
                        return;
                    }
                }
                else
                {
                    string json = JsonConvert.SerializeObject(new { IsOk = "NoOk", Msg = "" });
                    context.Response.Write(json);
                    return;
                }
            }
            else if (string.Compare(action, "yzm", false) == 0)
            {
                ValidateCode c    = new ValidateCode();
                string       code = c.CreateValidateCode(4);
                context.Session["varifyCode"] = code;

                c.CreateValidateGraphic(code, context);
            }
            else if (string.Compare(action, "loginInfo", false) == 0)
            {
                context.Response.ContentType = "application/json";
                LoginInfoData data = new LoginInfoData();

                int page  = int.Parse(context.Request["page"]);
                int limit = int.Parse(context.Request["limit"]);


                data.code  = 0;
                data.msg   = "ok";
                data.count = 6;

                List <LoginInfo> listInfo = new List <LoginInfo>();

                listInfo.Add(new LoginInfo()
                {
                    City      = "重庆",
                    Id        = 0,
                    Ip        = "192.168.1.1",
                    UserName  = "******",
                    LoginDate = "2020-6-10 19:00:00",
                    UserOS    = "win10"
                });
                listInfo.Add(new LoginInfo()
                {
                    City      = "重庆",
                    Id        = 1,
                    Ip        = "192.168.1.1",
                    UserName  = "******",
                    LoginDate = "2020-6-10 19:00:00",
                    UserOS    = "win10"
                });
                listInfo.Add(new LoginInfo()
                {
                    City      = "重庆",
                    Id        = 2,
                    Ip        = "192.168.1.1",
                    UserName  = "******",
                    LoginDate = "2020-6-10 19:00:00",
                    UserOS    = "win10"
                });
                listInfo.Add(new LoginInfo()
                {
                    City      = "重庆",
                    Id        = 3,
                    Ip        = "192.168.1.1",
                    UserName  = "******",
                    LoginDate = "2020-6-10 19:00:00",
                    UserOS    = "win10"
                });
                listInfo.Add(new LoginInfo()
                {
                    City      = "重庆",
                    Id        = 4,
                    Ip        = "192.168.1.1",
                    UserName  = "******",
                    LoginDate = "2020-6-10 19:00:00",
                    UserOS    = "win10"
                });
                listInfo.Add(new LoginInfo()
                {
                    City      = "重庆",
                    Id        = 5,
                    Ip        = "192.168.1.1",
                    UserName  = "******",
                    LoginDate = "2020-6-10 19:00:00",
                    UserOS    = "win10"
                });
                data.data = listInfo.Skip((page - 1) * limit).Take(limit).ToList();



                context.Response.Write(JsonConvert.SerializeObject(data));
            }
            else if (string.Compare(action, "notice", false) == 0)
            {
                context.Response.ContentType = "application/json";
                string p    = context.Request["page"];
                string l    = context.Request["limit"];
                int    page = -1;
                if (!string.IsNullOrEmpty(p))
                {
                    page = int.Parse(p);
                }
                int limit = -1;
                if (!string.IsNullOrEmpty(l))
                {
                    limit = int.Parse(l);
                }

                NoticeData data = new NoticeData();
                data.code = 0;
                data.msg  = "ok";
                var list = TestData.getNotice();
                if (page < 0 || limit < 0)
                {
                    data.data = list;
                }
                else
                {
                    data.data = list.Skip((page - 1) * limit).Take(limit).ToList();
                }
                data.count = list.Count();



                context.Response.Write(JsonConvert.SerializeObject(data));
            }
            else if (string.Compare(action, "article", false) == 0)
            {
                context.Response.ContentType = "application/json";
                string p    = context.Request["page"];
                string l    = context.Request["limit"];
                int    page = -1;
                if (!string.IsNullOrEmpty(p))
                {
                    page = int.Parse(p);
                }
                int limit = -1;
                if (!string.IsNullOrEmpty(l))
                {
                    limit = int.Parse(l);
                }

                ArticleData data = new ArticleData();
                data.code = 0;
                data.msg  = "ok";
                var list = TestData.GetArticle();
                if (page < 0 || limit < 0)
                {
                    data.data = list;
                }
                else
                {
                    data.data = list.Skip((page - 1) * limit).Take(limit).ToList();
                }
                data.count = list.Count();



                context.Response.Write(JsonConvert.SerializeObject(data));
            }
            else if (string.Compare(action, "uploadImg", false) == 0)
            {
                ImgJson iJson = new ImgJson();
                iJson.data = new List <string>();

                string dir         = "\\UpImgs\\" + DateTime.Now.ToString("yyyyMMdd");
                string physicsPath = HttpContext.Current.Server.MapPath("~" + dir);
                if (!System.IO.Directory.Exists(physicsPath))
                {
                    System.IO.Directory.CreateDirectory(physicsPath);
                }
                for (int i = 0; i < context.Request.Files.Count; i++)
                {
                    string phPath = string.Empty;
                    //获取上传的文件的对象
                    HttpPostedFile img = context.Request.Files[i];

                    //获取上传文件的名称
                    string s = img.FileName;
                    var    strFileExtension = s.Substring(s.LastIndexOf('.') + 1, s.Length - s.LastIndexOf('.') - 1);
                    string allowextension   = System.Configuration.ConfigurationManager.AppSettings["ImageType"];
                    if (allowextension.ToLower().IndexOf(strFileExtension.ToLower()) >= 0)
                    {
                        int    len      = s.LastIndexOf(".") - s.LastIndexOf("\\") - 1;
                        string fileName = DateTime.Now.ToString("yyyyMMdd") + DateTime.Now.Millisecond.ToString();
                        string fullName = fileName + "." + strFileExtension;

                        //fileName = fileName.Replace(",", "");
                        //fullName = fullName.Replace(",", "");
                        //fullName = fullName.Replace(":", "");
                        //截取获得上传文件的名称(ie上传会把绝对路径也连带上,这里只得到文件的名称)
                        //string str = System.Guid.NewGuid().ToString("N")+ s.Substring(s.LastIndexOf(".") - 1); // s.Substring(s.LastIndexOf("\\") + 1);
                        string path = dir + "\\" + fullName;
                        phPath = physicsPath + "//" + fullName;
                        //保存文件
                        img.SaveAs(phPath);
                        iJson.data.Add(path);
                    }
                }
                if (iJson.data.Count > 0 && iJson.data.Count == context.Request.Files.Count)
                {
                    iJson.code = 1;
                }
                else
                {
                    iJson.code = 0;
                    iJson.msg  = "上传图片出现错误";
                }
                context.Response.ContentType = "application/json";
                context.Response.AddHeader("Content-Type", "text/html; charset=UTF-8");
                context.Response.Write(JsonConvert.SerializeObject(iJson));
            }
            else if (string.Compare(action, "uploadImg1", false) == 0)
            {
                context.Response.AddHeader("Content-Type", "text/html; charset=UTF-8");

                string fileType       = context.Request["dir"];
                string dir            = string.Empty;
                string allowextension = string.Empty;
                if (fileType == "file")
                {
                    dir            = "\\UpFiles\\" + DateTime.Now.ToString("yyyyMMdd");
                    allowextension = System.Configuration.ConfigurationManager.AppSettings["FileType"];
                }
                else
                {
                    dir            = "\\UpImgs\\" + DateTime.Now.ToString("yyyyMMdd");
                    allowextension = System.Configuration.ConfigurationManager.AppSettings["ImageType"];
                }
                try
                {
                    string physicsPath = HttpContext.Current.Server.MapPath("~" + dir);
                    if (!System.IO.Directory.Exists(physicsPath))
                    {
                        System.IO.Directory.CreateDirectory(physicsPath);
                    }
                    if (context.Request.Files.Count > 0)
                    {
                        string phPath = string.Empty;
                        //获取上传的文件的对象
                        HttpPostedFile img = context.Request.Files[0];

                        //获取上传文件的名称
                        string s = img.FileName;
                        var    strFileExtension = s.Substring(s.LastIndexOf('.') + 1, s.Length - s.LastIndexOf('.') - 1);

                        if (allowextension.ToLower().IndexOf(strFileExtension.ToLower()) >= 0)
                        {
                            int    len      = s.LastIndexOf(".") - s.LastIndexOf("\\") - 1;
                            string fileName = DateTime.Now.ToString("yyyyMMdd") + DateTime.Now.Millisecond.ToString();
                            string fullName = fileName + "." + strFileExtension;

                            string path = dir + "\\" + fullName;
                            phPath = physicsPath + "//" + fullName;
                            string pp = path.Replace("\\", "/");
                            //保存文件
                            img.SaveAs(phPath);
                            context.Response.Write(JsonConvert.SerializeObject(new { error = 0, url = pp }));
                        }
                        else
                        {
                            context.Response.Write(JsonConvert.SerializeObject(new { error = 1, message = "文件格式不支持" }));
                        }
                    }
                    else
                    {
                        context.Response.Write(JsonConvert.SerializeObject(new { error = 1, message = "网络错误,后台没接收到文件" }));
                    }
                }
                catch (Exception)
                {
                    context.Response.Write(JsonConvert.SerializeObject(new { error = 1, message = "上传图片出错" }));
                    throw;
                }
            }
            else if (string.Compare(action, "noticeAE", false) == 0)
            {
                var      id      = context.Request["noticeId"];
                var      title   = context.Request["noticeTitle"];
                var      content = context.Request["noticeContent"];
                var      time    = context.Request["DataStart"];
                DateTime time1   = DateTime.Now;
                if (!string.IsNullOrEmpty(time))
                {
                    time1 = Convert.ToDateTime(time);
                }

                //编辑
                if (!string.IsNullOrEmpty(id))
                {
                }
                else
                {//新增
                }
                context.Response.Write(JsonConvert.SerializeObject(new { IsOk = "Ok", msg = "操作完成" }));
            }
            else if (string.Compare(action, "ArticleAE", false) == 0)
            {
                FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(context.Request.Cookies[FormsAuthentication.FormsCookieName].Value);

                if (ticket == null)
                {
                    context.Response.Write(JsonConvert.SerializeObject(new { IsOk = "NoOk", msg = "请刷新页面再试" }));
                    context.Response.End();
                }


                LLArticle article = new LLArticle();

                int    artId   = String.IsNullOrEmpty(context.Request["ArtId"]) ? -1 : int.Parse(context.Request["ArtId"]);
                string listStr = context.Request["ArtType"];

                if ("" != listStr && null != listStr)
                {
                    article.ArtType = listStr.Split(new char[] { ',' }).Select(str => int.Parse(str)).ToList();
                }


                article.Content = context.Request["Content"];
                article.Title   = context.Request["ArtTitle"];
                article.Digest  = context.Request["Digest"];
                article.ReadPwd = context.Request["ArtPwd"];
                article.Editor  = ticket.Name;
                if (artId > 0)
                {
                    article.LastUpdatetime = DateTime.Now;
                }
                else
                {
                    article.ArtTime = DateTime.Now;
                }
                context.Response.Write(JsonConvert.SerializeObject(new { IsOk = "Ok", msg = "操作成功" }));
            }
            else if (string.Compare(action, "articleType", false) == 0)
            {
                context.Response.ContentType = "application/json";
                string p    = context.Request["page"];
                string l    = context.Request["limit"];
                int    page = -1;
                if (!string.IsNullOrEmpty(p))
                {
                    page = int.Parse(p);
                }
                int limit = -1;
                if (!string.IsNullOrEmpty(l))
                {
                    limit = int.Parse(l);
                }

                ArtTypeData data = new ArtTypeData();
                data.code = 0;
                data.msg  = "ok";
                var list = TestData.GetLLType();
                if (page < 0 || limit < 0)
                {
                    data.data = list;
                }
                else
                {
                    data.data = list.Skip((page - 1) * limit).Take(limit).ToList();
                }
                data.count = list.Count();



                context.Response.Write(JsonConvert.SerializeObject(data));
            }
            else if (string.Compare(action, "artTypeAE", false) == 0)
            {
                var      id       = context.Request["TypeId"];
                var      title    = context.Request["TypeTitle"];
                var      detail   = context.Request["TypeDetail"];
                var      time     = context.Request["TypeCTime"];
                var      isHidden = context.Request["TypeIsHidden"];
                DateTime time1    = DateTime.Now;
                if (!string.IsNullOrEmpty(time))
                {
                    time1 = Convert.ToDateTime(time);
                }

                //编辑
                if (!string.IsNullOrEmpty(id))
                {
                }
                else
                {//新增
                }



                context.Response.Write(JsonConvert.SerializeObject(new { IsOk = "Ok", msg = "操作完成" }));
            }
        }