匿名接口修改

DataMaintenance
陈伟 2025-04-08 10:48:11 +08:00
parent d0cc4bb0e2
commit c01f97a068
2 changed files with 47 additions and 51 deletions

View File

@ -333,6 +333,7 @@ namespace OpenAuth.App.ServiceApp.FireManagement
return new Response<FmFireclueInfo> { Result = info };
}
}
public async Task<Response<dynamic>> LoadClueWithInfoById(long id)
{
using (var db = base.UnitWork.CreateContext())
@ -362,6 +363,7 @@ namespace OpenAuth.App.ServiceApp.FireManagement
return new Response<List<FmFireclueInfo>> { Result = list };
}
}
/// <summary>
/// 修改火情线索状态
/// </summary>
@ -389,6 +391,7 @@ namespace OpenAuth.App.ServiceApp.FireManagement
}
}
}
//按月统计火情线索
public async Task<Response<List<FireInfoForChart>>> GetFireClueStatistics(int type)
{
@ -612,70 +615,64 @@ namespace OpenAuth.App.ServiceApp.FireManagement
/// <returns></returns>
public async Task<Response<bool>> AddPointAsync(FmUserPoint userPoint)
{
var respose = new Response<bool>();
var response = new Response<bool>();
using var db = Repository.AsSugarClient();
if (userPoint != null)
var currentUser = _auth.GetCurrentUser();
userPoint.CreateId = currentUser.User.Id;
userPoint.Id = YitIdHelper.NextId();
userPoint.CreateTime = DateTime.Now;
var userPointHistory = userPoint.MapTo<FmUserPointHistory>();
var oldInfo = await db.Queryable<FmUserPoint>()
.Where(r => r.CreateId == userPoint.CreateId)
.FirstAsync();
//上线弹窗 第一次上报或者上线时间不超过2分钟
if (oldInfo == null || (oldInfo != null && oldInfo.CreateTime.AddMinutes(2) < DateTime.Now))
{
userPoint.Id = YitIdHelper.NextId();
userPoint.CreateTime = DateTime.Now;
var userPointHistory = userPoint.MapTo<FmUserPointHistory>();
var oldInfo = await db.Queryable<FmUserPoint>()
.Where(r => r.CreateId == userPoint.CreateId)
var user = await db.Queryable<SysUser>().Where(r => r.Id == userPoint.CreateId)
.FirstAsync();
//上线弹窗 第一次上报或者上线时间不超过2分钟
if (oldInfo == null || (oldInfo != null && oldInfo.CreateTime.AddMinutes(2) < DateTime.Now))
if (user != null)
{
var user = await db.Queryable<SysUser>().Where(r => r.Id == userPoint.CreateId)
.FirstAsync();
if (user != null)
await db.Insertable(new FmOnOffLine
{
await db.Insertable(new FmOnOffLine
{
Id = YitIdHelper.NextId(),
IdentifyId = user.Id,
OnOffTime = DateTime.Now,
Name = user.Name,
Type = true
}).ExecuteCommandAsync();
Id = YitIdHelper.NextId(),
IdentifyId = user.Id,
OnOffTime = DateTime.Now,
Name = user.Name,
Type = true
}).ExecuteCommandAsync();
WebSocketModel wsModel1 = new WebSocketModel
{
Module = "上线",
Data = user.Name
};
sendsocket(wsModel1);
}
WebSocketModel wsModel1 = new WebSocketModel
{
Module = "上线",
Data = user.Name
};
sendsocket(wsModel1);
}
}
if (oldInfo != null)
{
oldInfo.Lat = userPoint.Lat;
oldInfo.Lng = userPoint.Lng;
oldInfo.CreateTime = userPoint.CreateTime;
oldInfo.Intype = userPoint.Intype;
await db.Updateable(oldInfo).ExecuteCommandAsync();
}
else
{
await db.Insertable(userPoint).ExecuteCommandAsync();
}
await db.Insertable(userPointHistory).SplitTable().ExecuteCommandAsync();
respose.Code = 200;
respose.Result = true;
respose.Message = "添加成功";
if (oldInfo != null)
{
oldInfo.Lat = userPoint.Lat;
oldInfo.Lng = userPoint.Lng;
oldInfo.CreateTime = userPoint.CreateTime;
oldInfo.Intype = userPoint.Intype;
await db.Updateable(oldInfo).ExecuteCommandAsync();
}
else
{
respose.Code = 500;
respose.Result = false;
respose.Message = "添加失败";
await db.Insertable(userPoint).ExecuteCommandAsync();
}
return respose;
await db.Insertable(userPointHistory).SplitTable().ExecuteCommandAsync();
response.Code = 200;
response.Result = true;
response.Message = "添加成功";
return response;
}
public async Task sendsocket(WebSocketModel wsModel1)

View File

@ -399,7 +399,6 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers.FireManagement
/// <param name="info">坐标点</param>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public async Task<Response<bool>> AddPoint(FmUserPoint info)
{
return await _app.AddPointAsync(info);