• 111阅读
  • 2回复

[提问]多次读取http [复制链接]

上一主题 下一主题
离线介农酥
 

只看楼主 倒序阅读 楼主  发表于: 10-06
回复本帖可获得10RMB金钱奖励!
每人最多可获奖2次,奖池剩余40RMB金钱 (中奖几率70%)
服务器,一次性提交数据后,作为客户端的程序,不能一次性读完,而是分两次:
读取结果如下:
第一次:
  1. "{\"success\":true,\"errorMsg\":null,\"data\":[{\"uuid\":null,\"whCode\":\"SH-01\",\"whId\":219689,\"orderGroup\":\"B1909270001_1\",\"salesOrderCode\":\"1\",\"skuCode\":\"CC009\",\"skuVolume\":\"0.0\",\"skuEanCode\":\"CC090001001\",\"needSN\":false,\"cellIndex\":\"SO10\",\"qty\":1.0,\"printTypeList\":null,\"remark\":null},{\"uuid\":null,\"whCode\":\"SH-01\",\"whId\":219689,\"orderGroup\":\"B1909270001_1\",\"salesOrderCode\":\"SO201909200001\",\"skuCode\":\"CC002\",\"skuVolume\":\"1.0\",\"skuEanCode\":\"69201705250002\",\"needSN\":false,\"cellIndex\":\"SO1\",\"qty\":3.0,\"printTypeList\":null,\"remark\":null},{\"uuid\":null,\"whCode\":\"SH-01\",\"whId\":219689,\"orderGroup\":\"B1909270001_1\",\"salesOrderCode\":\"SO201909240008\",\"skuCode\":\"CC009\",\"skuVolume\":\"0.0\",\"skuEanCode\":\"CC090001001\",\"needSN\":false,\"cellIndex\":\"SO8\",\"qty\":1.0,\"printTypeList\":null,\"remark\":null},{\"uuid\":null,\"whCode\":\"SH-01\",\"whId\":219689,\"orderGroup\":\"B1909270001_1\",\"salesOrderCode\":\"SO201909240017\",\"skuCode\":\"CC002\",\"skuVolume\":\"1.0\",\"skuEanCode\":\"69201705250002\",\"needSN\":false,\"cellIndex\":\"SO17\",\"qty\":1.0,\"printTypeList\":null,\"remark\":null},{\"uuid\":null,\"whCode\":\"SH-01\",\"whId\":219689,\"orderGroup\":\"B1909270001_1\",\"salesOrderCode\":\"SO201909240020\",\"skuCode\":\"CC002\",\"skuVolume\":\"1.0\",\"skuEanCode\":\"69201705250002\",\"needSN\":false,\"cellIndex\":\"SO20\",\"qty\":1.0,\"printTypeList\":null,\"remark\":null},{\"uuid\":null,\"whCode\":\"SH-01\",\"whId\":219689,\""

第二次:
  1. "orderGroup\":\"B1909270001_1\",\"salesOrderCode\":\"SO201909230003\",\"skuCode\":\"CC009\",\"skuVolume\":\"0.0\",\"skuEanCode\":\"CC090001001\",\"needSN\":false,\"cellIndex\":\"SO3\",\"qty\":3.0,\"printTypeList\":null,\"remark\":null},{\"uuid\":null,\"whCode\":\"SH-01\",\"whId\":219689,\"orderGroup\":\"B1909270001_1\",\"salesOrderCode\":\"SO201909240011\",\"skuCode\":\"CC009\",\"skuVolume\":\"0.0\",\"skuEanCode\":\"CC090001001\",\"needSN\":false,\"cellIndex\":\"SO12\",\"qty\":1.0,\"printTypeList\":null,\"remark\":null},{\"uuid\":null,\"whCode\":\"SH-01\",\"whId\":219689,\"orderGroup\":\"B1909270001_1\",\"salesOrderCode\":\"SO201909240011\",\"skuCode\":\"CC002\",\"skuVolume\":\"1.0\",\"skuEanCode\":\"69201705250002\",\"needSN\":false,\"cellIndex\":\"SO12\",\"qty\":1.0,\"printTypeList\":null,\"remark\":null},{\"uuid\":null,\"whCode\":\"SH-01\",\"whId\":219689,\"orderGroup\":\"B1909270001_1\",\"salesOrderCode\":\"SO201909240004\",\"skuCode\":\"CC009\",\"skuVolume\":\"0.0\",\"skuEanCode\":\"CC090001001\",\"needSN\":false,\"cellIndex\":\"SO5\",\"qty\":1.0,\"printTypeList\":null,\"remark\":null},{\"uuid\":null,\"whCode\":\"SH-01\",\"whId\":219689,\"orderGroup\":\"B1909270001_1\",\"salesOrderCode\":\"SO201909240004\",\"skuCode\":\"CC002\",\"skuVolume\":\"1.0\",\"skuEanCode\":\"69201705250002\",\"needSN\":false,\"cellIndex\":\"SO5\",\"qty\":2.0,\"printTypeList\":null,\"remark\":null},{\"uuid\":null,\"whCode\":\"SH-01\",\"whId\":219689,\"orderGroup\":\"B1909270001_1\",\"salesOrderCode\":\"SO201909240015\",\"skuCode\":\"CC002\",\"skuVolume\":\"1.0\",\"skuEanCode\":\"69201705250002\",\"needSN\":false,\"cellIndex\":\"SO15\",\"qty\":1.0,\"printTypeList\":null,\"remark\":null},{\"uuid\":null,\"whCode\":\"SH-01\",\"whId\":219689,\"orderGroup\":\"B1909270001_1\",\"salesOrderCode\":\"SO201909240005\",\"skuCode\":\"CC009\",\"skuVolume\":\"0.0\",\"skuEanCode\":\"CC090001001\",\"needSN\":false,\"cellIndex\":\"SO6\",\"qty\":1.0,\"printTypeList\":null,\"remark\":null},{\"uuid\":null,\"whCode\":\"SH-01\",\"whId\":219689,\"orderGroup\":\"B1909270001_1\",\"salesOrderCode\":\"SO201909240009\",\"skuCode\":\"CC009\",\"skuVolume\":\"0.0\",\"skuEanCode\":\"CC090001001\",\"needSN\":false,\"cellIndex\":\"SO9\",\"qty\":1.0,\"printTypeList\":null,\"remark\":null},{\"uuid\":null,\"whCode\":\"SH-01\",\"whId\":219689,\"orderGroup\":\"B1909270001_1\",\"salesOrderCode\":\"SO201909240018\",\"skuCode\":\"CC002\",\"skuVolume\":\"1.0\",\"skuEanCode\":\"69201705250002\",\"needSN\":false,\"cellIndex\":\"SO18\",\"qty\":1.0,\"printTypeList\":null,\"remark\":null},{\"uuid\":null,\"whCode\":\"SH-01\",\"whId\":219689,\"orderGroup\":\"B1909270001_1\",\"salesOrderCode\":\"SO201909240010\",\"skuCode\":\"CC009\",\"skuVolume\":\"0.0\",\"skuEanCode\":\"CC090001001\",\"needSN\":false,\"cellIndex\":\"SO11\",\"qty\":1.0,\"printTypeList\":null,\"remark\":null},{\"uuid\":null,\"whCode\":\"SH-01\",\"whId\":219689,\"orderGroup\":\"B1909270001_1\",\"salesOrderCode\":\"SO201909240012\",\"skuCode\":\"CC009\",\"skuVolume\":\"0.0\",\"skuEanCode\":\"CC090001001\",\"needSN\":false,\"cellIndex\":\"SO13\",\"qty\":1.0,\"printTypeList\":null,\"remark\":null},{\"uuid\":null,\"whCode\":\"SH-01\",\"whId\":219689,\"orderGroup\":\"B1909270001_1\",\"salesOrderCode\":\"SO201909240019\",\"skuCode\":\"CC002\",\"skuVolume\":\"1.0\",\"skuEanCode\":\"69201705250002\",\"needSN\":false,\"cellIndex\":\"SO19\",\"qty\":1.0,\"printTypeList\":null,\"remark\":null},{\"uuid\":null,\"whCode\":\"SH-01\",\"whId\":219689,\"orderGroup\":\"B1909270001_1\",\"salesOrderCode\":\"SO201909240003\",\"skuCode\":\"CC009\",\"skuVolume\":\"0.0\",\"skuEanCode\":\"CC090001001\",\"needSN\":false,\"cellIndex\":\"SO4\",\"qty\":1.0,\"printTypeList\":null,\"remark\":null},{\"uuid\":null,\"whCode\":\"SH-01\",\"whId\":219689,\"orderGroup\":\"B1909270001_1\",\"salesOrderCode\":\"SO201909240013\",\"skuCode\":\"CC009\",\"skuVolume\":\"0.0\",\"skuEanCode\":\"CC090001001\",\"needSN\":false,\"cellIndex\":\"SO14\",\"qty\":1.0,\"printTypeList\":null,\"remark\":null},{\"uuid\":null,\"whCode\":\"SH-01\",\"whId\":219689,\"orderGroup\":\"B1909270001_1\",\"salesOrderCode\":\"SO201909230002\",\"skuCode\":\"CC007\",\"skuVolume\":\"0.0\",\"skuEanCode\":null,\"needSN\":false,\"cellIndex\":\"SO2\",\"qty\":2.0,\"printTypeList\":null,\"remark\":null},{\"uuid\":null,\"whCode\":\"SH-01\",\"whId\":219689,\"orderGroup\":\"B1909270001_1\",\"salesOrderCode\":\"SO201909240007\",\"skuCode\":\"CC009\",\"skuVolume\":\"0.0\",\"skuEanCode\":\"CC090001001\",\"needSN\":false,\"cellIndex\":\"SO7\",\"qty\":1.0,\"printTypeList\":null,\"remark\":null},{\"uuid\":null,\"whCode\":\"SH-01\",\"whId\":219689,\"orderGroup\":\"B1909270001_1\",\"salesOrderCode\":\"SO201909240016\",\"skuCode\":\"CC002\",\"skuVolume\":\"1.0\",\"skuEanCode\":\"69201705250002\",\"needSN\":false,\"cellIndex\":\"SO16\",\"qty\":2.0,\"printTypeList\":null,\"remark\":null}]}"

两次合起来的结果为正确的结果

问题
为什么就不能一次性读取,我设置了QNetworkReply::setReadBufferSize(qint64 size),也没什么用,有没有什么好的办法可以解决。
在线liulin188

只看该作者 1楼 发表于: 10-06
回帖奖励+ 10
应该是要监听finished槽函数,不过qt的那一套我不用
建议你用libcurl,这个最专业,专业的事情交给专业的库来做
qt就只用来弄来个界面壳


离线介农酥

只看该作者 2楼 发表于: 10-06
回 liulin188 的帖子
liulin188:应该是要监听finished槽函数,不过qt的那一套我不用
建议你用libcurl,这个最专业,专业的事情交给专业的库来做
qt就只用来弄来个界面壳
....... (2019-10-06 10:58) 

好人啊,改成finished果然就可以了。
快速回复
限100 字节
 
上一个 下一个