#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_riddle"); } m_webview->setPageUrl(url,QCoreApplication::applicationDirPath()+"/../cache"); connect(m_webview,SIGNAL(titleChanged(QString)),this,SLOT(onTitleChanged(QString))); ui->verticalLayout->addWidget(m_webview); m_ssows = new WSSSO(); } void FormAd::setAccountInfo(QMap info) { m_account = info; QString ssoHash = info.value("ssohash"); if(ssoHash.isEmpty()) { m_webview->setPageUrl(SNCDataBase::getRiddleUrl(),QCoreApplication::applicationDirPath()+"/../cache"); } else { QString url = getUserCenterUrl(); m_webview->setPageUrl(url,QCoreApplication::applicationDirPath()+"/../cache"); } } FormAd::~FormAd() { if(m_ssows) { m_ssows->abort(); delete m_ssows; } delete ui; delete m_webview; qDebug()<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_shkj"; return url; } void FormAd::onTitleChanged(QString title) { if(title=="ÉêÇë³É¹¦") emit userStateChanged(); }