Merge branch 'develop' of gitee.com:fusenpack/fusenapi into develop
This commit is contained in:
commit
aa3525c7ce
|
@ -8,10 +8,13 @@ import (
|
||||||
"fusenapi/constants"
|
"fusenapi/constants"
|
||||||
"fusenapi/initalize"
|
"fusenapi/initalize"
|
||||||
"fusenapi/server/render/internal/svc"
|
"fusenapi/server/render/internal/svc"
|
||||||
|
"fusenapi/service/repositories"
|
||||||
|
"fusenapi/utils/hash"
|
||||||
"fusenapi/utils/websocket_data"
|
"fusenapi/utils/websocket_data"
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 这里请求的py接口返回数据
|
// 这里请求的py接口返回数据
|
||||||
|
@ -58,8 +61,45 @@ func (m *MqConsumerRenderAssemble) Run(ctx context.Context, data []byte) error {
|
||||||
logx.Error("failed to get template info:", err)
|
logx.Error("failed to get template info:", err)
|
||||||
return nil //不返回错误就删除消息
|
return nil //不返回错误就删除消息
|
||||||
}
|
}
|
||||||
|
time.Now().UTC()
|
||||||
|
resourceKey := hash.JsonHashKey(parseInfo)
|
||||||
|
combineParam := map[string]interface{}{
|
||||||
|
"logo_url": parseInfo.RenderData.Logo,
|
||||||
|
"website": "",
|
||||||
|
"slogan": "",
|
||||||
|
"address": "",
|
||||||
|
"phone": "",
|
||||||
|
"colors": []string{},
|
||||||
|
"template_tagid": "b1a",
|
||||||
|
"is_crop": false,
|
||||||
|
"shape": "rectangle",
|
||||||
|
"ratio": 0,
|
||||||
|
"line": "",
|
||||||
|
"other": "",
|
||||||
|
"other1": "",
|
||||||
|
}
|
||||||
|
combineParamBytes, _ := json.Marshal(combineParam)
|
||||||
//获取刀版图
|
//获取刀版图
|
||||||
|
res, err := svcCtx.Repositories.ImageHandle.LogoCombine(ctx, &repositories.LogoCombineReq{
|
||||||
|
ResourceKey: resourceKey,
|
||||||
|
TemplateId: productTemplate.Id,
|
||||||
|
CombineParam: string(combineParamBytes),
|
||||||
|
UserId: parseInfo.RenderData.UserId,
|
||||||
|
GuestId: parseInfo.RenderData.GuestId,
|
||||||
|
})
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
logx.Error("合成刀版图失败:", err)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
combineImage := "" //刀版图
|
combineImage := "" //刀版图
|
||||||
|
if res != nil && res.ResourceUrl != nil {
|
||||||
|
combineImage = *res.ResourceUrl
|
||||||
|
} else {
|
||||||
|
logx.Error("合成刀版图失败,合成的刀版图是空指针:", err)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
logx.Info("合成刀版图成功")
|
||||||
//获取渲染设置信息
|
//获取渲染设置信息
|
||||||
element, err := svcCtx.AllModels.FsProductTemplateElement.FindOneByModelId(ctx, *productTemplate.ModelId)
|
element, err := svcCtx.AllModels.FsProductTemplateElement.FindOneByModelId(ctx, *productTemplate.ModelId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -13,5 +13,8 @@ AWS:
|
||||||
AccessKeyID: AKIAZB2JKUXDPNRP4YT2
|
AccessKeyID: AKIAZB2JKUXDPNRP4YT2
|
||||||
Secret: sjCEv0JxATnPCxno2KNLm0X8oDc7srUR+4vkYhvm
|
Secret: sjCEv0JxATnPCxno2KNLm0X8oDc7srUR+4vkYhvm
|
||||||
Token:
|
Token:
|
||||||
PythonApi: #python接口
|
BLMService:
|
||||||
CombineImageUrl: http://18.119.109.254:8999/LogoCombine #合成刀版图接口
|
Url: "http://18.119.109.254:8999"
|
||||||
|
LogoCombine:
|
||||||
|
#Url: "http://192.168.1.7:8999/LogoCombine"
|
||||||
|
Url: "http://18.119.109.254:8999/LogoCombine"
|
|
@ -19,7 +19,10 @@ type Config struct {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PythonApi struct {
|
BLMService struct {
|
||||||
CombineImageUrl string //合图url
|
Url string
|
||||||
|
LogoCombine struct {
|
||||||
|
Url string
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,11 +17,12 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type ServiceContext struct {
|
type ServiceContext struct {
|
||||||
Config config.Config
|
Config config.Config
|
||||||
MysqlConn *gorm.DB
|
MysqlConn *gorm.DB
|
||||||
AllModels *gmodel.AllModelsGen
|
AllModels *gmodel.AllModelsGen
|
||||||
RabbitMq *initalize.RabbitMqHandle
|
RabbitMq *initalize.RabbitMqHandle
|
||||||
AwsSession *session.Session
|
AwsSession *session.Session
|
||||||
|
Repositories *initalize.Repositories
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewServiceContext(c config.Config) *ServiceContext {
|
func NewServiceContext(c config.Config) *ServiceContext {
|
||||||
|
@ -34,6 +35,11 @@ func NewServiceContext(c config.Config) *ServiceContext {
|
||||||
AllModels: gmodel.NewAllModels(initalize.InitMysql(c.SourceMysql)),
|
AllModels: gmodel.NewAllModels(initalize.InitMysql(c.SourceMysql)),
|
||||||
RabbitMq: initalize.InitRabbitMq(c.SourceRabbitMq, nil),
|
RabbitMq: initalize.InitRabbitMq(c.SourceRabbitMq, nil),
|
||||||
AwsSession: session.Must(session.NewSession(&config)),
|
AwsSession: session.Must(session.NewSession(&config)),
|
||||||
|
Repositories: initalize.NewAllRepositories(&initalize.NewAllRepositorieData{
|
||||||
|
GormDB: initalize.InitMysql(c.SourceMysql),
|
||||||
|
BLMServiceUrl: &c.BLMService.Url,
|
||||||
|
AwsSession: session.Must(session.NewSession(&config)),
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user