Browse Source

调整多文件同步

master
453530270@qq.com 2 years ago
parent
commit
31c5dcdb81
  1. 2
      fssc/internal/handler/handler.go
  2. 2
      fssc/internal/handler/webconsole.go
  3. 39
      fssc/web/wbconsole.tmpl

2
fssc/internal/handler/handler.go

@ -161,7 +161,7 @@ func SendZip(w http.ResponseWriter, r *http.Request) {
fmt.Println("archive is not exist!!!")
}
// 执行完 跳转到 首页
http.Redirect(w, r, "/", http.StatusFound)
//http.Redirect(w, r, "/", http.StatusFound)
}
// 发送拦截

2
fssc/internal/handler/webconsole.go

@ -20,6 +20,7 @@ func WebConsole(w http.ResponseWriter, r *http.Request) {
if urlpath == "Li4=" {
urlpath = ""
}
//文件名
fname := r.URL.Query().Get("f")
//转码
@ -39,6 +40,7 @@ func WebConsole(w http.ResponseWriter, r *http.Request) {
downloadPath := filepath.Join(filepath.Base(config.G.FilePath), abupath)
// 相对路径
relpath := filepath.Join(abupath, "../")
fmt.Printf("relpath is %s\n", relpath)
//
fileInfo, err := os.Stat(realFilePath)
if err != nil {

39
fssc/web/wbconsole.tmpl

@ -64,7 +64,7 @@
<div class="form-group col-md-10">
<div class="input-group">
<div class="input-group-addon">服务器ip</div>
<input type="text" class="form-control" name="sip" id="scip" placeholder="eg:192.168.66.99">
<input type="text" class="form-control" name="scip" id="scip" placeholder="eg:192.168.66.99">
</div>
</div>
<div class="form-group col-md-2">
@ -88,7 +88,7 @@
<a href="./console" class="btn btn-primary btn-sm">home</a>
<a href="?p={{b64en $.Relpath}}&f=&file=1" class="btn btn-success btn-sm">返回上层</a>
<a href="javascript:void(0);" class="btn btn-success btn-sm" id="slall">全选</a>
<a href="">同步</a>
<a href="javascript:void(0);" class="btn btn-info btn-sm" id="sybtn">同步</a>
</p>
</div>
<form action="/sendZip" method="post" class="form-inline">
@ -117,6 +117,8 @@
</li>
{{ end }}
</ul>
<input type="hidden" name="curpath" value="{{$.UrlPath}}"/>
<input type="hidden" name="serverip" id="hscip" />
</form>
</div>
</div>
@ -155,17 +157,29 @@
<script type="text/javascript">
var chkall = true;
var chknum=0;
var scip=""; //目标服务器ip
$(function(){
// read sessionStorage
var oscip = sessionStorage.getItem("scip")
if(oscip!=""){
$("#scip").val(oscip);
scip = oscip;
$("input[name='serverip']").val(oscip);
}
// click function
$("#entsip").on("click",function(){
//
var sip = $("#scip").val();
var html = "<li class=\"list-group-item\">输入目标服务器"+sip+"</li>";
scip = $("#scip").val();
// ip storage
sessionStorage.setItem("scip",scip);
var html = "<li class=\"list-group-item\">输入目标服务器"+scip+"</li>";
// 目标站
$("#mbip").text("目标站("+sip+")");
$("#mbip").text("目标站("+scip+")");
// 获取信息
gescinfo(sip)
gescinfo(scip)
//
$("#rstatus").append(html)
})
@ -221,6 +235,19 @@
chkall = !chkall;
})
//同步操作
$("#sybtn").on("click",function(){
var ttsip = $("input[name='serverip']").val();
if(ttsip==""){
alert("老天鹅,你还没填写目标服务器地址。");
}else{
$("#hscip").val(scip);
// 提交表单
$(".form-inline").submit();
}
});
});
</script>
</body>

Loading…
Cancel
Save