基线 SVN r240
SVN-Revision: r240
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Lskj.IPersonnelConnection;
|
||||
|
||||
namespace Lskj.IPersonnelConnection
|
||||
{
|
||||
public static class PersonnelReplaceHelper
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// i人事 许可信息
|
||||
/// </summary>
|
||||
private static readonly string _iPersonnelAllowInformation = "{iPersonnelAllowInformation}";
|
||||
/// <summary>
|
||||
/// i人事 客户唯一身份标识
|
||||
/// </summary>
|
||||
private static readonly string _iPersonnelCustomerId = "{iPersonnelCustomerId}";
|
||||
/// <summary>
|
||||
/// i人事 私钥
|
||||
/// </summary>
|
||||
private static readonly string _iPersonnelPrivateKey = "{iPersonnelPrivateKey}";
|
||||
/// <summary>
|
||||
/// i人事 加密的签名信息
|
||||
/// </summary>
|
||||
private static readonly string _iPersonnelEncryptedMessage = "{iPersonnelEncryptedMessage}";
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:替换i人事接口中的参数</para>
|
||||
/// <para>创建人:</para>
|
||||
/// <para>创建日期:2023-04-21 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="defaultValue">url地址</param>
|
||||
/// <param name="iPersonnelAllowInformation">许可信息</param>
|
||||
/// <param name="iPersonnelCustomerId">客户标识</param>
|
||||
/// <param name="iPersonnelPrivateKey">私钥</param>
|
||||
/// <param name="UserLinkPhone">登录人电话</param>
|
||||
/// <returns>System.String.</returns>
|
||||
public static string UrlEncryption(string Url, string iPersonnelAllowInformation, string iPersonnelCustomerId, string iPersonnelPrivateKey,string UserLinkPhone)
|
||||
{
|
||||
if (Url.Contains("{iPersonnelAllowInformation}") || Url.Contains("{iPersonnelEncryptedMessage}"))
|
||||
{
|
||||
//替换许可
|
||||
Url = Url.Replace(_iPersonnelAllowInformation, iPersonnelAllowInformation);
|
||||
//替换加密的签名信息
|
||||
TimeSpan ts = DateTime.Now.ToUniversalTime() - new DateTime(1970, 1, 1);
|
||||
long time = (long)ts.TotalMilliseconds;//当前时间的时间戳
|
||||
string EncryptedMessage = string.Format("company_id={0}&mobile_no={1}×tamp={2}", iPersonnelCustomerId, UserLinkPhone, time);
|
||||
string value = EncryptByPrivateKey.encryptByPrivateKey(EncryptedMessage, iPersonnelPrivateKey);
|
||||
Url = Url.Replace(_iPersonnelEncryptedMessage, value);
|
||||
}
|
||||
return Url;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user