You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.3 KiB
33 lines
1.3 KiB
2 years ago
|
using BBWYB.Common.Http;
|
||
|
using BBWYB.Common.Log;
|
||
|
using BBWYB.Common.Models;
|
||
|
using BBWYB.Server.Model.Dto;
|
||
|
using Newtonsoft.Json;
|
||
|
using Yitter.IdGenerator;
|
||
|
|
||
|
namespace BBWYB.Server.Business
|
||
|
{
|
||
|
public class MDSBusiness : BaseBusiness, IDenpendency
|
||
|
{
|
||
|
private RestApiService restApiService;
|
||
|
public MDSBusiness(IFreeSql fsql, NLogManager nLogManager, IIdGenerator idGenerator, RestApiService restApiService) : base(fsql, nLogManager, idGenerator)
|
||
|
{
|
||
|
this.restApiService = restApiService;
|
||
|
}
|
||
|
|
||
|
public UserInfoResponse GetUserInfo(string token)
|
||
|
{
|
||
|
var httpResult = restApiService.SendRequest("http://mdsapi.qiyue666.com/", "TaskList/User/GetUserInfo", null, new Dictionary<string, string>()
|
||
|
{
|
||
|
{ "Authorization",token}
|
||
|
}, HttpMethod.Get);
|
||
|
if (httpResult.StatusCode != System.Net.HttpStatusCode.OK)
|
||
|
throw new BusinessException($"获取用户信息失败 {httpResult.Content}");
|
||
|
var response = JsonConvert.DeserializeObject<ApiResponse<UserInfoResponse>>(httpResult.Content);
|
||
|
if (!response.Success)
|
||
|
throw new BusinessException($"获取用户信息失败 {response.Msg}");
|
||
|
return response.Data;
|
||
|
}
|
||
|
}
|
||
|
}
|