Commit 644d1345 by Joneq

增加代码

parent 1f73bc73
Showing with 6 additions and 3 deletions
......@@ -3,13 +3,13 @@ package service
import (
"encoding/json"
"errors"
xj "github.com/basgys/goxml2json"
"github.com/beevik/etree"
"github.com/go-kratos/kratos/pkg/conf/paladin"
"github.com/go-kratos/kratos/pkg/log"
bm "github.com/go-kratos/kratos/pkg/net/http/blademaster"
"github.com/mushishixian/gosoap"
"strings"
xj "github.com/basgys/goxml2json"
)
var ErpConfig struct{
......@@ -102,16 +102,19 @@ func CheckOrderReturnData(res *gosoap.Response) (err error) {
xml := strings.NewReader(`<?xml version="1.0" encoding="UTF-8"?>`+result.Text())
turnJson, err := xj.Convert(xml)
log.Info(result.Text())
if err != nil {
return errors.New("转换Json失败")
}
log.Info(turnJson.String())
err = json.Unmarshal([]byte(turnJson.String()),&ErpReturnOrderData)
ErpReturnOrderData.Xml.P.A = ErpReturnOrderData.Xml.P.A[:len(ErpReturnOrderData.Xml.P.A)-1]
if err != nil {
return errors.New("没查询到erp订单数据")
return errors.New(err.Error())
}
return nil
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment