Пример #1
0
 public static string loadSchoolUrl(string BabyId)
 {
     try
     {
         if (HttpContext.Current.Session["StudentId_LocalUrl"] == null ||
             (HttpContext.Current.Session["StudentId_LocalUrl"] != null && HttpContext.Current.Session["StudentId_LocalUrl"].ToString() != BabyId))
         {
             string local_url = string.Empty; // 局域网地址
             #region 学校配置URL
             DataTable dtUrl = new Rc.BLL.Resources.BLL_ConfigSchool().GetSchoolPublicUrl(BabyId).Tables[0];
             if (dtUrl.Rows.Count > 0) // 有局域网配置数据
             {
                 HttpContext.Current.Session["UserPublicUrl" + BabyId] = dtUrl.Rows[0]["publicUrl"];
                 HttpContext.Current.Session["StudentId_LocalUrl"]     = BabyId;
                 local_url = dtUrl.Rows[0]["apiUrlList"].ToString();
                 return(JsonConvert.SerializeObject(new
                 {
                     err = "",
                     local_url = local_url,
                     local_url_en = Rc.Common.DBUtility.DESEncrypt.Encrypt(local_url)
                 }));
             }
             else
             {
                 return(JsonConvert.SerializeObject(new
                 {
                     err = "未配置局域网数据"
                 }));
             }
             #endregion
         }
         else
         {
             return(JsonConvert.SerializeObject(new
             {
                 err = "已验证局域网"
             }));
         }
     }
     catch (Exception ex)
     {
         return(JsonConvert.SerializeObject(new
         {
             err = "error"
         }));
     }
 }
Пример #2
0
        /// <summary>
        /// 自动同步
        /// </summary>
        void YourTask()
        {
            if (DateTime.Now.ToString("HH:mm") == Rc.Common.ConfigHelper.GetConfigString("SyncDataTime"))
            {
                //同步数据(生产平台启动URL同步)
                string          url = Rc.Common.ConfigHelper.GetConfigString("ProductPublicUrl") + "ReCloudMgr/SyncData.aspx";//生产平台地址
                HttpWebRequest  myHttpWebRequest  = (HttpWebRequest)WebRequest.Create(url);
                HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
            }

            if (DateTime.Now.ToString("HH:mm") == Rc.Common.ConfigHelper.GetConfigString("SyncPlanTime"))
            {
                //同步教案(生产平台启动,调用运营平台URL下载)
                string          urlPlan = Rc.Common.ConfigHelper.GetConfigString("SynTeachingPlanWebSiteUrl") + "ReCloudMgr/FileSyncPlan_Auto.aspx";//运营平台地址
                HttpWebRequest  myHttpWebRequestPlan  = (HttpWebRequest)WebRequest.Create(urlPlan);
                HttpWebResponse myHttpWebResponsePlan = (HttpWebResponse)myHttpWebRequestPlan.GetResponse();

                //同步习题集(生产平台启动,调用运营平台URL下载)
                string          urlTestpaper = Rc.Common.ConfigHelper.GetConfigString("SynTestWebSiteUrl") + "ReCloudMgr/FileSyncTestPaper_Auto.aspx";//运营平台地址
                HttpWebRequest  myHttpWebRequestTestpaper  = (HttpWebRequest)WebRequest.Create(urlTestpaper);
                HttpWebResponse myHttpWebResponseTestpaper = (HttpWebResponse)myHttpWebRequestTestpaper.GetResponse();
            }
            if (DateTime.Now.ToString("HH:mm") == Rc.Common.ConfigHelper.GetConfigString("SyncPlanSchoolTime"))
            {
                //同步教案(学校)(生产平台启动,获取运营平台学校URL地址,调用学校对外URL下载)
                DataTable dt = new Rc.BLL.Resources.BLL_ConfigSchool().GetOperateList("D_PublicValue<>''").Tables[0];
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow item in dt.Rows)
                    {
                        string          url = item["D_PublicValue"].ToString() + "ReCloudMgr/FileSyncSchool_Auto.aspx?SchoolId=" + item["School_ID"];//学校对外URL地址
                        HttpWebRequest  myHttpWebRequest  = (HttpWebRequest)WebRequest.Create(url);
                        HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
                    }
                }

                //string urlSchool = Rc.Common.ConfigHelper.GetConfigString("ProductPublicUrl") + "ReCloudMgr/FileSyncSchoolUrl.aspx";//生产平台地址
                //HttpWebRequest myHttpWebRequestSchool = (HttpWebRequest)WebRequest.Create(urlSchool);
                //HttpWebResponse myHttpWebResponseSchool = (HttpWebResponse)myHttpWebRequestSchool.GetResponse();
            }
        }