新增了获取oss签名

This commit is contained in:
2024-08-20 15:27:06 +08:00
parent 702e482659
commit 6dd6172be9
4 changed files with 54 additions and 1 deletions
+16
View File
@@ -131,3 +131,19 @@ func (r *PublicService) GetUserIP(h *http.Request) string {
}
return h.RemoteAddr
}
// GetOssSign 获取oss签名
func (a *PublicService) GetOssSign(scene int) (*aliyun.GetOssSignResponse, error) {
var dir string
if scene == 1 {
dir = dir + "user/avatar/"
}
if dir == "" {
return nil, errors.New("获取签名失败")
}
// 生成签名
ossSign, _ := aliyun.GetOssSign(dir)
return ossSign, nil
}