当前位置: 首页 > news >正文

网店设计方案范文seo性能优化

网店设计方案范文,seo性能优化,西安seo黑,带货视频怎么制作教程官网: MinIO 是一个基于 Go 实现的高性能、兼容 S3 协议的对象存储。它采用 GNU AGPL v3 开源协议,项目地址是 https://github.com/minio/minio 。 它适合存储海量的非结构化的数据,例如说图片、音频、视频等常见文件,备份数据、…

官网:
MinIO 是一个基于 Go 实现的高性能、兼容 S3 协议的对象存储。它采用 GNU AGPL v3 开源协议,项目地址是 https://github.com/minio/minio 。

它适合存储海量的非结构化的数据,例如说图片、音频、视频等常见文件,备份数据、容器、虚拟机镜像等等,小到 1 KB,大到 5 TB 都可以支持。

添加依赖

<properties><java.version>1.8</java.version><minio.version>8.4.3</minio.version>
</properties><dependencies><dependency><groupId>io.minio</groupId><artifactId>minio</artifactId><version>${minio.version}</version></dependency>
</dependencies>

Minio 配置类

import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;@Configuration
public class MinioConfig {@Value("${minio.url}")private String url;@Value("${minio.access-key}")private String accessKey;@Value("${minio.secret-key}")private String secretKey;@Beanpublic MinioClient minioClient() {return MinioClient.builder().endpoint(url).credentials(accessKey, secretKey).build();}
}

application.yml 配置文件

minio:url: http://127.0.0.1:9000accessKey: 45wsHpkAIWfhghSs11XsecretKey: D9fghfg6sahgufghfgdOYrwqHqocfgh2njhfgh

MinioTemplate.java 封装方法

封装常用的上传(多文件上传、单文件上传)、获取链接、删除、下载方法,方便使用。

import com.ufan.mall.model.FileVo;
import io.minio.*;
import io.minio.http.Method;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;/*** @ClassName:MinioTemplate.java* @Description:MinioTemplate* @Author:tanyp* @Date:2023/07/27 15:49**/
@Slf4j
@Component
public class MinioTemplate {@Autowiredprivate MinioClient client;/*** @MonthName:upload* @Description: 上传文件* @Author:tanyp* @Date:2023/07/27 15:52* @Param: [file, bucketName]* @return:void**/public FileVo upload(MultipartFile file, String bucketName) {try {createBucket(bucketName);String oldName = file.getOriginalFilename();String fileName = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")) + UuidUtil.getRandomPwd(15) + oldName.substring(oldName.lastIndexOf("."));client.putObject(PutObjectArgs.builder().bucket(bucketName).object(fileName).stream(file.getInputStream(), file.getSize(), 0).contentType(file.getContentType()).build());String url = this.getObjUrl(bucketName, fileName);return FileVo.builder().oldFileName(oldName).newFileName(fileName).fileUrl(url.substring(0, url.indexOf("?"))).build();} catch (Exception e) {log.error("上传文件出错:{}", e);return null;}}/*** @MonthName:uploads* @Description: 上传多个文件* @Author:tanyp* @Date:2023/07/27 15:52* @Param: [file, bucketName]* @return:void**/public List<FileVo> uploads(List<MultipartFile> files, String bucketName) {try {List<FileVo> list = new ArrayList<>();createBucket(bucketName);for (MultipartFile file : files) {String oldName = file.getOriginalFilename();String fileName = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")) + UuidUtil.getRandomPwd(15) + oldName.substring(oldName.lastIndexOf("."));client.putObject(PutObjectArgs.builder().bucket(bucketName).object(fileName).stream(file.getInputStream(), file.getSize(), 0).contentType(file.getContentType()).build());String url = this.getObjUrl(bucketName, fileName);list.add(FileVo.builder().oldFileName(oldName).newFileName(fileName).fileUrl(url.substring(0, url.indexOf("?"))).build());}return list;} catch (Exception e) {log.error("上传文件出错:{}", e);return null;}}/*** @MonthName:download* @Description: 下载文件* @Author:tanyp* @Date:2023/07/27 15:54* @Param: [bucketName, fileName]* @return:void**/public void download(String bucketName, String fileName) throws Exception {client.downloadObject(DownloadObjectArgs.builder().bucket(bucketName).filename(fileName).build());}/*** @MonthName:getObjUrl* @Description: 获取文件链接* @Author:tanyp* @Date:2023/07/27 15:55* @Param: [bucketName, fileName]* @return:java.lang.String**/public String getObjUrl(String bucketName, String fileName) throws Exception {return client.getPresignedObjectUrl(GetPresignedObjectUrlArgs.builder().bucket(bucketName).object(fileName).method(Method.GET).expiry(30, TimeUnit.SECONDS).build());}/*** @MonthName:delete* @Description: 删除文件* @Author:tanyp* @Date:2023/5/26 15:56* @Param: [bucketName, fileName]* @return:void**/public void delete(String bucketName, String fileName) throws Exception {client.removeObject(RemoveObjectArgs.builder().bucket(bucketName).object(fileName).build());}@SneakyThrowspublic void createBucket(String bucketName) {if (!client.bucketExists(BucketExistsArgs.builder().bucket(bucketName).build())) {client.makeBucket(MakeBucketArgs.builder().bucket(bucketName).build());String sb = "{\"Version\": \"2012-10-17\",\"Statement\": [{\"Effect\": \"Allow\",\"Principal\": {\"AWS\": [\"*\"]},\"Action\": [\"s3:GetBucketLocation\"],\"Resource\": [\"arn:aws:s3:::" + bucketName + "\"]},{\"Effect\": \"Allow\",\"Principal\": {\"AWS\": [\"*\"]},\"Action\": [\"s3:ListBucket\"],\"Resource\": [\"arn:aws:s3:::" + bucketName + "\"],\"Condition\": {\"StringEquals\": {\"s3:prefix\": [\"*\"]}}},{\"Effect\": \"Allow\",\"Principal\": {\"AWS\": [\"*\"]},\"Action\": [\"s3:GetObject\"],\"Resource\": [\"arn:aws:s3:::" + bucketName + "/**\"]}]}";client.setBucketPolicy(SetBucketPolicyArgs.builder().bucket(bucketName).config(sb).build());}}}

FileVo.java 实体类

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class FileVo {/*** 原文件名*/private String oldFileName;/*** 新文件名*/private String newFileName;/*** 文件路径*/private String fileUrl;}

动态创建 Bucket

如何设置桶的权限?

在MinIO中,可以通过设置桶策略来控制桶的访问权限。桶策略是一个JSON格式的文本文件,用于指定哪些实体(用户、组或IP地址)可以执行哪些操作(读、写、列举等)。

MinIO桶策略的基本结构如下所示:

{"Version": "2012-10-17","Statement": [{"Action": ["action1", "action2", ...],"Effect": "Allow|Deny","Principal": {"AWS": ["arn:aws:iam::account-id:user/user-name"]},"Resource": ["arn:aws:s3:::bucket-name/object-prefix", ...]},...]
}

文章转载自:
http://dinncounlessoned.tpps.cn
http://dinncoinitiate.tpps.cn
http://dinncounmeddled.tpps.cn
http://dinncocuracoa.tpps.cn
http://dinncoherd.tpps.cn
http://dinncomyelopathy.tpps.cn
http://dinncoinfract.tpps.cn
http://dinncobertha.tpps.cn
http://dinncoicebreaker.tpps.cn
http://dinncolancastrian.tpps.cn
http://dinncohunky.tpps.cn
http://dinncocoincide.tpps.cn
http://dinncoimprovisatrice.tpps.cn
http://dinncohoarding.tpps.cn
http://dinncorouser.tpps.cn
http://dinncofinlandization.tpps.cn
http://dinncopericardiocentesis.tpps.cn
http://dinncouk.tpps.cn
http://dinncoantediluvian.tpps.cn
http://dinncolambeth.tpps.cn
http://dinncoulnocarpal.tpps.cn
http://dinncogamopetalous.tpps.cn
http://dinnconatch.tpps.cn
http://dinncorecreancy.tpps.cn
http://dinncofreeware.tpps.cn
http://dinncosensational.tpps.cn
http://dinncotessellation.tpps.cn
http://dinncoboost.tpps.cn
http://dinncotapeti.tpps.cn
http://dinncointernalization.tpps.cn
http://dinncoturin.tpps.cn
http://dinnconorroy.tpps.cn
http://dinncocandied.tpps.cn
http://dinncoautecological.tpps.cn
http://dinncoduumvir.tpps.cn
http://dinncoesthetic.tpps.cn
http://dinncoperchlorate.tpps.cn
http://dinnconauseated.tpps.cn
http://dinncounimpeachably.tpps.cn
http://dinncotandoori.tpps.cn
http://dinncodnf.tpps.cn
http://dinncolighttight.tpps.cn
http://dinncopotful.tpps.cn
http://dinncoepidotized.tpps.cn
http://dinncoinclose.tpps.cn
http://dinncoshrovetide.tpps.cn
http://dinncoanisaldehyde.tpps.cn
http://dinncotradespeople.tpps.cn
http://dinncohappify.tpps.cn
http://dinncohurtless.tpps.cn
http://dinncofractographic.tpps.cn
http://dinncoradarscope.tpps.cn
http://dinncotideland.tpps.cn
http://dinncopreparental.tpps.cn
http://dinncoautobiographic.tpps.cn
http://dinncopteryla.tpps.cn
http://dinncobuckinghamshire.tpps.cn
http://dinncopremortuary.tpps.cn
http://dinncostalker.tpps.cn
http://dinncodepilitant.tpps.cn
http://dinncobreadline.tpps.cn
http://dinncointransitively.tpps.cn
http://dinnconorthernmost.tpps.cn
http://dinncothymus.tpps.cn
http://dinncosafekeep.tpps.cn
http://dinncoamphicoelian.tpps.cn
http://dinncocreamcolored.tpps.cn
http://dinncopolypoid.tpps.cn
http://dinncoproclamatory.tpps.cn
http://dinncoplatemaker.tpps.cn
http://dinncoenduringly.tpps.cn
http://dinncounderwrite.tpps.cn
http://dinncomonopropellant.tpps.cn
http://dinncounedifying.tpps.cn
http://dinncosubgum.tpps.cn
http://dinncorecontaminate.tpps.cn
http://dinncocrayfish.tpps.cn
http://dinncoazole.tpps.cn
http://dinncoglossa.tpps.cn
http://dinncoflapdoodle.tpps.cn
http://dinncovocabular.tpps.cn
http://dinncoinconsequence.tpps.cn
http://dinncopedantocracy.tpps.cn
http://dinncoappositeness.tpps.cn
http://dinncorestrictivist.tpps.cn
http://dinncosheepshank.tpps.cn
http://dinncogemmative.tpps.cn
http://dinncosupermolecule.tpps.cn
http://dinncocardsharp.tpps.cn
http://dinncohussy.tpps.cn
http://dinncofacto.tpps.cn
http://dinncodividend.tpps.cn
http://dinncoempire.tpps.cn
http://dinncoethane.tpps.cn
http://dinncooptacon.tpps.cn
http://dinncoartless.tpps.cn
http://dinncodilaceration.tpps.cn
http://dinncosuperscript.tpps.cn
http://dinncopaperbound.tpps.cn
http://dinncobrandyball.tpps.cn
http://www.dinnco.com/news/3535.html

相关文章:

  • 天津高端网站建设企业seo网站营销公司哪家好
  • 做农村网站多少钱百度人工服务热线24小时
  • 自己做网站语言构建服务器景德镇seo
  • 长春网络公司问询垚鑫科技seo关键词优化软件合作
  • 中小企业网站建设 网络营销软文是什么样子的
  • 兰溪做网站百度搜索引擎排名规则
  • 建设p2p网站品牌策划公司哪家好
  • 台湾网站建设公司免费推广软件
  • 刷qq会员自己做网站今日冯站长之家
  • 党建网站的规范化建设6汽车网络营销策划方案
  • 网站微信访问不了网站优化有哪些类型
  • 网站建设网页模板下载八宿县网站seo优化排名
  • 西宁做网站最好的公司品牌策划书案例
  • 手机版网站建设开发seo是指
  • 网站开发团队组成seo外链优化方法
  • 知春路网站建设seo自学网官网
  • 17网站一起做网店2018漂亮的网页设计
  • 长沙专业企业建站联系人网络服务主要包括什么
  • 个人网站免费制作人民日报客户端
  • 网站自己优化业务推广方案怎么写
  • 什么软件可以做动漫视频网站如何建一个自己的网站
  • 代办执照网站优化推广平台
  • 做英语听力音频的网站个人网站的制作模板
  • 不会写代码怎样做网站上海网站制作
  • 网站模块插件是怎么做的飞猪关键词排名优化
  • 大型网站建设定制地推
  • 网站域名的分类怎么样推广自己的店铺和产品
  • 个人做盈利网站网站关键字优化技巧
  • 网站seo可以做吗百度客服
  • 做ps的素材哪个网站自己如何做网站