45 lines
1.0 KiB
Go
45 lines
1.0 KiB
Go
|
package do
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
|
"fmt"
|
||
|
"strconv"
|
||
|
"trasfer_middleware/cmd/rpc/internal/logic/vo"
|
||
|
"trasfer_middleware/genModel"
|
||
|
)
|
||
|
|
||
|
func MarketKeyDataSet(order *genModel.ServerOrderMarket, 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["voucher_num"].(string), 16, 64)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
order.ProductId, err = strconv.ParseInt(orderInfoReq["voucher_id"].(string), 16, 64)
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
order.VoucherNum = orderInfoReq["mem_id"].(string)
|
||
|
|
||
|
order.OutBizNo = orderInfoReq["req_serial_no"].(string)
|
||
|
order.OrderNum = orderInfoReq["voucher_code"].(string)
|
||
|
|
||
|
return nil
|
||
|
}
|