commit8c343fb01fAuthor: 陈淳 <454313500@qq.com> Date: Sun Apr 28 11:36:48 2024 +0800 style: 修复股票api过期问题 commitae30d4b2cbAuthor: 陈淳 <454313500@qq.com> Date: Fri Apr 26 19:08:18 2024 +0800 fix: 修复值对象查询导致问题,已同步sqlsugar更新 commit4c12626b44Author: 陈淳 <454313500@qq.com> Date: Mon Apr 22 18:15:57 2024 +0800 feat: 添加值对象 commitd389dcbedfAuthor: 陈淳 <454313500@qq.com> Date: Mon Apr 22 18:06:09 2024 +0800 feat: 添加值对象 commit58ff8f45cfAuthor: 陈淳 <454313500@qq.com> Date: Mon Apr 22 15:54:25 2024 +0800 feat: 去除新增的缓存操作 commit826271c84dAuthor: 陈淳 <454313500@qq.com> Date: Mon Apr 22 15:39:41 2024 +0800 feat: 添加缓存crud
37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using System.Threading.Tasks;
|
||
using Newtonsoft.Json;
|
||
using Newtonsoft.Json.Linq;
|
||
using Volo.Abp.DependencyInjection;
|
||
|
||
namespace Yi.Framework.Bbs.Domain.Managers.BankValue
|
||
{
|
||
public class BiyingBankValueProvider : IBankValueProvider, ITransientDependency
|
||
{
|
||
//官网地址:www.biyingapi.com
|
||
private const string Url = "https://api.biyingapi.com/hsrl/ssjy/600519/5579aa4b391945678";
|
||
public async Task<decimal> GetValueAsync()
|
||
{
|
||
try
|
||
{
|
||
using (HttpClient client = new HttpClient())
|
||
{
|
||
var reponse = await client.GetAsync(Url);
|
||
reponse.EnsureSuccessStatusCode();
|
||
var dataStr = await reponse.Content.ReadAsStringAsync();
|
||
JObject jsonObject = JObject.Parse(dataStr);
|
||
return jsonObject["p"].Value<decimal>();
|
||
}
|
||
}
|
||
catch(Exception ex) {
|
||
throw new Exception("BiyingBank获取数据异常", ex);
|
||
|
||
}
|
||
|
||
}
|
||
}
|
||
}
|