public function checkshoubankinfo($authorid, $req_appenv) { $db = new DB_test(); $ErrorReponse = new ErrorReponse(); $query = "select * from tb_author where fd_author_id = '{$authorid}' and (fd_author_shoucardman =''" . "or fd_author_shoucardphone ='' or fd_author_shoucardno ='' or fd_author_shoucardbank ='' ) and fd_author_couponstate='1'"; $db->query($query); //echo $query; if ($db->nf()) { if ($req_appenv < 3) { $arr_message = array("result" => "failure", "message" => "还未申请商家银行号信息,进入“更多-》我的银行卡”功能补充资料!"); } else { $arr_message = array("result" => "failure", "message" => "还未申请商家银行号信息,请联系客服电话补充资料!"); } $retcode = "200"; //反馈状态 0 成功 200 自定义错误 $Error = array('result' => 'failure', 'retcode' => '200', 'retmsg' => $arr_message['message']); $ErrorReponse->reponError($Error); //出错反馈 return false; } else { $query = "select * from tb_author where fd_author_id = '{$authorid}' and fd_author_couponstate='0'"; $db->query($query); if ($db->nf()) { $arr_message = array("result" => "failure", "message" => "抵用券落地银行卡号等待审批中,请耐心等待!"); $retcode = "200"; //反馈状态 0 成功 200 自定义错误 $Error = array('result' => 'failure', 'retcode' => '200', 'retmsg' => $arr_message['message']); $ErrorReponse->reponError($Error); //出错反馈 return false; } $query = "select * from tb_author where fd_author_id = '{$authorid}' and fd_author_couponstate='2'"; $db->query($query); if ($db->nf()) { $arr_message = array("result" => "failure", "message" => "抵用券相关银行卡号审批不通过,请正确填写相关资料!"); $retcode = "200"; //反馈状态 0 成功 200 自定义错误 $Error = array('result' => 'failure', 'retcode' => '200', 'retmsg' => $arr_message['message']); $ErrorReponse->reponError($Error); //出错反馈 return false; } else { return true; } } }
public function CreateOrder($requestBody, $authorId, $payChannel) { $logger = Logger::getLogger("transfermoney"); $logger->debug("开始创建转账付款订单"); // 调用外部函数****** $logger->debug("正在创建转账付款订单 : 调用函数GetPayCalcuInfo::readpaycardid,传入参数(" . $requestBody["cardReaderId"] . ", " . $authorId . ")"); $agentInfo = GetPayCalcuInfo::readpaycardid($requestBody["cardReaderId"], $authorId); $logger->debug("正在创建转账付款订单 : 调用函数GetPayCalcuInfo::readpaycardid,返回的结果" . print_r($agentInfo, true)); // ******调用外部函数 $cardReaderId = $agentInfo["paycardid"]; // 刷卡器ID $agentId = $agentInfo["cusid"]; // 代理商ID $payChannelFee = 0; switch ($payChannel) { case "YiBao": $payChannelFee = YiBaoPay::GetPayFee($requestBody['payMoney']); break; } $orderId = "tfbtfs" . date("YmdHiss") . mt_rand(1000, 9999); // 调用外部函数****** $orderListNumber = makeorderno("transfermoneyglist", "tfmglist", "tfs"); // ******调用外部函数 $payDate = date("Y-m-d H:i:s"); $feeMoney = 0; // 调用外部函数****** $logger->debug("正在创建转账付款订单 : 调用函数getbankid,传入参数(" . $requestBody["receiveBankName"] . ")"); $receiveBankId = getbankid(u2g($requestBody["receiveBankName"])); if ($receiveBankId == "") { ErrorReponse::reponError(array("retcode" => "200", "retmsg" => "不支持的银行")); } $logger->debug("正在创建转账付款订单 : 调用函数getbankid,返回的结果" . $receiveBankId); $logger->debug("正在创建转账付款订单 : 调用函数GetPayCalcuInfo :: readPayFee,传入参数({$authorId}, {$receiveBankId}, " . $requestBody['transferMoney'] . ", " . $requestBody['arriveId'] . ", 2, " . $requestBody["payType"] . ")"); $payChannelFeeInfo = GetPayCalcuInfo::readPayFee($authorId, $receiveBankId, $requestBody['transferMoney'], $requestBody['arriveId'], 2, $requestBody["payType"]); $logger->debug("正在创建转账付款订单 : 调用函数GetPayCalcuInfo :: readPayFee,返回的结果" . print_r($payChannelFeeInfo, true)); if (is_array($payChannelFeeInfo)) { $feeMoney = $payChannelFeeInfo["feemoney"]; } $arriveDate = GetPayCalcuInfo::getfeedate($payDate, $payChannelFeeInfo['addday']); $logger->debug("正在创建转账付款订单 : 调用函数GetPayCalcuInfo :: getfeedate,返回的结果" . $arriveDate); // ******调用外部函数 $query = "INSERT INTO tb_transfermoneyglist (fd_tfmglist_no, fd_tfmglist_bkordernumber, fd_tfmglist_payrq, fd_tfmglist_paycardid, fd_tfmglist_authorid, fd_tfmglist_sdcrid, fd_tfmglist_sdcrpayfeemoney, fd_tfmglist_sdcragentfeemoney, fd_tfmglist_paytype, fd_tfmglist_paydate, fd_tfmglist_payfeedirct, fd_tfmglist_fucardno, fd_tfmglist_fucardbank, \n\t\tfd_tfmglist_fucardmobile, fd_tfmglist_fucardman, \n\t\tfd_tfmglist_shoucardno, fd_tfmglist_shoucardbank, \n\t\tfd_tfmglist_shoucardman, fd_tfmglist_shoucardmobile, fd_tfmglist_sendsms, fd_tfmglist_shoucardmemo, fd_tfmglist_current, fd_tfmglist_paymoney, fd_tfmglist_payfee, fd_tfmglist_money, fd_tfmglist_feebankid, fd_tfmglist_arrivedate, fd_tfmglist_arriveid, fd_tfmglist_state) VALUES \n\t\t('{$orderListNumber}', '{$orderId}', '01', \n\t\t'{$cardReaderId}', {$authorId}, 3, {$payChannelFee}, \n\t\t0.00, '" . $requestBody["payType"] . "', '{$payDate}', 'f', \n\t\t'" . $requestBody["sendBankCardId"] . "', '" . $requestBody["sendBankName"] . "', \n\t\t'" . $requestBody["sendPhone"] . "', '" . $requestBody["sendPersonName"] . "', \n\t\t'" . $requestBody["receiveBankCardId"] . "', '" . $requestBody["receiveBankName"] . "', \n\t\t'" . $requestBody["receivePersonName"] . "', '" . $requestBody["receivePhone"] . "', 0, '', \n\t\t'RMB', " . $requestBody["transferMoney"] . ", {$feeMoney}, " . $requestBody["payMoney"] . ", {$receiveBankId}, \n\t\t'{$arriveDate}', '" . $requestBody['arriveId'] . "', '0')"; $logger->debug("新增数据进 tb_transfermoneyglist 的sql" . $query); $db = new DB_test(); $db->query(u2g($query)); return $orderId; }
public function PayWithVerifyCode() { $now = time(); $logger = Logger::getLogger('transfermoney'); $logger->debug("开始使用验证码进行验证后充值({$now})"); $authorId = trim($this->arr_channelinfo['authorid']); // 用户ID $msgBody = $this->arr_body; foreach ($msgBody as $key => $value) { $msgBody[$key] = trim($value); } // 必填的字段 $requiredField = array("orderId", "verifyCode"); foreach ($requiredField as $key => $value) { if ($msgBody[$value] == "") { ErrorReponse::reponError(array('retcode' => '200', 'retmsg' => '用户输入信息不完整')); } } $logger->info("正在使用验证码进行验证后充值({$now}) : 输入的信息包括" . print_r($msgBody, true)); $cardInfo = array("orderId" => $msgBody['orderId'], "verifyCode" => $msgBody['verifyCode']); $payResult = YiBaoPay::PayWithVerifyCode($cardInfo); $logger->info("完成易宝支付({$now}), 返回的结果" . print_r($payResult, true)); TransferMoney::YiBaoPayFeedback($payResult, $msgBody['orderId']); if ($payResult['r1_Code'] == "1") { $retcode = "0"; $arr_message = array("result" => "success", "message" => "支付成功,正在为您转账中"); } else { $retcode = "200"; $arr_message = array("result" => "fail", "message" => $payResult['errorMsg']); } $arr_msg["msgbody"]['result'] = $arr_message['result']; $arr_msg["msgbody"]['message'] = $arr_message['message']; $logger->info("完成使用验证码进行验证后充值({$now}) : 返回的信息包括" . print_r($arr_msg["msgbody"], true)); $returnvalue = array("msgbody" => $arr_msg["msgbody"]); $returnval = TfbxmlResponse::ResponsetoApp($retcode, $returnvalue); return $returnval; }
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 deletePassenger() { $authorid = trim($this->arr_channelinfo['authorid']); // 必填 if($authorid == "") ErrorReponse :: reponError(array("retcode" => "200", "retmsg" => "用户输入信息不完整")); $arr_body = $this->arr_body; $id = trim($arr_body["id"]); $type = trim($arr_body["type"]); if($type == "1") { // 删除乘机人 $sql = "UPDATE ctrip_airticket_passenger SET is_active = 0 WHERE id = " . $id; } else if($type == "2") { // 删除联系人 $sql = "UPDATE ctrip_airticket_contacter SET is_active = 0 WHERE id = " . $id; } else ErrorReponse :: reponError(array("retcode" => "200", "retmsg" => "用户输入信息不完整")); if(isset($sql)) { $db = new DB_test(); $result = $db->query($sql); $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; }
error_reporting(E_ERROR); $reqcontext = file_get_contents("php://input"); $TfbAuthRequest = new TfbAuthRequest(); $Publiccls = new PublicClass(); //初始化类实例 set_error_handler('my_error_handler'); $reqxmlcontext = $TfbAuthRequest->getReqContext($reqcontext); //解密并获得请求数据 $arr_xml = $Publiccls->xml_to_array($reqxmlcontext); $authorid = $arr_xml['operation_request']['msgheader']['channelinfo']['authorid']; $arr_authorinfo = AuToken::getauthorusername($authorid); $authortruename = $arr_authorinfo['username']; $file = "../../" . CONST_LOGDIR . "/" . date('md') . "-" . $authortruename . "log" . ".txt"; $filehandle = fopen($file, "a"); $now = date('Y-m-d H:i:s'); fwrite($filehandle, $now . "\r\n======请求内容:\r\n" . $reqcontext . "\r\n\r\n" . $reqxmlcontext); fclose($filehandle); $apiAutoken = $TfbAuthRequest->apiAutoken($reqxmlcontext); //授权码等信息验证 if ($apiAutoken && $api_name && $api_name_func) { spl_autoload_register(array('Loader', 'loadClass')); $classname = $api_name; $ApiClass = new $classname(); $returnvalue = $ApiClass->{$api_name_func}(); echo $returnvalue; } else { $ErrorReponse = new ErrorReponse(); $Error = array('result' => 'failure', 'retcode' => '404'); $ErrorReponse->reponError($Error); //出错反馈 }
public static function readPayQuota($authorid, $paycardid, $paytype, $paymoney) { global $arr_limitauthorid; if (!in_array($authorid, $arr_limitauthorid)) { return true; } if ($paytype == 'coupon' || $paytype == 'creditcard' || $paytype == 'tfmg' || $paytype == 'suptfmg' || $paytype == 'order' || $paytype == 'recharge') { return true; } $db = new DB_test(); $ErrorReponse = new ErrorReponse(); $query = "select fd_author_bkcardscdmsetid as bkcardscdmsetid , fd_author_bkcardpayfsetid as bkcardpayfsetid," . " fd_author_slotscdmsetid as slotscdmsetid, fd_author_slotpayfsetid as slotpayfsetid from tb_author " . " where fd_author_id='{$authorid}'"; //echo $query; if ($db->execute($query)) { $array_taocan = $db->get_one($query); } $bkcardscdmsetid = $array_taocan['bkcardscdmsetid']; $slotscdmsetid = $array_taocan['slotscdmsetid']; $paydate = date("Y-m-d"); $query = "select fd_scdmset_sallmoney as sallmoney,fd_scdmset_nallmoney as nallmoney, fd_scdmset_everymoney as everymoney," . "fd_scdmset_everycounts as everycounts , fd_scdmset_severymoney as severymoney,fd_scdmset_neverymoney as neverymoney " . "from tb_slotcardmoneyset where fd_scdmset_id='{$bkcardscdmsetid}' "; //额度都以元 if ($db->execute($query)) { $arr_sysquota = $db->get_one($query); } $arr_monthreqmoney = CheckPayQuota::readpmreqmoney($authorid); //申请上来的审批额度信息 $arr_monthquota = CheckPayQuota::readmonthnmoney($authorid, $paycardid, $paytype); //每月已使用额度信息 $arr_datequota = CheckPayQuota::readdatenmoney($authorid, $paycardid, $paydate, $paytype); //本日已使用额度问题 $sysmonthallmoney = $arr_sysquota['nallmoney'] + $arr_monthreqmoney['paymoney']; //当前月份总共可以使用额度 $monthallmoney = $paymoney + $arr_monthquota['paymoney']; //当前月份总共可以使用额度 if ($paymoney > $arr_sysquota['neverymoney']) { $Error = array('result' => 'failure', 'retcode' => '200', 'retmsg' => '每笔交易额最大限制' . $arr_sysquota['neverymoney'] . "元"); $ErrorReponse->reponError($Error); //出错反馈 } if ($monthallmoney > $sysmonthallmoney) { $Error = array('result' => 'failure', 'retcode' => '200', 'retmsg' => '每月可使用额度已用完,请登录PC端个人平台申请额外额度!'); $ErrorReponse->reponError($Error); //出错反馈 } if ($arr_datequota['datecount'] >= $arr_sysquota['everycounts']) { $Error = array('result' => 'failure', 'retcode' => '200', 'retmsg' => '您每日的刷卡次数' . $arr_sysquota['everycounts'] . '已经用完,请明天再试!'); $ErrorReponse->reponError($Error); //出错反馈 } if ($arr_datequota['paymoney'] >= $arr_sysquota['everymoney']) { $Error = array('result' => 'failure', 'retcode' => '200', 'retmsg' => '您每日的刷卡金额' . $arr_sysquota['everymoney'] . '元已经用完,请明天再试!'); $ErrorReponse->reponError($Error); //出错反馈 } return true; }
public function ReadMobileRechangeList() { $authorId = trim($this->arr_channelinfo['authorid']); // 用户ID if ($authorId == "") { ErrorReponse::reponError(array('retcode' => '200', 'retmsg' => '用户信息异常')); } $pageStart = trim($this->arr_body['msgstart']) + 0; $pageCount = trim($this->arr_body['msgdisplay']) + 0; $pageCount = $pageCount > 0 ? $pageCount : 8; $query = "SELECT fd_mrclist_rechamoney AS rechamoney, fd_mrclist_paymoney AS rechapaymoney, \n\t\t\t\tfd_mrclist_mobileprov AS rechamobileprov, fd_mrclist_bankcardno AS rechabkcardno, \n\t\t\t\tfd_mrclist_paydate AS rechadatetime, fd_mrclist_rechaphone AS rechamobile \n\t\t\t\tFROM tb_mobilerechargelist \n\t\t\t\tWHERE fd_mrclist_authorid = '{$authorId}' AND fd_mrclist_payrq = '00' \n\t\t\t\tORDER BY fd_mrclist_paydate DESC LIMIT {$pageStart}, {$pageCount}"; $db = new DB_test(); $db->query($query); $msgBody = auto_charset($db->getData('', 'msgbody'), 'gbk', 'utf-8'); if (!$msgBody) { $arr_message = array("result" => "fail", "message" => "您还未使用过手机充值业务!"); $retcode = "200"; } else { $arr_message = array("result" => "success", "message" => ""); $retcode = "0"; } $msgBody['msgbody']['result'] = $arr_message['result']; $msgBody['msgbody']['message'] = $arr_message['message']; $returnvalue = array("msgbody" => $msgBody['msgbody']); $returnval = TfbxmlResponse::ResponsetoApp($retcode, $returnvalue); return $returnval; }
public static function bankorderquery($authorid, $paycardid, $orderNumber, $orderTime) { global $weburl; global $g_sdcrid; $ErrorReponse = new ErrorReponse(); // 1. 初始化 $arr_merid = BankPayInfoV2::getpaymerinfo($authorid); $merid = $arr_merid['merid']; $securitykey = $arr_merid['securitykey']; $tradeurl = $arr_merid['tradeurl']; $queryurl = $arr_merid['queryurl']; $sdcrid = $arr_merid['sdcrid']; $payurl = $weburl . "third_api/upmp_query_v2.php?orderTime={$orderTime}&orderNumber={$orderNumber}&merid={$merid}&securitykey={$securitykey}&queryurl={$queryurl}&tradeurl={$tradeurl}"; // echo $payurl; $ch = curl_init(); // 2. 设置选项,包括URL curl_setopt($ch, CURLOPT_URL, $payurl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0); // 3. 执行并获取HTML文档内容 //$arr_output[] = curl_exec($ch); $output = curl_exec($ch); $file = "../../tfb_log/" . date('md') . "-" . $sdcrid . "log" . ".txt"; $filehandle = fopen($file, "a"); $now = date('Y-m-d H:i:s'); fwrite($filehandle, $now . "\r\n======银联查询内容:\r\n" . $output . "\r\n\r\n" . $payurl); fclose($filehandle); if ($output === FALSE) { $Error = array('rettype' => '700', 'retcode' => '700', 'retmsg' => curl_error($ch)); $ErrorReponse->reponError($Error); exit; } $arr_ofpayinfo = $output; if ($output == true) { return $arr_ofpayinfo; exit; } // 4. 释放curl句柄 curl_close($ch); if ($arr_ofpayinfo['respCode'] != 0) { $Error = array('rettype' => '700', 'retcode' => '700', 'retmsg' => $arr_ofpayinfo['respMsg'] . "[" . $arr_ofpayinfo['respCode'] . "]"); $ErrorReponse->reponError($Error); exit; } else { return $arr_ofpayinfo; } }
public static function bankpayorder($money, $cardinfo = '') { global $weburl; $ErrorReponse = new ErrorReponse(); // 1. 初始化 $cardinfo = "{" . $cardinfo . "}"; $money = round($money * 100, 0) + 0; $payurl = $weburl . "upmp/examples/purchase.php?money={$money}&cardinfo={$cardinfo}"; $ch = curl_init(); // 2. 设置选项,包括URL curl_setopt($ch, CURLOPT_URL, $payurl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0); // 3. 执行并获取HTML文档内容 //$arr_output[] = curl_exec($ch); $output = curl_exec($ch); if ($output === FALSE) { $Error = array('rettype' => '800', 'retcode' => '800', 'retmsg' => curl_error($ch)); $ErrorReponse->reponError($Error); exit; } //echo $output; $str = str_replace("(", "", str_replace(")", "", str_replace("Array", "", str_replace(" ", "", $output)))); $arr_value = explode("[", $str); for ($i = 0; $i < count($arr_value); $i++) { $arr_valuetmp = explode("]=>", $arr_value[$i]); $arr_bankpay[$arr_valuetmp[0]] = $arr_valuetmp[1]; } // 4. 释放curl句柄 curl_close($ch); if ($arr_bankpay['respCode'] != 0) { $Error = array('rettype' => '800', 'retcode' => '800', 'retmsg' => $arr_bankpay['respMsg'] . "[" . $arr_bankpay['respCode'] . "]"); $ErrorReponse->reponError($Error); exit; } else { $bkorderno = $arr_bankpay['tn']; return $bkorderno; } }