public function YiBaoPayFeedback($payResult, $orderId) { if ($payResult["r1_Code"] == "1") { $db = new DB_test(); $query = "update tb_transfermoneyglist set fd_tfmglist_payrq ='00' ,fd_tfmglist_paydate = NOW(), fd_tfmglist_bkntno = '" . $payResult['r2_TrxId'] . "' where fd_tfmglist_bkordernumber = '{$orderId}'"; $db->query($query); $query = "update tb_agentpaymoneylist set fd_agpm_payrq = '00', fd_agpm_bkntno = '" . $payResult['r2_TrxId'] . "' where fd_agpm_bkordernumber = '{$orderId}'"; $db->query($query); $query = "select 1 from tb_cus_fenrunglist where 1 and fd_frlist_bkordernumber = '" . $orderId . "' limit 1"; if ($db->execute($query)) { } else { $query = "SELECT fd_tfmglist_authorid AS authorid, fd_author_cusid AS cusid, fd_tfmglist_paycardid AS paycardid, fd_tfmglist_paydate AS paydate, fd_tfmglist_paymoney AS paymoney, fd_tfmglist_payfee AS payfee, fd_tfmglist_sdcrpayfeemoney AS sdcrpayfeemoney, fd_tfmglist_paytype AS paytype, fd_tfmglist_sdcrpayfeemoney FROM tb_transfermoneyglist WHERE fd_tfmglist_bkordernumber = '{$orderId}'"; if ($db->execute($query)) { $arr_info = $db->get_one($query); $cusfee = 0; $tfbfenrun = 0; $cusfeeResult = getcusfenrun::get_cusfenrun($arr_info['cusid'], $arr_info['paytype'], $arr_info['payMoney'], $arr_info['fd_tfmglist_sdcrpayfeemoney'], $arr_info['fd_tfmglist_payfee'], 0, date("Y-m-d"), null, null); $cusfee = $cusfeeResult["cusfee"]; $tfbfenrun = $arr_cusfee['tfbfenrun']; unset($dateArray); $dateArray['fd_frlist_authorid'] = $arr_info['authorid']; $dateArray['fd_frlist_cusid'] = $arr_info['cusid']; $dateArray['fd_frlist_paycardid'] = $arr_info['paycardid']; $dateArray['fd_frlist_paydate'] = $arr_info['paydate']; $dateArray['fd_frlist_paymoney'] = $arr_info['paymoney']; $dateArray['fd_frlist_payfee'] = $arr_info['payfee']; $dateArray['fd_frlist_cusfee'] = $cusfee; $dateArray['fd_frlist_bkordernumber'] = $orderId; $dateArray['fd_frlist_payrq'] = '00'; $dateArray['fd_frlist_paytype'] = $arr_info['paytype']; $dateArray['fd_frlist_sdcrid'] = 3; $dateArray['fd_frlist_sdcrpayfeemoney'] = $arr_info['sdcrpayfeemoney']; $dateArray['fd_frlist_tfbfenrun'] = $tfbfenrun; $dateArray['fd_frlist_datetime'] = date("Y-m-d H:i:s"); $db->insert("tb_cus_fenrunglist", $dateArray); } } } }
private static function getpaymerinfo($authorid) { $db = new DB_test(); $ErrorReponse = new ErrorReponse(); $query = "select fd_sdcr_merid as merid,fd_sdcr_securitykey as securitykey,fd_sdcr_id as sdcrid," . "fd_sdcr_payfee as \t\t sdcrpayfee,fd_sdcr_tradeurl as tradeurl,fd_sdcr_queryurl as queryurl," . "fd_sdcr_minpayfee as minsdcrpayfee," . "fd_sdcr_agentfee as sdcragentfee from tb_author join tb_sendcenter " . "on fd_sdcr_id = fd_author_sdcrid where fd_author_id = '{$authorid}'"; if ($db->execute($query)) { $arr_merinfo = $db->get_one($query); return $arr_merinfo; } else { $Error = array('rettype' => '100', 'retcode' => '100', 'retmsg' => '商户未审核,不允许操作该功能。'); $ErrorReponse->reponError($Error); exit; } }
public function readQQhasRechamoney($qq) { //计算QQ当前刷卡金额 $db = new DB_test(); $arr_header = $this->arr_header; $arr_body = $this->arr_body; $arr_channelinfo = $this->arr_channelinfo; $authorid = $arr_channelinfo['authorid']; $now = date('Y-m-d'); $query = "select sum(fd_mrclist_rechamoney) as remoney from tb_qqrechargelist\n where fd_mrclist_qq = '{$qq}' and fd_mrclist_payrq= '00' and fd_mrclist_paydate = '{$now}'"; if ($db->execute($query)) { $arr_merinfo = $db->get_one($query); } return $arr_merinfo['remoney']; }
public function readRechacostmoney($money) { $db = new DB_test(); $arr_header = $this->arr_header; $arr_body = $this->arr_body; $arr_channelinfo = $this->arr_channelinfo; $authorid = $arr_channelinfo['authorid']; $query = "select (fd_recham_paymoney-fd_recham_costmoney) as payfee from tb_mobilerechamoney\n where fd_recham_money = '{$money}'"; $db->query($query); if ($db->execute($query)) { $arr_merinfo = $db->get_one($query); $payfee = $arr_merinfo['payfee'] - $money * 0.44 / 100; } else { $payfee = 0; } return $payfee; }
public function AddKuaibkcard() { $db = new DB_test(); $arr_header = $this->arr_header; $arr_body = $this->arr_body; $arr_channelinfo = $this->arr_channelinfo; $authorid = trim($arr_channelinfo['authorid']); $bkcardbankcode = trim($arr_body['bkcardbankid']); $bkcardbank = trim($arr_body['bkcardbank']); $bkcardno = trim($arr_body['bkcardno']); $bkcardbankman = trim($arr_body['bkcardbankman']); $bkcardbankphone = trim($arr_body['bkcardbankphone']); $bkcardyxmonth = trim($arr_body['bkcardyxmonth']); $bkcardyxyear = trim($arr_body['bkcardyxyear']); $bkcardcvv = trim($arr_body['bkcardcvv']); $bkcardidcard = trim($arr_body['bkcardidcard']); $bkcardcardtype = trim($arr_body['bkcardcardtype']); $bkcardisdefault = trim($arr_body['bkcardisdefault']); $bkcardbankid = getbankid(u2g($bkcardbank)); $query = "select 1 from tb_author_quickpaycard where fd_bkauthorid = {$authorid} AND fd_bkcardno = '{$bkcardno}'"; if ($db->execute($query)) { ErrorReponse::reponError(array('retcode' => '200', 'retmsg' => '该卡已经绑定过')); } if ($bkcardisdefault == 1) { $query = "UPDATE tb_author_quickpaycard SET fd_bkcardisdefault = 0 WHERE fd_bkauthorid = " . $authorid; $db->query($query); } $query = "insert into tb_author_quickpaycard(\n\t\t\t\t\t\t\tfd_bkauthorid\t\t\t,fd_bkcardno\t\t,fd_bkcardbankid\t,\n\t\t\t\t fd_bkcardbankcode\t\t,fd_bkcardbank\t\t,fd_bkcardbankman\t,\n\t\t\t\t fd_bkcardbankphone\t\t,fd_bkcardyxmonth ,fd_bkcardyxyear ,\n\t\t\t\t fd_bkcardcvv\t\t,fd_bkcardidcard\t\t,fd_bkcardisdefault\t\t ,\n\t\t\t\t fd_bkcardcardtype)values\n\t\t\t\t\t\t ('{$authorid}'\t\t,'{$bkcardno}'\t,'{$bkcardbankid}'\t\t,\n\t\t\t\t\t\t '{$bkcardbankcode}'\t\t,'{$bkcardbank}'\t,'{$bkcardbankman}'\t\t,\n\t\t\t\t\t\t '{$bkcardbankphone}'\t\t,'{$bkcardyxmonth}'\t,'{$bkcardyxyear}'\t\t\t,\n\t\t\t\t\t\t '{$bkcardcvv}'\t\t\t,'{$bkcardidcard}','{$bkcardisdefault}'\t\t,\n\t\t\t\t\t\t '{$bkcardcardtype}')"; $db->query(auto_charset($query, 'utf-8', 'gbk')); $retcode = "0"; $arr_message = array("result" => "success", "message" => "添加成功"); $arr_msg['msgbody']['result'] = $arr_message['result']; $arr_msg['msgbody']['message'] = $arr_message['message']; $returnvalue = array("msgbody" => $arr_msg['msgbody']); $returnval = TfbxmlResponse::ResponsetoApp($retcode, $returnvalue); return $returnval; }
function getappnav($req_version, $req_appenv, $req_appevn) { $db = new DB_test(); if ($req_appevn != '') { $req_appenv = $req_appevn; } if ($req_version == '') { return true; } if ($req_appenv < 3) { $query = "select * from tb_version where fd_version_apptype= '1' and fd_version_no <= '{$req_version}'"; if ($db->execute($query)) { return true; } else { $Error = array('result' => 'failure', 'retcode' => '200', 'retmsg' => '您使用的是旧版本程序,请下载【通过菜单-》更多-》版本更新】最新本!'); $this->ErrorReponse->reponError($Error); //出错反馈 exit; } } }
public static function get_cusfenrun($cusid, $appmenuno, $paymoney, $payfee, $feelirun = 0) { $db = new DB_test(); $query = "select * from tb_appmenu where fd_appmnu_no = '{$appmenuno}'"; if ($db->execute($query)) { $arr_menuval = $db->get_one($query); $appmenuid = $arr_menuval['fd_appmnu_id']; } else { $appmenuid = 0; //所有功能 ; } $query = "select fd_cus_fenrunid as fenrunid from tb_customer where fd_cus_id = '{$cusid}' "; if ($db->execute($query)) { $arr_cus = $db->get_one($query); $fenrunid = $arr_cus['fenrunid']; } $query = "select * from tb_cus_fenrunset where fd_fenrun_id = '{$fenrunid}' "; if ($db->execute($query)) { $arr_fenrun = $db->get_one($query); } $query = "select * from tb_cus_fenrunsetappmenu where fd_frmset_fenrunid = '{$fenrunid}' group by fd_frmset_appmnuid "; if ($db->execute($query)) { $arr_fenrunappmenu = $db->get_all_key($query, fd_frmset_appmnuid); } $arr_lirunset = $arr_fenrunappmenu[$appmenuid]; //获取到功能分润设置 if (is_array($arr_lirunset)) { $jsmoneytype = $arr_lirunset['fd_frmset_jsmoneytype']; switch ($jsmoneytype) { case "paymoney": $paycardmoney = $paymoney; //交易金额 break; case "payfee": $paycardmoney = $payfee; break; case "feelirun": $paycardmoney = $feelirun; break; } $mode = $arr_lirunset['fd_frmset_mode']; //润分方式 固定还是% $fixfee = $arr_lirunset['fd_frmset_fee']; //固定分润金额 $minfee = $arr_lirunset['fd_frmset_minfee']; //最小分润金额 $maxfee = $arr_lirunset['fd_frmset_maxfee']; //最大分润金额 $fee = $arr_lirunset['fd_frmset_sqfee']; //浮动费率 $fee = substr($fee, 0, -1); switch ($mode) { case "fix": $return_feemoney = $fixfee; break; default: $return_feemoney = round($fee / 100 * $paycardmoney, 2); $return_feemoney = $return_feemoney < $minfee ? $minfee : $return_feemoney; $return_feemoney = $return_feemoney > $maxfee ? $maxfee : $return_feemoney; break; } } else { $return_feemoney = 0; //为设置分润方案 } return $return_feemoney; }
public static function getauthorusername($authorid) { $db = new DB_test(); $query = "select fd_author_state as state,fd_author_truename as truename,fd_author_username as username," . " fd_author_memid as memid,fd_author_shoucardno as shoucardno,fd_author_shoucardman as shoucardman," . " fd_author_shoucardphone as shoucardmobile,fd_author_shoucardbank as shoucardbank from" . " tb_author where fd_author_id = '{$authorid}' "; if ($db->execute($query)) { $arr_author = $db->get_one($query); $authortruename = g2u($arr_author['username']); } return $arr_author; }
public function PayFeedback($payResult, $orderId) { $now = time(); $logger = Logger::getLogger('mobilerecharge'); $logger->info("开始处理手机充值支付后返回数据({$now}) : 订单号({$orderId}), 返回的支付信息" . print_r($payResult, true)); if ($payResult['orderId'] != "" && $orderId != "" && $payResult['orderId'] != $orderId || $payResult['orderId'] == "" && $orderId == "") { $logger->error("处理手机充值支付后返回数据出错({$now}) : 订单号有错误(" . $payResult['orderId'] . "不等于" . $orderId . ")"); return; } $orderId = $orderId != "" ? $orderId : $payResult['orderId']; $logger->debug("正在处理手机充值支付后返回数据({$now}) : 通付宝订单号({$orderId})"); if ($payResult['returnCode'] != "1" && $payResult['transNumber'] == "") { return; } $db = new DB_test(); if ($payResult['returnCode'] == "1") { $query = "SELECT fd_mrclist_rechaphone, fd_mrclist_rechamoney, fd_mrclist_authorid, fd_mrclist_cusid, fd_mrclist_paycardid, fd_mrclist_bkmoney, fd_mrclist_payfee, fd_mrclist_cusfee, fd_mrclist_sdcrid FROM tb_mobilerechargelist \n\t\t\tWHERE fd_mrclist_bkordernumber = '" . $orderId . "' AND fd_mrclist_payrq != '00'"; $dataInDB = $db->get_all($query); if (is_array($dataInDB) && count($dataInDB) == 1) { $logger->debug("正在处理手机充值支付后返回数据({$now}) : 通过通付宝订单号({$orderId})获取数据" . print_r($dataInDB, true)); // 给代理商分润 $query = "SELECT 1 FROM tb_cus_fenrunglist WHERE fd_frlist_bkordernumber = '" . $orderId . "' LIMIT 1"; $logger->debug("正在处理手机充值支付后返回数据({$now}) : 判断是否需要添加数据到tb_cus_fenrunglist表 " . $query); $hasShareInterest = $db->execute($query); if (!$hasShareInterest) { $logger->debug("正在处理手机充值支付后返回数据({$now}) : 需要添加数据到tb_cus_fenrunglist表"); $query = "INSERT INTO tb_cus_fenrunglist (fd_frlist_authorid, fd_frlist_cusid, fd_frlist_paycardid, fd_frlist_paydate, fd_frlist_paymoney, fd_frlist_payfee, fd_frlist_cusfee, fd_frlist_bkordernumber, fd_frlist_payrq, fd_frlist_paytype, fd_frlist_datetime, fd_frlist_ifjsfenrun, fd_frlist_sdcrid) VALUES (" . $dataInDB[0]['fd_mrclist_authorid'] . ", " . $dataInDB[0]['fd_mrclist_cusid'] . ", '" . $dataInDB[0]['fd_mrclist_paycardid'] . "', NOW(), " . $dataInDB[0]['fd_mrclist_bkmoney'] . ", " . $dataInDB[0]['fd_mrclist_payfee'] . ", " . $dataInDB[0]['fd_mrclist_cusfee'] . ", '" . $orderId . "', '00', 'mobilerecharge', NOW(), 0, '" . $dataInDB[0]['fd_mrclist_sdcrid'] . "');"; $db->query($query); $logger->debug("正在处理手机充值支付后返回数据({$now}) : 代理商分润时执行的SQL语句" . $query); } else { $logger->debug("正在处理手机充值支付后返回数据({$now}) : 代理商分润时执行的SQL语句"); } $data = array('FUNC' => 'MOBILE_RECHARGE', 'phone' => $dataInDB[0]['fd_mrclist_rechaphone'], 'money' => $dataInDB[0]['fd_mrclist_rechamoney'], 'orderId' => $orderId); $logger->info("完成处理手机充值支付后返回数据({$now}) : 发起充值 : " . print_r($data, true)); AsyncCall($data); } else { $logger->error("完成处理手机充值支付后返回数据({$now}) : 通过通付宝订单号({$orderId})获取的数据有误 : " . print_r($dataInDB, true)); } } // 返回的数据回写进通付宝数据库 if ($payResult['returnCode'] == "1") { if ($payResult['transNumber'] != "") { // 支付成功,易宝交易号不为空 $query = "UPDATE tb_mobilerechargelist SET fd_mrclist_bkntno = '" . $payResult['transNumber'] . "', fd_mrclist_payrq = '00' WHERE fd_mrclist_bkordernumber = '" . $orderId . "'"; } else { // 支付成功,易宝交易号为空 $query = "UPDATE tb_mobilerechargelist SET fd_mrclist_payrq = '00' WHERE fd_mrclist_bkordernumber = '" . $orderId . "'"; } } else { if ($payResult['transNumber'] != "") { // 支付不成功,易宝交易号不为空 $query = "UPDATE tb_mobilerechargelist SET fd_mrclist_bkntno = '" . $payResult['transNumber'] . "' WHERE fd_mrclist_bkordernumber = '" . $orderId . "'"; } } $logger->debug("正在处理手机充值支付后返回数据({$now}) : query({$query})"); if ($query != "") { $db->query($query); } $logger->debug("正在处理手机充值支付后返回数据({$now}) : 通付宝订单号({$orderId})回写进通付宝数据库"); }
public function activePayCard() { $db = new DB_test(); $arr_header = $this->arr_header; $arr_body = $this->arr_body; $arr_channelinfo = $this->arr_channelinfo; $paycardkey = $arr_body['paycardkey']; $authorid = $arr_channelinfo['authorid']; $paycardkey = strtolower($paycardkey); $paycardkey = str_replace("fff", "", $paycardkey); $query = "select fd_paycard_id,fd_paycard_active from tb_paycard where fd_paycard_key = '{$paycardkey}' "; //首页广告显示 $db->query($query); if (!$db->nf()) { $arr_message = array("result" => "failure", "message" => "激活失败,刷卡器设备号码不存在,请联系客服!"); $retcode = "200"; //反馈状态 0 成功 200 自定义错误 } else { $query = "select fd_paycard_id,fd_paycard_active from tb_paycard where " . " (fd_paycard_authorid ='0' or fd_paycard_authorid is NULL) \n\t\t\t and fd_paycard_key = '{$paycardkey}' "; //首页广告显示 $db->query($query); if ($db->nf()) { $db->next_record(); $paycardid = $db->f(fd_paycard_id); $query = "update tb_paycard set fd_paycard_active = '1' ,fd_paycard_activetime = now()," . "fd_paycard_authorid = '{$authorid}',fd_paycard_posstate='2' where fd_paycard_id = '{$paycardid}'"; $db->query($query); $arr_message = array("result" => "success", "message" => "恭喜您,刷卡器已经激活成功!"); $retcode = "0"; //反馈状态 0 成功 200 自定义错误 } else { $query = "select fd_paycard_id,fd_paycard_active from tb_paycard where " . " 1\n\t\t\t and fd_paycard_key = '{$paycardkey}' and fd_paycard_authorid <>'{$authorid}'"; //首页广告显示 if ($db->execute($query)) { $retmessage = "该刷卡器已被其他商户激活"; } else { $retmessage = "你已激活刷卡器,可以直接使用了!"; } $arr_message = array("result" => "failure", "message" => $retmessage); $retcode = "200"; //反馈状态 0 成功 200 自定义错误 } } $arr_msg['msgbody']['result'] = $arr_message['result']; $arr_msg['msgbody']['message'] = $arr_message['message']; $returnvalue = array("msgbody" => $arr_msg['msgbody']); $returnval = TfbxmlResponse::ResponsetoApp($retcode, $returnvalue); return $returnval; }
function getmoreFileimg($scatid, $dateid, $limitnum = 6) { global $g_showpic; $db = new DB_test(); if ($dateid) { $querywhere = " and fd_cat_dateid='{$dateid}'"; } else { $queryorder = " limit 0,{$limitnum}"; } $query = "select fd_cat_thumurl as thumrul,fd_cat_urllink as urllink,fd_cat_no as no,fd_cat_id as id,fd_cat_url as url,fd_cat_id as id,fd_cat_name as content,fd_cat_display as display from tb_upload_category_list where fd_cat_scatid='{$scatid}' {$querywhere} order by fd_cat_no asc {$queryorder}"; if ($db->execute($query)) { $arr_yewuval = $db->get_all($query); } // echo $query; return $arr_yewuval; }
public static function readpmreqmoney($authorid) { $db = new DB_test(); $query = "select sum(fd_pmreq_repmoney) as repmoney,month(fd_pmreq_reqdatetime) as months," . "year(fd_pmreq_reqdatetime) as years " . "from tb_slotcardmoneyreq where fd_pmreq_authorid = '{$authorid}' and fd_pmreq_state = '9' " . "group by years,months "; if ($db->execute($query)) { $arr_monthreqmoney = $db->get_one($query); } return $arr_monthreqmoney; }
public static function get_cusfenrun($cusid, $appmenuno, $paymoney, $payfee, $feelirun = 0, $paydate = '', $payprice = '', $paynum = '') { $db = new DB_test(); $query = "select * from tb_appmenu where fd_appmnu_no = '{$appmenuno}'"; if ($db->execute($query)) { $arr_menuval = $db->get_one($query); $appmenuid = $arr_menuval['fd_appmnu_id']; } else { $appmenuid = 0; //所有功能 ; } $query = "select fd_cus_fenrunid as fenrunid\n from tb_customer where fd_cus_id = '{$cusid}' and fd_cus_state = 9 and\n fd_cus_active = '1' "; if ($db->execute($query)) { $arr_cus = $db->get_one($query); $fenrunid = $arr_cus['fenrunid']; } else { return 0; exit; } $query = "select *,fd_fenrun_orderbuycz as orderbuycz,fd_fenrun_agentprice as agentprice\n from tb_cus_fenrunset where fd_fenrun_id = '{$fenrunid}' "; if ($db->execute($query)) { $arr_fenrun = $db->get_one($query); } $agentprice = $arr_fenrun['agentprice']; $orderbuycz = $arr_fenrun['orderbuycz']; if ($appmenuno == 'orderbuy') { $cusfee = ($payprice - $orderbuycz - $agentprice) * $paynum; return $cusfee; exit; } if ($arr_fenrun['fd_fenrun_lirunset'] == 'all') { $appmenuid = 0; } $query = "select * from tb_cus_fenrunsetappmenu where fd_frmset_fenrunid = '{$fenrunid}' group by fd_frmset_appmnuid "; if ($db->execute($query)) { $arr_fenrunappmenu = $db->get_all_key($query, "fd_frmset_appmnuid"); } $arr_lirunset = $arr_fenrunappmenu[$appmenuid]; //获取到功能分润设置 if (is_array($arr_lirunset)) { $jsmoneytype = $arr_lirunset['fd_frmset_jsmoneytype']; switch ($jsmoneytype) { case "paymoney": $paycardmoney = $paymoney; //交易金额 break; case "payfee": $paycardmoney = $payfee; break; case "feelirun": $paycardmoney = $feelirun; break; } $mode = $arr_lirunset['fd_frmset_mode']; //润分方式 固定还是% $fixfee = $arr_lirunset['fd_frmset_fee']; //固定分润金额 $minfee = $arr_lirunset['fd_frmset_minfee']; //最小分润金额 $maxfee = $arr_lirunset['fd_frmset_maxfee']; //最大分润金额 $fee = $arr_lirunset['fd_frmset_sqfee']; //浮动费率 $fee = substr($fee, 0, -1); switch ($mode) { case "fix": $return_feemoney = $fixfee; break; default: $return_feemoney = round($fee / 100 * $paycardmoney, 2); $return_feemoney = $return_feemoney < $minfee ? $minfee : $return_feemoney; $return_feemoney = $return_feemoney > $maxfee ? $maxfee : $return_feemoney; break; } } else { $return_feemoney = 0; //为设置分润方案 } return $return_feemoney; }
public function payagentfenrunlist() { $db = new DB_test(); $arr_header = $this->arr_header; $arr_body = $this->arr_body; $arr_channelinfo = $this->arr_channelinfo; //$paycardid = trim(GetPayCalcuInfo::readpaycardid($arr_body['paycardid'])); //插卡器 $authorid = trim($arr_channelinfo['authorid']); //操作者 $agentid = trim($arr_channelinfo['agentid']); //代理商id $querytype = trim($arr_body['querytype']); //收益条件 $querywhere = trim($arr_body['querywhere']); //充值金额 $appfunid = trim($arr_body['appfunid']); //充值金额 switch ($querytype) { case "year": break; case "month": break; case "date": break; } $querywhere1 = " and fd_frlist_paydate like '%{$querywhere}%'"; $query = "select fd_frlist_cusid,sum(fd_frlist_cusfee) as totalfenrun\n from tb_cus_fenrunglist\n where fd_frlist_payrq = '00' and fd_frlist_sdcrid<100\n {$querywhere1} and fd_frlist_cusid = '{$agentid}' group by fd_frlist_cusid\n "; if ($db->execute($query)) { $arr_money = $db->get_one($query); } $query = "select fd_amtype_id as appfunid, fd_amtype_name as appfunname,\n sum(fd_frlist_paymoney) as paymoney,sum(fd_frlist_payfee) as payfee,sum(fd_frlist_cusfee) as allfenrun\n from tb_cus_fenrunglist left join tb_appmenu on fd_appmnu_no = fd_frlist_paytype\n left join tb_appmenutype on fd_amtype_id = fd_appmnu_amtypeid\n where fd_frlist_payrq = '00' and fd_frlist_sdcrid<100\n {$querywhere1} and fd_frlist_cusid = '{$agentid}' group by fd_amtype_id order by\n fd_amtype_no "; $db->query($query); $msgdiscount = $db->nf(); $arr_msg = auto_charset($db->getData('', 'msgbody'), 'gbk', 'utf-8'); if (!$arr_msg) { $arr_message = array("result" => "failure", "message" => "没有数据!"); $retcode = "200"; //反馈状态 0 成功 200 自定义错误 } else { $arr_message = array("result" => "success", "message" => "读取成功!"); $retcode = "0"; //反馈状态 0 成功 200 自定义错误 } $arr_msg['msgbody']['result'] = $arr_message['result']; $arr_msg['msgbody']['message'] = $arr_message['message']; $arr_msg['msgbody']['totalfenrun'] = $arr_money['totalfenrun']; $returnvalue = array("msgbody" => $arr_msg['msgbody']); $returnval = TfbxmlResponse::ResponsetoApp($retcode, $returnvalue); return $returnval; }
public static function readsuptfmgcount($authorid, $paytype) { $db = new DB_test(); $datetime = date("Y-m-d"); $query = "select count(1) as count " . "from tb_agentpaymoneylist where fd_agpm_authorid = '{$authorid}' and fd_agpm_paytype = '{$paytype}' and " . "fd_agpm_paydate = '{$datetime}' and fd_agpm_payrq = '00' "; if ($db->execute($query)) { $arr_count = $db->get_one($query); } return $arr_count['count']; }
function payOrderRq() { global $weburl; $db = new DB_test(); $arr_header = $this->arr_header; $arr_body = $this->arr_body; $arr_channelinfo = $this->arr_channelinfo; $authorid = trim($arr_channelinfo['authorid']); $paytype = 'orderbuy'; $orderpaytypeid = trim($arr_body['orderpaytypeid']); $orderprodureid = trim($arr_body['orderprodureid']); //支付类型id $ordernum = trim($arr_body['ordernum']); //充值金额 $orderprice = trim(u2g($arr_body['orderprice'])); //实际支付金额 $ordermoney = trim(u2g($arr_body['ordermoney'])); //订单金额 $ordershaddressid = trim($arr_body['ordershaddressid']); //手机所属地区 $oredershaddress = trim(u2g($arr_body['oredershaddress'])); //银行卡号 $ordershman = trim(u2g($arr_body['ordershman'])); //银行卡关联id tb_banckcard.fd_bankcard_id $ordershphone = trim(u2g($arr_body['ordershphone'])); //认证信息 $orderfucardno = trim(u2g($arr_body['orderfucardno'])); //认证信息 $orderfucardbank = trim(u2g($arr_body['orderfucardbank'])); //认证信息 $ordermemo = trim(u2g($arr_body['ordermemo'])); //认证信息 $agentno = trim(u2g($arr_body['agentno'])); //认证信息 $orderpaytype = trim($arr_body['paytype']); $promoney = trim(u2g($arr_body['promoney'])); //认证信息 $yunmoney = trim(u2g($arr_body['yunmoney'])); //认证信息 $produrename = trim(u2g($arr_body['produrename'])); $bkmoney = $ordermoney; //promoney+yunmoney $rechabkcardno = makeorderno("orderglist", "orderlist", "orl"); $arr_bkinfo = BankPayInfo::bankpayorder($authorid, $paycardid, $bkmoney, $orderfucardno); $bkntno = trim($arr_bkinfo['bkntno']); $sdcrid = trim($arr_bkinfo['sdcrid']); if ($agentno != "") { // $cusid =$this->checkcusagentno($agentno); $query = "select fd_cus_id as cusid from tb_customer where fd_cus_no = '{$agentno}'"; if ($db->execute($query)) { $arr_cusinfo = $db->get_one($query); $cusid = $arr_cusinfo['cusid']; } else { $arr_message = array("result" => "failure", "message" => "对不起,您填写的代理商代号错误,请重新填写!"); $retcode = "200"; //反馈状态 0 成功 200 自定义错误 $arr_msg['msgbody']['result'] = $arr_message['result']; $arr_msg['msgbody']['message'] = $arr_message['message']; $arr_msg['msgbody']['bkntno'] = $bkntno; $returnvalue = array("msgbody" => $arr_msg['msgbody']); $returnval = TfbxmlResponse::ResponsetoApp($retcode, $returnvalue); return $returnval; exit; } } $datetime = date("Y-m-d H:i:s"); $date = date("Y-m-d"); //$bkmoney = $bkorderNumber = trim($arr_bkinfo['bkorderNumber']); $datadetailArray['fd_orderlist_paytype'] = $paytype; $datadetailArray['fd_orderlist_no'] = $listno; $datadetailArray['fd_orderlist_authorid'] = $authorid; $datadetailArray['fd_orderlist_bkntno'] = $bkntno; $datadetailArray['fd_orderlist_date'] = $date; $datadetailArray['fd_orderlist_payrq'] = '01'; //刚请求的交易码状态为01 $datadetailArray['fd_orderlist_bkordernumber'] = $bkorderNumber; $datadetailArray['fd_orderlist_sdcrid'] = $sdcrid; $datadetailArray['fd_orderlist_produreid'] = $orderprodureid; $datadetailArray['fd_orderlist_produrename'] = $produrename; $datadetailArray['fd_orderlist_cusid'] = $cusid; //分润代理商 $datadetailArray['fd_orderlist_num'] = $ordernum; $datadetailArray['fd_orderlist_price'] = $orderprice; $datadetailArray['fd_orderlist_promoney'] = $promoney; $datadetailArray['fd_orderlist_yunmoney'] = $yunmoney; $datadetailArray['fd_orderlist_ordermoney'] = $ordermoney; $datadetailArray['fd_orderlist_shaddressid'] = $ordershaddressid; $datadetailArray['fd_orderlist_shaddress'] = $oredershaddress; $datadetailArray['fd_orderlist_shman'] = $ordershman; $datadetailArray['fd_orderlist_shphone'] = $ordershphone; $datadetailArray['fd_orderlist_fucardno'] = $orderfucardno; $datadetailArray['fd_orderlist_fucardbank'] = $orderfucardbank; $datadetailArray['fd_orderlist_memo'] = $ordermemo; $datadetailArray['fd_orderlist_datetime'] = $datetime; $datadetailArray['fd_orderlist_agentno'] = $agentno; $db->insert("tb_orderglist", $datadetailArray); $listid = $db->insert_id(); $arr_message = array("result" => "success", "message" => "请求交易码成功!"); $retcode = "0"; //反馈状态 0 成功 200 自定义错误 $arr_msg['msgbody']['result'] = $arr_message['result']; $arr_msg['msgbody']['message'] = $arr_message['message']; $arr_msg['msgbody']['bkntno'] = $bkntno; $returnvalue = array("msgbody" => $arr_msg['msgbody']); $returnval = TfbxmlResponse::ResponsetoApp($retcode, $returnvalue); return $returnval; }
if ($msgstart < 0) { $msgstart = 0; } $all_paymoney = 0; $query = "select *,case\n when fd_mrclist_payrq ='01' then '" . $arr_state[0] . "'\n when fd_mrclist_payrq ='00' then '" . $arr_state[1] . "'" . "when fd_mrclist_payrq ='03' then '" . $arr_state[2] . "'\n else '" . $arr_state[4] . "' END fd_mrclist_payrq,\n fd_mrclist_ofstate,\n case\n when fd_mrclist_ofstate ='1' then '<font color=blue>充值成功</font>'\n when fd_mrclist_ofstate ='-1' then '正在充值'\n else '<font color=red>充值失败</font>' END ofstate\n from tb_mobilerechargelist\n left join tb_author on fd_author_id = fd_mrclist_authorid\n left join tb_sendcenter on fd_sdcr_id = fd_mrclist_sdcrid\n where 1\n\t\t\tand (fd_mrclist_payrq = '00') and fd_mrclist_sdcrid<100 order by fd_mrclist_id desc "; $db->query($query); //and fd_agpm_paytype <>'recharge' $total = $db->num_rows($result); pageft($total, $displaypg, $url); if ($firstcount < 0) { $firstcount = 0; } $count = $firstcount; $query = "{$query} limit {$firstcount},{$displaypg}"; $rows = $db->num_rows(); if ($db->execute($query)) { $arr_val = $db->get_all($query); } if (is_array($arr_val)) { foreach ($arr_val as $key => $arr_val) { $tcount++; if ($arr_val['fd_mrclist_ofstate'] != '1') { $arr_val['eidt_ofstate'] = '<a href="javascript:void(0);" name="' . $arr_val['fd_mrclist_authorid'] . '" class="eidt_ofstate" rel="' . $arr_val['fd_mrclist_bkntno'] . '">再次充值</a>'; } else { $arr_val['eidt_ofstate'] = ""; } $t->set_var($arr_val); $arr_allval['all_paymoney'] += $arr_val['fd_mrclist_paymoney']; $arr_allval['all_rechamoney'] += $arr_val['fd_mrclist_rechamoney']; $t->parse("headbxbks", "HEADBXBK", true); }
public static function getTaocanfee($authorid, $array_taocan, $type, $money) { $db = new DB_test(); $bkcardscdmsetid = $array_taocan[0]['bkcardscdmsetid']; $bkcardpayfsetid = $array_taocan[0]['bkcardpayfsetid']; $slotscdmsetid = $array_taocan[0]['slotscdmsetid']; $slotpayfsetid = $array_taocan[0]['slotpayfsetid']; switch ($type) { case "1": // 信用卡还款 $listid = $bkcardpayfsetid; break; case "2": // 转账汇款 $listid = $bkcardpayfsetid; break; case "3": // 还款款 $listid = $bkcardpayfsetid; break; default: //银行卡 $listid = $bkcardpayfsetid; break; } $query = "select fd_payfset_maxfee as maxfee ,fd_payfset_minfee as minfee ,fd_payfset_fee as fee ," . "fd_payfset_defeedirct as defeedirct ,fd_payfset_arriveid as arriveid ,fd_payfset_fixfee as fixfee from tb_payfeeset where fd_payfset_id='{$listid}' "; $db->query($query); if ($db->execute($query)) { $array_taocan = $db->get_one($query); if ($array_taocan[0]['fixfee'] > 0) { $feemoney = $array_taocan[0]['fixfee']; } else { $fee = $array_taocan[0]['fee']; $feemoney = round($fee / 100 * $money, 2); $feemoney = $feemoney < $array_taocan[0]['minfee'] ? $array_taocan[0]['minfee'] : $feemoney; $feemoney = $feemoney > $array_taocan[0]['maxfee'] ? $array_taocan[0]['maxfee'] : $feemoney; } $arrvalue = array('feemoney' => $feemoney, 'defeedirct' => $array_taocan[0]['defeedirct'], 'arriveid' => $array_taocan[0]['defeedirct']); return $arrvalue; } else { return false; } }