|
|
@@ -317,12 +317,6 @@ func (r *MQBodyReq) GetProtoBytes(serialNumber *uint32) (bytes *[]byte, err erro
|
|
|
bytes = &b
|
|
|
}
|
|
|
case global.GoodsFavoriteOperateReq:
|
|
|
- reg, _ := regexp.Compile(`"[0-9]{19}"`)
|
|
|
- all := reg.FindAll([]byte(data), -1)
|
|
|
- for _, i := range all {
|
|
|
- r := strings.Replace(string(i), "\"", "", -1)
|
|
|
- data = strings.Replace(data, string(i), r, -1)
|
|
|
- }
|
|
|
m := pb.GoodsFavoriteOperateReq{}
|
|
|
if err = r.reflect(data, &m); err != nil {
|
|
|
return
|
|
|
@@ -508,6 +502,14 @@ func (r *MQBodyReq) GetProtoBytes(serialNumber *uint32) (bytes *[]byte, err erro
|
|
|
}
|
|
|
|
|
|
func (r *MQBodyReq) reflect(data string, m proto.Message) (err error) {
|
|
|
+ // 由于JS对Long类型支持不佳,故让小程序端在使用单号时以字符串发过来,服务这边会自动把19位数字的字符串转化为数字
|
|
|
+ reg, _ := regexp.Compile(`"[0-9]{19}"`)
|
|
|
+ all := reg.FindAll([]byte(data), -1)
|
|
|
+ for _, i := range all {
|
|
|
+ r := strings.Replace(string(i), "\"", "", -1)
|
|
|
+ data = strings.Replace(data, string(i), r, -1)
|
|
|
+ }
|
|
|
+
|
|
|
if e := jsonpb.UnmarshalString(data, m); e != nil {
|
|
|
global.M2A_LOG.Error(e.Error(), zap.Error(e))
|
|
|
err = errors.New("业务数据装箱失败")
|