@@ -10,8 +10,11 @@ import ( | |||
"applet/app/utils/cache" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement" | |||
enum2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/enum" | |||
"fmt" | |||
sts20150401 "github.com/alibabacloud-go/sts-20150401/v2/client" | |||
"github.com/aliyun/aliyun-oss-go-sdk/oss" | |||
"github.com/gin-gonic/gin" | |||
"strings" | |||
) | |||
func MenuList(c *gin.Context) { | |||
@@ -189,3 +192,111 @@ func CommOss(c *gin.Context, args ImgReqUploadReq) { | |||
e.OutSuc(c, signedURL, nil) | |||
} | |||
const STSVoucherRedisKey = "STS_Voucher_Cache_Key" | |||
type GetSTSVoucherResp struct { | |||
STSToken sts20150401.AssumeRoleResponseBodyCredentials `json:"sts_token"` // STS 凭证 | |||
Bucket string `json:"bucket"` // oss 桶名称 | |||
Region string `json:"region"` // 所在地域 | |||
} | |||
// GetSTSVoucher | |||
// @Summary 通用请求-对象存储-STS临时访问凭证(获取) | |||
// @Tags 对象存储 | |||
// @Description STS临时访问凭证(获取) | |||
// @Accept json | |||
// @Produce json | |||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||
// @Success 200 {object} comm.GetSTSVoucherResp "凭证及其他信息" | |||
// @Failure 400 {object} md.Response "具体错误" | |||
// @Router /api/comm/getSTSVoucher [GET] | |||
func GetSTSVoucher(c *gin.Context) { | |||
redisConn := cache.GetPool().Get() | |||
sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn) | |||
sysCfgs, err := sysCfgDb.SysCfgGetAll() | |||
if err != nil { | |||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | |||
return | |||
} | |||
if sysCfgs == nil { | |||
e.OutErr(c, e.ERR_CFG_CACHE, nil) | |||
return | |||
} | |||
cfgMap := make(map[string]string, len(*sysCfgs)) | |||
for _, cfg := range *sysCfgs { | |||
cfgMap[cfg.Key] = cfg.Val | |||
} | |||
redisKey := STSVoucherRedisKey | |||
redisValue, err := cache.GetString(redisKey) | |||
if err != nil { | |||
if err.Error() == "redigo: nil returned" { | |||
endpoint := cfgMap[enum2.AliyunOssEndpoint] | |||
//assumeRoleAccessKeyID := cfgMap[enum2.AliyunOssAssumeRoleAccessKeyID] | |||
//assumeRoleAccessKeySecret := cfgMap[enum2.AliyunOssAssumeRoleAccessKeySecret] | |||
//assumeRoleARN := cfgMap[enum2.AliyunOssAssumeRoleARN] | |||
assumeRoleAccessKeyID := "LTAI5t7NtS83omCUZwBLQNU5" | |||
assumeRoleAccessKeySecret := "cMQyPeZIZJPt7bIwvMXHfKxoeFx09u" | |||
assumeRoleARN := "acs:ram::1319334214744861:role/ramosstest" | |||
roleSessionName := "STSRam" | |||
endpointList := strings.Split(endpoint, "-") | |||
stsEndPoint := fmt.Sprintf("sts.%s-%s", endpointList[1], endpointList[2]) | |||
client, err := svc.CreateSTSClient(&assumeRoleAccessKeyID, &assumeRoleAccessKeySecret, &stsEndPoint) | |||
if err != nil { | |||
e.OutErr(c, e.ERR, err.Error()) | |||
return | |||
} | |||
roleArn := assumeRoleARN | |||
fmt.Println(roleArn) | |||
durationSeconds := 3600 | |||
assumeRoleResponse, err := svc.AssumeRole(client, &roleArn, &roleSessionName, int64(durationSeconds)) | |||
if err != nil { | |||
e.OutErr(c, e.ERR, err.Error()) | |||
return | |||
} | |||
CredentialsStr := utils.SerializeStr(assumeRoleResponse.Body.Credentials) | |||
// 提早 60s 释放,避免能拿到令牌但无法上传 | |||
cache.SetEx(redisKey, CredentialsStr, durationSeconds-60) | |||
credentials := sts20150401.AssumeRoleResponseBodyCredentials{ | |||
AccessKeyId: assumeRoleResponse.Body.Credentials.AccessKeyId, | |||
AccessKeySecret: assumeRoleResponse.Body.Credentials.AccessKeySecret, | |||
Expiration: assumeRoleResponse.Body.Credentials.Expiration, | |||
SecurityToken: assumeRoleResponse.Body.Credentials.SecurityToken, | |||
} | |||
bucket := cfgMap[enum2.AliyunOssBucketName] | |||
region := strings.Split(bucket, ".")[0] | |||
resp := GetSTSVoucherResp{ | |||
STSToken: credentials, | |||
Bucket: bucket, | |||
Region: region, | |||
} | |||
e.OutSuc(c, resp, nil) | |||
} else { | |||
e.OutErr(c, e.ERR, nil) | |||
return | |||
} | |||
} | |||
var credentials sts20150401.AssumeRoleResponseBodyCredentials | |||
utils.Unserialize([]byte(redisValue), &credentials) | |||
bucket := cfgMap[enum2.AliyunOssBucketName] | |||
region := strings.Split(bucket, ".")[0] | |||
resp := GetSTSVoucherResp{ | |||
STSToken: credentials, | |||
Bucket: bucket, | |||
Region: region, | |||
} | |||
e.OutSuc(c, resp, nil) | |||
return | |||
} |
@@ -66,15 +66,30 @@ func GetBasic(c *gin.Context) { | |||
if !ok { | |||
sysCfgDb.SysCfgInsert(enum2.AliyunOptions, "", enum2.AliyunOss(enum2.AliyunOptions).String()) | |||
} | |||
assumeRoleARN, ok := cfgMap[enum2.AliyunOssAssumeRoleARN] | |||
if !ok { | |||
sysCfgDb.SysCfgInsert(enum2.AliyunOssAssumeRoleARN, "", enum2.AliyunOss(enum2.AliyunOssAssumeRoleARN).String()) | |||
} | |||
assumeRoleAccessKeySecret, ok := cfgMap[enum2.AliyunOssAssumeRoleAccessKeySecret] | |||
if !ok { | |||
sysCfgDb.SysCfgInsert(enum2.AliyunOssAssumeRoleAccessKeySecret, "", enum2.AliyunOss(enum2.AliyunOssAssumeRoleAccessKeySecret).String()) | |||
} | |||
assumeRoleAccessKeyID, ok := cfgMap[enum2.AliyunOssAssumeRoleAccessKeyID] | |||
if !ok { | |||
sysCfgDb.SysCfgInsert(enum2.AliyunOssAssumeRoleAccessKeyID, "", enum2.AliyunOss(enum2.AliyunOssAssumeRoleAccessKeyID).String()) | |||
} | |||
resp := md.GetBasicResp{ | |||
OssEndpoint: endpoint, | |||
OssBucketName: bucketName, | |||
OssBucketScheme: bucketScheme, | |||
OssAccessKeyId: accessKeyID, | |||
OssAccessKeySecret: accessKeySecret, | |||
OssObjectDomain: domain, | |||
OssOption: options, | |||
OssEndpoint: endpoint, | |||
OssBucketName: bucketName, | |||
OssBucketScheme: bucketScheme, | |||
OssAccessKeyId: accessKeyID, | |||
OssAccessKeySecret: accessKeySecret, | |||
OssObjectDomain: domain, | |||
OssOption: options, | |||
OssAssumeRoleAccessKeyID: assumeRoleAccessKeyID, | |||
OssAssumeRoleAccessKeySecret: assumeRoleAccessKeySecret, | |||
OssAssumeRoleARN: assumeRoleARN, | |||
} | |||
e.OutSuc(c, resp, nil) | |||
@@ -122,5 +137,14 @@ func SetBasic(c *gin.Context) { | |||
if req.OssOption != "" { | |||
cfgDb.SysCfgUpdate(enum2.AliyunOptions, req.OssOption) | |||
} | |||
if req.OssAssumeRoleAccessKeyID != "" { | |||
cfgDb.SysCfgUpdate(enum2.AliyunOssAssumeRoleAccessKeyID, req.OssAssumeRoleAccessKeyID) | |||
} | |||
if req.OssAssumeRoleAccessKeySecret != "" { | |||
cfgDb.SysCfgUpdate(enum2.AliyunOssAssumeRoleAccessKeySecret, req.OssAssumeRoleAccessKeySecret) | |||
} | |||
if req.OssAssumeRoleARN != "" { | |||
cfgDb.SysCfgUpdate(enum2.AliyunOssAssumeRoleARN, req.OssAssumeRoleARN) | |||
} | |||
e.OutSuc(c, "success", nil) | |||
} |
@@ -1,21 +1,27 @@ | |||
package md | |||
type GetBasicResp struct { | |||
OssEndpoint string `json:"oss_endpoint" example:"oss地域节点"` | |||
OssBucketName string `json:"oss_bucket_name" example:"oss存储桶名称"` | |||
OssBucketScheme string `json:"oss_bucket_scheme" example:"oss上传方式"` | |||
OssAccessKeyId string `json:"oss_access_key_id" example:"oss访问秘钥id"` | |||
OssAccessKeySecret string `json:"oss_access_key_secret" example:"oss访问秘钥"` | |||
OssObjectDomain string `json:"oss_object_domain" example:"oss域名"` | |||
OssOption string `json:"oss_option" example:"oss上传文件类型选项,以逗号分割"` | |||
OssEndpoint string `json:"oss_endpoint" example:"oss地域节点"` | |||
OssBucketName string `json:"oss_bucket_name" example:"oss存储桶名称"` | |||
OssBucketScheme string `json:"oss_bucket_scheme" example:"oss上传方式"` | |||
OssAccessKeyId string `json:"oss_access_key_id" example:"oss访问秘钥id"` | |||
OssAccessKeySecret string `json:"oss_access_key_secret" example:"oss访问秘钥"` | |||
OssObjectDomain string `json:"oss_object_domain" example:"oss域名"` | |||
OssOption string `json:"oss_option" example:"oss上传文件类型选项,以逗号分割"` | |||
OssAssumeRoleAccessKeyID string `json:"oss_assume_role_access_key_id" example:"oss RAM角色访问秘钥id"` | |||
OssAssumeRoleAccessKeySecret string `json:"oss_assume_role_access_key_secret" example:"oss RAM角色访问秘钥"` | |||
OssAssumeRoleARN string `json:"oss_assume_arn" example:"oss RAM角色ARN"` | |||
} | |||
type SetBasicReq struct { | |||
OssEndpoint string `json:"oss_endpoint" example:"oss地域节点"` | |||
OssBucketName string `json:"oss_bucket_name" example:"oss存储桶名称"` | |||
OssBucketScheme string `json:"oss_bucket_scheme" example:"oss上传方式"` | |||
OssAccessKeyId string `json:"oss_access_key_id" example:"oss访问秘钥id"` | |||
OssAccessKeySecret string `json:"oss_access_key_secret" example:"oss访问秘钥"` | |||
OssObjectDomain string `json:"oss_object_domain" example:"oss域名"` | |||
OssOption string `json:"oss_option" example:"oss上传文件类型选项,以逗号分割"` | |||
OssEndpoint string `json:"oss_endpoint" example:"oss地域节点"` | |||
OssBucketName string `json:"oss_bucket_name" example:"oss存储桶名称"` | |||
OssBucketScheme string `json:"oss_bucket_scheme" example:"oss上传方式"` | |||
OssAccessKeyId string `json:"oss_access_key_id" example:"oss访问秘钥id"` | |||
OssAccessKeySecret string `json:"oss_access_key_secret" example:"oss访问秘钥"` | |||
OssObjectDomain string `json:"oss_object_domain" example:"oss域名"` | |||
OssOption string `json:"oss_option" example:"oss上传文件类型选项,以逗号分割"` | |||
OssAssumeRoleAccessKeyID string `json:"oss_assume_role_access_key_id" example:"oss RAM角色访问秘钥id"` | |||
OssAssumeRoleAccessKeySecret string `json:"oss_assume_role_access_key_secret" example:"oss RAM角色访问秘钥"` | |||
OssAssumeRoleARN string `json:"oss_assume_arn" example:"oss RAM角色ARN"` | |||
} |
@@ -337,4 +337,5 @@ func rFinancialCenter(r *gin.RouterGroup) { | |||
func rComm(r *gin.RouterGroup) { | |||
r.POST("/getMenuList", comm.MenuList) // 获取菜单栏列表 | |||
r.POST("/getOssUrl", comm.GetOssUrl) // 获取阿里云上传PutObject所需的签名URL | |||
r.GET("/getSTSVoucher", comm.GetSTSVoucher) | |||
} |
@@ -4,6 +4,11 @@ import ( | |||
"applet/app/db" | |||
"applet/app/utils/cache" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement" | |||
openapi "github.com/alibabacloud-go/darabonba-openapi/v2/client" | |||
ram20150501 "github.com/alibabacloud-go/ram-20150501/v2/client" | |||
sts20150401 "github.com/alibabacloud-go/sts-20150401/v2/client" | |||
util2 "github.com/alibabacloud-go/tea-utils/v2/service" | |||
"github.com/alibabacloud-go/tea/tea" | |||
"strings" | |||
) | |||
@@ -30,3 +35,34 @@ func GetSysCfgStr(key string) string { | |||
return sysCfgDb.SysCfgGetWithDb(key) | |||
} | |||
func CreateSTSClient(accessKeyId *string, accessKeySecret *string, stsEndpoint *string) (*sts20150401.Client, error) { | |||
config := &openapi.Config{ | |||
AccessKeyId: accessKeyId, | |||
AccessKeySecret: accessKeySecret, | |||
// Endpoint 请参考 https://api.aliyun.com/product/Sts | |||
Endpoint: stsEndpoint, | |||
} | |||
return sts20150401.NewClient(config) | |||
} | |||
func AssumeRole(client *sts20150401.Client, roleArn *string, roleSessionName *string, durationSeconds int64) (*sts20150401.AssumeRoleResponse, error) { | |||
assumeRoleRequest := &sts20150401.AssumeRoleRequest{ | |||
DurationSeconds: &durationSeconds, | |||
RoleArn: roleArn, | |||
RoleSessionName: roleSessionName, | |||
} | |||
return client.AssumeRoleWithOptions(assumeRoleRequest, &util2.RuntimeOptions{}) | |||
} | |||
func CreateGetRoleClient(accessKeyId, accessKeySecret *string) (_result *ram20150501.Client, _err error) { | |||
config := &openapi.Config{ | |||
AccessKeyId: accessKeyId, | |||
AccessKeySecret: accessKeySecret, | |||
} | |||
// Endpoint 请参考 https://api.aliyun.com/product/Ram | |||
config.Endpoint = tea.String("ram.aliyuncs.com") | |||
_result = &ram20150501.Client{} | |||
_result, _err = ram20150501.NewClient(config) | |||
return _result, _err | |||
} |
@@ -1,5 +1,4 @@ | |||
// Code generated by swaggo/swag. DO NOT EDIT. | |||
// Package docs Code generated by swaggo/swag. DO NOT EDIT | |||
package docs | |||
import "github.com/swaggo/swag" | |||
@@ -1343,6 +1342,44 @@ const docTemplate = `{ | |||
} | |||
} | |||
}, | |||
"/api/comm/getSTSVoucher": { | |||
"get": { | |||
"description": "STS临时访问凭证(获取)", | |||
"consumes": [ | |||
"application/json" | |||
], | |||
"produces": [ | |||
"application/json" | |||
], | |||
"tags": [ | |||
"对象存储" | |||
], | |||
"summary": "通用请求-对象存储-STS临时访问凭证(获取)", | |||
"parameters": [ | |||
{ | |||
"type": "string", | |||
"description": "验证参数Bearer和token空格拼接", | |||
"name": "Authorization", | |||
"in": "header", | |||
"required": true | |||
} | |||
], | |||
"responses": { | |||
"200": { | |||
"description": "凭证及其他信息", | |||
"schema": { | |||
"$ref": "#/definitions/comm.GetSTSVoucherResp" | |||
} | |||
}, | |||
"400": { | |||
"description": "具体错误", | |||
"schema": { | |||
"$ref": "#/definitions/md.Response" | |||
} | |||
} | |||
} | |||
} | |||
}, | |||
"/api/config": { | |||
"get": { | |||
"description": "基本配置", | |||
@@ -1400,9 +1437,7 @@ const docTemplate = `{ | |||
"name": "req", | |||
"in": "body", | |||
"required": true, | |||
"schema": { | |||
"type": "object" | |||
} | |||
"schema": {} | |||
} | |||
], | |||
"responses": { | |||
@@ -6811,6 +6846,18 @@ const docTemplate = `{ | |||
"type": "string", | |||
"example": "oss访问秘钥" | |||
}, | |||
"oss_assume_arn": { | |||
"type": "string", | |||
"example": "oss RAM角色ARN" | |||
}, | |||
"oss_assume_role_access_key_id": { | |||
"type": "string", | |||
"example": "oss RAM角色访问秘钥id" | |||
}, | |||
"oss_assume_role_access_key_secret": { | |||
"type": "string", | |||
"example": "oss RAM角色访问秘钥" | |||
}, | |||
"oss_bucket_name": { | |||
"type": "string", | |||
"example": "oss存储桶名称" | |||
@@ -6844,6 +6891,18 @@ const docTemplate = `{ | |||
"type": "string", | |||
"example": "oss访问秘钥" | |||
}, | |||
"oss_assume_arn": { | |||
"type": "string", | |||
"example": "oss RAM角色ARN" | |||
}, | |||
"oss_assume_role_access_key_id": { | |||
"type": "string", | |||
"example": "oss RAM角色访问秘钥id" | |||
}, | |||
"oss_assume_role_access_key_secret": { | |||
"type": "string", | |||
"example": "oss RAM角色访问秘钥" | |||
}, | |||
"oss_bucket_name": { | |||
"type": "string", | |||
"example": "oss存储桶名称" | |||
@@ -6866,6 +6925,48 @@ const docTemplate = `{ | |||
} | |||
} | |||
}, | |||
"client.AssumeRoleResponseBodyCredentials": { | |||
"type": "object", | |||
"properties": { | |||
"AccessKeyId": { | |||
"description": "The AccessKey ID.", | |||
"type": "string" | |||
}, | |||
"AccessKeySecret": { | |||
"description": "The AccessKey secret.", | |||
"type": "string" | |||
}, | |||
"Expiration": { | |||
"description": "The time when the STS token expires. The time is displayed in UTC.", | |||
"type": "string" | |||
}, | |||
"SecurityToken": { | |||
"description": "The STS token.\n\n\u003e Alibaba Cloud STS does not impose limits on the length of STS tokens. We strongly recommend that you do not specify a maximum length for STS tokens.", | |||
"type": "string" | |||
} | |||
} | |||
}, | |||
"comm.GetSTSVoucherResp": { | |||
"type": "object", | |||
"properties": { | |||
"bucket": { | |||
"description": "oss 桶名称", | |||
"type": "string" | |||
}, | |||
"region": { | |||
"description": "所在地域", | |||
"type": "string" | |||
}, | |||
"sts_token": { | |||
"description": "STS 凭证", | |||
"allOf": [ | |||
{ | |||
"$ref": "#/definitions/client.AssumeRoleResponseBodyCredentials" | |||
} | |||
] | |||
} | |||
} | |||
}, | |||
"comm.ImgReqUploadReq": { | |||
"type": "object", | |||
"required": [ | |||
@@ -9893,9 +9994,7 @@ const docTemplate = `{ | |||
"type": "object", | |||
"properties": { | |||
"data": { | |||
"description": "内容", | |||
"type": "object", | |||
"additionalProperties": true | |||
"description": "内容" | |||
}, | |||
"mod_name": { | |||
"description": "模块名称", | |||
@@ -12875,6 +12974,8 @@ var SwaggerInfo = &swag.Spec{ | |||
Description: "管理后台接口文档", | |||
InfoInstanceName: "swagger", | |||
SwaggerTemplate: docTemplate, | |||
LeftDelim: "{{", | |||
RightDelim: "}}", | |||
} | |||
func init() { | |||
@@ -1335,6 +1335,44 @@ | |||
} | |||
} | |||
}, | |||
"/api/comm/getSTSVoucher": { | |||
"get": { | |||
"description": "STS临时访问凭证(获取)", | |||
"consumes": [ | |||
"application/json" | |||
], | |||
"produces": [ | |||
"application/json" | |||
], | |||
"tags": [ | |||
"对象存储" | |||
], | |||
"summary": "通用请求-对象存储-STS临时访问凭证(获取)", | |||
"parameters": [ | |||
{ | |||
"type": "string", | |||
"description": "验证参数Bearer和token空格拼接", | |||
"name": "Authorization", | |||
"in": "header", | |||
"required": true | |||
} | |||
], | |||
"responses": { | |||
"200": { | |||
"description": "凭证及其他信息", | |||
"schema": { | |||
"$ref": "#/definitions/comm.GetSTSVoucherResp" | |||
} | |||
}, | |||
"400": { | |||
"description": "具体错误", | |||
"schema": { | |||
"$ref": "#/definitions/md.Response" | |||
} | |||
} | |||
} | |||
} | |||
}, | |||
"/api/config": { | |||
"get": { | |||
"description": "基本配置", | |||
@@ -1392,9 +1430,7 @@ | |||
"name": "req", | |||
"in": "body", | |||
"required": true, | |||
"schema": { | |||
"type": "object" | |||
} | |||
"schema": {} | |||
} | |||
], | |||
"responses": { | |||
@@ -6803,6 +6839,18 @@ | |||
"type": "string", | |||
"example": "oss访问秘钥" | |||
}, | |||
"oss_assume_arn": { | |||
"type": "string", | |||
"example": "oss RAM角色ARN" | |||
}, | |||
"oss_assume_role_access_key_id": { | |||
"type": "string", | |||
"example": "oss RAM角色访问秘钥id" | |||
}, | |||
"oss_assume_role_access_key_secret": { | |||
"type": "string", | |||
"example": "oss RAM角色访问秘钥" | |||
}, | |||
"oss_bucket_name": { | |||
"type": "string", | |||
"example": "oss存储桶名称" | |||
@@ -6836,6 +6884,18 @@ | |||
"type": "string", | |||
"example": "oss访问秘钥" | |||
}, | |||
"oss_assume_arn": { | |||
"type": "string", | |||
"example": "oss RAM角色ARN" | |||
}, | |||
"oss_assume_role_access_key_id": { | |||
"type": "string", | |||
"example": "oss RAM角色访问秘钥id" | |||
}, | |||
"oss_assume_role_access_key_secret": { | |||
"type": "string", | |||
"example": "oss RAM角色访问秘钥" | |||
}, | |||
"oss_bucket_name": { | |||
"type": "string", | |||
"example": "oss存储桶名称" | |||
@@ -6858,6 +6918,48 @@ | |||
} | |||
} | |||
}, | |||
"client.AssumeRoleResponseBodyCredentials": { | |||
"type": "object", | |||
"properties": { | |||
"AccessKeyId": { | |||
"description": "The AccessKey ID.", | |||
"type": "string" | |||
}, | |||
"AccessKeySecret": { | |||
"description": "The AccessKey secret.", | |||
"type": "string" | |||
}, | |||
"Expiration": { | |||
"description": "The time when the STS token expires. The time is displayed in UTC.", | |||
"type": "string" | |||
}, | |||
"SecurityToken": { | |||
"description": "The STS token.\n\n\u003e Alibaba Cloud STS does not impose limits on the length of STS tokens. We strongly recommend that you do not specify a maximum length for STS tokens.", | |||
"type": "string" | |||
} | |||
} | |||
}, | |||
"comm.GetSTSVoucherResp": { | |||
"type": "object", | |||
"properties": { | |||
"bucket": { | |||
"description": "oss 桶名称", | |||
"type": "string" | |||
}, | |||
"region": { | |||
"description": "所在地域", | |||
"type": "string" | |||
}, | |||
"sts_token": { | |||
"description": "STS 凭证", | |||
"allOf": [ | |||
{ | |||
"$ref": "#/definitions/client.AssumeRoleResponseBodyCredentials" | |||
} | |||
] | |||
} | |||
} | |||
}, | |||
"comm.ImgReqUploadReq": { | |||
"type": "object", | |||
"required": [ | |||
@@ -9885,9 +9987,7 @@ | |||
"type": "object", | |||
"properties": { | |||
"data": { | |||
"description": "内容", | |||
"type": "object", | |||
"additionalProperties": true | |||
"description": "内容" | |||
}, | |||
"mod_name": { | |||
"description": "模块名称", | |||
@@ -170,6 +170,15 @@ definitions: | |||
oss_access_key_secret: | |||
example: oss访问秘钥 | |||
type: string | |||
oss_assume_arn: | |||
example: oss RAM角色ARN | |||
type: string | |||
oss_assume_role_access_key_id: | |||
example: oss RAM角色访问秘钥id | |||
type: string | |||
oss_assume_role_access_key_secret: | |||
example: oss RAM角色访问秘钥 | |||
type: string | |||
oss_bucket_name: | |||
example: oss存储桶名称 | |||
type: string | |||
@@ -194,6 +203,15 @@ definitions: | |||
oss_access_key_secret: | |||
example: oss访问秘钥 | |||
type: string | |||
oss_assume_arn: | |||
example: oss RAM角色ARN | |||
type: string | |||
oss_assume_role_access_key_id: | |||
example: oss RAM角色访问秘钥id | |||
type: string | |||
oss_assume_role_access_key_secret: | |||
example: oss RAM角色访问秘钥 | |||
type: string | |||
oss_bucket_name: | |||
example: oss存储桶名称 | |||
type: string | |||
@@ -210,6 +228,38 @@ definitions: | |||
example: oss上传文件类型选项,以逗号分割 | |||
type: string | |||
type: object | |||
client.AssumeRoleResponseBodyCredentials: | |||
properties: | |||
AccessKeyId: | |||
description: The AccessKey ID. | |||
type: string | |||
AccessKeySecret: | |||
description: The AccessKey secret. | |||
type: string | |||
Expiration: | |||
description: The time when the STS token expires. The time is displayed in | |||
UTC. | |||
type: string | |||
SecurityToken: | |||
description: |- | |||
The STS token. | |||
> Alibaba Cloud STS does not impose limits on the length of STS tokens. We strongly recommend that you do not specify a maximum length for STS tokens. | |||
type: string | |||
type: object | |||
comm.GetSTSVoucherResp: | |||
properties: | |||
bucket: | |||
description: oss 桶名称 | |||
type: string | |||
region: | |||
description: 所在地域 | |||
type: string | |||
sts_token: | |||
allOf: | |||
- $ref: '#/definitions/client.AssumeRoleResponseBodyCredentials' | |||
description: STS 凭证 | |||
type: object | |||
comm.ImgReqUploadReq: | |||
properties: | |||
content_type: | |||
@@ -2298,9 +2348,7 @@ definitions: | |||
md.ModuleSettingGetResp: | |||
properties: | |||
data: | |||
additionalProperties: true | |||
description: 内容 | |||
type: object | |||
mod_name: | |||
description: 模块名称 | |||
type: string | |||
@@ -5242,6 +5290,31 @@ paths: | |||
summary: 通用请求-对象存储-上传许可链接(获取) | |||
tags: | |||
- 对象存储 | |||
/api/comm/getSTSVoucher: | |||
get: | |||
consumes: | |||
- application/json | |||
description: STS临时访问凭证(获取) | |||
parameters: | |||
- description: 验证参数Bearer和token空格拼接 | |||
in: header | |||
name: Authorization | |||
required: true | |||
type: string | |||
produces: | |||
- application/json | |||
responses: | |||
"200": | |||
description: 凭证及其他信息 | |||
schema: | |||
$ref: '#/definitions/comm.GetSTSVoucherResp' | |||
"400": | |||
description: 具体错误 | |||
schema: | |||
$ref: '#/definitions/md.Response' | |||
summary: 通用请求-对象存储-STS临时访问凭证(获取) | |||
tags: | |||
- 对象存储 | |||
/api/config: | |||
get: | |||
consumes: | |||
@@ -5277,8 +5350,7 @@ paths: | |||
in: body | |||
name: req | |||
required: true | |||
schema: | |||
type: object | |||
schema: {} | |||
produces: | |||
- application/json | |||
responses: | |||
@@ -4,7 +4,7 @@ go 1.19 | |||
// replace code.fnuoos.com/EggPlanet/egg_models.git => E:/company/Egg/egg_models | |||
// replace code.fnuoos.com/EggPlanet/egg_system_rules.git => E:/company/Egg/egg_system_rules | |||
replace code.fnuoos.com/EggPlanet/egg_system_rules.git => E:/company/Egg/egg_system_rules | |||
require ( | |||
github.com/boombuler/barcode v1.0.1 | |||
@@ -37,6 +37,11 @@ require ( | |||
code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20241118083738-0f22da9ba0be | |||
code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5 | |||
github.com/360EntSecGroup-Skylar/excelize v1.4.1 | |||
github.com/alibabacloud-go/darabonba-openapi/v2 v2.0.10 | |||
github.com/alibabacloud-go/ram-20150501/v2 v2.1.0 | |||
github.com/alibabacloud-go/sts-20150401/v2 v2.0.2 | |||
github.com/alibabacloud-go/tea v1.2.2 | |||
github.com/alibabacloud-go/tea-utils/v2 v2.0.6 | |||
github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible | |||
github.com/gin-contrib/sessions v1.0.1 | |||
github.com/go-pay/gopay v1.5.98 | |||
@@ -54,12 +59,20 @@ require ( | |||
github.com/BurntSushi/toml v1.4.0 // indirect | |||
github.com/KyleBanks/depth v1.2.1 // indirect | |||
github.com/PuerkitoBio/goquery v1.9.2 // indirect | |||
github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.5 // indirect | |||
github.com/alibabacloud-go/debug v1.0.1 // indirect | |||
github.com/alibabacloud-go/endpoint-util v1.1.0 // indirect | |||
github.com/alibabacloud-go/openapi-util v0.1.0 // indirect | |||
github.com/alibabacloud-go/tea-utils v1.4.3 // indirect | |||
github.com/alibabacloud-go/tea-xml v1.1.3 // indirect | |||
github.com/aliyun/credentials-go v1.3.10 // indirect | |||
github.com/andybalholm/cascadia v1.3.2 // indirect | |||
github.com/antchfx/htmlquery v1.3.3 // indirect | |||
github.com/antchfx/xmlquery v1.4.2 // indirect | |||
github.com/antchfx/xpath v1.3.2 // indirect | |||
github.com/bytedance/sonic v1.11.6 // indirect | |||
github.com/bytedance/sonic/loader v0.1.1 // indirect | |||
github.com/clbanning/mxj/v2 v2.5.5 // indirect | |||
github.com/cloudwego/base64x v0.1.4 // indirect | |||
github.com/cloudwego/iasm v0.2.0 // indirect | |||
github.com/gabriel-vasile/mimetype v1.4.3 // indirect | |||
@@ -97,6 +110,7 @@ require ( | |||
github.com/temoto/robotstxt v1.1.2 // indirect | |||
github.com/tidwall/match v1.1.1 // indirect | |||
github.com/tidwall/pretty v1.2.0 // indirect | |||
github.com/tjfoc/gmsm v1.4.1 // indirect | |||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect | |||
github.com/ugorji/go/codec v1.2.12 // indirect | |||
go.uber.org/atomic v1.7.0 // indirect | |||
@@ -113,6 +127,7 @@ require ( | |||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect | |||
google.golang.org/appengine v1.4.0 // indirect | |||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 // indirect | |||
gopkg.in/ini.v1 v1.67.0 // indirect | |||
gopkg.in/yaml.v3 v3.0.1 // indirect | |||
honnef.co/go/tools v0.0.1-2020.1.4 // indirect | |||
xorm.io/builder v0.3.13 // indirect | |||