| | |
| | | } |
| | | int totalCount = _sub.GetSubsidyDataCount(Keyword, City, City+Region); |
| | | int totalPage = (int)Math.Ceiling((double)totalCount / PageSize); |
| | | List<SubsidyDataPage> totalData = _sub.GetSubsidyDataList(PageNumber, PageSize, Keyword, City, Region); |
| | | List<SubsidyDataPage> totalData = _sub.GetSubsidyDataList(PageNumber, PageSize, Keyword, City, City + Region); |
| | | return new PaginatedResult<SubsidyDataPage>(totalData, totalCount, totalPage); |
| | | } |
| | | |
| | |
| | | Console.WriteLine("今日政策洞察额度已经用完,如有需要请联系管理员!"); |
| | | return "-1"; |
| | | } |
| | | |
| | | // 设置API的URL |
| | | string apiUrl = "https://api.coze.cn/v1/workflow/run"; |
| | | // 设置授权令牌 |
| | | string bearerToken = "pat_58jGFdi1EjYOZnLCJRe162Mq3E9Xary8gyXzTDKEvUn3wqXNi9WzGktFgHPK1oUa"; |
| | | // 设置请求的JSON内容 |
| | | string jsonContent = $@"{{ |
| | | ""workflow_id"": ""7427048743201832975"", |
| | | ""parameters"": {{ |
| | | ""BOT_USER_INPUT"": """", |
| | | ""keyword"": ""{CompanyName}能申请哪些政策"" |
| | | }} |
| | | }}"; |
| | | //coze |
| | | // // 设置API的URL |
| | | // string apiUrl = "https://api.coze.cn/v1/workflow/run"; |
| | | // // 设置授权令牌 |
| | | // string bearerToken = "pat_58jGFdi1EjYOZnLCJRe162Mq3E9Xary8gyXzTDKEvUn3wqXNi9WzGktFgHPK1oUa"; |
| | | // // 设置请求的JSON内容 |
| | | // string jsonContent = $@"{{ |
| | | // ""workflow_id"": ""7427048743201832975"", |
| | | // ""parameters"": {{ |
| | | // ""BOT_USER_INPUT"": """", |
| | | // ""keyword"": ""{CompanyName}能申请哪些政策"" |
| | | // }} |
| | | //}}"; |
| | | //dify |
| | | // 设置API的URL |
| | | string apiUrl = "http://122.51.217.202/v1/workflows/run"; |
| | | // 设置授权令牌 |
| | | string bearerToken = "app-rkZ7HxYgO77OHUsLruW9ozhY"; |
| | | // 设置请求的JSON内容 |
| | | string jsonContent = $@"{{ |
| | | ""user"": ""rensofter"", |
| | | ""inputs"": {{ |
| | | ""company"": ""{CompanyName}"" |
| | | }} |
| | | }}"; |
| | | |
| | | using (HttpClient client = new HttpClient()) |
| | | using (HttpClient client = new HttpClient()) |
| | | { |
| | | HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, apiUrl) |
| | | { |
| | |
| | | var dataObject = JObject.Parse(data); |
| | | |
| | | // 提取output字段 |
| | | string output = dataObject["output"].ToString(); |
| | | string outputs = dataObject["outputs"].ToString(); |
| | | // 解析data字段中的JSON字符串 |
| | | var datatxt = JObject.Parse(outputs); |
| | | // 提取output字段 |
| | | string text = datatxt["text"].ToString(); |
| | | |
| | | bool isInsert = _sir.AddSubsidyInquiryRecordData(UserId, CompanyName, output); |
| | | if (!isInsert&&output==null) |
| | | |
| | | bool isInsert = _sir.AddSubsidyInquiryRecordData(UserId, CompanyName, text); |
| | | if (!isInsert&& text == null) |
| | | { |
| | | Console.WriteLine("请求失败"); |
| | | return null; |
| | | } |
| | | return output; |
| | | return text; |
| | | } |
| | | else |
| | | { |