From 53c7de340f55ab0c917a03d54d883b4a8082f42d Mon Sep 17 00:00:00 2001
From: cdk <2441919651@qq.com>
Date: 星期四, 27 十一月 2025 09:47:48 +0800
Subject: [PATCH] 增加通过网址获取供应商评分数据的接口
---
Controllers/BaseController.cs | 31 +++++++++----------------------
1 files changed, 9 insertions(+), 22 deletions(-)
diff --git a/Controllers/BaseController.cs b/Controllers/BaseController.cs
index 3caae53..52ffce2 100644
--- a/Controllers/BaseController.cs
+++ b/Controllers/BaseController.cs
@@ -1,34 +1,21 @@
锘縰sing Microsoft.AspNetCore.Mvc;
-using System;
+using Microsoft.Extensions.DependencyInjection;
public class BaseController : ControllerBase
{
- protected string OrgId
+ private RequestInfo _requestInfo;
+
+ protected RequestInfo RequestInfo
{
get
{
- var orgId = GetOrgIdFromHeader();
- if (string.IsNullOrEmpty(orgId))
+ if (_requestInfo == null)
{
- throw new ArgumentException("璇锋眰缁勭粐ID涓嶅瓨鍦紒璇锋鏌ヨ姹傚ご涓槸鍚﹀寘鍚湁鏁堢殑OrgId銆�");
+ //蹇呭~椤�
+ //_requestInfo.ValidateRequired("OrgId");
+ _requestInfo = HttpContext.RequestServices.GetService<RequestInfo>();
}
- return orgId;
+ return _requestInfo;
}
- }
-
- private string GetOrgIdFromHeader()
- {
- if (HttpContext.Request.Headers.TryGetValue("OrgId", out var orgIdValue))
- {
- return orgIdValue.ToString();
- }
- return null;
- }
-
- // 鍙�夛細鎻愪緵涓�涓畨鍏ㄨ幏鍙朞rgId鐨勬柟娉曪紝涓嶆姏鍑哄紓甯歌�屾槸杩斿洖榛樿鍊兼垨null
- protected bool TryGetOrgId(out string orgId)
- {
- orgId = GetOrgIdFromHeader();
- return !string.IsNullOrEmpty(orgId);
}
}
\ No newline at end of file
--
Gitblit v1.9.3