Compare commits
No commits in common. "main" and "feat-sxy-import" have entirely different histories.
main
...
feat-sxy-i
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
|
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// - protoc-gen-go-triple v1.0.8
|
// - protoc-gen-go-triple v1.0.8
|
||||||
// - protoc v3.20.3
|
// - protoc v4.24.0--rc1
|
||||||
// source: pb/bundle.proto
|
// source: pb/bundle.proto
|
||||||
|
|
||||||
package bundle
|
package bundle
|
||||||
|
@ -14,12 +14,12 @@ BosBaseDir = "fonchain-main"
|
|||||||
BosHttp = "https://"
|
BosHttp = "https://"
|
||||||
BosDomain = "cdns.fontree.cn"
|
BosDomain = "cdns.fontree.cn"
|
||||||
[oss]
|
[oss]
|
||||||
AccessKeyId = "${OSS_AK}"
|
AccessKeyId = "LTAI5tCx628rkZ65oi5F5nxu"
|
||||||
AccessKeySecret = "${OSS_SK}"
|
AccessKeySecret = "WjSLa9tWs8RTdUmhKu3HLXIMogdUbo"
|
||||||
Endpoint = "${OSS_ENDPOINTT}"
|
Endpoint = "cdn-test.cdn.szjixun.cn"
|
||||||
BucketName = "${OSS_BUCKETNAME}"
|
BucketName = "fontree-test2"
|
||||||
BaseDir = "fontree-fiee-test"
|
BaseDir = "fonchain-main"
|
||||||
CdnHost = "${OSS_CDN}"
|
CdnHost = "https://cdn-test.szjixun.cn"
|
||||||
[redis]
|
[redis]
|
||||||
RedisDB = "2"
|
RedisDB = "2"
|
||||||
RedisAddr = "127.0.0.1:6379"
|
RedisAddr = "127.0.0.1:6379"
|
||||||
|
@ -15,12 +15,12 @@ BosBaseDir = "fiee"
|
|||||||
BosHttp = "https://"
|
BosHttp = "https://"
|
||||||
BosDomain = "cdns.fontree.cn"
|
BosDomain = "cdns.fontree.cn"
|
||||||
[oss]
|
[oss]
|
||||||
AccessKeyId = "OSS_AK"
|
AccessKeyId = "LTAI5tLz1fSK53FQAEC9uNSb"
|
||||||
AccessKeySecret = "OSS_SK"
|
AccessKeySecret = "oGB9chrQzQzITXR2IGv37Ji5WxZh4j"
|
||||||
Endpoint = "OSS_ENDPOINTT"
|
Endpoint = "oss-cn-hangzhou.aliyuncs.com"
|
||||||
BucketName = "OSS_BUCKETNAME"
|
BucketName = "fontree-test"
|
||||||
BaseDir = "fontree-fiee-test"
|
BaseDir = "fiee"
|
||||||
CdnHost = "OSS_CDN"
|
CdnHost = "https://cdn-test.szjixun.cn"
|
||||||
|
|
||||||
[redis]
|
[redis]
|
||||||
RedisDB = "2"
|
RedisDB = "2"
|
||||||
|
@ -4,7 +4,7 @@ dubbo:
|
|||||||
protocol: zookeeper
|
protocol: zookeeper
|
||||||
timeout: 3s
|
timeout: 3s
|
||||||
# address: 121.229.45.214:9004
|
# address: 121.229.45.214:9004
|
||||||
address: 127.0.0.1:2181
|
address: 172.16.100.93:2181
|
||||||
# address: 127.0.0.1:2181
|
# address: 127.0.0.1:2181
|
||||||
# address: 114.218.158.24:2181
|
# address: 114.218.158.24:2181
|
||||||
consumer:
|
consumer:
|
||||||
|
@ -26,12 +26,12 @@ TelNum = "18021272627"
|
|||||||
Password = "Gy.123456"
|
Password = "Gy.123456"
|
||||||
|
|
||||||
[oss]
|
[oss]
|
||||||
AccessKeyId = "OSS_AK"
|
AccessKeyId = "LTAI5tHfjSmWXHqfWgaL7Uo5"
|
||||||
AccessKeySecret = "OSS_SK"
|
AccessKeySecret = "kOPctFZ3DHsbdSSym1fLyDK39hkzPI"
|
||||||
Endpoint = "OSS_ENDPOINTT"
|
Endpoint = "oss-cn-hangzhou.aliyuncs.com"
|
||||||
BucketName = "OSS_BUCKETNAME"
|
BucketName = "erp-k8s-store"
|
||||||
BaseDir = "fontree-fiee"
|
BaseDir = "fiee"
|
||||||
CdnHost = "OSS_CDN"
|
CdnHost = "https://e-cdn.fontree.cn"
|
||||||
|
|
||||||
[stripe]
|
[stripe]
|
||||||
Webhookkey = "whsec_Mol32WD1KcKHUdYsSwap0LR03q2g9qNY"
|
Webhookkey = "whsec_Mol32WD1KcKHUdYsSwap0LR03q2g9qNY"
|
||||||
|
@ -15,12 +15,20 @@ BosBaseDir = "fiee"
|
|||||||
BosHttp = "https://"
|
BosHttp = "https://"
|
||||||
BosDomain = "cdns.fontree.cn"
|
BosDomain = "cdns.fontree.cn"
|
||||||
[oss]
|
[oss]
|
||||||
AccessKeyId = "OSS_AK"
|
AccessKeyId = "LTAI5tLz1fSK53FQAEC9uNSb"
|
||||||
AccessKeySecret = "OSS_SK"
|
AccessKeySecret = "oGB9chrQzQzITXR2IGv37Ji5WxZh4j"
|
||||||
Endpoint = "OSS_ENDPOINTT"
|
Endpoint = "oss-cn-hangzhou.aliyuncs.com"
|
||||||
BucketName = "OSS_BUCKETNAME"
|
BucketName = "fontree-test"
|
||||||
BaseDir = "fontree-fiee-test"
|
BaseDir = "fiee"
|
||||||
CdnHost = "OSS_CDN"
|
CdnHost = "https://cdn-test.szjixun.cn"
|
||||||
|
|
||||||
|
[oss]
|
||||||
|
AccessKeyId="LTAI5tLz1fSK53FQAEC9uNSb"
|
||||||
|
AccessKeysecret ="oGB9chrQzQzITXR2IGv37Ji5WxZh4j"
|
||||||
|
Endpoint = "oss-cn-hangzhou.aliyuncs.com"
|
||||||
|
BucketName = "fontree-test"
|
||||||
|
BaseDir = "fiee"
|
||||||
|
CdnHost = "https://cdn-test.szjixun.cn"
|
||||||
|
|
||||||
[redis]
|
[redis]
|
||||||
RedisDB = "2"
|
RedisDB = "2"
|
||||||
|
@ -4,12 +4,9 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"fonchain-fiee/pkg/common"
|
"fonchain-fiee/pkg/common"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
"go.uber.org/zap"
|
|
||||||
"gopkg.in/ini.v1"
|
"gopkg.in/ini.v1"
|
||||||
"os"
|
"os"
|
||||||
"reflect"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -252,63 +249,5 @@ func Viper(iniConf string) (err error) {
|
|||||||
panic("viper.Unmarshal failed" + err.Error())
|
panic("viper.Unmarshal failed" + err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
traverseFields(reflect.ValueOf(*ConfigData), "", ConfigData)
|
|
||||||
zap.L().Info("ConfigData", zap.Any("ConfigData", ConfigData))
|
|
||||||
fmt.Printf("ConfigData--%+v", ConfigData)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
func traverseFields(value reflect.Value, prefix string, configPtr interface{}) {
|
|
||||||
valueType := value.Type()
|
|
||||||
prefixEnv := "${"
|
|
||||||
suffixEnv := "}"
|
|
||||||
// 遍历结构体的字段
|
|
||||||
for i := 0; i < valueType.NumField(); i++ {
|
|
||||||
field := valueType.Field(i)
|
|
||||||
fieldValue := value.Field(i)
|
|
||||||
// 拼接字段名(带有前缀)
|
|
||||||
fieldName := prefix + field.Name
|
|
||||||
// 判断字段的类型
|
|
||||||
if fieldValue.Kind() == reflect.Struct {
|
|
||||||
// 递归遍历嵌套结构体字段
|
|
||||||
traverseFields(fieldValue, fieldName+".", configPtr)
|
|
||||||
} else {
|
|
||||||
// 获取字段的值
|
|
||||||
fieldValueStr := fmt.Sprintf("%v", fieldValue.Interface())
|
|
||||||
// 判断是不是需要通过环境变量获取
|
|
||||||
if len(fieldValueStr) > 3 && strings.HasPrefix(fieldValueStr, prefixEnv) && strings.HasSuffix(fieldValueStr, suffixEnv) {
|
|
||||||
end := len(fieldValueStr) - len(suffixEnv)
|
|
||||||
var hasDefault bool
|
|
||||||
if strings.Index(fieldValueStr, "|") > 0 {
|
|
||||||
hasDefault = true
|
|
||||||
end = strings.Index(fieldValueStr, "|")
|
|
||||||
}
|
|
||||||
envStr := fieldValueStr[len(prefixEnv):end]
|
|
||||||
getValue := os.Getenv(envStr)
|
|
||||||
if getValue == "" && hasDefault {
|
|
||||||
getValue = fieldValueStr[end+1 : len(fieldValueStr)-len(suffixEnv)]
|
|
||||||
}
|
|
||||||
setSubFieldValue(configPtr, fieldName, getValue)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func setSubFieldValue(configPtr interface{}, fieldPath string, newValue interface{}) {
|
|
||||||
value := reflect.ValueOf(configPtr).Elem()
|
|
||||||
fields := strings.Split(fieldPath, ".")
|
|
||||||
for _, field := range fields {
|
|
||||||
value = value.FieldByName(field)
|
|
||||||
if !value.IsValid() {
|
|
||||||
return // 字段不存在,直接返回
|
|
||||||
}
|
|
||||||
if value.Kind() == reflect.Ptr {
|
|
||||||
value = value.Elem() // 解引用指针类型的字段
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 检查字段是否可设置
|
|
||||||
if value.CanSet() {
|
|
||||||
// 根据字段类型,将新值转换为对应类型并设置字段的值
|
|
||||||
newValue := reflect.ValueOf(newValue).Convert(value.Type())
|
|
||||||
value.Set(newValue)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -129,7 +129,7 @@ func MakeThumbnail(imagePath, savePath string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (u *Upload) PutBos(filePath string, mediaType string, needRemove bool) (url string, err error) {
|
func (u *Upload) PutBos(filePath string, mediaType string, needRemove bool) (url string, err error) {
|
||||||
BOSClient, err := objstorage.NewOSS(os.Getenv(config.ConfigData.Oss.AccessKeyId), os.Getenv(config.ConfigData.Oss.AccessKeySecret), os.Getenv(config.ConfigData.Oss.Endpoint))
|
BOSClient, err := objstorage.NewOSS(config.ConfigData.Oss.AccessKeyId, config.ConfigData.Oss.AccessKeySecret, config.ConfigData.Oss.Endpoint)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Errorf("PutBos NewOOS err ", err)
|
logger.Errorf("PutBos NewOOS err ", err)
|
||||||
err = errors.New(e.GetMsg(e.ErrorUploadBos))
|
err = errors.New(e.GetMsg(e.ErrorUploadBos))
|
||||||
@ -148,14 +148,14 @@ func (u *Upload) PutBos(filePath string, mediaType string, needRemove bool) (url
|
|||||||
}
|
}
|
||||||
filePath = strings.Replace(filePath, "./runtime", "", 1)
|
filePath = strings.Replace(filePath, "./runtime", "", 1)
|
||||||
var objectName string = fmt.Sprintf("%s/%s%s", config.ConfigData.Oss.BaseDir, config.Env, filePath)
|
var objectName string = fmt.Sprintf("%s/%s%s", config.ConfigData.Oss.BaseDir, config.Env, filePath)
|
||||||
_, err = BOSClient.PutObjectFromBytes(os.Getenv(config.ConfigData.Oss.BucketName), objectName, fileBytes)
|
_, err = BOSClient.PutObjectFromBytes(config.ConfigData.Oss.BucketName, objectName, fileBytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Errorf("PutBos PutObject err %+v", err.Error())
|
logger.Errorf("PutBos PutObject err %+v", err.Error())
|
||||||
err = errors.New(e.GetMsg(e.ErrorUploadBos))
|
err = errors.New(e.GetMsg(e.ErrorUploadBos))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//url = fmt.Sprintf("%s%s%s/%s", config.BosHttp, config.BosBucketName, config.BosUrl, objectName)
|
//url = fmt.Sprintf("%s%s%s/%s", config.BosHttp, config.BosBucketName, config.BosUrl, objectName)
|
||||||
url = fmt.Sprintf("%s/%s", os.Getenv(config.ConfigData.Oss.CdnHost), objectName)
|
url = fmt.Sprintf("%s/%s", config.ConfigData.Oss.CdnHost, objectName)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,10 +89,9 @@ func CheckWebLogin(provider *account.AccountClientImpl) gin.HandlerFunc {
|
|||||||
service.NotLoginRes(ctx, logic.ConvertLoginMsg(ctx, e.ErrNotLogin))
|
service.NotLoginRes(ctx, logic.ConvertLoginMsg(ctx, e.ErrNotLogin))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
fmt.Println("authorization", authorization)
|
|
||||||
jwt, err := secret.GetJwtFromStr(authorization)
|
jwt, err := secret.GetJwtFromStr(authorization)
|
||||||
fmt.Println("jwt", jwt)
|
|
||||||
fmt.Println("jwt_err", err)
|
|
||||||
logger.Info("---------end帐号转jwt:时间:", time.Now().Sub(startTime))
|
logger.Info("---------end帐号转jwt:时间:", time.Now().Sub(startTime))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
service.NotLoginRes(ctx, err.Error())
|
service.NotLoginRes(ctx, err.Error())
|
||||||
@ -108,24 +107,20 @@ func CheckWebLogin(provider *account.AccountClientImpl) gin.HandlerFunc {
|
|||||||
info, err := service.AccountProvider.DecryptJwt(ctx, &req)
|
info, err := service.AccountProvider.DecryptJwt(ctx, &req)
|
||||||
logger.Info("---------end帐号微服务解密:时间:", time.Now().Sub(startTime))
|
logger.Info("---------end帐号微服务解密:时间:", time.Now().Sub(startTime))
|
||||||
|
|
||||||
fmt.Println("DecryptJwt", info)
|
|
||||||
fmt.Println("DecryptJwtErr:----->", err)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
service.NotLoginRes(ctx, err.Error())
|
service.NotLoginRes(ctx, err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//if info.OfflineCode == e.OfflineSqueeze {
|
//if info.OfflineCode == e.OfflineSqueeze {
|
||||||
// service.Error(ctx, e.NotLoginSqueeze, errors.New(e.ErrOfflineSqueeze))
|
// service.Error(ctx, e.NotLoginSqueeze, errors.New(e.ErrOfflineSqueeze))
|
||||||
// return
|
// return
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if info.IsOffline == true {
|
if info.IsOffline == true {
|
||||||
//如果是来自体制外的请求,过滤挤掉校验
|
|
||||||
if !(ctx != nil && (ctx.GetHeader("origin") == "https://erp-out.szjixun.cn")) {
|
|
||||||
service.ErrorWeb(ctx, e.NotLogin, errors.New(logic.ConvertOfflineMsg(ctx, e.ErrOffline)))
|
service.ErrorWeb(ctx, e.NotLogin, errors.New(logic.ConvertOfflineMsg(ctx, e.ErrOffline)))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//1 获取用户的账号信息
|
//1 获取用户的账号信息
|
||||||
infoReq := &account.InfoRequest{
|
infoReq := &account.InfoRequest{
|
||||||
@ -135,8 +130,7 @@ func CheckWebLogin(provider *account.AccountClientImpl) gin.HandlerFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
infoRes, err := service.AccountProvider.Info(ctx, infoReq)
|
infoRes, err := service.AccountProvider.Info(ctx, infoReq)
|
||||||
fmt.Println("infoRes", infoRes)
|
|
||||||
fmt.Println("infoResErr", err)
|
|
||||||
logger.Info("---------end帐号info时间:", time.Now().Sub(startTime))
|
logger.Info("---------end帐号info时间:", time.Now().Sub(startTime))
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -135,8 +135,6 @@ func NewRouter() *gin.Engine {
|
|||||||
v1.POST("aschat/autoReplyRuler/update", asChat.Handler.UpdateChatAutoReplyRuler)
|
v1.POST("aschat/autoReplyRuler/update", asChat.Handler.UpdateChatAutoReplyRuler)
|
||||||
v1.POST("aschat/autoReplyRuler/detail", asChat.Handler.GetChatAutoReplyRulerDetail)
|
v1.POST("aschat/autoReplyRuler/detail", asChat.Handler.GetChatAutoReplyRulerDetail)
|
||||||
v1.POST("aschat/autoReplyRuler/query", asChat.Handler.GetChatAutoReplyRulerList)
|
v1.POST("aschat/autoReplyRuler/query", asChat.Handler.GetChatAutoReplyRulerList)
|
||||||
v1.POST("aschat/autoReplyRuler/userSwitch/get", asChat.ChatHandlerIns.UserSwitchAutoReplyStatus) //获取自动回复开关状态
|
|
||||||
v1.POST("aschat/autoReplyRuler/userSwitch/set", asChat.ChatHandlerIns.SetSwitchAutoReplyStatus) //设置自动回复开关状态
|
|
||||||
|
|
||||||
v1.POST("/test/user/log/erp", asChat.Handler.ErpLoginDemo)
|
v1.POST("/test/user/log/erp", asChat.Handler.ErpLoginDemo)
|
||||||
v1.POST("/test/user/log/fiee", asChat.Handler.FieeLoginDemo)
|
v1.POST("/test/user/log/fiee", asChat.Handler.FieeLoginDemo)
|
||||||
|
@ -17,7 +17,6 @@ import (
|
|||||||
"github.com/goccy/go-json"
|
"github.com/goccy/go-json"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
"log"
|
"log"
|
||||||
"strconv"
|
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
@ -26,7 +25,6 @@ import (
|
|||||||
const CacheChatRecordKey = "fiee:chatRecord"
|
const CacheChatRecordKey = "fiee:chatRecord"
|
||||||
const CacheSessionKey = "fiee:chatSession"
|
const CacheSessionKey = "fiee:chatSession"
|
||||||
const CacheNewMsgStatKey = "fiee:newMsgStat"
|
const CacheNewMsgStatKey = "fiee:newMsgStat"
|
||||||
const CacheAutoReplySwitchKey = "fiee:AutoReplySwitch"
|
|
||||||
|
|
||||||
var chatCacheLocker sync.RWMutex
|
var chatCacheLocker sync.RWMutex
|
||||||
|
|
||||||
@ -250,37 +248,3 @@ func (cr ChatCache) coverOwnerNewMessageStat(ctx context.Context, ownerId int64,
|
|||||||
err = cache.RedisClient.Set(cr.GetNewMsgStatCacheKey(ownerId), value, 0).Err()
|
err = cache.RedisClient.Set(cr.GetNewMsgStatCacheKey(ownerId), value, 0).Err()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------用户自动回复开关
|
|
||||||
// erp获取最新的消息统计
|
|
||||||
func (cr ChatCache) GetCacheAutoReplySwitchKey(userId int64) string {
|
|
||||||
return fmt.Sprintf("%s:%d", CacheAutoReplySwitchKey, userId)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (cr ChatCache) SetAutoReplySwitch(ctx context.Context, ownerId int64, enableAutoReply bool) {
|
|
||||||
//chatCacheLocker.RLock()
|
|
||||||
//defer chatCacheLocker.RUnlock()
|
|
||||||
err := cache.RedisClient.Set(cr.GetCacheAutoReplySwitchKey(ownerId), enableAutoReply, 0).Err()
|
|
||||||
if err != nil {
|
|
||||||
log.Print("保存用户会话失败", zap.Error(err))
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (cr ChatCache) GetAutoReplySwitch(ctx context.Context, ownerId int64) (enableAutoReply bool) {
|
|
||||||
//chatCacheLocker.RLock()
|
|
||||||
//defer chatCacheLocker.RUnlock()
|
|
||||||
val, err := cache.RedisClient.Get(cr.GetCacheAutoReplySwitchKey(ownerId)).Bytes()
|
|
||||||
if err != nil {
|
|
||||||
log.Print("获取自动回复开关查询失败", zap.Error(err), zap.Int64("ownerId", ownerId))
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
// 解析缓存值为布尔值
|
|
||||||
boolVal, err := strconv.ParseBool(string(val))
|
|
||||||
if err != nil {
|
|
||||||
log.Print("解析自动回复开关值失败", zap.Error(err), zap.String("value", string(val)), zap.Int64("ownerId", ownerId))
|
|
||||||
return true // 解析失败时也返回默认值true
|
|
||||||
}
|
|
||||||
|
|
||||||
return boolVal
|
|
||||||
}
|
|
||||||
|
@ -35,7 +35,6 @@ type NewMessageRequest struct {
|
|||||||
SessionId string `json:"sessionId"`
|
SessionId string `json:"sessionId"`
|
||||||
Message
|
Message
|
||||||
AtUserId int64 `json:"atUserId"` //指定发送给sessionId中的某一个用户
|
AtUserId int64 `json:"atUserId"` //指定发送给sessionId中的某一个用户
|
||||||
//EnableAutoReply bool `json:"-"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 服务端接收到消息后,使用websocket发送给userId关联的客户端,通知客户端有新消息,然后调用接口获取消息
|
// 服务端接收到消息后,使用websocket发送给userId关联的客户端,通知客户端有新消息,然后调用接口获取消息
|
||||||
@ -219,7 +218,3 @@ type UserDetailResp struct {
|
|||||||
Phone string `json:"phone"`
|
Phone string `json:"phone"`
|
||||||
GroupPhoto string `json:"groupPhoto"`
|
GroupPhoto string `json:"groupPhoto"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserSwitchAutoReplyReq struct {
|
|
||||||
EnableAutoReply bool `json:"enableAutoReply"`
|
|
||||||
}
|
|
||||||
|
@ -612,54 +612,3 @@ func (cr ChatHandler) UserDetail(c *gin.Context) {
|
|||||||
|
|
||||||
service.Success(c, detail)
|
service.Success(c, detail)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *ChatHandler) UserSwitchAutoReplyStatus(c *gin.Context) {
|
|
||||||
chatUser, code := jwt.ParseToChatUser(c)
|
|
||||||
if code != 0 {
|
|
||||||
service.ErrWithCode(c, code)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
var req dto.UserSwitchAutoReplyReq
|
|
||||||
if err := c.ShouldBindJSON(&req); err != nil {
|
|
||||||
service.Error(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
enable := a.cache.GetAutoReplySwitch(c, chatUser.ID)
|
|
||||||
var resp = map[string]any{
|
|
||||||
"enableAutoReply": enable,
|
|
||||||
}
|
|
||||||
service.Success(c, resp)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (a *ChatHandler) SetSwitchAutoReplyStatus(c *gin.Context) {
|
|
||||||
chatUser, code := jwt.ParseToChatUser(c)
|
|
||||||
if code != 0 {
|
|
||||||
service.ErrWithCode(c, code)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
var req dto.UserSwitchAutoReplyReq
|
|
||||||
if err := c.ShouldBindJSON(&req); err != nil {
|
|
||||||
service.Error(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
a.cache.SetAutoReplySwitch(c, chatUser.ID, req.EnableAutoReply)
|
|
||||||
msg := dto.Message{
|
|
||||||
MsgType: 1,
|
|
||||||
LocalStamp: time.Now().Unix(),
|
|
||||||
}
|
|
||||||
if req.EnableAutoReply {
|
|
||||||
msg.Text = "已退出人工"
|
|
||||||
} else {
|
|
||||||
msg.Text = "已进入人工,不会接收自动消息"
|
|
||||||
}
|
|
||||||
err := logic.NewMessage(c, &a.cache, chatUser, dto.NewMessageRequest{
|
|
||||||
Robot: true,
|
|
||||||
SessionId: fmt.Sprintf("%d", chatUser.ID),
|
|
||||||
Message: msg,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
service.Error(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
service.Success(c)
|
|
||||||
}
|
|
||||||
|
@ -165,11 +165,6 @@ func (r *Robot) Run() {
|
|||||||
fmt.Printf("robot listen event:%#v\n", event)
|
fmt.Printf("robot listen event:%#v\n", event)
|
||||||
r.mu.Lock()
|
r.mu.Lock()
|
||||||
//加入聊天室规则
|
//加入聊天室规则
|
||||||
enableAutoReply := false
|
|
||||||
if event.Client != nil {
|
|
||||||
enableAutoReply = new(chatCache.ChatCache).GetAutoReplySwitch(context.Background(), event.Client.UserId)
|
|
||||||
}
|
|
||||||
if enableAutoReply {
|
|
||||||
hasHit := false
|
hasHit := false
|
||||||
for _, rule := range r.joinSessionRules {
|
for _, rule := range r.joinSessionRules {
|
||||||
hit := rule.Hit(event, r.Info)
|
hit := rule.Hit(event, r.Info)
|
||||||
@ -222,7 +217,6 @@ func (r *Robot) Run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
r.mu.Unlock()
|
r.mu.Unlock()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,13 +13,12 @@ import (
|
|||||||
"fonchain-fiee/pkg/service/bundle/logic"
|
"fonchain-fiee/pkg/service/bundle/logic"
|
||||||
bundleModel "fonchain-fiee/pkg/service/bundle/model"
|
bundleModel "fonchain-fiee/pkg/service/bundle/model"
|
||||||
"fonchain-fiee/pkg/service/upload"
|
"fonchain-fiee/pkg/service/upload"
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/360EntSecGroup-Skylar/excelize"
|
"github.com/360EntSecGroup-Skylar/excelize"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/gin-gonic/gin/binding"
|
"github.com/gin-gonic/gin/binding"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func DeleteBundleOrder(c *gin.Context) {
|
func DeleteBundleOrder(c *gin.Context) {
|
||||||
@ -503,7 +502,6 @@ func OrderRecordsListV2(c *gin.Context) {
|
|||||||
if u, ok := userMap[item.CustomerId]; ok {
|
if u, ok := userMap[item.CustomerId]; ok {
|
||||||
item.CustomerName = u.Name
|
item.CustomerName = u.Name
|
||||||
item.TelNum = u.TelNum
|
item.TelNum = u.TelNum
|
||||||
item.SubNum = u.SubNum
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -585,7 +583,6 @@ func OrderRecordsListDownload(c *gin.Context) {
|
|||||||
if u, ok := userMap[item.CustomerId]; ok {
|
if u, ok := userMap[item.CustomerId]; ok {
|
||||||
item.CustomerName = u.Name
|
item.CustomerName = u.Name
|
||||||
item.TelNum = u.TelNum
|
item.TelNum = u.TelNum
|
||||||
item.SubNum = u.SubNum
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -609,7 +606,7 @@ func exportExcel(orderList []*bundle.OrderBundleRecordInfo) (*excelize.File, err
|
|||||||
f.SetSheetName("Sheet1", sheetName)
|
f.SetSheetName("Sheet1", sheetName)
|
||||||
|
|
||||||
headers := []string{
|
headers := []string{
|
||||||
"套餐订单号", "套餐类型", "套餐付款状态", "艺人手机号", "用户编号", "艺人", "套餐订单创建时间", "套餐支付时间", "套餐金额",
|
"套餐订单号", "套餐类型", "套餐付款状态", "艺人手机号", "艺人", "套餐订单创建时间", "套餐支付时间", "套餐金额",
|
||||||
"增值服务订单号", "增值税服务金额", "支付金额", "币种", "手续费", "增值订单创建时间", "增值付款状态",
|
"增值服务订单号", "增值税服务金额", "支付金额", "币种", "手续费", "增值订单创建时间", "增值付款状态",
|
||||||
}
|
}
|
||||||
for i, h := range headers {
|
for i, h := range headers {
|
||||||
@ -639,22 +636,22 @@ func exportExcel(orderList []*bundle.OrderBundleRecordInfo) (*excelize.File, err
|
|||||||
f.SetCellValue(sheetName, fmt.Sprintf("B%d", rowIndex), bundleInfo.BundleName)
|
f.SetCellValue(sheetName, fmt.Sprintf("B%d", rowIndex), bundleInfo.BundleName)
|
||||||
f.SetCellValue(sheetName, fmt.Sprintf("C%d", rowIndex), GetPayStatusText(bundleInfo.PayStatus))
|
f.SetCellValue(sheetName, fmt.Sprintf("C%d", rowIndex), GetPayStatusText(bundleInfo.PayStatus))
|
||||||
f.SetCellValue(sheetName, fmt.Sprintf("D%d", rowIndex), bundleInfo.TelNum)
|
f.SetCellValue(sheetName, fmt.Sprintf("D%d", rowIndex), bundleInfo.TelNum)
|
||||||
f.SetCellValue(sheetName, fmt.Sprintf("E%d", rowIndex), bundleInfo.SubNum)
|
f.SetCellValue(sheetName, fmt.Sprintf("E%d", rowIndex), bundleInfo.CustomerName)
|
||||||
f.SetCellValue(sheetName, fmt.Sprintf("F%d", rowIndex), bundleInfo.CustomerName)
|
f.SetCellValue(sheetName, fmt.Sprintf("F%d", rowIndex), bundleInfo.BundleCreateAt)
|
||||||
f.SetCellValue(sheetName, fmt.Sprintf("G%d", rowIndex), bundleInfo.BundleCreateAt)
|
f.SetCellValue(sheetName, fmt.Sprintf("G%d", rowIndex), bundleInfo.PayTime)
|
||||||
f.SetCellValue(sheetName, fmt.Sprintf("H%d", rowIndex), bundleInfo.PayTime)
|
f.SetCellValue(sheetName, fmt.Sprintf("H%d", rowIndex), bundleInfo.Amount)
|
||||||
f.SetCellValue(sheetName, fmt.Sprintf("I%d", rowIndex), bundleInfo.Amount)
|
|
||||||
|
|
||||||
if addCount > 0 {
|
if addCount > 0 {
|
||||||
for i, add := range bundleInfo.AddBundleInfo {
|
for i, add := range bundleInfo.AddBundleInfo {
|
||||||
r := rowIndex + i
|
r := rowIndex + i
|
||||||
f.SetCellValue(sheetName, fmt.Sprintf("J%d", r), add.OrderAddNo)
|
f.SetCellValue(sheetName, fmt.Sprintf("I%d", r), add.OrderAddNo)
|
||||||
f.SetCellValue(sheetName, fmt.Sprintf("K%d", r), add.Amount)
|
f.SetCellValue(sheetName, fmt.Sprintf("J%d", r), add.Amount)
|
||||||
f.SetCellValue(sheetName, fmt.Sprintf("L%d", r), add.SettlementAmount)
|
f.SetCellValue(sheetName, fmt.Sprintf("K%d", r), add.SettlementAmount)
|
||||||
f.SetCellValue(sheetName, fmt.Sprintf("M%d", r), GetCurrencyTypeText(add.CurrencyType))
|
f.SetCellValue(sheetName, fmt.Sprintf("L%d", r), GetCurrencyTypeText(add.CurrencyType))
|
||||||
f.SetCellValue(sheetName, fmt.Sprintf("N%d", r), add.HandlingFee)
|
f.SetCellValue(sheetName, fmt.Sprintf("M%d", r), add.HandlingFee)
|
||||||
f.SetCellValue(sheetName, fmt.Sprintf("O%d", r), add.OrderAddCreateAt)
|
//f.SetCellValue(sheetName, fmt.Sprintf("N%d", r), add.ExchangeRate)
|
||||||
f.SetCellValue(sheetName, fmt.Sprintf("P%d", r), GetPayStatusText(add.AddPayStatus))
|
f.SetCellValue(sheetName, fmt.Sprintf("N%d", r), add.OrderAddCreateAt)
|
||||||
|
f.SetCellValue(sheetName, fmt.Sprintf("O%d", r), GetPayStatusText(add.AddPayStatus))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for i := 8; i <= 15; i++ {
|
for i := 8; i <= 15; i++ {
|
||||||
|
@ -11,11 +11,10 @@ import (
|
|||||||
"fonchain-fiee/pkg/service/bundle/logic"
|
"fonchain-fiee/pkg/service/bundle/logic"
|
||||||
bundleModel "fonchain-fiee/pkg/service/bundle/model"
|
bundleModel "fonchain-fiee/pkg/service/bundle/model"
|
||||||
"fonchain-fiee/pkg/utils"
|
"fonchain-fiee/pkg/utils"
|
||||||
"strconv"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/gin-gonic/gin/binding"
|
"github.com/gin-gonic/gin/binding"
|
||||||
|
"strconv"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func GetReconciliationList(c *gin.Context) {
|
func GetReconciliationList(c *gin.Context) {
|
||||||
@ -29,29 +28,6 @@ func GetReconciliationList(c *gin.Context) {
|
|||||||
service.Error(c, detailErr)
|
service.Error(c, detailErr)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var userIds []int64
|
|
||||||
for _, u := range detail.List {
|
|
||||||
userIds = append(userIds, int64(u.UserID))
|
|
||||||
}
|
|
||||||
userListResp, err := service.AccountFieeProvider.UserList(context.Background(), &accountFiee.UserListRequest{
|
|
||||||
Ids: userIds,
|
|
||||||
Domain: "app",
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
service.Error(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
userMap := make(map[int64]*accountFiee.UserListInfo, len(userListResp.UserList))
|
|
||||||
if len(userListResp.UserList) > 0 {
|
|
||||||
for _, u := range userListResp.UserList {
|
|
||||||
userMap[int64(u.Id)] = u
|
|
||||||
}
|
|
||||||
for _, u := range detail.List {
|
|
||||||
if user, ok := userMap[int64(u.UserID)]; ok {
|
|
||||||
u.SubNum = user.SubNum
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
service.Success(c, detail)
|
service.Success(c, detail)
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -68,31 +44,8 @@ func GetReconciliationListDownload(c *gin.Context) {
|
|||||||
service.Error(c, detailErr)
|
service.Error(c, detailErr)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var userIds []int64
|
|
||||||
for _, u := range detail.List {
|
|
||||||
userIds = append(userIds, int64(u.UserID))
|
|
||||||
}
|
|
||||||
userListResp, err := service.AccountFieeProvider.UserList(context.Background(), &accountFiee.UserListRequest{
|
|
||||||
Ids: userIds,
|
|
||||||
Domain: "app",
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
service.Error(c, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
userMap := make(map[int64]*accountFiee.UserListInfo, len(userListResp.UserList))
|
|
||||||
if len(userListResp.UserList) > 0 {
|
|
||||||
for _, u := range userListResp.UserList {
|
|
||||||
userMap[int64(u.Id)] = u
|
|
||||||
}
|
|
||||||
for _, u := range detail.List {
|
|
||||||
if user, ok := userMap[int64(u.UserID)]; ok {
|
|
||||||
u.SubNum = user.SubNum
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
titleList := []string{
|
titleList := []string{
|
||||||
"关联套餐订单号", "关联增值服务订单号", "对账单创建时间", "用户编号", "艺人", "艺人手机号", "套餐", "支付金额", "手续费", "币种", "支付渠道", "支付时间", "支付状态", "流水号",
|
"关联套餐订单号", "关联增值服务订单号", "对账单创建时间", "艺人", "艺人手机号", "套餐", "支付金额", "手续费", "币种", "支付渠道", "支付时间", "支付状态", "流水号",
|
||||||
}
|
}
|
||||||
var dataList []interface{}
|
var dataList []interface{}
|
||||||
|
|
||||||
@ -107,7 +60,6 @@ func GetReconciliationListDownload(c *gin.Context) {
|
|||||||
i.BundleOrderOn,
|
i.BundleOrderOn,
|
||||||
i.BundleAddOrderOn,
|
i.BundleAddOrderOn,
|
||||||
i.CreationTime,
|
i.CreationTime,
|
||||||
i.SubNum,
|
|
||||||
i.UserName,
|
i.UserName,
|
||||||
i.UserTel,
|
i.UserTel,
|
||||||
i.BundleName,
|
i.BundleName,
|
||||||
|
@ -11,10 +11,9 @@ import (
|
|||||||
"fonchain-fiee/pkg/e"
|
"fonchain-fiee/pkg/e"
|
||||||
modelCast "fonchain-fiee/pkg/model/cast"
|
modelCast "fonchain-fiee/pkg/model/cast"
|
||||||
"fonchain-fiee/pkg/service"
|
"fonchain-fiee/pkg/service"
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
func UpdateWorkImage(ctx *gin.Context) {
|
func UpdateWorkImage(ctx *gin.Context) {
|
||||||
@ -51,7 +50,6 @@ func UpdateWorkImage(ctx *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
newCtx := NewCtxWithUserInfo(ctx)
|
newCtx := NewCtxWithUserInfo(ctx)
|
||||||
req.Source = 1
|
|
||||||
resp, err := service.CastProvider.UpdateWorkImage(newCtx, req)
|
resp, err := service.CastProvider.UpdateWorkImage(newCtx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
service.Error(ctx, err)
|
service.Error(ctx, err)
|
||||||
@ -95,7 +93,6 @@ func UpdateWorkVideo(ctx *gin.Context) {
|
|||||||
req.ArtistPhone = infoResp.TelNum
|
req.ArtistPhone = infoResp.TelNum
|
||||||
req.ArtistPhoneAreaCode = infoResp.TelAreaCode
|
req.ArtistPhoneAreaCode = infoResp.TelAreaCode
|
||||||
newCtx := NewCtxWithUserInfo(ctx)
|
newCtx := NewCtxWithUserInfo(ctx)
|
||||||
req.Source = 1
|
|
||||||
resp, err := service.CastProvider.UpdateWorkVideo(newCtx, req)
|
resp, err := service.CastProvider.UpdateWorkVideo(newCtx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
service.Error(ctx, err)
|
service.Error(ctx, err)
|
||||||
@ -238,7 +235,7 @@ func RePublish(ctx *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改余量我还需要调用吗
|
//修改余量我还需要调用吗
|
||||||
func UserBundleBalanceCost() {
|
func UserBundleBalanceCost() {
|
||||||
service.BundleProvider.AddBundleBalance(context.Background(), &bundle.AddBundleBalanceReq{})
|
service.BundleProvider.AddBundleBalance(context.Background(), &bundle.AddBundleBalanceReq{})
|
||||||
}
|
}
|
||||||
|
@ -217,14 +217,14 @@ func quickBos(file *multipart.FileHeader, mediaType string, mask string, source
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
var objectName string = fmt.Sprintf("%s/%s/%s", config.ConfigData.Oss.BaseDir, config.Env, filePath)
|
var objectName string = fmt.Sprintf("%s/%s/%s", config.ConfigData.Oss.BaseDir, config.Env, filePath)
|
||||||
BOSClient, _ := objstorage.NewOSS(os.Getenv(config.ConfigData.Oss.AccessKeyId), os.Getenv(config.ConfigData.Oss.AccessKeySecret), os.Getenv(config.ConfigData.Oss.Endpoint))
|
BOSClient, _ := objstorage.NewOSS(config.ConfigData.Oss.AccessKeyId, config.ConfigData.Oss.AccessKeySecret, config.ConfigData.Oss.Endpoint)
|
||||||
_, err = BOSClient.PutObjectFromBytes(os.Getenv(config.ConfigData.Oss.BucketName), objectName, fileBytes)
|
_, err = BOSClient.PutObjectFromBytes(config.ConfigData.Oss.BucketName, objectName, fileBytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
//logger.Errorf("quickOss err", err)
|
//logger.Errorf("quickOss err", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//url = fmt.Sprintf("%s%s%s/%s", config.BosHttp, config.BosBucketName, config.BosUrl, objectName)
|
//url = fmt.Sprintf("%s%s%s/%s", config.BosHttp, config.BosBucketName, config.BosUrl, objectName)
|
||||||
url = fmt.Sprintf("%s/%s", os.Getenv(config.ConfigData.Oss.CdnHost), objectName)
|
url = fmt.Sprintf("%s/%s", config.ConfigData.Oss.CdnHost, objectName)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,9 +266,8 @@ func BaiduCheckImage(imageByte []byte) (err error) {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func PutBos(filePath string, mediaType string, needRemove bool) (url string, err error) {
|
func PutBos(filePath string, mediaType string, needRemove bool) (url string, err error) {
|
||||||
BOSClient, err := objstorage.NewOSS(os.Getenv(config.ConfigData.Oss.AccessKeyId), os.Getenv(config.ConfigData.Oss.AccessKeySecret), os.Getenv(config.ConfigData.Oss.Endpoint))
|
BOSClient, err := objstorage.NewOSS(config.ConfigData.Oss.AccessKeyId, config.ConfigData.Oss.AccessKeySecret, config.ConfigData.Oss.Endpoint)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("=== PutBos NewOss err ", err)
|
|
||||||
//logger.Errorf("PutBos NewOss err ", err)
|
//logger.Errorf("PutBos NewOss err ", err)
|
||||||
err = errors.New(e.GetMsg(e.ErrorUploadBos))
|
err = errors.New(e.GetMsg(e.ErrorUploadBos))
|
||||||
return
|
return
|
||||||
@ -291,15 +290,14 @@ func PutBos(filePath string, mediaType string, needRemove bool) (url string, err
|
|||||||
}
|
}
|
||||||
filePath = strings.Replace(filePath, model.MediaPath, "", 1)
|
filePath = strings.Replace(filePath, model.MediaPath, "", 1)
|
||||||
var objectName string = fmt.Sprintf("%s/%s%s", config.ConfigData.Oss.BaseDir, config.Env, filePath)
|
var objectName string = fmt.Sprintf("%s/%s%s", config.ConfigData.Oss.BaseDir, config.Env, filePath)
|
||||||
_, err = BOSClient.PutObjectFromBytes(os.Getenv(config.ConfigData.Oss.BucketName), objectName, fileBytes)
|
_, err = BOSClient.PutObjectFromBytes(config.ConfigData.Oss.BucketName, objectName, fileBytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("=== PutBos PutObject err ", err)
|
|
||||||
//logger.Errorf("PutBos PutObject err %+v", err.Error())
|
//logger.Errorf("PutBos PutObject err %+v", err.Error())
|
||||||
err = errors.New(e.GetMsg(e.ErrorUploadBos))
|
err = errors.New(e.GetMsg(e.ErrorUploadBos))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//url = fmt.Sprintf("%s%s%s/%s", config.BosHttp, config.BosBucketName, config.BosUrl, objectName)
|
//url = fmt.Sprintf("%s%s%s/%s", config.BosHttp, config.BosBucketName, config.BosUrl, objectName)
|
||||||
url = fmt.Sprintf("%s/%s", os.Getenv(config.ConfigData.Oss.CdnHost), objectName)
|
url = fmt.Sprintf("%s/%s", config.ConfigData.Oss.CdnHost, objectName)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
func GetSnapshot(videoPath, snapshotPath string, frameNum int) (snapshotName string, err error) {
|
func GetSnapshot(videoPath, snapshotPath string, frameNum int) (snapshotName string, err error) {
|
||||||
@ -333,14 +331,14 @@ func GetSnapshot(videoPath, snapshotPath string, frameNum int) (snapshotName str
|
|||||||
}
|
}
|
||||||
|
|
||||||
func UploadWithBuffer(fileBuffer *bytes.Buffer, cloudStoreSubPath string) (url string, err error) {
|
func UploadWithBuffer(fileBuffer *bytes.Buffer, cloudStoreSubPath string) (url string, err error) {
|
||||||
Client, err := objstorage.NewOSS(os.Getenv(config.ConfigData.Oss.AccessKeyId), os.Getenv(config.ConfigData.Oss.AccessKeySecret), os.Getenv(config.ConfigData.Oss.Endpoint))
|
Client, err := objstorage.NewOSS(config.ConfigData.Oss.AccessKeyId, config.ConfigData.Oss.AccessKeySecret, config.ConfigData.Oss.Endpoint)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = errors.New(fmt.Sprintf("云存储初始化失败:%s", err.Error()))
|
err = errors.New(fmt.Sprintf("云存储初始化失败:%s", err.Error()))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
cloudStoreSubPath = getEnvDir(cloudStoreSubPath)
|
cloudStoreSubPath = getEnvDir(cloudStoreSubPath)
|
||||||
_, err = Client.PutObjectFromBytes(os.Getenv(config.ConfigData.Oss.BucketName), cloudStoreSubPath, fileBuffer.Bytes())
|
_, err = Client.PutObjectFromBytes(config.ConfigData.Oss.BucketName, cloudStoreSubPath, fileBuffer.Bytes())
|
||||||
url = os.Getenv(config.ConfigData.Oss.CdnHost) + "/" + cloudStoreSubPath
|
url = config.ConfigData.Oss.CdnHost + "/" + cloudStoreSubPath
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
func getEnvDir(cloudStoreSubPath string) (ep string) {
|
func getEnvDir(cloudStoreSubPath string) (ep string) {
|
||||||
|
Loading…
Reference in New Issue
Block a user