json: cannot unmarshal number into Go struct field xx of type string
golang后台接口接收数据错误:
json: cannot unmarshal number into Go struct field PayCoinOrderInsertReq.deductionsSum of type string
处理错误时需要传输的值转为string
Map<String, Object> getRequestData() => {
// 'id':UserData.UserInfoData.data?.id??0,
'userId': UserData.UserInfoData.data?.userId ?? '',
'coinName': coinName??'',
'coinAddress': coinAddress??'',
'money': _coinNumberController.text,
'usdtRate': '${AppBaseData.exchangeRate}',
'fee': '${AppBaseData.fee}',
'deductionsSum':'$sumMoney',
};userId, := map1["userId"].(string)
token, := map1["token"].(string)
coinName, := map1["coinName"].(string)
coinAddress, := map1["coinAddress"].(string)
money, := map1["money"].(string) //交易金额
usdtRate, := map1["usdtRate"].(string)
fee, := map1["fee"].(string)
deductionsSum, := map1["deductionsSum"].(string)
if !check.CheckTakenUnique(token, userId, c)
{return
}
评论
匿名评论
隐私政策
你无需删除空行,直接评论以获取最佳展示效果