[FrontednWebApi] 可獲取 device_node 中的 forge_dbid 值

This commit is contained in:
GiteaAdmin 2023-02-05 01:10:00 +08:00
parent 270e0855fc
commit a17a11b180
3 changed files with 34 additions and 20 deletions

View File

@ -306,7 +306,8 @@ namespace FrontendWebApi.ApiControllers
dn.device_guid, dn.device_guid,
dn.full_name AS Device_node_full_name, dn.full_name AS Device_node_full_name,
dn.device_node_coordinate, dn.device_node_coordinate,
dn.priority dn.priority,
dn.forge_dbid
FROM device_node dn FROM device_node dn
WHERE dn.deleted = 0 AND dn.device_guid = @device_guid WHERE dn.deleted = 0 AND dn.device_guid = @device_guid
ORDER BY dn.priority ASC"; ORDER BY dn.priority ASC";

View File

@ -58,27 +58,39 @@ namespace FrontendWebApi.ApiControllers
userinfo_guid = User.Claims.Where(a => a.Type == "userinfo_guid").Select(e => e.Value).FirstOrDefault(), userinfo_guid = User.Claims.Where(a => a.Type == "userinfo_guid").Select(e => e.Value).FirstOrDefault(),
}; };
if (myUser.exp == 0) //if (myUser.exp == 0)
{ //{
jwt_str = "Jwt Token不合法"; // jwt_str = "Jwt Token不合法";
jwtlife = false; // jwtlife = false;
filterContext.Result = new JsonResult(new { HttpStatusCode.Unauthorized }); // filterContext.Result = new JsonResult(new { HttpStatusCode.Unauthorized });
} //}
else //else
{ //{
// if (myUser.exp <= DateTime.Now.AddHours(-8).AddMinutes(10).Subtract(new DateTime(1970, 1, 1)).TotalSeconds)
// {
// jwtlife = true;
// JwtLogin jwtLoing = new JwtLogin()
// {
// account = myUser.account,
// email = myUser.email,
// full_name = myUser.full_name,
// userinfo_guid = myUser.userinfo_guid
// };
// jwt_str = jwt.GenerateToken(jwtLoing).token;
// }
//}
if (myUser.exp <= DateTime.Now.AddHours(-8).AddMinutes(10).Subtract(new DateTime(1970, 1, 1)).TotalSeconds) if (myUser.exp <= DateTime.Now.AddHours(-8).AddMinutes(10).Subtract(new DateTime(1970, 1, 1)).TotalSeconds)
{ {
jwtlife = true; jwtlife = true;
JwtLogin jwtLoing = new JwtLogin() JwtLogin jwtLoing = new JwtLogin()
{ {
account = myUser.account, account ="webUser",
email = myUser.email, email = "webUser@gmail.com",
full_name = myUser.full_name, full_name = "webUser",
userinfo_guid = myUser.userinfo_guid userinfo_guid = "6ac24708-3a40-4199-88c5-22df310cd1a8"
}; };
jwt_str = jwt.GenerateToken(jwtLoing).token; jwt_str = jwt.GenerateToken(jwtLoing).token;
} }
}
base.OnActionExecuting(filterContext); base.OnActionExecuting(filterContext);
} }
} }

View File

@ -207,6 +207,7 @@ namespace FrontendWebApi.Models
public string Device_node_full_name { get; set; } public string Device_node_full_name { get; set; }
public string Device_node_coordinate { get; set; } public string Device_node_coordinate { get; set; }
public int Priority { get; set; } public int Priority { get; set; }
public int forge_dbid { get; set; }
} }
public class DeviceItem public class DeviceItem