using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using Newtonsoft.Json;
|
using WIDESEA_ISerialPortRepository;
|
using WIDESEA_SerialPortRepository;
|
using WIDESEAWCS_Common;
|
using WIDESEAWCS_Core;
|
using WIDESEAWCS_Core.BaseServices;
|
using WIDESEAWCS_DTO.Telescopic;
|
|
using WIDESEAWCS_ITaskInfoService;
|
using WIDESEAWCS_Model.Models;
|
|
namespace WIDESEAWCS_TaskInfoService
|
{
|
public class FaceRecognitionServer : ServiceBase<Dt_FaceRecognition, IFaceRecognitionRepository>, IFaceRecognitionServer
|
{
|
|
public FaceRecognitionServer( IFaceRecognitionRepository BaseDal) : base(BaseDal)
|
{
|
|
}
|
|
|
|
|
public override PageGridData<Dt_FaceRecognition> GetPageData(PageDataOptions options)
|
{
|
OrderByParameters = new Dictionary<string, SqlSugar.OrderByType> {
|
{ nameof(Dt_ArticleInfom.ID),SqlSugar.OrderByType.Asc },
|
};
|
return base.GetPageData(options);
|
}
|
public WebResponseContent AddGroup(string groupName)
|
{
|
try
|
{
|
// 1. 调用百度 API 进行用户组创建
|
string apiResult = BaiDuFaceHelper.GroupAdd(groupName);
|
|
// 2. 解析 API 返回的 JSON 结果
|
dynamic resultObj = JsonConvert.DeserializeObject(apiResult);
|
|
if (resultObj.error_code == 0)
|
{
|
return WebResponseContent.Instance.OK("用户组创建成功");
|
}
|
else
|
{
|
return WebResponseContent.Instance.Error("百度 API 创建失败:" + resultObj.error_msg);
|
}
|
}
|
catch (Exception ex)
|
{
|
return WebResponseContent.Instance.Error("创建用户组失败:" + ex.Message);
|
}
|
}
|
|
|
}
|
}
|