llj
2 天以前 1c90213ebd42e2d00324a71a67a60d07e4c8a7da
WebAPI/Controllers/WebAPIController.cs
@@ -392,7 +392,7 @@
                    objJsonResult.Message = "登录异常!Token 生成异常,无法获取公司信息!";
                }
                string tokenStr = Utility.JWTHelper.GenerateToken(UserName.Trim(), DBUtility.ClsPub.StrToPsd(PassWord.Trim()));
                string tokenStr = Utility.JWTHelper.GenerateToken(ds.Tables[0].Rows[0]["Czybm"].ToString(), ds.Tables[0].Rows[0]["Czymc"].ToString());
                objjson.code = "0";
@@ -409,7 +409,7 @@
                objjson.code = "0";
                objjson.count = 0;
                objjson.Message = "[0000-1-074]登录异常!" + e.Message;
                objjson.Message = "[0000-1-074]登录异常!" + e;
                objjson.data = null;
                return objjson; ;
            }
@@ -20473,7 +20473,7 @@
            {
                objjson.code = "0";
                objjson.count = 0;
                objjson.Message = "获取失败" + ex.ToString();
                objjson.Message = "获取失败" + ex.Message.ToString();
                objjson.data = null;
                return objjson;
            }
@@ -20968,7 +20968,18 @@
                {
                    objjson.code = "0";
                    objjson.count = 0;
                    objjson.Message = "获取失败,明细查无数据";
                    if(Type == "DJ")
                    {
                        objjson.Message = "获取失败,模具无绑定的点检规程";
                    }
                    else if (Type == "BY")
                    {
                        objjson.Message = "获取失败,模具无绑定的保养规程";
                    }
                    else
                    {
                        objjson.Message = "获取失败,明细查无数据";
                    }
                    objjson.data = null;
                    return objjson;
                }
@@ -21169,12 +21180,12 @@
                SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
                ds = oCN.RunProcReturn("select ManagerFlag from gy_czygl where czymc='" + user.Trim() + "'", "gy_czygl");
                if (!(bool)ds.Tables[0].Rows[0]["ManagerFlag"])  //是否管理员
                {
                    //不是管理员
                    sWhere += " and 制单人 = '" + user + "'";
                }
                //ds = oCN.RunProcReturn("select ManagerFlag from gy_czygl where czymc='" + user.Trim() + "'", "gy_czygl");
                //if (!(bool)ds.Tables[0].Rows[0]["ManagerFlag"])  //是否管理员
                //{
                //    //不是管理员
                //    sWhere += " and 制单人 = '" + user + "'";
                //}
                string sql = string.Format(@"select * from " + HView + " where 1 = 1 " + sWhere + " order by 日期 desc, hmainid desc");
@@ -22852,6 +22863,7 @@
        /// <returns></returns>
        [Route("Web/GetModuleName")]
        [HttpGet]
        [AllowAnonymous]
        public object GetModuleName(string HModuleType)
        {
            try
@@ -23455,6 +23467,7 @@
        #region 用于连接的健康度检验,只要能访问通这个接口,则表明连接可用
        [Route("Health")]
        [HttpGet]
        [AllowAnonymous]
        public IHttpActionResult CheckHealth()
        {
            // 返回 200 状态码 确认健康状态
@@ -23991,5 +24004,81 @@
            }
        }
        #endregion
        /// <summary>
        /// APP登录权限验证接口
        /// </summary>
        [Route("Auth/CheckAppLoginAuth")]
        [HttpPost]
        public object CheckAppLoginAuth()
        {
            try
            {
                // 获取请求参数
                string orgID = HttpContext.Current.Request.Form["orgID"] ?? "";
                string orgName = HttpContext.Current.Request.Form["orgName"] ?? "";
                string serverUrl = HttpContext.Current.Request.Form["serverUrl"] ?? "";
                string phoneType = HttpContext.Current.Request.Form["phoneType"] ?? "";
                string userAccount = HttpContext.Current.Request.Form["userAccount"] ?? "";
                string other = HttpContext.Current.Request.Form["other"] ?? "";
                // 参数验证
                if (string.IsNullOrEmpty(userAccount))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "账号不能为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                if (string.IsNullOrEmpty(orgID))
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "组织ID不能为空!";
                    objJsonResult.data = null;
                    return objJsonResult;
                }
                // 参数安全处理(防止注入)
                orgID = orgID.Replace("'", "''");
                orgName = orgName.Replace("'", "''");
                serverUrl = serverUrl.Replace("'", "''");
                phoneType = phoneType.Replace("'", "''");
                userAccount = userAccount.Replace("'", "''");
                // 执行固定存储过程
                string sql = $"EXEC SP_CheckAppLoginAuth '{orgID}', '{orgName}', '{serverUrl}', '{phoneType}','{userAccount}','{other}'";
                ds = oCN.RunProcReturn(sql, "SP_CheckAppLoginAuth");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    int result = Convert.ToInt32(ds.Tables[0].Rows[0]["Result"]);
                    string message = ds.Tables[0].Rows[0]["Message"].ToString();
                    objJsonResult.code = "1";
                    objJsonResult.count = 1;
                    objJsonResult.Message = message;
                    objJsonResult.data = ds.Tables[0];
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "验证接口返回异常!";
                    objJsonResult.data = null;
                }
                return objJsonResult;
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "Exception!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
    }
}