📄 jl.cs
字号:
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace apolloService
{
/// <summary>
/// JL 的摘要说明。
/// </summary>
public class JL
{
#region Dll Import
[DllImport("JL_ISP.dll",EntryPoint="JL_HTTPLogin")]
static extern int JL_HTTPLogin (
string strHost,
int nPort,
string strUserId,
string strPassword,
string strRegCode,
ref IntPtr pHandle);
[DllImport("JL_ISP.dll",EntryPoint="JL_SendMsg")]
static extern int JL_SendMsg ( IntPtr pHandle, //操作句柄
string strFromPhone, // strFromPhone 短消息发送者手机号码 ,可以发送单条或者多条短信,多个号码之间用 "," 隔开
string strToPhone, // strToPhone 目的手机号码
string strContent, // strContent 信息内容
string strSendTime);
[DllImport("JL_ISP.dll",EntryPoint="JL_Logout")]
static extern int JL_Logout (IntPtr pHandle);
[DllImport("JL_ISP.dll",EntryPoint="JL_ReceiveSM")]
static extern int JL_ReceiveSM (IntPtr pHandle, int nLastMsgId);
[DllImport("JL_ISP.dll",EntryPoint="JL_GetOneSM")]
static extern int JL_GetOneSM (IntPtr pHandle,
ref int pnMsgID,
StringBuilder strFrom,
StringBuilder strCreateTime,
StringBuilder strContent);
//--------------------------------------------------------------------------
[DllImport("JL_ISP.dll",EntryPoint="JL_GetAccountBalance")]
static extern int JL_GetAccountBalance (IntPtr pHandle, ref Single fBalance);
[DllImport("JL_ISP.dll",EntryPoint="JL_GetAccountPrice")]
static extern int JL_GetAccountPrice (IntPtr pHandle, ref Single fPrice);
[DllImport("JL_ISP.dll",EntryPoint="JL_GetAccountType")]
static extern int JL_GetAccountType (IntPtr pHandle, ref int nType);
[DllImport("JL_ISP.dll",EntryPoint="JL_GetAccountRegTime")]
static extern int JL_GetAccountRegTime (IntPtr pHandle, StringBuilder strDate);
[DllImport("JL_ISP.dll",EntryPoint="JL_GetAccountDenyTime")]
static extern int JL_GetAccountDenyTime (IntPtr pHandle,StringBuilder strDate);
//--------------------------------------------------------------------------
[DllImport("JL_ISP.dll",EntryPoint="JL_GetSendCount")]
static extern int JL_GetSendCount (IntPtr pHandle,
string strStartDate,
string strEndDate,
ref int nCountWaitSend,
ref int nCountTestSend);
[DllImport("JL_ISP.dll",EntryPoint="JL_ModifyPassword")]
static extern int JL_ModifyPassword (IntPtr pHandle,string strNewPassword);
//--------------------------------------------------------------------------
[DllImport("User32.dll",EntryPoint="FindWindow")]
private static extern IntPtr FindWindow(string lpClassName,
string lpWindowName);
[DllImport("user32.dll",EntryPoint="FindWindowEx")]
private static extern IntPtr FindWindowEx(IntPtr hwndParent,
IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
[DllImport("User32.dll",EntryPoint="SendMessage")]
private static extern int SendMessage(IntPtr hWnd,
int Msg, IntPtr wParam, string lParam);
#endregion
public JL()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
public int HTTPLogin(string strHost,int nPort,string strUserId,string strPassword,string strRegCode,ref IntPtr pHandle)
{
int bRtn = JL_HTTPLogin(strHost,nPort,strUserId,strPassword,strRegCode,ref pHandle);
return bRtn;
}
public int Logout(IntPtr pHandle)
{
JL_Logout(pHandle);
return 0;
}
public int ReceiveSM (IntPtr pHandle, int nLastMsgId)
{
int bRtn = JL_ReceiveSM(pHandle,nLastMsgId);
return bRtn;
}
//
public int GetAccountBalance (IntPtr pHandle, ref Single fBalance)
{
int bRtn = JL_GetAccountBalance(pHandle,ref fBalance);
return bRtn;
}
public int GetAccountPrice (IntPtr pHandle, ref Single fPrice)
{
int bRtn = JL_GetAccountPrice(pHandle,ref fPrice);
return bRtn;
}
public int GetAccountType (IntPtr pHandle, ref int nType)
{
int bRtn = JL_GetAccountType(pHandle,ref nType);
return bRtn;
}
public int GetAccountRegTime (IntPtr pHandle,StringBuilder strDate)
{
int bRtn = JL_GetAccountRegTime(pHandle,strDate);
return bRtn;
}
public int GetAccountDenyTime (IntPtr pHandle,StringBuilder strDate)
{
int bRtn = JL_GetAccountDenyTime(pHandle,strDate);
return bRtn;
}
//---------------------------------------------------------------------------------------------
public int SendMsg(IntPtr pHandle, string fPhone, string tphone, string content, string stime)
{
int bRtn = JL_SendMsg(pHandle,fPhone,tphone,content,stime);
return bRtn;
}
//---------------------------------------------------------------------------------------------
public int GetSendCount(IntPtr pHandle, string strStartDate, string strEndDate,ref int nCountWaitSend,ref int nCountTestSend)
{
int bRtn = JL_GetSendCount(pHandle, strStartDate, strEndDate,ref nCountWaitSend,ref nCountTestSend);
return bRtn;
}
public int ModifyPassword (IntPtr pHandle,string strNewPassword)
{
int bRtn = JL_ModifyPassword (pHandle,strNewPassword);
return bRtn;
}
public int GetOneSM(IntPtr pHandle, ref int pnMsgID,StringBuilder strFrom,StringBuilder strCreateTime,StringBuilder strContent)
{
int bRtn = JL_GetOneSM(pHandle, ref pnMsgID,strFrom,strCreateTime,strContent);
return bRtn;
}
public string Message(int bRtn)
{
switch (bRtn)
{
case 0:
return "正常.";
case 1:
return "TCP方式登录. ";
case 2:
return "HTTP方式登录. ";
case -1:
return "EPID错误. ";
case -2:
return "无该用户. ";
case -3:
return "注册码错 ";
case -4:
return "用户被停用. ";
case -5:
return "未注册成功.";
case -6:
return "超出使用日期";
case -7:
return "费用不足";
case -8:
return "源手机错误. ";
case -9:
return "目的手机错误. ";
case -10:
return "信息内容错误. ";
case -11:
return "连接失败. ";
case -12:
return "系统内部错误或者无效的客户状态.";
case -13:
return "客户权限不对";
case -14:
return "不是从指定的IP处登录";
case -15:
return "帐号已经登录(TCP). ";
case -16:
return "内部通讯错误. ";
case -17:
return "无可用的MT通道. ";
case -18:
return "不支持该功能";
case -20:
return "未知错误. ";
default:
return "未知错误.";
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -