This commit is contained in:
laodaming 2023-07-11 18:37:36 +08:00
parent d2766d5bd3
commit ccf1ae19b2
2 changed files with 24 additions and 4 deletions

View File

@ -16,7 +16,7 @@ var Backends []*Backend
func main() {
rootDir := "../server" // Change this to your root directory
vueBuild := "/home/eson/workspace/fusenpack-vue-created"
vueBuild := "/home/ldm/workdir/fusenpack-vue-created"
apiURL, err := url.Parse("http://localhost:9900")
if err != nil {
panic(err)

View File

@ -10,6 +10,7 @@ import (
"fusenapi/utils/auth"
"fusenapi/utils/basic"
"fusenapi/utils/color_list"
"fusenapi/utils/encryption_decryption"
"fusenapi/utils/format"
"fusenapi/utils/image"
"fusenapi/utils/step_price"
@ -380,7 +381,17 @@ func (l *GetProductInfoLogic) GetProductInfo(req *types.GetProductInfoReq, useri
if req.HaveCloudRendering == true {
renderDesign = l.getRenderDesign(req.ClientNo)
}
return resp.SetStatusWithMessage(basic.CodeOK, "success", types.GetProductInfoRsp{
//查询是否是加密的(不太合理)
encryptWebsetting, err := l.svcCtx.AllModels.FsWebSet.FindValueByKey(l.ctx, "is_encrypt")
if err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return resp.SetStatusWithMessage(basic.CodeDbRecordNotFoundErr, "web setting is_encrypt is not exists")
}
logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeDbSqlErr, "failed to get web setting")
}
//不加密
rspData := types.GetProductInfoRsp{
Id: productInfo.Id,
Type: *productInfo.Type,
Title: *productInfo.Title,
@ -396,8 +407,17 @@ func (l *GetProductInfoLogic) GetProductInfo(req *types.GetProductInfoReq, useri
LastDesign: lastDesign,
RenderDesign: renderDesign,
Colors: color_list.GetColor(),
})
}
if encryptWebsetting.Value == nil || *encryptWebsetting.Value == "0" {
return resp.SetStatusWithMessage(basic.CodeOK, "success", rspData)
}
bytesData, _ := json.Marshal(rspData)
enData, err := encryption_decryption.CBCEncrypt(string(bytesData))
if err != nil {
logx.Error(err)
return resp.SetStatusWithMessage(basic.CodeServiceErr, "failed to encryption response data")
}
return resp.SetStatusWithMessage(basic.CodeOK, "success", enData)
}
// 获取渲染设计