| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Muchinfo.MTPClient.Infrastructure.LinkProxy;
- using Muchinfo.MTPClient.Infrastructure.Utilities;
- using Muchinfo.MTPClient.IService;
- using System.Runtime.InteropServices;
- namespace Muchinfo.MTPClient.Service
- {
- /// <summary>
- /// 风管云平台专用服务
- /// </summary>
- public class ErmcpService: IErmcpService
- {
- [DllImport("WinDataCollect.dll", EntryPoint = "?CTP_GetSystemInfo@@YAHPADAAH@Z", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
- private static extern int CTP_GetSystemInfo(IntPtr pSystemInfo, ref int nLen);
- /// <summary>
- /// 获取登录ID
- /// </summary>
- /// <param name="username">可传入“登录账号”、“登录代码”和“手机号码”</param>
- /// <param name="successAction">成功能回调</param>
- /// <param name="errorAction">失败回调</param>
- public void GetLoginId(string username, Action<string> successAction, Action<Data.ErrorEntity> errorAction)
- {
- var url = string.Format("{0}{1}?username={2}", LinkManager.Instance.Parameters.GoCommonSearchUrl,
- "/User/GetLoginID",
- username);
- var jsonString = HttpUtility.HttpGet(url);
- if (jsonString != null)
- {
- Dictionary<String, Object> dicJson =
- Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<String, Object>>(jsonString);
- if (dicJson["code"].ToString() == "200")
- {
- successAction(dicJson["data"].ToString());
- return;
- }
- }
- successAction(username);
- }
- /// <summary>
- /// CTP获取系统信息
- /// </summary>
- /// <returns></returns>
- public byte[] GetSystemInfo()
- {
- var nLen = 0;
- byte[] szOutData = null;
- //创建内存
- var pSystemInfo = Marshal.AllocHGlobal(270);
-
- var iResult = CTP_GetSystemInfo(pSystemInfo, ref nLen);
- if (iResult == 0)
- {
- //拷贝到数组上面
- szOutData = new byte[nLen];
- Marshal.Copy(pSystemInfo, szOutData, 0, nLen);
- }
- //释放内存
- Marshal.FreeHGlobal(pSystemInfo);
- return szOutData;
- }
- }
- }
|