添加应用详情页下载量显示

This commit is contained in:
2022-12-11 02:05:34 +08:00
parent 8a54dd92a3
commit 333a1168d4
5 changed files with 85 additions and 1 deletions

View File

@@ -30,6 +30,17 @@ void SparkAPI::get(QUrl url)
});
httprequest->getRequest(request);
}
void SparkAPI::getRAW(QUrl url)
{
QNetworkRequest request;
HttpRequest *httprequest=new HttpRequest;
request.setUrl(QUrl(url.toString().replace("+","%2B")));
connect(httprequest,&HttpRequest::finished,[=](QString data){
emit finishedRAW(data);
httprequest->deleteLater();
});
httprequest->getRequest(request);
}
void SparkAPI::getAppList(QString type)
{
get(QUrl(getServerUrl()+"store/"+type+"/applist.json"));
@@ -42,6 +53,10 @@ void SparkAPI::getAppInfo(QUrl spk)
{
get(QUrl(getServerUrl()+"store"+spk.path().replace("+","%2B") + "/app.json"));
}
void SparkAPI::getAppDownloadTimes(QUrl spk)
{
getRAW(QUrl(getServerUrl()+"store"+spk.path().replace("+","%2B") + "/download-times.txt"));
}
QString SparkAPI::getServerUrl()
{
return SparkAPI::serverUrl;

View File

@@ -13,8 +13,10 @@ public:
static QString getServerUrl();
static QString getImgServerUrl();
static void setServerUrl(QString url);
void getAppDownloadTimes(QUrl spk);
void getSearchList(QString keyword);
void get(QUrl url);
void getRAW(QUrl url);
void getAppList(QString type);
void getAppInfo(QUrl spk);
explicit SparkAPI(QObject *parent = nullptr);
@@ -24,6 +26,7 @@ private:
signals:
void finished(QJsonArray);
void finishedRAW(QString);
void finishedObject(QJsonObject);
public slots: