# Conflicts: # app/hdl/hdl_demo.gomaster
@@ -1,6 +1,7 @@ | |||||
package comm | package comm | ||||
import ( | import ( | ||||
"applet/app/cfg" | |||||
"applet/app/db" | "applet/app/db" | ||||
"applet/app/e" | "applet/app/e" | ||||
"applet/app/md" | "applet/app/md" | ||||
@@ -14,6 +15,7 @@ import ( | |||||
"fmt" | "fmt" | ||||
"github.com/aliyun/aliyun-oss-go-sdk/oss" | "github.com/aliyun/aliyun-oss-go-sdk/oss" | ||||
"github.com/gin-gonic/gin" | "github.com/gin-gonic/gin" | ||||
"os" | |||||
"time" | "time" | ||||
) | ) | ||||
@@ -57,6 +59,10 @@ func GetOssUrl(c *gin.Context) { | |||||
ossBucketScheme := cfgMap[enum2.AliyunOssBucketScheme] | ossBucketScheme := cfgMap[enum2.AliyunOssBucketScheme] | ||||
accessKeyID := cfgMap[enum2.AliyunOssAccessKeyID] | accessKeyID := cfgMap[enum2.AliyunOssAccessKeyID] | ||||
accessKeySecret := cfgMap[enum2.AliyunOssAccessKeySecret] | accessKeySecret := cfgMap[enum2.AliyunOssAccessKeySecret] | ||||
if cfg.Prd { | |||||
accessKeyID = os.Getenv(enum2.AliyunOssAccessKeyID) | |||||
accessKeySecret = os.Getenv(enum2.AliyunOssAccessKeySecret) | |||||
} | |||||
// 创建OSSClient实例。 | // 创建OSSClient实例。 | ||||
client, err := oss.New(ossBucketScheme+"://"+endpoint, accessKeyID, accessKeySecret) | client, err := oss.New(ossBucketScheme+"://"+endpoint, accessKeyID, accessKeySecret) | ||||
@@ -7,6 +7,7 @@ import ( | |||||
"applet/app/lib/aes/md" | "applet/app/lib/aes/md" | ||||
"applet/app/svc" | "applet/app/svc" | ||||
"applet/app/utils" | "applet/app/utils" | ||||
"code.fnuoos.com/EggPlanet/egg_system_rules.git/enum" | |||||
"encoding/json" | "encoding/json" | ||||
"fmt" | "fmt" | ||||
"github.com/gin-gonic/gin" | "github.com/gin-gonic/gin" | ||||
@@ -53,6 +54,8 @@ func Demo1(c *gin.Context) { | |||||
//es.CreateIndexIfNotExists(md2.EggUserShortLink, md2.EggUserShortLinkMap) | //es.CreateIndexIfNotExists(md2.EggUserShortLink, md2.EggUserShortLinkMap) | ||||
data := make(map[string]string) | data := make(map[string]string) | ||||
if cfg.Prd { | if cfg.Prd { | ||||
data["access_key_id"] = os.Getenv(enum.AliyunOssAccessKeyID) | |||||
data["access_key_secret"] = os.Getenv(enum.AliyunOssAccessKeySecret) | |||||
data["aliyun_sms_id"] = os.Getenv("aliyun_sms_id") | data["aliyun_sms_id"] = os.Getenv("aliyun_sms_id") | ||||
data["aliyun_sms_secret"] = os.Getenv("aliyun_sms_secret") | data["aliyun_sms_secret"] = os.Getenv("aliyun_sms_secret") | ||||
data["oss_access_key_id"] = os.Getenv("oss_access_key_id") | data["oss_access_key_id"] = os.Getenv("oss_access_key_id") | ||||