新增了获取oss签名
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user