2025-09-04 18:28:02 +08:00

66 lines
1.7 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using EasyEncryption;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using SWS.CAD.Models;
using SWS.CAD.Models.NoEntity;
using SWS.Commons;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
namespace SWS.CAD.Services
{
public class SettingsService : HttpService
{
public SettingsService() : base()
{
}
/// <summary>
/// 根据名字拿
/// </summary>
/// <param name="settingName"></param>
/// <param name="projId"></param>
/// <returns></returns>
public async Task<List<ec_projectSettings>> GetList()
{
var res = await this.GetAsync<List<ec_projectSettings>>($"SettingsApi/GetList?projId={GlobalObject.curProject?.ProjectId}");
if (res.code == 200)
{
return res.data;
}
else
{
}
return null;
}
/// <summary>
/// 新增或者修改。根据Name来的id不重要
/// </summary>
/// <param name="entity"></param>
/// <param name="projId"></param>
/// <returns></returns>
public async Task<object> SaveEntitys(List<ec_projectSettings> entity)
{
var res = await this.PostBodyAsync<ec_projectSettings, List<ec_projectSettings>> ($"SettingsApi/SaveEntitys?projId={GlobalObject.curProject?.ProjectId}", entity);
if (res.code == 200)
{
//return res.info;
return null;
}
else
{
return res.info; // 返回错误信息
}
}
}
}