TA的每日心情 | 开心 2024-8-31 15:58 |
---|
签到天数: 89 天 [LV.6]常住居民II
管理员
- 积分
- 3366
|
(defun $load-fas-web$ (ip port file-n lst)
;ip 远程服务器ip地址
;port 远程服务器端口
;file-n 远程服务器上的fas文件
;lst预留参数
;调用示例($load-fas-web$ "http://127.0.0.1" "8000" "1.zx" nil)
(if (and ip (wcmatch ip "[,http://*,]") file-n) ;"http://127.0.0.1"
(progn
(IF (AND al-load-stream make-string-input-stream al-fas-load)
()
(PROGN (IF (FINDFILE "al-load-stream.FAS")
(LOAD (FINDFILE "al-load-stream.FAS"))
)
(IF (FINDFILE "al-fas-load.fas")
(LOAD (FINDFILE "al-fas-load.fas"))
)
(IF (FINDFILE "make-string-input-stream.FAS")
(LOAD (FINDFILE "make-string-input-stream.FAS"))
)
)
)
(setq
str
($http-local2$
(list
(cons "IP" ip)
(cons "端口" port)
(cons "http方法" "GET")
;(cons "接口" "EmbedFile") ;lisp在线加载的接口
(cons "接口" "DownloadHeadFile") ;fas在线加载的接口
(cons
"报文头"
(list
(cons "embed_file_path" (strcat "staticfiles/" file-n))
)
)
(cons "报文体" "")
(cons "返回格式" "数组")
)
)
) ;向exe发送请求,返回的是字符串
(if (or (= str "Bad Request") (= str "400"))
(setq str nil)
)
(progn (vl-catch-all-apply
'vl-file-delete
(list "d:\\1.fas")
)
(WriteBinaryStream "d:\\1.fas" str)
) ;写出文件看看文件是否可以直接加载,注意上面的返回格式必须是 数组
(setq jz? (al-fas-load
(make-string-input-stream
(vl-list->string
(vlax-safearray->list (vlax-variant-value str))
)
)
)
)
)
)
) |
|