예제 #1
0
        public InitController()
        {
            if (!DBState)
            {
                DataObj.OutError("8001");
                InitState = false;
                return;
            }
            string GetStr             = System.Web.HttpContext.Current.Request.QueryString.ToString();
            string PostStr            = System.Web.HttpContext.Current.Request.Form.ToString();
            string WriteLog           = ConfigurationManager.AppSettings["WriteLog"].ToString();
            string ControllerCloseLog = ConfigurationManager.AppSettings["ControllerCloseLog"].ToString();

            if (WriteLog == "true")
            {
                string AbsolutePath   = System.Web.HttpContext.Current.Request.Url.AbsolutePath;
                var    pathSplit      = AbsolutePath.Split('/');
                var    controllerName = pathSplit.Count() >= 3 ? pathSplit[2] : "";
                bool   islog          = true;
                var    controllers    = ControllerCloseLog.Split(',');
                islog = controllers.Contains(controllerName) ? false : true;
                if (islog)
                {
                    Log.Write(GetStr, PostStr);
                }
            }
            DataObj.IsReg = false;
            DataObj.ENo   = System.Web.HttpContext.Current.Request.Form["eno"];
            DataObj.Data  = System.Web.HttpContext.Current.Request.Form["data"];
            DataObj.Code  = System.Web.HttpContext.Current.Request.Form["code"];
            DataObj.Key   = ConfigurationManager.AppSettings["regkey"].ToString();
            Equipment     = new Equipment();
            if (DataObj.ENo != "0")//已注册
            {
                Equipment = Entity.Equipment.FirstOrDefault(n => n.No == DataObj.ENo);
                if (Equipment == null)
                {
                    DataObj.OutError("3001");
                    return;
                }
                if (DataObj.Code != "0000" && !DataObj.Code.IsNullOrEmpty())
                {
                    string Ver = "";
                    if (DataObj.Code.IndexOf("android_") != -1)
                    {
                        Ver = DataObj.Code.Replace("android_", "");
                    }
                    if (DataObj.Code.IndexOf("apple_") != -1)
                    {
                        Ver = DataObj.Code.Replace("apple_", "");
                    }
                    if (!Ver.IsNullOrEmpty())
                    {
                        if (Ver != Equipment.SoftVer)
                        {
                            Equipment.SoftVer = Ver;
                            Entity.SaveChanges();
                        }
                    }
                }
                //if (Equipment.RqType == "Android")
                //{
                //    DataObj.OutError("3001");
                //    return;
                //}
                DataObj.Key   = Equipment.Keys;
                DataObj.IsReg = true;
            }

            AppPath    = Utils.GetHost();
            ApiPath    = ConfigurationManager.AppSettings["ApiPath"].ToString();
            ApkPath    = ConfigurationManager.AppSettings["ApkPath"].ToString();
            SysPath    = ConfigurationManager.AppSettings["SysPath"].ToString();
            PayPath    = ConfigurationManager.AppSettings["PayPath"].ToString();
            NoticePath = ConfigurationManager.AppSettings["NoticePath"].ToString();
            if (AppPath.IsNullOrEmpty())
            {
                if (Equipment.RqType == "Android")
                {
                    AppPath = ApkPath;
                }
                else if (Equipment.RqType == "Apple")
                {
                    AppPath = ApiPath;
                }
                else
                {
                    AppPath = string.Empty;
                }
            }
            ApiImgPath = ConfigurationManager.AppSettings["ApiImgPath"].ToString();
            ApkImgPath = ConfigurationManager.AppSettings["ApkImgPath"].ToString();
            SysImgPath = ConfigurationManager.AppSettings["SysImgPath"].ToString();
            if (Equipment.RqType == "Android")
            {
                AppImgPath = ApkImgPath;
            }
            else if (Equipment.RqType == "Apple")
            {
                AppImgPath = ApiImgPath;
            }
            else
            {
                AppImgPath = string.Empty;
            }

            if (ConfigurationManager.AppSettings["Cache"] != null)
            {
                string hascache = ConfigurationManager.AppSettings["Cache"].ToString();
                if (hascache == "true")
                {
                    HasCache = true;
                }
            }
        }
예제 #2
0
 //无GET参数时返回信息
 public void Get()
 {
     DataObj.OutError("1000");
 }