Commit ab1c6221 by 刘帅

添加入账反馈接口

parent ef406819
...@@ -118,11 +118,10 @@ FlowControl::FlowControl() ...@@ -118,11 +118,10 @@ FlowControl::FlowControl()
socket->write(replyData.toUtf8()); socket->write(replyData.toUtf8());
socket->waitForBytesWritten(1000); socket->waitForBytesWritten(1000);
} }
if(recvObj.contains("reqtype") && if(recvObj.contains("reqtype")) //
( recvObj["reqtype"] == 25 || recvObj["reqtype"] == 80)) //商品库存同步
{ {
recvObj.insert("token", m_token); recvObj.insert("token", m_token);
_onStockSync(recvObj); componentProxy(recvObj);
} }
} }
socket->close(); socket->close();
...@@ -449,19 +448,34 @@ void FlowControl::_onGetMenu() ...@@ -449,19 +448,34 @@ void FlowControl::_onGetMenu()
); );
} }
//TODO STOCK_SYNC //TODO 转发组件请求
void FlowControl::_onStockSync(QJsonObject obj) void FlowControl::componentProxy(QJsonObject obj)
{ {
QByteArray request = QJsonDocument(obj).toJson(); QByteArray request = QJsonDocument(obj).toJson();
int reqtype = obj["reqtype"].toInt();
m_http.Post(request m_http.Post(request
,[this](const QByteArray &data) ,[this, reqtype](const QByteArray &data)
{ {
QLOG_INFO() << QString("同步库存返回数据:\n %1").arg(QString(data).simplified()); if(reqtype == 23)
{
QLOG_INFO() << QString("入账反馈返回数据:\n %1").arg(QString(data).simplified());
}
else
{
QLOG_INFO() << QString("同步库存返回数据:\n %1").arg(QString(data).simplified());
}
} }
,[this](const QNetworkReply::NetworkError &error) ,[this, reqtype](const QNetworkReply::NetworkError &error)
{ {
showAlertForm(AlertForm::ERROR, "同步库存失败[网络错误,请检查网络连接]", true); if(reqtype == 23)
QLOG_ERROR() << QString("同步库存失败: %1").arg(error); {
QLOG_ERROR() << QString("入账反馈失败: %1").arg(error);
}
else
{
showAlertForm(AlertForm::ERROR, "同步库存失败[网络错误,请检查网络连接]", true);
QLOG_ERROR() << QString("同步库存失败: %1").arg(error);
}
} }
); );
} }
......
...@@ -107,11 +107,11 @@ private slots: ...@@ -107,11 +107,11 @@ private slots:
* */ * */
void _onGetCode(); void _onGetCode();
/* 功能:库存同步 /* 功能:转发组件请求
* 参数:[1]同步库存接口json字串 * 参数:组件请求字串
* 返回:NULL * 返回:NULL
* */ * */
void _onStockSync(QJsonObject obj); void componentProxy(QJsonObject obj);
/* 功能:部分退款后续处理 /* 功能:部分退款后续处理
* 参数:[1]订单id * 参数:[1]订单id
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment