- 一、場景
- 二、proto檔案內容
- 三、解決
一、場景
Micro Web介面請求,傳參內容如下
{"ids": 1}
- 報錯:
cannot unmarshal number into Go value of type []json.RawMessage - 翻譯:
無法將數字解編為型別為[]的Go值json.RawMessage - 分析:不能把
數字決議為[],應該是要傳陣列[1],而不是傳數字1
二、proto檔案內容
message GoodsRequest {
int64 id = 1;
repeated int64 ids = 2;
double sale_price = 3;
string desc = 4;
repeated GoodsSku tags = 5;
}
message GoodsSku {
int64 id = 1;
int64 goods_id = 2;
string name = 3;
int64 type= 4;
double market_price = 5;
}
三、解決
- 引數方式傳錯了,正確的方式為:
{"ids": [1, 2]}
id的傳參方式如下:
{"id": 1}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/242440.html
標籤:區塊鏈
下一篇:kratosL 01
