| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 用于连接的健康度检验,只要能访问通这个接口,则表明连接可用 |
| | | [Route("Health")] |
| | | [HttpGet] |
| | | public IHttpActionResult CheckHealth() |
| | | { |
| | | // 返回 200 状态码 确认健康状态 |
| | | return Ok(); |
| | | } |
| | | #endregion |
| | | |
| | | #region 登录用户与设备ClientID 的关系 写入数据库 |
| | | [Route("Web/SetGy_UserClientIdConnection")] |
| | | [HttpPost] |
| | | public object SetGy_UserClientIdConnection([FromBody] JObject msg) |
| | | { |
| | | DataSet ds; |
| | | oCN.BeginTran(); |
| | | try |
| | | { |
| | | LogService.Write($@"exec h_p_SetGy_UserClientIdRelation |
| | | @HUserbm=N'{msg["HUserbm"].ToString()}', |
| | | @HUserName=N'{msg["HUserName"].ToString()}', |
| | | @HClientID=N'{msg["HClientID"].ToString()}', |
| | | @HOnline={msg["HOnline"].ToString()} |
| | | ", "h_p_SetGy_UserClientIdRelation"); |
| | | ds = oCN.RunProcReturn($@"exec h_p_SetGy_UserClientIdRelation |
| | | @HUserbm=N'{msg["HUserbm"].ToString()}', |
| | | @HUserName=N'{msg["HUserName"].ToString()}', |
| | | @HClientID=N'{msg["HClientID"].ToString()}', |
| | | @HOnline={msg["HOnline"].ToString()} |
| | | ", "h_p_SetGy_UserClientIdRelation"); |
| | | |
| | | if(ds.Tables[0].Rows[0]["HStatus"].ToString() == "1") |
| | | { |
| | | oCN.Commit(); |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "保存设备信息成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存设备信息失败!" + ds.Tables[0].Rows[0]["msg"]; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | }catch(Exception e) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存设备信息失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | } |
| | | } |