@@ -21,10 +21,19 @@ import ( | |||
// @Accept json | |||
// @Produce json | |||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||
// @Param req body comm.ImgReqUploadReq true "签名上传url" | |||
// @Success 200 {string} "许可链接" | |||
// @Failure 400 {object} md.Response "具体错误" | |||
// @Router /api/settCenter/oss/aliYun/getBasic [get] | |||
// @Router /api/comm/getOssUrl [get] | |||
func GetOssUrl(c *gin.Context) { | |||
var args comm.ImgReqUploadReq | |||
err := c.ShouldBindJSON(&args) | |||
if err != nil { | |||
err = svc.HandleValidateErr(err) | |||
err1 := err.(e.E) | |||
e.OutErr(c, err1.Code, err1.Error()) | |||
return | |||
} | |||
redisConn := cache.GetPool().Get() | |||
sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn) | |||
sysCfgs, err := sysCfgDb.SysCfgGetAll() | |||
@@ -41,23 +50,27 @@ func GetOssUrl(c *gin.Context) { | |||
for _, cfg := range *sysCfgs { | |||
cfgMap[cfg.Key] = cfg.Val | |||
} | |||
endpoint := cfgMap[enum2.AliyunOss(enum2.AliyunOssEndpoint).String()] | |||
bucketName := cfgMap[enum2.AliyunOss(enum2.AliyunOssBucketName).String()] | |||
objectName := cfgMap[enum2.AliyunOss(enum2.AliyunOssBucketScheme).String()] | |||
accessKeyID := cfgMap[enum2.AliyunOss(enum2.AliyunOssAccessKeyID).String()] | |||
accessKeySecret := cfgMap[enum2.AliyunOss(enum2.AliyunOssAccessKeySecret).String()] | |||
endpoint := cfgMap[enum2.AliyunOssEndpoint] | |||
bucketName := cfgMap[enum2.AliyunOssBucketName] | |||
ossBucketScheme := cfgMap[enum2.AliyunOssBucketScheme] | |||
accessKeyID := cfgMap[enum2.AliyunOssAccessKeyID] | |||
accessKeySecret := cfgMap[enum2.AliyunOssAccessKeySecret] | |||
client, err := oss.New(endpoint, accessKeyID, accessKeySecret) | |||
// 创建OSSClient实例。 | |||
client, err := oss.New(ossBucketScheme+"://"+endpoint, accessKeyID, accessKeySecret) | |||
if err != nil { | |||
e.OutErr(c, e.ERR_AES_ENCODE, err.Error()) | |||
e.OutErr(c, e.ERR, err.Error()) | |||
return | |||
} | |||
// 获取存储空间。 | |||
bucket, err := client.Bucket(bucketName) | |||
if err != nil { | |||
e.OutErr(c, e.ERR_AES_ENCODE, err.Error()) | |||
e.OutErr(c, e.ERR, err.Error()) | |||
return | |||
} | |||
signedURL, err := bucket.SignURL(objectName, oss.HTTPPut, 60*5) | |||
signedURL, err := bucket.SignURL(args.FileName, oss.HTTPPut, 60*5) | |||
if err != nil { | |||
e.OutErr(c, e.ERR_AES_ENCODE, err.Error()) | |||
return | |||
@@ -3,3 +3,15 @@ package comm | |||
type AccessRecordsReq struct { | |||
Index string `json:"index,required"` // 页面标签 | |||
} | |||
type ImgReqUploadReq struct { | |||
FileName string `json:"file_name" binding:"required" example:"文件名"` | |||
} | |||
type UploadReq struct { | |||
FileName string `json:"file_name" binding:"required" example:"文件名"` | |||
File string `json:"file" binding:"required" example:"文件内容(base64)"` | |||
} | |||
type ImgReqUploadResp struct { | |||
SignUrl string `json:"sign_url" example:"签名上传url"` | |||
} |
@@ -24,7 +24,7 @@ const docTemplate = `{ | |||
"host": "{{.Host}}", | |||
"basePath": "{{.BasePath}}", | |||
"paths": { | |||
"/api/settCenter/oss/aliYun/getBasic": { | |||
"/api/comm/getOssUrl": { | |||
"get": { | |||
"description": "上传许可链接(获取)", | |||
"consumes": [ | |||
@@ -44,6 +44,15 @@ const docTemplate = `{ | |||
"name": "Authorization", | |||
"in": "header", | |||
"required": true | |||
}, | |||
{ | |||
"description": "签名上传url", | |||
"name": "req", | |||
"in": "body", | |||
"required": true, | |||
"schema": { | |||
"$ref": "#/definitions/comm.ImgReqUploadReq" | |||
} | |||
} | |||
], | |||
"responses": { | |||
@@ -2340,74 +2349,24 @@ const docTemplate = `{ | |||
} | |||
} | |||
}, | |||
"code_fnuoos_com_EggPlanet_egg_models_git_src_model.ImSendRedPackageOrd": { | |||
"comm.AccessRecordsReq": { | |||
"type": "object", | |||
"properties": { | |||
"amount": { | |||
"type": "string" | |||
}, | |||
"create_time": { | |||
"type": "string" | |||
}, | |||
"id": { | |||
"type": "integer" | |||
}, | |||
"im_data": { | |||
"type": "string" | |||
}, | |||
"im_uid": { | |||
"type": "integer" | |||
}, | |||
"ord_no": { | |||
"type": "string" | |||
}, | |||
"received_im_user_ids": { | |||
"type": "string" | |||
}, | |||
"received_times": { | |||
"type": "string" | |||
}, | |||
"received_user_amount": { | |||
"type": "string" | |||
}, | |||
"received_user_ids": { | |||
"type": "string" | |||
}, | |||
"red_packet_balance_amount": { | |||
"type": "string" | |||
}, | |||
"red_packet_balance_nums": { | |||
"type": "integer" | |||
}, | |||
"red_packet_nums": { | |||
"type": "integer" | |||
}, | |||
"red_packet_type": { | |||
"type": "integer" | |||
}, | |||
"state": { | |||
"type": "integer" | |||
}, | |||
"uid": { | |||
"type": "integer" | |||
}, | |||
"update_time": { | |||
"type": "string" | |||
}, | |||
"wait_draw_im_user_ids": { | |||
"type": "string" | |||
}, | |||
"wait_draw_user_ids": { | |||
"index": { | |||
"description": "页面标签", | |||
"type": "string" | |||
} | |||
} | |||
}, | |||
"comm.AccessRecordsReq": { | |||
"comm.ImgReqUploadReq": { | |||
"type": "object", | |||
"required": [ | |||
"file_name" | |||
], | |||
"properties": { | |||
"index": { | |||
"description": "页面标签", | |||
"type": "string" | |||
"file_name": { | |||
"type": "string", | |||
"example": "文件名" | |||
} | |||
} | |||
}, | |||
@@ -3535,7 +3494,7 @@ const docTemplate = `{ | |||
"description": "红包详情信息", | |||
"allOf": [ | |||
{ | |||
"$ref": "#/definitions/code_fnuoos_com_EggPlanet_egg_models_git_src_model.ImSendRedPackageOrd" | |||
"$ref": "#/definitions/model.ImSendRedPackageOrd" | |||
} | |||
] | |||
}, | |||
@@ -3942,6 +3901,9 @@ const docTemplate = `{ | |||
"phone": { | |||
"type": "string" | |||
}, | |||
"title": { | |||
"type": "string" | |||
}, | |||
"type": { | |||
"type": "string", | |||
"example": "问题类型的name" | |||
@@ -4075,6 +4037,68 @@ const docTemplate = `{ | |||
} | |||
} | |||
}, | |||
"model.ImSendRedPackageOrd": { | |||
"type": "object", | |||
"properties": { | |||
"amount": { | |||
"type": "string" | |||
}, | |||
"create_time": { | |||
"type": "string" | |||
}, | |||
"id": { | |||
"type": "integer" | |||
}, | |||
"im_data": { | |||
"type": "string" | |||
}, | |||
"im_uid": { | |||
"type": "integer" | |||
}, | |||
"ord_no": { | |||
"type": "string" | |||
}, | |||
"received_im_user_ids": { | |||
"type": "string" | |||
}, | |||
"received_times": { | |||
"type": "string" | |||
}, | |||
"received_user_amount": { | |||
"type": "string" | |||
}, | |||
"received_user_ids": { | |||
"type": "string" | |||
}, | |||
"red_packet_balance_amount": { | |||
"type": "string" | |||
}, | |||
"red_packet_balance_nums": { | |||
"type": "integer" | |||
}, | |||
"red_packet_nums": { | |||
"type": "integer" | |||
}, | |||
"red_packet_type": { | |||
"type": "integer" | |||
}, | |||
"state": { | |||
"type": "integer" | |||
}, | |||
"uid": { | |||
"type": "integer" | |||
}, | |||
"update_time": { | |||
"type": "string" | |||
}, | |||
"wait_draw_im_user_ids": { | |||
"type": "string" | |||
}, | |||
"wait_draw_user_ids": { | |||
"type": "string" | |||
} | |||
} | |||
}, | |||
"pb.SendRedPacketResp": { | |||
"type": "object", | |||
"properties": { | |||
@@ -18,7 +18,7 @@ | |||
"host": "ddxq.izhim.com", | |||
"basePath": "/api/v1", | |||
"paths": { | |||
"/api/settCenter/oss/aliYun/getBasic": { | |||
"/api/comm/getOssUrl": { | |||
"get": { | |||
"description": "上传许可链接(获取)", | |||
"consumes": [ | |||
@@ -38,6 +38,15 @@ | |||
"name": "Authorization", | |||
"in": "header", | |||
"required": true | |||
}, | |||
{ | |||
"description": "签名上传url", | |||
"name": "req", | |||
"in": "body", | |||
"required": true, | |||
"schema": { | |||
"$ref": "#/definitions/comm.ImgReqUploadReq" | |||
} | |||
} | |||
], | |||
"responses": { | |||
@@ -2334,74 +2343,24 @@ | |||
} | |||
} | |||
}, | |||
"code_fnuoos_com_EggPlanet_egg_models_git_src_model.ImSendRedPackageOrd": { | |||
"comm.AccessRecordsReq": { | |||
"type": "object", | |||
"properties": { | |||
"amount": { | |||
"type": "string" | |||
}, | |||
"create_time": { | |||
"type": "string" | |||
}, | |||
"id": { | |||
"type": "integer" | |||
}, | |||
"im_data": { | |||
"type": "string" | |||
}, | |||
"im_uid": { | |||
"type": "integer" | |||
}, | |||
"ord_no": { | |||
"type": "string" | |||
}, | |||
"received_im_user_ids": { | |||
"type": "string" | |||
}, | |||
"received_times": { | |||
"type": "string" | |||
}, | |||
"received_user_amount": { | |||
"type": "string" | |||
}, | |||
"received_user_ids": { | |||
"type": "string" | |||
}, | |||
"red_packet_balance_amount": { | |||
"type": "string" | |||
}, | |||
"red_packet_balance_nums": { | |||
"type": "integer" | |||
}, | |||
"red_packet_nums": { | |||
"type": "integer" | |||
}, | |||
"red_packet_type": { | |||
"type": "integer" | |||
}, | |||
"state": { | |||
"type": "integer" | |||
}, | |||
"uid": { | |||
"type": "integer" | |||
}, | |||
"update_time": { | |||
"type": "string" | |||
}, | |||
"wait_draw_im_user_ids": { | |||
"type": "string" | |||
}, | |||
"wait_draw_user_ids": { | |||
"index": { | |||
"description": "页面标签", | |||
"type": "string" | |||
} | |||
} | |||
}, | |||
"comm.AccessRecordsReq": { | |||
"comm.ImgReqUploadReq": { | |||
"type": "object", | |||
"required": [ | |||
"file_name" | |||
], | |||
"properties": { | |||
"index": { | |||
"description": "页面标签", | |||
"type": "string" | |||
"file_name": { | |||
"type": "string", | |||
"example": "文件名" | |||
} | |||
} | |||
}, | |||
@@ -3529,7 +3488,7 @@ | |||
"description": "红包详情信息", | |||
"allOf": [ | |||
{ | |||
"$ref": "#/definitions/code_fnuoos_com_EggPlanet_egg_models_git_src_model.ImSendRedPackageOrd" | |||
"$ref": "#/definitions/model.ImSendRedPackageOrd" | |||
} | |||
] | |||
}, | |||
@@ -3936,6 +3895,9 @@ | |||
"phone": { | |||
"type": "string" | |||
}, | |||
"title": { | |||
"type": "string" | |||
}, | |||
"type": { | |||
"type": "string", | |||
"example": "问题类型的name" | |||
@@ -4069,6 +4031,68 @@ | |||
} | |||
} | |||
}, | |||
"model.ImSendRedPackageOrd": { | |||
"type": "object", | |||
"properties": { | |||
"amount": { | |||
"type": "string" | |||
}, | |||
"create_time": { | |||
"type": "string" | |||
}, | |||
"id": { | |||
"type": "integer" | |||
}, | |||
"im_data": { | |||
"type": "string" | |||
}, | |||
"im_uid": { | |||
"type": "integer" | |||
}, | |||
"ord_no": { | |||
"type": "string" | |||
}, | |||
"received_im_user_ids": { | |||
"type": "string" | |||
}, | |||
"received_times": { | |||
"type": "string" | |||
}, | |||
"received_user_amount": { | |||
"type": "string" | |||
}, | |||
"received_user_ids": { | |||
"type": "string" | |||
}, | |||
"red_packet_balance_amount": { | |||
"type": "string" | |||
}, | |||
"red_packet_balance_nums": { | |||
"type": "integer" | |||
}, | |||
"red_packet_nums": { | |||
"type": "integer" | |||
}, | |||
"red_packet_type": { | |||
"type": "integer" | |||
}, | |||
"state": { | |||
"type": "integer" | |||
}, | |||
"uid": { | |||
"type": "integer" | |||
}, | |||
"update_time": { | |||
"type": "string" | |||
}, | |||
"wait_draw_im_user_ids": { | |||
"type": "string" | |||
}, | |||
"wait_draw_user_ids": { | |||
"type": "string" | |||
} | |||
} | |||
}, | |||
"pb.SendRedPacketResp": { | |||
"type": "object", | |||
"properties": { | |||
@@ -12,53 +12,20 @@ definitions: | |||
description: 总数据量 | |||
type: integer | |||
type: object | |||
code_fnuoos_com_EggPlanet_egg_models_git_src_model.ImSendRedPackageOrd: | |||
properties: | |||
amount: | |||
type: string | |||
create_time: | |||
type: string | |||
id: | |||
type: integer | |||
im_data: | |||
type: string | |||
im_uid: | |||
type: integer | |||
ord_no: | |||
type: string | |||
received_im_user_ids: | |||
type: string | |||
received_times: | |||
type: string | |||
received_user_amount: | |||
type: string | |||
received_user_ids: | |||
type: string | |||
red_packet_balance_amount: | |||
type: string | |||
red_packet_balance_nums: | |||
type: integer | |||
red_packet_nums: | |||
type: integer | |||
red_packet_type: | |||
type: integer | |||
state: | |||
type: integer | |||
uid: | |||
type: integer | |||
update_time: | |||
type: string | |||
wait_draw_im_user_ids: | |||
type: string | |||
wait_draw_user_ids: | |||
type: string | |||
type: object | |||
comm.AccessRecordsReq: | |||
properties: | |||
index: | |||
description: 页面标签 | |||
type: string | |||
type: object | |||
comm.ImgReqUploadReq: | |||
properties: | |||
file_name: | |||
example: 文件名 | |||
type: string | |||
required: | |||
- file_name | |||
type: object | |||
md.AdvertisingBasic: | |||
properties: | |||
android_ad_is_open: | |||
@@ -843,7 +810,7 @@ definitions: | |||
properties: | |||
detail: | |||
allOf: | |||
- $ref: '#/definitions/code_fnuoos_com_EggPlanet_egg_models_git_src_model.ImSendRedPackageOrd' | |||
- $ref: '#/definitions/model.ImSendRedPackageOrd' | |||
description: 红包详情信息 | |||
list: | |||
description: 领取红包用户列表 | |||
@@ -1122,6 +1089,8 @@ definitions: | |||
type: array | |||
phone: | |||
type: string | |||
title: | |||
type: string | |||
type: | |||
example: 问题类型的name | |||
type: string | |||
@@ -1216,6 +1185,47 @@ definitions: | |||
description: 余额 | |||
type: string | |||
type: object | |||
model.ImSendRedPackageOrd: | |||
properties: | |||
amount: | |||
type: string | |||
create_time: | |||
type: string | |||
id: | |||
type: integer | |||
im_data: | |||
type: string | |||
im_uid: | |||
type: integer | |||
ord_no: | |||
type: string | |||
received_im_user_ids: | |||
type: string | |||
received_times: | |||
type: string | |||
received_user_amount: | |||
type: string | |||
received_user_ids: | |||
type: string | |||
red_packet_balance_amount: | |||
type: string | |||
red_packet_balance_nums: | |||
type: integer | |||
red_packet_nums: | |||
type: integer | |||
red_packet_type: | |||
type: integer | |||
state: | |||
type: integer | |||
uid: | |||
type: integer | |||
update_time: | |||
type: string | |||
wait_draw_im_user_ids: | |||
type: string | |||
wait_draw_user_ids: | |||
type: string | |||
type: object | |||
pb.SendRedPacketResp: | |||
properties: | |||
seq: | |||
@@ -1236,7 +1246,7 @@ info: | |||
title: 蛋蛋星球-APP客户端 | |||
version: "1.0" | |||
paths: | |||
/api/settCenter/oss/aliYun/getBasic: | |||
/api/comm/getOssUrl: | |||
get: | |||
consumes: | |||
- application/json | |||
@@ -1247,6 +1257,12 @@ paths: | |||
name: Authorization | |||
required: true | |||
type: string | |||
- description: 签名上传url | |||
in: body | |||
name: req | |||
required: true | |||
schema: | |||
$ref: '#/definitions/comm.ImgReqUploadReq' | |||
produces: | |||
- application/json | |||
responses: | |||
@@ -32,7 +32,7 @@ require ( | |||
) | |||
require ( | |||
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241126104405-980be92ee61d | |||
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241126123220-2fadc60eff6f | |||
code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241126083327-1b1d0a2602a0 | |||
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 | |||