|
@@ -90,9 +90,12 @@ type
|
|
|
function ConnectServer(AIP: string; var ACompanyName: string): Integer; // 新装软件,先弹出设置IP窗口
|
|
|
function UpDataFile(AUserID, ATenderID, APhaseNo: Integer; AFile, AMD5_JL: string;
|
|
|
AIsSubmit: Boolean; var AResultStr: string; ACheckPassed: Boolean; ACheckerMemo: string): Boolean;
|
|
|
- function UpAttachmentFile(AUperID, AWebID, ABillID: Integer; AFile,
|
|
|
- ACategory, AMemo, APhaseName: string; var ANewFileName: string): Boolean;
|
|
|
- function GetAttachmentFileList(AWebID: Integer; var vArr: TOVArr): Boolean;
|
|
|
+
|
|
|
+ function UpAttachment(AUperID, AWebID, ABillID, APhase: Integer; AFile, ACategory, AMemo: string; var ANewFileName: string): Boolean;
|
|
|
+ function UpAttachmentOnLine(AWebID, ABillID, APhase: Integer; AIDAry: array of string): Boolean;
|
|
|
+ function DeleteAttachment(AFileID: Integer): Integer;
|
|
|
+ function GetAttachmentList(AWebID: Integer; var vArr: TOVArr): Boolean;
|
|
|
+
|
|
|
function zip(AFileArr: array of string): string;
|
|
|
function CheckZip(AZipFile: string; AFileCount: Integer): Boolean; // 检测zip是否能够正确解压出所有文件。
|
|
|
function TempName(ALength: Integer = 12): string;
|
|
@@ -107,7 +110,7 @@ type
|
|
|
function PageError(AMid: string): string;
|
|
|
function ExistInServer(AWebID: Integer): Boolean;
|
|
|
function GetNameFromURLProtocol(AURLProtocol: string): string;
|
|
|
- function DeleteAttachment(AFileID: Integer): Integer;
|
|
|
+
|
|
|
|
|
|
property Account: string read FAccount write SetAccount;
|
|
|
property UserID: Integer read FUserID write SetUserID;
|
|
@@ -602,8 +605,8 @@ begin
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
-function TPHPWeb.UpAttachmentFile(AUperID, AWebID, ABillID: Integer; AFile,
|
|
|
- ACategory, AMemo, APhaseName: string; var ANewFileName: string): Boolean;
|
|
|
+function TPHPWeb.UpAttachment(AUperID, AWebID, ABillID, APhase: Integer; AFile,
|
|
|
+ ACategory, AMemo: string; var ANewFileName: string): Boolean;
|
|
|
var
|
|
|
vMPFDS: TIdMultiPartFormDataStream;
|
|
|
sResult, sURL: string;
|
|
@@ -623,9 +626,9 @@ begin
|
|
|
sURL := Format('%stender/attachment/%d/%d/upload', [FMeasureURL, AWebID, AUperID]);
|
|
|
vMPFDS.AddFile('upitem', AFile, 'text/plain');
|
|
|
vMPFDS.AddFormField('itemid', IntToStr(ABillID));
|
|
|
- vMPFDS.AddFormField('Category', ACategory);
|
|
|
- vMPFDS.AddFormField('Memo', ReplaceCharsForJson(AMemo));
|
|
|
- vMPFDS.AddFormField('PhaseName', APhaseName);
|
|
|
+ vMPFDS.AddFormField('category', ACategory);
|
|
|
+ vMPFDS.AddFormField('memo', ReplaceCharsForJson(AMemo));
|
|
|
+ vMPFDS.AddFormField('phase', IntToStr(APhase));
|
|
|
|
|
|
vMPFDS.Position := 0;
|
|
|
try
|
|
@@ -656,7 +659,7 @@ begin
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
-function TPHPWeb.GetAttachmentFileList(AWebID: Integer; var vArr: TOVArr): Boolean;
|
|
|
+function TPHPWeb.GetAttachmentList(AWebID: Integer; var vArr: TOVArr): Boolean;
|
|
|
var sURL: string;
|
|
|
begin
|
|
|
sURL := Format('%stender/attachment/%d/list', [FMeasureURL, AWebID]);
|
|
@@ -692,10 +695,54 @@ var sURL: string;
|
|
|
vArr: array of string;
|
|
|
begin
|
|
|
vArr := VarArrayOf(['msg']);
|
|
|
- sURL := Format('%stender/attachment/%d/list', [FMeasureURL, AFileID]);
|
|
|
+ sURL := Format('%stender/attachment/%d/del', [FMeasureURL, AFileID]);
|
|
|
Result := Search(sURL, [], [], vArr);
|
|
|
end;
|
|
|
|
|
|
+function TPHPWeb.UpAttachmentOnLine(AWebID, ABillID, APhase: Integer; AIDAry: array of string): Boolean;
|
|
|
+//var
|
|
|
+// vMPFDS: TIdMultiPartFormDataStream;
|
|
|
+// sResult, sURL: string;
|
|
|
+// J: TCslJson;
|
|
|
+// vArr: array of string;
|
|
|
+begin
|
|
|
+{ Result := False;
|
|
|
+
|
|
|
+ vMPFDS := TIdMultiPartFormDataStream.Create;
|
|
|
+ try
|
|
|
+ sURL := Format('%stender/attachment/%d/%d/upload', [FMeasureURL, AWebID, PHPWeb.UserID]);
|
|
|
+ vMPFDS.AddFormField('itemid', IntToStr(ABillID));
|
|
|
+ vMPFDS.AddFormField('phase', IntToStr(APhase));
|
|
|
+
|
|
|
+ vMPFDS.Position := 0;
|
|
|
+ try
|
|
|
+ sResult := IdHTTP.Post(sURL, vMPFDS);
|
|
|
+ except
|
|
|
+ Abort;
|
|
|
+ end;
|
|
|
+ finally
|
|
|
+ vMPFDS.Free;
|
|
|
+ end;
|
|
|
+
|
|
|
+ J := TCslJson.Create;
|
|
|
+ try
|
|
|
+ J.Text := Utf8ToAnsi(sResult);
|
|
|
+ if SameText(J.Value['status'], 'true') then
|
|
|
+ begin
|
|
|
+ Result := True;
|
|
|
+ vArr := VarArrayOf(['onlinefilename']);
|
|
|
+ J.ChildValues('iteminfo', vArr);
|
|
|
+ ANewFileName := vArr[0];
|
|
|
+ end
|
|
|
+ else
|
|
|
+ begin
|
|
|
+ Result := False;
|
|
|
+ end;
|
|
|
+ finally
|
|
|
+ J.Free;
|
|
|
+ end; }
|
|
|
+end;
|
|
|
+
|
|
|
initialization
|
|
|
|
|
|
finalization
|