sunpengfei
7 天以前 df19a6d58ef1d94e11c4dbfd76074e0e54d3d32c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using Furion;
using Furion.DataEncryption;
using Furion.HttpRemote;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace FlexJobApi.Core
{
    /// <summary>
    /// 电子签客户端资源提供者
    /// </summary>
    public class ElectronSignServerCustomerResourceHttpProvider : IResourceHttpProvider
    {
        public async Task<string> SendAsStringAsync(HttpRequestBuilder builder)
        {
            var httpRemoteService = App.GetRequiredService<IHttpRemoteService>();
            var appId = App.GetConfig<string>("ElectronSignServer:AppId");
            var privateKey = App.GetConfig<string>("ElectronSignServer:PrivateKey");
            var sign = MD5Encryption.Encrypt($"{appId}-{privateKey}".ToUpper(), true);
            builder = builder
                .WithHeader("appId", appId)
                .WithHeader("sign", sign);
            var response = await httpRemoteService.SendAsStringAsync(builder);
            return response;
        }
    }
}