- 开源协议: Unlicense
 - 官网地址: https://sjqzhang.github.io/go-fastdfs/#vision
 - 安装:
 
wget --no-check-certificate  https://github.com/sjqzhang/go-fastdfs/releases/download/v1.3.1/fileserver -O fileserver && chmod +x fileserver && ./fileserver
 
- 上传 文件(基于solon)
 
@ApiOperation("文件上传")
@Mapping("/upload")
public String upload(UploadedFile file){
    String result = "";
    InputStreamResource isr = new InputStreamResource(file.getContent(),
            file.getName());
    Map<String, Object> params = new HashMap<>();
    params.put("file", isr);
    params.put("path", "86501729");
    params.put("output", "json");
    String resp = HttpUtil.post("http://192.168.1.156:8080/upload", params);
    Console.log("resp: {}", resp);
    result = resp;
    return resp;
}
@ApiOperation("下载")
@Mapping("download")
public void down(Context ctx) throws IOException {
    File file = new File("http://192.168.1.156:8080/group1/zkcy/screenshot-20230217-112719.png");
    ctx.outputAsFile(file);
}
 
-  
web页面安装
- 下载地址: https://github.com/perfree/go-fastdfs-web/releases
 - 默认端口8088,修改默认端口号更改config/application.yml即可
 - 如go-fastdfs开启了按组管理,则需要填写组名,反之不用填写
 - 进入安装页填写集群地址时,该地址需要在go-fastdfs配置文件配置管理ip白名单,否则获取不到数据!
 - 文件列表功能需要go-fastdfs服务版本在v1.2.8以上
 - 遇到获取不到信息的功能,先试一下本地调用go-fastdfs接口看是否能获取到
 
 -  
命令介绍
 
	1.运行
	./goFastDfsWeb.sh start
	2.查看运行状态
	./goFastDfsWeb.sh status
	3.重新启动
	./goFastDfsWeb.sh restart
	4.停止
	./goFastDfsWeb.sh stop
 
-  
如遇到-bash: ./goFastDfsWeb.sh: /bin/bash^M: 坏的解释器: 没有那个文件或目录错误,则执行以下命令再运行
sed -i 's/\r//' ./goFastDfsWeb.sh -  
web界面配置
- 首次运行时,需要填初始化服务信息 在cfg.json中添加白名单如下图
 -  
1. cfg.json 在安装路径下的conf文件夹下 
- 初始化时如无分组 请勿填写 仅需填写 ip地址即可 也就是中间的一行
 - 填写用户名密码即可
 - 账号信息 zkcy qwer123!
 - 页面如下 http://192.168.1.156:8088/login
 
 -  
开启上传验证

 -  
在cfg.json中添加 验证url

 -  
代码示例
@ApiOperation("文件上传") @Mapping("/upload") public String upload(UploadedFile file,String authToken){ InputStreamResource isr = new InputStreamResource(file.getContent(), file.getName()); Map<String, Object> params = new HashMap<>(); params.put("file", isr); params.put("path", "zkcy"); params.put("output", "json"); params.put("auth_token", authToken); String resp = HttpUtil.post("http://192.168.1.156:8080/upload", params); Console.log("resp: {}", resp); return resp; } //cfg.json中配置的验证url 校验token @Post @ApiOperation("验证") @Mapping("/auth") public String auth(String auth_token) throws Exception { if ("ok".equals(auth_token)){ return "ok"; }else { return "fail"; } } 



















