void CGrabSpecalRedPacket::AcceptRedPackeSpecail(CString sendhash,uistruct::REDPACKETPOOL_t pPoolList) { string strshow=UiFun::UI_LoadString("MORTTARD_MODULE" , "MORTTARD_UPDATATIP" ,theApp.gsLanguage); if (!UiFun::IsCurrentAppId(theApp.m_redPacketScriptid.c_str(),theApp.m_neststcriptid.strNewSrcriptRedPacektid.c_str(),strshow)) { return; } if (!theApp.IsSyncBlock ) { UiFun::MessageBoxEx(UiFun::UI_LoadString("SEND_MODULE" , "SEND_UNFINISHED_BUSINESS" ,theApp.gsLanguage) , UiFun::UI_LoadString("COMM_MODULE" , "COMM_TIP" ,theApp.gsLanguage),MFB_OK|MFB_TIP ); return; } if (!CheckRegIDValid( theApp.m_redPacketScriptid)) return ; CString walletaddr = m_walletmoney; INT64 sub = (INT64)(strtod(walletaddr,NULL)*COIN) - theApp.m_RedPacketCfg.AcceptRedPacketSpecailFee; if (sub < 0) { UiFun::MessageBoxEx(UiFun::UI_LoadString("MORTTARD_MODULE" , "MORTTARD_FEETIP" ,theApp.gsLanguage) , UiFun::UI_LoadString("COMM_MODULE" , "COMM_TIP" ,theApp.gsLanguage) ,MFB_OK|MFB_TIP ); return; } if (strtod(m_balance,NULL) < pPoolList.total_amount) { UiFun::MessageBoxEx(UiFun::UI_LoadString("MORTTARD_MODULE" , "MORTTARD_REDMONEY_MORE_BALANCE" ,theApp.gsLanguage) , UiFun::UI_LoadString("COMM_MODULE" , "COMM_TIP" ,theApp.gsLanguage),MFB_OK|MFB_TIP ); return; } CString addr = m_addr; if (addr == _T("")) { UiFun::MessageBoxEx(UiFun::UI_LoadString("P2P_MODULE" , "P2P_ADDRESS_NOT_NULL" ,theApp.gsLanguage) , UiFun::UI_LoadString("COMM_MODULE" , "COMM_TIP" ,theApp.gsLanguage) ,MFB_OK|MFB_TIP ); return; } if (strcmp(pPoolList.send_acc_id.c_str(),addr) == 0) { UiFun::MessageBoxEx(UiFun::UI_LoadString("MORTTARD_MODULE" , "MORTTARD_SNOTG" ,theApp.gsLanguage) , UiFun::UI_LoadString("COMM_MODULE" , "COMM_TIP" ,theApp.gsLanguage) ,MFB_OK|MFB_TIP ); return; } if (IsAcceptRedPacket(addr,pPoolList)) { UiFun::MessageBoxEx(UiFun::UI_LoadString("MORTTARD_MODULE" , "MORTTARD_HAVEGRAB" ,theApp.gsLanguage) , UiFun::UI_LoadString("COMM_MODULE" , "COMM_TIP" ,theApp.gsLanguage),MFB_OK|MFB_TIP ); return; } string strContractData,strHash; strHash= CSoyPayHelp::getInstance()->GetReverseHash(sendhash.GetString()); strContractData = m_RedPacketHelp.PacketAcceptSecpailContract(strHash); INT64 strTxFee = theApp.m_RedPacketCfg.AcceptRedPacketSpecailFee; if ( strTxFee < 10000 ) { UiFun::MessageBoxEx(UiFun::UI_LoadString("P2P_MODULE" , "P2P_TIP" ,theApp.gsLanguage) , UiFun::UI_LoadString("COMM_MODULE" , "COMM_TIP" ,theApp.gsLanguage),MFB_OK|MFB_TIP ); return ; } string strShowData =""; string strData = CSoyPayHelp::getInstance()->CreateContractTx( theApp.m_redPacketScriptid,addr.GetString(),strContractData,0,strTxFee,0); CSoyPayHelp::getInstance()->SendContacrRpc(strData,strShowData); if (strShowData =="") { return; } Json::Reader reader; Json::Value root; if (!reader.parse(strShowData, root)) return ; BOOL bRes = FALSE ; string strTip; int pos = strShowData.find("hash"); if ( pos >=0 ) { //插入到交易记录数据库 string strHash = root["hash"].asString(); CPostMsg postmsg(MSG_USER_GET_UPDATABASE,WM_REVTRANSACTION); postmsg.SetData(strHash); theApp.m_MsgQueue.push(postmsg); } if ( pos >=0 ) { bRes = TRUE ; //strTip.Format( _T("恭喜发送赌约成功!\n%s") , root["hash"].asCString() ) ; strTip =UiFun::UI_LoadString("MORTTARD_MODULE" , "MORTTARD_WITHDRAWALS_SEND_SUCCESS" ,theApp.gsLanguage) ; }else{ strTip =UiFun::UI_LoadString("MORTTARD_MODULE" , "MORTTARD_GRABERROR" ,theApp.gsLanguage) ; } //保存到数据库 if ( bRes ) { string txhash = root["hash"].asString(); //插入到数据库 string strSourceData; strSourceData =strprintf("'%s','%s','%d','%lf' , '%s' ,'%s' , '%d' , '%d','%d','%lf','%d'" , \ pPoolList.send_hash.c_str() ,txhash.c_str() , 0 ,0.0 ,pPoolList.send_acc_id , addr ,0,2,0,pPoolList.total_amount,pPoolList.packets_num); uistruct::DATABASEINFO_t pDatabase; pDatabase.strSource = strSourceData; pDatabase.strTabName = _T("t_red_packets_grab"); CPostMsg postmsg(MSG_USER_INSERT_DATA,0); string strTemp = pDatabase.ToJson(); postmsg.SetData(strTemp); theApp.m_MsgQueue.push(postmsg); } UiFun::MessageBoxEx(strTip.c_str() , UiFun::UI_LoadString("COMM_MODULE" , "COMM_TIP" ,theApp.gsLanguage) ,MFB_OK|MFB_TIP ); }
void CIpoDlg::OnBnClickedButtonDrawal() { return; // TODO: 在此添加控件通知处理程序代码 if (!CheckRegIDValid( theApp.m_ipoScritptid )) return ; string strShowData = ""; CString addr; GetDlgItem(IDC_EDIT_ADDR)->GetWindowText(addr); if (addr == _T("")) { UiFun::MessageBoxEx(_T("地址不能为空") , _T("提示") ,MFB_OK|MFB_TIP ); return; } CString Money = _T(""); GetDlgItem(IDC_STATIC_AMOUNT)->GetWindowText(Money); double dmoney = strtod(Money,NULL); string strContractData = m_P2PBetHelp.GetAppAccountMoneyContract(addr.GetString(),1,2,REAL_MONEY(dmoney)); CString strTxFee; INT64 minFee = theApp.m_P2PBetCfg.GetAppAmountnFee; //45266;theApp.m_P2PBetCfg.GetAppAmountnFee double dnum = (minFee*1.0/COIN); strTxFee.Format(_T("%.8f"),dnum); //GetDlgItem(IDC_EDIT_GETFEE)->GetWindowText(strTxFee) ; if ( (INT64)REAL_MONEY(strtod(strTxFee,NULL)) < 10000 ) { UiFun::MessageBoxEx(_T("小费不足") , _T("提示") ,MFB_OK|MFB_TIP ); return ; } string strData = CSoyPayHelp::getInstance()->CreateContractTx( theApp.m_ipoScritptid,addr.GetString(),strContractData,0,(INT64)REAL_MONEY((strtod(strTxFee,NULL))),0); CSoyPayHelp::getInstance()->SendContacrRpc(strData,strShowData); if (strShowData == "") { return; } Json::Reader reader; Json::Value root; if (!reader.parse(strShowData, root)) return ; BOOL bRes = FALSE ; string strTip; int pos = strShowData.find("hash"); if ( pos >=0 ) { //插入到交易记录数据库 string strHash = root["hash"].asString(); CPostMsg postmsg(MSG_USER_GET_UPDATABASE,WM_REVTRANSACTION); postmsg.SetData(strHash); theApp.m_MsgQueue.push(postmsg); } if ( pos >=0 ) { bRes = TRUE ; strTip = strprintf("恭喜提现成功!\n%s" , root["hash"].asCString() ) ; }else{ strTip = "提现失败!" ; } UiFun::MessageBoxEx(strTip.c_str() , _T("提示") ,MFB_OK|MFB_TIP ); }
void CIpo::OnBnClickedButtonDraw() { // TODO: 在此添加控件通知处理程序代码 if ( IDCANCEL == UiFun::MessageBoxEx(_T("是否确认要提现") , _T("提示") , MFB_OKCANCEL|MFB_TIP ) ) return; if (!CheckRegIDValid( m_appid )) return ; string strShowData = _T(""); CString addr; GetDlgItem(IDC_EDIT_ADDRESS)->GetWindowText(addr); if (addr == _T("")) { UiFun::MessageBoxEx(_T("地址不能为空") , _T("提示") ,MFB_OK|MFB_TIP ); return; } string strCond; strCond = strprintf(" address='%s' or reg_id='%s'", addr,addr); uistruct::LISTADDR_t pAddr; int nItem = theApp.m_SqliteDeal.GetWalletAddressItem(strCond, &pAddr) ; if (pAddr.address == "") { UiFun::MessageBoxEx(_T("此地址不是钱包地址,不能提现") , _T("提示") ,MFB_OK|MFB_TIP ); return; } if (pAddr.bSign == 0 ) { UiFun::MessageBoxEx(_T("此地址没有注册,不能提现") , _T("提示") ,MFB_OK|MFB_TIP ); return; } double dmoney = GetFreeMoney(addr); if (dmoney <=0.0) { UiFun::MessageBoxEx(_T("此地址没有可提现的金额") , _T("提示") ,MFB_OK|MFB_TIP ); return; } string strContractData =""; if (CheckRegIDValid( addr.GetString() )){ strContractData=m_P2PBetHelp.GetAppAccountMoneyContract(addr.GetString(),1,1,REAL_MONEY(dmoney)); }else{ strContractData=m_P2PBetHelp.GetAppAccountMoneyContract(addr.GetString(),1,2,REAL_MONEY(dmoney)); } CString strTxFee; INT64 minFee = theApp.m_AppBalanceCfg.WithdrawFee; double dnum = (minFee*1.0/COIN); strTxFee.Format(_T("%.8f"),dnum); if ( (INT64)REAL_MONEY(strtod(strTxFee,NULL)) < 10000 ) { UiFun::MessageBoxEx(_T("小费不足") , _T("提示") ,MFB_OK|MFB_TIP ); return ; } string strData = CSoyPayHelp::getInstance()->CreateContractTx( m_appid,addr.GetString(),strContractData,0,(INT64)REAL_MONEY((strtod(strTxFee,NULL))),0); CSoyPayHelp::getInstance()->SendContacrRpc(strData,strShowData); if (strShowData =="") { return; } Json::Reader reader; Json::Value root; if (!reader.parse(strShowData, root)) return ; BOOL bRes = FALSE ; string strTip; int pos = strShowData.find("hash"); if ( pos >=0 ) { //插入到交易记录数据库 string strHash = root["hash"].asString(); CPostMsg postmsg(MSG_USER_GET_UPDATABASE,WM_REVTRANSACTION); postmsg.SetData(strHash); theApp.m_msgQueue.push(postmsg); } if ( pos >=0 ) { bRes = TRUE ; strTip = strprintf("%s\n%s" , _T("恭喜提现成功!"),root["hash"].asCString() ) ; }else{ strTip = _T("提现失败") ; } UiFun::MessageBoxEx(strTip.c_str() , _T("提示") ,MFB_OK|MFB_TIP ); }