#include "formad.h" #include "ui_formad.h" #include "sncdatabase.h" #include "respencrypt.h" #include "respgetservertime.h" FormAd::FormAd(QWidget *parent) : QWidget(parent), ui(new Ui::FormAd) { ui->setupUi(this); page_ads = SNCDataBase::getLocalPageAds(); m_webview = new CacheWebView(this); m_webview->setMinimumWidth(280); m_webview->setMaximumWidth(280); QString url = ""; if(page_ads.count()>0) { url = page_ads.value("ad_app2_wool"); } m_webview->setPageUrl(url,QCoreApplication::applicationDirPath()+"/../cache"); ui->verticalLayout->addWidget(m_webview); m_ssows = new WSSSO(); } FormAd::~FormAd() { if(m_ssows) { m_ssows->abort(); delete m_ssows; } delete m_webview; delete ui; qDebug()< info) { QString userHash = info.value("userhash"); m_account = info; if(userHash.isEmpty()) { m_webview->setPageUrl(m_pageUrl,QCoreApplication::applicationDirPath()+"/../cache"); } else { QString url = getUserCenterUrl(); m_webview->setPageUrl(url,QCoreApplication::applicationDirPath()+"/../cache"); } } QString FormAd::getUserCenterUrl() { QString ssoHash = m_account.value("ssohash"); QString json = m_ssows->encrypt(ssoHash); RespEncrypt resp1(json); QString data = resp1.getEncryptData(); json = m_ssows->getServerTime(); RespGetServerTime resp2(json); QString authCode; QByteArray ba; QString str = SNCDataBase::getAuthCodeUrl().arg(resp2.getServerTime().mid(0,16)); ba = QCryptographicHash::hash ( str.toAscii(), QCryptographicHash::Md5 ); authCode.append(ba.toHex()); QString url = SNCDataBase::getSSOAccountUrl() + "?s=mf&r="+authCode+"&u="+data+"&p=ad_"+m_clientID; return url; }