diff --git a/proxyserver/main.go b/proxyserver/main.go index f232c82d..e6fc3ff5 100644 --- a/proxyserver/main.go +++ b/proxyserver/main.go @@ -30,7 +30,7 @@ func SetCors(w http.ResponseWriter, r *http.Request) { 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) diff --git a/server/product/internal/logic/getproductinfologic.go b/server/product/internal/logic/getproductinfologic.go index 3ef3b921..7ec71273 100644 --- a/server/product/internal/logic/getproductinfologic.go +++ b/server/product/internal/logic/getproductinfologic.go @@ -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) } // 获取渲染设计