zhanghonglin
3 小时以前 1e6a3ce80c38124fe8750f59956528204e696d4e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
using System.Reflection;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.BaseController;
using WIDESEAWCS_DTO.ERP;
using WIDESEAWCS_ISystemServices;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Model.Models.ERP;
using WIDESEAWCS_Model.Models.TaskInfo;
using System.IO;
using WIDESEAWCS_Core.Helper;
 
 
namespace WIDESEAWCS_Server.Controllers.ERP
{
    [Route("api/ERP")]
    [ApiController]
    public class Dt_ERPController : ApiBaseController<IDt_ERPService, Dt_ERP>
    {
        public Dt_ERPController(IDt_ERPService service) : base(service)
        {
        }
 
        //获取ERP的AppTicket
        [HttpPost, HttpGet, Route("GetappTicket"), AllowAnonymous]
        public string GetappTicket([FromBody] AppTicket AppTicket)
        {
            return Service.GetappTicket(AppTicket);
        }
 
        ////ERP验证可信域名
        //[HttpPost, HttpGet, Route("Reputation"), AllowAnonymous]
        //public string Reputation()
        //{
        //    try
        //    {
        //        //// 1. 获取文件的物理路径(根据项目结构,文件在ERP文件夹下)
        //        //// 方式1:基于程序运行目录(推荐)
        //        //string projectRoot = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
        //        //string filePath = Path.Combine(projectRoot, "ERP", "CHANJET_CHECK.txt");
 
        //        //// 2. 检查文件是否存在
        //        //if (!global::System.IO.File.Exists(filePath))
        //        //{
        //        //    return NotFound("文件不存在");
        //        //}
 
        //        //// 3. 读取文件内容
        //        //byte[] fileBytes = global::System.IO.File.ReadAllBytes(filePath);
        //        //string fileName = "CHANJET_CHECK.txt";
 
        //        //// 4. 返回文件(MIME类型为text/plain)
        //        //return File(fileBytes, "text/plain", fileName);
        //        string ERP = AppSettings.Get("ERPAppTicket");
        //        return ERP;
        //    }
        //    catch (Exception ex)
        //    {
        //        //return StatusCode(500, $"读取文件失败:{ex.Message}");
        //        return null;
        //    }
        //}
    }
}