📄 ecardxmlrpcut.pas
字号:
begin
ResultCode[0]:=inttostr(CT_SVR_ERR_DECODEERR);
ResultCode[1]:=CT_SVR_ERRCONTENT[CT_SVR_ERR_DECODEERR];
exit;
end;
SIU_SVR_DistInfo[k].SVR_DictInfoLth:=j;
n:=0;
if DictType='group' then
begin
Setlength(SIU_SVR_DistInfo[k].SVR_DictInfo,j,6);
for m:=0 to j do
begin
item:=( struct.Items[m] as TXMLRPCStructMember);
struct1:=TXMLRPCStruct.Create;
if item.name <> 'result' then
begin
struct1.XML:=item.value;
for i:=0 to struct1.Count-1 do
begin
item1:=( struct1.Items[i] as TXMLRPCStructMember);
if item1.name = 'id' then
SIU_SVR_DistInfo[k].SVR_DictInfo[n,0]:=item1.AsString;
if item1.name = 'name' then
SIU_SVR_DistInfo[k].SVR_DictInfo[n,1]:=item1.AsString;
if item1.name = 'item' then
begin
TmpStr:=item1.AsString;
SIU_SVR_SWITCHITEM.SIU_SVR_SWITCHBINHEX(2,SIU_SVR_DistInfo[k].SVR_DictInfo[n,2],TmpStr);
end;
if item1.name = 'days' then
SIU_SVR_DistInfo[k].SVR_DictInfo[n,3]:=inttostr(item1.AsInteger);
if item1.name = 'timeout' then
SIU_SVR_DistInfo[k].SVR_DictInfo[n,4]:=inttostr(item1.AsInteger);
if item1.name = 'order' then
SIU_SVR_DistInfo[k].SVR_DictInfo[n,5]:=inttostr(item1.AsInteger);
end;
n:=n+1;
end;
struct1.Free;
end;
SIU_SVR_DistInfo[k].SIU_SVR_DistInfo_Oder(k);
end;
if DictType='status' then
begin
Setlength(SIU_SVR_DistInfo[k].SVR_DictInfo,j,2);
for m:=0 to j do
begin
item:=( struct.Items[m] as TXMLRPCStructMember);
if item.name <> 'result' then
begin
SIU_SVR_DistInfo[k].SVR_DictInfo[n,0]:=item.name;
SIU_SVR_DistInfo[k].SVR_DictInfo[n,1]:=item.AsString;
n:=n+1;
end;
end;
end;
if DictType='price' then
begin
Setlength(SIU_SVR_DistInfo[k].SVR_DictInfo,j,5);
for m:=0 to j do
begin
item:=( struct.Items[m] as TXMLRPCStructMember);
struct1:=TXMLRPCStruct.Create;
if item.name <> 'result' then
begin
struct1.XML:=item.value;
for i:=0 to struct1.Count-1 do
begin
item1:=( struct1.Items[i] as TXMLRPCStructMember);
if item1.name = 'type' then
SIU_SVR_DistInfo[k].SVR_DictInfo[n,0]:=inttostr(item1.AsInteger);
if item1.name = 'price' then
SIU_SVR_DistInfo[k].SVR_DictInfo[n,1]:=floattostr(item1.AsDouble);
if item1.name = 'group' then
SIU_SVR_DistInfo[k].SVR_DictInfo[n,2]:=item1.AsString;
if item1.name = 'itemid' then
SIU_SVR_DistInfo[k].SVR_DictInfo[n,3]:=item1.AsString;
end;
n:=n+1;
end;
struct1.Free;
end;
SIU_SVR_DistInfo[k].SIU_SVR_DistInfo_Oder(k);
end;
if DictType='item' then
begin
Setlength(SIU_SVR_DistInfo[k].SVR_DictInfo,j,4);
for m:=0 to j do
begin
item:=( struct.Items[m] as TXMLRPCStructMember);
struct1:=TXMLRPCStruct.Create;
if item.name <> 'result' then
begin
struct1.XML:=item.value;
for i:=0 to struct1.Count-1 do
begin
item1:=( struct1.Items[i] as TXMLRPCStructMember);
if item1.name = 'id' then
SIU_SVR_DistInfo[k].SVR_DictInfo[n,0]:=item1.AsString;
if item1.name = 'name' then
SIU_SVR_DistInfo[k].SVR_DictInfo[n,1]:=item1.AsString;
if item1.name = 'type' then
SIU_SVR_DistInfo[k].SVR_DictInfo[n,2]:=item1.AsString;
if item1.name = 'code' then
SIU_SVR_DistInfo[k].SVR_DictInfo[n,3]:=inttostr(item1.AsInteger+1);
end;
n:=n+1;
end;
struct1.Free;
end;
SIU_SVR_DistInfo[k].SIU_SVR_DistInfo_Oder(k);
end;
if DictType='company' then
begin
Setlength(SIU_SVR_DistInfo[k].SVR_DictInfo,j,4);
for m:=0 to j do
begin
item:=( struct.Items[m] as TXMLRPCStructMember);
struct1:=TXMLRPCStruct.Create;
if item.name <> 'result' then
begin
struct1.XML:=item.value;
for i:=0 to struct1.Count-1 do
begin
item1:=( struct1.Items[i] as TXMLRPCStructMember);
if item1.name = 'id' then
SIU_SVR_DistInfo[k].SVR_DictInfo[n,0]:=item1.AsString;
if item1.name = 'name' then
SIU_SVR_DistInfo[k].SVR_DictInfo[n,1]:=item1.AsString;
if item1.name = 'expdate' then
SIU_SVR_DistInfo[k].SVR_DictInfo[n,2]:=datetimetostr(item1.AsDateTime);
if item1.name = 'order' then
SIU_SVR_DistInfo[k].SVR_DictInfo[n,3]:=inttostr(item1.AsInteger);
end;
n:=n+1;
end;
struct1.Free;
end;
SIU_SVR_DistInfo[k].SIU_SVR_DistInfo_Oder(k);
end;
if (DictType<>'group') and (DictType<>'item') and (DictType<>'status') and (DictType<>'price') and (DictType<>'company') then
begin
Setlength(SIU_SVR_DistInfo[k].SVR_DictInfo,j,3);
for m:=0 to j do
begin
item:=( struct.Items[m] as TXMLRPCStructMember);
struct1:=TXMLRPCStruct.Create;
if item.name <> 'result' then
begin
struct1.XML:=item.value;
for i:=0 to struct1.Count-1 do
begin
item1:=( struct1.Items[i] as TXMLRPCStructMember);
if item1.name = 'id' then
SIU_SVR_DistInfo[k].SVR_DictInfo[n,0]:=item1.AsString;
if item1.name = 'name' then
SIU_SVR_DistInfo[k].SVR_DictInfo[n,1]:=item1.AsString;
if item1.name = 'order' then
SIU_SVR_DistInfo[k].SVR_DictInfo[n,2]:=inttostr(item1.AsInteger);
end;
n:=n+1;
end;
struct1.Free;
end;
SIU_SVR_DistInfo[k].SIU_SVR_DistInfo_Oder(k);
end;
struct.Free;
Result:=true;
end;
procedure TECardXMLRPC.RegUserDecode( InfoXml:string;var Reg_UserInfo:TSIU_CL_UserInfo);
var
i:integer;
struct:TXMLRPCStruct;
item:TXMLRPCStructMember;
TmpStr:string;
begin
struct:=TXMLRPCStruct.Create;
struct.XML:=InfoXml;
Reg_UserInfo.SIU_CL_OI_CleanInfo;
for i:= 0 to struct.Count-1 do
begin
item:=( struct.Items[i] as TXMLRPCStructMember);
// showmessage(item.name);
if item.name = 'result' then
continue;
if item.name = 'user_id' then
Reg_UserInfo.U_ID :=item.AsString;
if item.name = 'outer_id' then
Reg_UserInfo.U_OUTER_ID:=item.AsString;
if item.name = 'zj_id' then
Reg_UserInfo.U_ZJ_ID:=item.AsString;
if item.name = 'zj_type' then
Reg_UserInfo.U_ZJ_TYPE :=item.AsString;
if item.name = 'card_id' then
Reg_UserInfo.U_CARD_ID :=item.AsString;
if item.name = 'login_id' then
Reg_UserInfo.U_LOGIN_ID:=item.AsString;
if item.name = 'password' then
Reg_UserInfo.U_PWD:=item.AsString;
if item.name = 'group' then
Reg_UserInfo.U_GROUP:=item.AsString;
if item.name = 'item' then
begin
TmpStr:=item.AsString;
SIU_SVR_SWITCHITEM.SIU_SVR_SWITCHBINHEX(2,Reg_UserInfo.U_ITEM,TmpStr);
end;
if item.name = 'status' then
Reg_UserInfo.U_STATUS:=item.AsString;
if item.name = 'barcode' then
Reg_UserInfo.U_BARCODE :=item.AsString;
if item.name = 'name' then
Reg_UserInfo.U_NAME :=item.AsString;
if item.name = 'sex' then
Reg_UserInfo.U_SEX :=item.AsString;
if item.name = 'nation' then
Reg_UserInfo.U_NATION:=item.AsString;
if item.name = 'birthday' then
Reg_UserInfo.U_BIRTHDAY:=item.AsDateTime;
if item.name = 'education' then
Reg_UserInfo.U_EDUCATION:=item.AsString;
if item.name = 'protitle' then
Reg_UserInfo.U_PROTITLE:=item.AsString;
if item.name = 'profession' then
Reg_UserInfo.U_PROFESSION:=item.AsString;
if item.name = 'country' then
Reg_UserInfo.U_COUNTRY:=item.AsString;
if item.name = 'province' then
Reg_UserInfo.U_PROVINCE:=item.AsString;
if item.name = 'county' then
Reg_UserInfo.U_COUNTY:=item.AsString;
if item.name = 'company' then
Reg_UserInfo.U_COMPANY:=item.AsString;
if item.name = 'address' then
Reg_UserInfo.U_ADDRESS:=item.AsString;
if item.name = 'postcode' then
Reg_UserInfo.U_POSTCODE:=item.AsString;
if item.name = 'telephone' then
Reg_UserInfo.U_TEL:=item.AsString;
if item.name = 'mobile' then
Reg_UserInfo.U_MOBILE:=item.AsString;
if item.name = 'email' then
Reg_UserInfo.U_EMAIL:=item.AsString;
if item.name = 'en_email' then
Reg_UserInfo.U_EN_EMAIL:=item.AsString;
if item.name = 'external' then
Reg_UserInfo.U_External:=item.value;
if item.name = 'photo' then
Reg_UserInfo.U_PHOTO:=item.AsBase64;
if item.name = 'regdate' then
Reg_UserInfo.U_REG_DATE:=item.AsDateTime;
if item.name = 'chkdate' then
Reg_UserInfo.U_CHK_DATE:=item.AsDateTime;
if item.name = 'expdate' then
Reg_UserInfo.U_EXP_DATE:=item.AsDateTime;
if item.name = 'moddate' then
Reg_UserInfo.U_MOD_DATE:=item.AsDateTime;
end;
Struct.Free;
end;
//-----------------------------------------------------------------------------------//
//------------------------------------编码-------------------------------------------//
procedure TECardXMLRPC.PrintEncode(var InfoXml:string;tmpXml:array of string;i:integer);
var
Struct: TXMLRPCStruct;
j:integer;
item:TXMLRPCStructMember;
begin
Struct := TXMLRPCStruct.Create;
for j:=0 to i-1 do
Struct.AddString(tmpXml[j]).name:=inttostr(j);
InfoXml:=Struct.XML;
Struct.Free;
end;
procedure TECardXMLRPC.RegUserEncode(var Reg_UserInfo:TSIU_CL_UserInfo;var InfoXml:string);
var
Struct,Struct1: TXMLRPCStruct;
TmpStr:string;
i,k:integer;
begin
Struct := TXMLRPCStruct.Create;
Struct.AddString(Reg_UserInfo.U_ID).name :='user_id';
Struct.AddString(Reg_UserInfo.U_OUTER_ID).name :='outer_id';
Struct.AddString(Reg_UserInfo.U_ZJ_ID).name :='zj_id';
Struct.AddString(Reg_UserInfo.U_ZJ_TYPE).name :='zj_type';
Struct.AddString(Reg_UserInfo.U_CARD_ID).name :='card_id';
Struct.AddString(Reg_UserInfo.U_LOGIN_ID).name :='login_id';
Struct.AddString(Reg_UserInfo.U_PWD).name :='password';
Struct.AddString(Reg_UserInfo.U_GROUP).name :='group';
SIU_SVR_SWITCHITEM.SIU_SVR_SWITCHBINHEX(1,Reg_UserInfo.U_ITEM,TmpStr);
Struct.AddString(TmpStr).name :='item';
Struct.AddString(Reg_UserInfo.U_STATUS).name :='status';
Struct.AddString(Reg_UserInfo.U_BARCODE).name :='barcode';
Struct.AddString(Reg_UserInfo.U_NAME).name :='name';
Struct.AddString(Reg_UserInfo.U_SEX).name :='sex';
Struct.AddString(Reg_UserInfo.U_NATION).name :='nation';
Struct.AddDateTime(Reg_UserInfo.U_BIRTHDAY).name:='birthday';
Struct.AddString(Reg_UserInfo.U_EDUCATION).name :='education';
Struct.AddString(Reg_UserInfo.U_PROTITLE).name :='protitle';
Struct.AddString(Reg_UserInfo.U_PROFESSION).name :='profession';
Struct.AddString(Reg_UserInfo.U_COUNTRY).name :='country';
Struct.AddString(Reg_UserInfo.U_PROVINCE).name :='province';
Struct.AddString(Reg_UserInfo.U_COUNTY).name :='county';
Struct.AddString(Reg_UserInfo.U_COMPANY).name :='company';
Struct.AddString(Reg_UserInfo.U_ADDRESS).name :='address';
Struct.AddString(Reg_UserInfo.U_POSTCODE).name :='postcode';
Struct.AddString(Reg_UserInfo.U_TEL).name :='telephone';
Struct.AddString(Reg_UserInfo.U_MOBILE).name :='mobile';
Struct.AddString(Reg_UserInfo.U_EMAIL).name :='email';
Struct.AddString(Reg_UserInfo.U_EN_EMAIL).name :='en_email';
Struct.AddBase64(Reg_UserInfo.U_PHOTO).name:='photo';
Struct.AddDateTime(Reg_UserInfo.U_REG_DATE).name:='regdate';
Struct.AddDateTime(Reg_UserInfo.U_CHK_DATE).name:='chkdate';
Struct.AddDateTime(Reg_UserInfo.U_EXP_DATE).name:='expdate';
Struct.AddDateTime(Reg_UserInfo.U_MOD_DATE).name:='moddate';
k:=SIU_SVR_ArrayInfo.SIU_SVR_GetArray('company',CT_SVR_DICT);
for i:=0 to SIU_SVR_DistInfo[k].SVR_DictInfoLth-1 do
if SIU_SVR_DistInfo[k].SVR_DictInfo[i,1]=Reg_UserInfo.U_COMPANY then
Struct.AddDateTime(strtodatetime(SIU_SVR_DistInfo[k].SVR_DictInfo[i,2])).name:='expdate';
if trim(Reg_UserInfo.U_External)='' then
begin
Struct1 := TXMLRPCStruct.Create;
Struct.AddString(Struct1.XML).name:='external';
Struct1.Free;
end
else
Struct.AddString(Reg_UserInfo.U_External).name:='external';
InfoXml:=Struct.XML;
Struct.Free;
end;
function TECardXMLRPC.PhotoEncode(photo:String):string;
var
Struct: TXMLRPCStruct;
begin
Struct := TXMLRPCStruct.Create;
Struct.AddBase64(photo).name:='photo';
Result:=Struct.XML;
Struct.Free;
end;
//-----------------------------------------------------------------------------------//
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -