From bbcf5a65e0aeae3e6a4bae91284ce80ae8d3d5f9 Mon Sep 17 00:00:00 2001
From: chenzx <m15572880737@163.com>
Date: 星期四, 26 十二月 2024 20:02:05 +0800
Subject: [PATCH] czx20241226接口

---
 GasolineBlend.BLL/SubsidyDataBLL.cs |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 54 insertions(+), 2 deletions(-)

diff --git a/GasolineBlend.BLL/SubsidyDataBLL.cs b/GasolineBlend.BLL/SubsidyDataBLL.cs
index d4afa6f..a0c186d 100644
--- a/GasolineBlend.BLL/SubsidyDataBLL.cs
+++ b/GasolineBlend.BLL/SubsidyDataBLL.cs
@@ -81,6 +81,59 @@
             return new PaginatedResult<SubsidyDataPage>(totalData, totalCount, totalPage);
         }
 
+
+
+        public List<SubsidyDataPage> GetSubsidyDataFilter(string Keyword, string CompanyName)
+        {
+            // 璁剧疆API鐨刄RL  
+            string apiUrl = "http://open.api.tianyancha.com/services/open/ic/baseinfoV3/2.0";
+            // 璁剧疆鎺堟潈浠ょ墝  
+            string authToken = "5d4c3939-53bb-422f-8ab6-91865b958e3a";
+            // 璁剧疆璇锋眰鐨凧SON鍐呭  
+            string Region = "";
+            string City = "";
+            // 鍒涘缓HttpClient瀹炰緥
+            using (var client = new HttpClient())
+            {
+                // 娣诲姞Authorization澶撮儴
+                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(authToken);
+
+                // 娣诲姞keyword鍙傛暟鍒版煡璇㈠瓧绗︿覆
+                var queryString = $"?keyword={Uri.EscapeDataString(CompanyName)}";
+
+                // 鏋勫缓瀹屾暣鐨刄RL
+                string fullUrl = apiUrl + queryString;
+
+                try
+                {
+                    // 鍙戦�丟ET璇锋眰
+                    HttpResponseMessage response = client.GetAsync(fullUrl).Result;
+
+                    // 纭繚鍝嶅簲鐘舵�佷负鎴愬姛
+                    response.EnsureSuccessStatusCode();
+
+                    // 璇诲彇鍝嶅簲鍐呭
+                    string responseBody = response.Content.ReadAsStringAsync().Result;
+                    // 灏咼SON瀛楃涓插弽搴忓垪鍖栦负JObject
+                    JObject jsonData = JObject.Parse(responseBody);
+                    if ((int)jsonData["error_code"] != 0)
+                    {
+
+                        return null;
+                    }
+                    // 璁块棶宓屽鐨凧SON灞炴��
+                    City = (string)jsonData["result"]["city"];
+                    Region = (string)jsonData["result"]["district"];
+                }
+                catch (HttpRequestException e)
+                {
+                    LogHelper.Write(Level.Error, "鑾峰彇鏀跨瓥鍒楄〃鏁版嵁 GetSubsidyDataListAPi鏌ヨ", e, OperatorProvider.Instance.Current == null ? "GuestEx" : OperatorProvider.Instance.Current.LoginName);
+                }
+            }
+            string Province = _sub.GetProvince(City, Region);
+            List<SubsidyDataPage> totalData = _sub.GetSubsidyDataFilter( Keyword, City, Region, Province);
+            return totalData;
+        }
         //public string GetMoonshot(string CompanyName)
         //{
         //    string _apiKey = "sk-Lec41LGc7aV8KdFzOCiJQIM9A8bsbBk5KumvqBSyfeW9EXec"; // 鏇挎崲涓轰綘鐨凙PI瀵嗛挜
@@ -226,8 +279,7 @@
         {
                 try
                 {
-                int IsVIP =34;
-                //int IsVIP = _acc.GetIsPolicyVIPList(UserId);
+                int IsVIP = _acc.GetIsPolicyVIPList(UserId);
                 int Count = _sir.GetSubsidyInquiryRecordToDayCount(UserId);
                     if (Count>= IsVIP) {
                         Console.WriteLine("浠婃棩鏀跨瓥娲炲療棰濆害宸茬粡鐢ㄥ畬锛屽鏈夐渶瑕佽鑱旂郴绠$悊鍛�!");

--
Gitblit v1.8.0