business.h
来自「用C 语言开发Tuxedo客户端连接程序」· C头文件 代码 · 共 979 行 · 第 1/3 页
H
979 行
Fget(fmlbuf, X_RESULTCODE, (FLDOCC)0, (char *)&xresultcode, (FLDLEN *)NULL);
Fget(fmlbuf, X_RESULTINFO, (FLDOCC)0, (char *)infotemp, (FLDLEN *)NULL);
Fget(fmlbuf, X_RECORDNUM, (FLDOCC)0, (char *)&xrecordnum, (FLDLEN *)NULL);
infotemp[500] = '\0';
sBasicOutput->x_resultcode = xresultcode;
sprintf(sBasicOutput->x_resultinfo, "%s", infotemp);
sBasicOutput->x_recordnum = xrecordnum;
}
}
/* 释放输入、输出缓存,断开tuxedo连接 */
tpfree((char*)fmlbuf);
tpterm();
/* 返回结果 */
if (iReturn < 0)
return -1;
return 0;
}
/*-----------------------------------------------------------------------------
* Function: fnSendSMS
* Purpose : 发送短信
* Input :
* SBasicInput * -- 输入参数,基本输入数据
* SSendSMSInput* -- 输入参数
* SBasicOutput * -- 输出参数,基本输出数据
* Return : 0 成功, -1 失败
*-----------------------------------------------------------------------------
*/
#if defined(__STDC__) || defined(__cplusplus)
int fnSendSMS(SBasicInput * sBasicInput, SSendSMSInput * sSendSMSInput,SBasicOutput * sBasicOutput)
#else
int fnSendSMS(sBasicInput, sSendSMSInput,sBasicOutput)
SBasicInput * sBasicInput;
SSendSMSInput * sSendSMSInput;
SBasicOutput * sBasicOutput;
#endif
{
FBFR *fmlbuf= (FBFR *) NULL; /* tuxedo服务调用输入输出缓存 */
int iReturn;
long lOutLen;
long xresultcode = 0; /*返回结果代码*/
char xresultinfo[X_RESULTINFO_LEN] = "\0"; /*返回结果信息*/
long xrecordnum = 0; /*返回结果记录数,多行输出时有效*/
char infotemp[2000];
long sendtimecode=1;
long sEND_OBJECT_CODE=1;
long id=0;
long rEFERED_COUNT=0;
long fORCE_REFER_COUNT=1;
long sMS_PRIORITY=50;
(void)TuxedoConnect();
fmlbuf = (FBFR *)tpalloc((char *)FMLTYPE, NULL, 4096);
if (fmlbuf == (FBFR *)NULL)
{
tpterm();
return -1;
}
iReturn = Finit(fmlbuf, 4096);
if(iReturn >= 0)
{
/* 填写tuxedo服务输入数据 */
iReturn =
Fchg(fmlbuf, X_TRANS_CODE, (FLDOCC)0, (char *)"ITF_SMHT_SMSINSERT", (FLDLEN)0)|
Fchg(fmlbuf, PROVINCE_CODE, (FLDOCC)0, (char *)sBasicInput->province_code, (FLDLEN)0)|
Fchg(fmlbuf, IN_MODE_CODE, (FLDOCC)0, (char *)sBasicInput->in_mode_code, (FLDLEN)0)|
Fchg(fmlbuf, TRADE_EPARCHY_CODE, (FLDOCC)0, (char *)sBasicInput->trade_eparchy_code, (FLDLEN)0)|
Fchg(fmlbuf, TRADE_CITY_CODE, (FLDOCC)0, (char *)sBasicInput->trade_city_code, (FLDLEN)0)|
Fchg(fmlbuf, TRADE_DEPART_ID, (FLDOCC)0, (char *)sBasicInput->trade_depart_id, (FLDLEN)0)|
Fchg(fmlbuf, TRADE_STAFF_ID, (FLDOCC)0, (char *)sBasicInput->trade_staff_id, (FLDLEN)0)|
Fchg(fmlbuf, ROUTE_EPARCHY_CODE, (FLDOCC)0, (char *)sBasicInput->rout_eparchy_code, (FLDLEN)0)|
Fchg(fmlbuf, TRADE_DEPART_PASSWD, (FLDOCC)0, (char *)sBasicInput->trade_depart_passwd, (FLDLEN)0);
}
if (iReturn >= 0)
{
/* 填写返销查询输入数据 */
iReturn =
Fchg(fmlbuf, SMS_NOTICE_ID, (FLDOCC)0, (char *)"123456789012345", (FLDLEN)0)|
Fchg(fmlbuf, RECV_OBJECT, (FLDOCC)0, (char *)sSendSMSInput->Serial_Number, (FLDLEN)0)|
Fchg(fmlbuf, SMS_CHANNEL_CODE, (FLDOCC)0, (char *)"11", (FLDLEN)0)|
Fchg(fmlbuf, SEND_OBJECT_CODE, (FLDOCC)0, (char *)&sEND_OBJECT_CODE, (FLDLEN)0)|
Fchg(fmlbuf, SEND_TIME_CODE, (FLDOCC)0, (char *)&sendtimecode, (FLDLEN)0)|
Fchg(fmlbuf, SEND_COUNT_CODE, (FLDOCC)0, (char *)&sendtimecode, (FLDLEN)0)|
Fchg(fmlbuf, REFERED_COUNT, (FLDOCC)0, (char *)&rEFERED_COUNT, (FLDLEN)0)|
Fchg(fmlbuf, FORCE_REFER_COUNT, (FLDOCC)0, (char *)&fORCE_REFER_COUNT, (FLDLEN)0)|
Fchg(fmlbuf, SMS_PRIORITY, (FLDOCC)0, (char *)&sMS_PRIORITY, (FLDLEN)0)|
Fchg(fmlbuf, ID, (FLDOCC)0, (char *)"0", (FLDLEN)0)|
Fchg(fmlbuf, RECV_OBJECT_TYPE, (FLDOCC)0, (char *)"00", (FLDLEN)0)|
Fchg(fmlbuf, SMS_KIND_CODE, (FLDOCC)0, (char *)"02", (FLDLEN)0)|
Fchg(fmlbuf, SMS_TYPE_CODE, (FLDOCC)0, (char *)"20", (FLDLEN)0)|
Fchg(fmlbuf, EPARCHY_CODE, (FLDOCC)0, (char *)"0991", (FLDLEN)0)|
Fchg(fmlbuf, REFER_STAFF_ID , (FLDOCC)0, (char *)"ITFZY000", (FLDLEN)0)|
Fchg(fmlbuf, REFER_DEPART_ID, (FLDOCC)0, (char *)sBasicInput->trade_depart_id, (FLDLEN)0)|
Fchg(fmlbuf, NOTICE_CONTENT_TYPE, (FLDOCC)0, (char *)"0", (FLDLEN)0)|
Fchg(fmlbuf, NOTICE_CONTENT, (FLDOCC)0, (char *)sSendSMSInput->notice_content, (FLDLEN)0)|
Fchg(fmlbuf, REFER_TIME, (FLDOCC)0, (char *)sSendSMSInput->notice_time, (FLDLEN)0)|
Fchg(fmlbuf, DEAL_TIME, (FLDOCC)0, (char *)sSendSMSInput->notice_time, (FLDLEN)0)|
Fchg(fmlbuf, FORCE_OBJECT, (FLDOCC)0, (char *)"", (FLDLEN)0)|
Fchg(fmlbuf, FORCE_START_TIME, (FLDOCC)0, (char *)"", (FLDLEN)0)|
Fchg(fmlbuf, FORCE_END_TIME, (FLDOCC)0, (char *)"", (FLDLEN)0)|
Fchg(fmlbuf, DEAL_STAFFID, (FLDOCC)0, (char *)"", (FLDLEN)0)|
Fchg(fmlbuf, DEAL_DEPARTID, (FLDOCC)0, (char *)"", (FLDLEN)0)|
Fchg(fmlbuf, DEAL_STATE, (FLDOCC)0, (char *)" ", (FLDLEN)0)|
Fchg(fmlbuf, REMARK, (FLDOCC)0, (char *)"", (FLDLEN)0)|
Fchg(fmlbuf, REVC1, (FLDOCC)0, (char *)"", (FLDLEN)0)|
Fchg(fmlbuf, REVC2, (FLDOCC)0, (char *)"", (FLDLEN)0)|
Fchg(fmlbuf, REVC3, (FLDOCC)0, (char *)"", (FLDLEN)0)|
Fchg(fmlbuf, REVC4, (FLDOCC)0, (char *)"", (FLDLEN)0);
}
if (iReturn < 0)
{
tpfree((char*)fmlbuf);
tpterm();
return -1;
}
else
{
/* 调用tuxedo服务 */
iReturn = tpcall("ITF_BKHSVC", (char *)fmlbuf, 0, (char **)&fmlbuf, (long *)&lOutLen, TPNOTRAN);
/*printf("iReturn = %d\n", iReturn );*/
if (iReturn >= 0)
{
/* 取返回数据 */
Fget(fmlbuf, X_RESULTCODE, (FLDOCC)0, (char *)&xresultcode, (FLDLEN *)NULL);
Fget(fmlbuf, X_RESULTINFO, (FLDOCC)0, (char *)infotemp, (FLDLEN *)NULL);
Fget(fmlbuf, X_RECORDNUM, (FLDOCC)0, (char *)&xrecordnum, (FLDLEN *)NULL);
infotemp[500] = '\0';
sBasicOutput->x_resultcode = xresultcode;
sprintf(sBasicOutput->x_resultinfo, "%s", infotemp);
sBasicOutput->x_recordnum = xrecordnum;
}
}
/* 释放输入、输出缓存,断开tuxedo连接 */
tpfree((char*)fmlbuf);
tpterm();
/* 返回结果 */
if (iReturn < 0)
return -1;
return 0;
}
int fnEncrypt(char *pwd1, char *pwd2, char *ret)
{
long bytes;
long l,a,j, k ;
long rand_seed1, rand_seed2,
rand_seed3, mod_seed ;
long mm[101];
char cmm[20] = "" ;
char temp[2] = "" ;
char tempchar[2] = "" ;
char tempchar1[2] = "" ;
char tempchar2[2] = "" ;
char pwd[21] = "" ;
bytes = 6 ;
l = a = j = k = 0 ;
rand_seed1 = 23456 ;
rand_seed2 = 31212 ;
rand_seed3 = 1029 ;
mod_seed = 32768 ;
strcpy(cmm, "") ;
strcpy(pwd, "") ;
strcpy(pwd, strcat(pwd1, pwd2)) ;
if (strcmp(pwd1, "") == 0 || strlen(pwd1) == 0)
return (-1) ;
l = strlen(pwd) ;
for (j = 1 ; j <= l ; j++)
{
strncpy(tempchar, pwd + j - 1, 1) ;
a = (long)tempchar[0] ;
rand_seed1 = (rand_seed1 + a * j) % mod_seed ;
rand_seed2 = ((rand_seed2 + a *(l - j)) % (mod_seed / 4)) * 2 ;
rand_seed3 = ((rand_seed3 + a * a) % (mod_seed / 4)) * 2 + 1 ;
}
if (bytes > 10)
bytes = 10 ;
l = strlen(pwd1) ;
if (l > bytes)
strncpy(pwd1, pwd1, bytes) ;
else
{
for (l = l + 1 ; l <= bytes ; l++)
{
rand_seed1 = (rand_seed1 * rand_seed2 + rand_seed3) % mod_seed ;
a = rand_seed1 % 126 ;
if (a < 33)
a = 'A' + a ;
sprintf(temp, "%s", a) ;
strcat(pwd1, temp) ;
}
}
l = strlen(pwd2) ;
if (l > bytes)
strncpy(pwd2, pwd2, bytes) ;
else
{
for (l = l + 1 ; l <= bytes ; l++)
{
rand_seed1 = (rand_seed1 * rand_seed2 + rand_seed3) % mod_seed ;
a = rand_seed1 % 126 ;
if (a < 33)
a = 'A' + a ;
sprintf(temp, "%l", a) ;
strcat(pwd2, temp) ;
}
}
for (l = 0 ; l <= 100 ; l++)
mm[l] = 0 ;
a = (rand_seed1 * rand_seed2 + rand_seed3) % mod_seed ;
for (l = 1 ; l <= bytes ; l++)
{
for (k = 1 ; k <= bytes ; k++)
{
strncpy(tempchar1, pwd1 + l - 1, 1) ;
strncpy(tempchar2, pwd2 + l - 1, 1) ;
a = (a * rand_seed1 + tempchar1[0] * tempchar2[0] * l) % mod_seed ;
if (a >= mod_seed / 2)
{
rand_seed1 = (rand_seed1 * rand_seed2 + rand_seed3) % mod_seed ;
mm[rand_seed1 % (bytes * bytes)] = rand_seed1 ;
}
else
{
rand_seed1 = (rand_seed1 *(rand_seed3 + 1) + rand_seed2 + 1) % mod_seed ;
mm[rand_seed1 % (bytes * bytes)] = rand_seed1 ;
}
}
}
for (k = bytes * bytes ; k >= 1 ; k--)
{
if (k > 1)
mm[k - 1] += (mm[k] / 256) ;
}
for (l = 1 ; l <= bytes * bytes ; l++)
{
rand_seed1 = (rand_seed1 * rand_seed1) % mod_seed ;
if (mm[l] == 0)
mm[l] = rand_seed1 ;
}
strcpy(cmm, "") ;
for (k = 1 ; k <= bytes ; k++)
{
for (l = 1 ; l <= bytes ; l++)
{
strncpy(tempchar1, pwd1 + l - 1, 1) ;
strncpy(tempchar2, pwd2 + k - 1, 1) ;
a = (mm[l + (k - 1) * bytes] * tempchar2[0] * tempchar1[0]) % 62 ;
if (a < 10)
{
sprintf(temp, "%c", a + '0') ;
strcat(cmm, temp) ;
}
else
{
if (a < 36)
{
sprintf(temp, "%c", a - 10 + 'a') ;
strcat(cmm, temp) ;
}
else
{
if (a < 62)
{
sprintf(temp, "%c", a - 36 + 'A') ;
strcat(cmm, temp) ;
}
else
strcat(cmm, "_") ;
}
}
}
}
strcpy(ret, cmm) ;
return (0) ;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?