44 lines
973 B
Go
44 lines
973 B
Go
|
package do
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
|
"fmt"
|
||
|
"strconv"
|
||
|
"trasfer_middleware/cmd/rpc/internal/logic/vo"
|
||
|
"trasfer_middleware/genModel"
|
||
|
)
|
||
|
|
||
|
func ZLTXRechargeData(order *genModel.ServerOrderZltx, resq string, resp string) (err error) {
|
||
|
var (
|
||
|
orderInfoReq map[string]interface{}
|
||
|
orderInfoRes map[string]interface{}
|
||
|
)
|
||
|
if orderInfoRes["code"].(string) != vo.ZLTX_RS_SUCCESS {
|
||
|
return err
|
||
|
}
|
||
|
err = json.Unmarshal([]byte(resq), &orderInfoReq)
|
||
|
if err != nil {
|
||
|
return fmt.Errorf("订单已存在")
|
||
|
}
|
||
|
err = json.Unmarshal([]byte(resp), &orderInfoRes)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
order.Num, err = strconv.ParseInt(orderInfoReq["number"].(string), 16, 64)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
order.ProductId, err = strconv.ParseInt(orderInfoReq["productId"].(string), 16, 64)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
order.VoucherNum = orderInfoReq["merchantId"].(string)
|
||
|
|
||
|
order.OutBizNo = orderInfoReq["outTradeNo"].(string)
|
||
|
|
||
|
return nil
|
||
|
}
|