public function validateUser() { $retcode = "200"; $arr_message = array("result" => "fail", "message" => "操作出现异常,请稍后再试!"); $db = new DB_test(); $phonenumber = trim($this->arr_body['phonenumber']); $query = "SELECT fd_author_id FROM tb_author WHERE fd_author_username = '******'"; $authorid = $db->get_all($query); if ($authorid != 0 && count($authorid) > 0) { $authorid = $authorid[0]["fd_author_id"]; $query = "SELECT Q.fd_question_contect AS que, A.fd_answer AS answer \n\t\t\t\t\tFROM tb_safeguard_secque_useranswer AS A \n\t\t\t\t\tINNER JOIN tb_safeguard_secque AS Q ON A.fd_question_id = Q.fd_question_id \n\t\t\t\t\tWHERE A.fd_author_id = " . $authorid; $db->query($query); $retcode = "0"; if ($db->nf() > 0) { $arr_msg = auto_charset($db->getData('', 'msgbody'), 'gbk', 'utf-8'); $arr_msg['msgbody']['authorid'] = $authorid; $arr_message = array("result" => "success", "message" => "成功获取密保问题"); } else { $retcode = "200"; $arr_message = array("result" => "failure", "message" => "您还未设置过密保问题"); } } else { $retcode = "200"; $arr_message = array("result" => "failure", "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; }
public function RelateAgent($authorId, $agentCode) { $logger = Logger::getLogger('AuthorInfo'); $logger->info("开始绑定代理商 : authorId : $authorId, agentCode : $agentCode"); $db = new DB_test(); $query = "SELECT fd_cus_id FROM tb_customer WHERE fd_cus_no = '$agentCode'"; $logger->debug("开始绑定代理商 : query : $query"); $agentId = $db->get_all($query); if(!is_array($agentId) || count($agentId) != 1) { $logger->debug("开始绑定代理商 : return 0"); return 0; } else { $query = "UPDATE tb_author SET fd_author_bdagentno = '$agentCode', fd_author_bdagentid = " . $agentId[0]["fd_cus_id"] . ", fd_author_bdagenttime = NOW() WHERE fd_author_id = $authorId"; $logger->debug("开始绑定代理商 : query : $query"); $db->query($query); return 1; } }
$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); } } else {
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})回写进通付宝数据库"); }
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 function completeOrder() { $logger = Logger::getLogger('gamerecharge'); $logger->debug("start completeOrder"); $authorid = trim($this->arr_channelinfo['authorid']); $bkntno = trim($this->arr_body['bkntno']); $retcode = "200"; $arr_message = array("result" => "fail", "message" => "操作出现异常,请稍后再试!"); $hasReceiveMoney = false; if ($authorid != "" && $bkntno != "") { $logger->debug("process completeOrder : authorid and bkntno : (" . $authorid . ", " . $bkntno . ")"); $query = "SELECT *, DATE_FORMAT(fd_grclist_paydate,'%Y%m%d') as fd_grclist_paydate FROM tb_gamerechargelist WHERE fd_grclist_authorid = {$authorid} AND fd_grclist_bkntno = '{$bkntno}'"; $db = new DB_test(); $orderInDB = $db->get_all($query); if ($orderInDB != 0 && count($orderInDB) > 0) { $orderNumber = $orderInDB[0]["fd_grclist_bkordernumber"]; $orderTime = $orderInDB[0]["fd_grclist_paydate"]; $logger->debug("process completeOrder : orderNumber : (" . $orderNumber . ")"); $arr_returninfo = BankPayInfoV2::bankorderquery($authorid, '', $orderNumber, $orderTime); $logger->debug("process completeOrder : value from BankPayInfoV2 : (" . $arr_returninfo . ")"); if (md5($arr_returninfo) == "cace2a1f74fa974808c185f17ef557de") { $retcode = 0; $arr_message = array("result" => "success", "message" => "付款已收到,正在为您充值中!"); $hasReceiveMoney = true; } else { $arr_message = array("result" => "fail", "message" => $arr_returninfo); } } else { $arr_message = array("result" => "fail", "message" => "输入信息有误"); } } else { $arr_message = array("result" => "fail", "message" => "输入信息不完整"); } if ($hasReceiveMoney) { $logger->debug("process completeOrder : start ofpay"); // 开始调用欧飞接口进行充值 if ($orderInDB != 0 && count($orderInDB) > 0) { $cardid = $orderInDB[0]["fd_grclist_gamecardid"]; $cardnum = $orderInDB[0]["fd_grclist_gamecardnum"]; $game_userid = $orderInDB[0]["fd_grclist_gameuserid"]; $game_area = $orderInDB[0]["fd_grclist_gamearea"]; $game_srv = $orderInDB[0]["fd_grclist_gamesrv"]; $objOfpayV2 = new OfpayV2(); $returnvalue = $objOfpayV2->gameRecharge($orderNumber, $cardid, $cardnum, $game_userid, $game_area, $game_srv, &$errMsg); $logger->debug("process completeOrder : value from OfpayV2 : (" . $returnvalue . ")"); if ($errMsg != "") { $arr_message['message'] = $errMsg; } $query = "UPDATE tb_gamerechargelist SET fd_grclist_state = 1, fd_grclist_datetime = NOW() WHERE fd_grclist_authorid = {$authorid} AND fd_grclist_bkntno = '{$bkntno}'"; $db->query($query); $this->customerProfit($orderInDB); } } $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; }
public function GetGuestRoom() { $sql = "SELECT id, name, resident, bed_size AS bedSize, url FROM ctrip_hotel_room LEFT JOIN ctrip_hotel_image ON ctrip_hotel_room.name = ctrip_hotel_image.caption WHERE ctrip_hotel_room.hotel_id = 431626 AND ctrip_hotel_image.hotel_id = 431626 ORDER BY id, name"; $db = new DB_test(); $db->query($sql); $roomList = $db->get_all($sql); for($i = 0; $i < count($roomList); $i++) { $room = array(); $room["code"] = $roomList[$i]["id"]; $room["name"] = auto_charset($roomList[$i]["name"], 'gbk', 'utf-8');; $room["resident"] = $roomList[$i]["resident"]; $room["bedSize"] = $roomList[$i]["bedSize"]; $room["price"] = 124; $room["priceCode"] = 121242; $room["roomImage"][] = "http://Images4.c-ctrip.com/target/hotel/1000/217/d2e0c48eddbc4daca9137f1da436c948_550_412.jpg"; $room["roomImage"][] = "http://Images4.c-ctrip.com/target/hotel/1000/83/5cc5832beaff4171aa8c8abb953aab01_550_412.jpg"; $room["roomImage"][] = "http://Images4.c-ctrip.com/target/hotel/1000/86/71e73bfa996f434bb019d4484e244f00_550_412.jpg"; $arr_msg['msgbody'][] = $room; } $arr_message = array("result" => "success", "message" => "成功获取数据"); $retcode = "0"; $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; }
private function getAuthorInfo($authorid, $mobile) { $now = time(); $logger = Logger::getLogger('AuthorInfo'); $logger->debug("start getAuthorInfo({$now}) : authorid({$authorid}), mobile({$mobile})"); if ($authorid != "") { $query = "SELECT fd_author_isstop, fd_author_state, fd_author_id, fd_author_password, fd_author_paypassword, fd_author_cusid, fd_author_bdagentid \n\t\t\t\t\tFROM tb_author WHERE fd_author_id = '{$authorid}'"; } else { $query = "SELECT fd_author_isstop, fd_author_state, fd_author_id, fd_author_password, fd_author_paypassword, fd_author_cusid, fd_author_bdagentid \n\t\t\t\t\tFROM tb_author WHERE fd_author_username = '******'"; } if ($query != "") { $logger->debug("process getAuthorInfo({$now}) : query({$query})"); $db = new DB_test(); $result = $db->get_all($query); if (!is_array($result) || count($result) != 1) { $logger->error("process getAuthorInfo({$now}) : get data from query({$query}), dataInDB(" . print_r($result, true) . ")"); return null; } else { $author = array("fd_author_isstop" => $result[0]["fd_author_isstop"], "fd_author_state" => $result[0]["fd_author_state"], "fd_author_id" => $result[0]["fd_author_id"], "fd_author_password" => $result[0]["fd_author_password"], "fd_author_paypassword" => $result[0]["fd_author_paypassword"], "fd_author_bdagentid" => $result[0]["fd_author_bdagentid"], "fd_author_cusid" => $result[0]["fd_author_cusid"] + 0); return $author; } } return null; }
public function CheckTransStatus() { $now = time(); $logger = Logger::getLogger('mobilerecharge'); $logger->debug("开始银联支付完成后,检查订单状态({$now})"); $msgBody = $this->arr_body; $transNumber = trim($msgBody['bkntno']); $result = trim($msgBody['result']); if ($transNumber == "") { ErrorReponse::reponError(array('retcode' => '200', 'retmsg' => '账单信息不能为空')); } $logger->info("正在银联支付完成后,检查订单状态({$now}) : transNumber({$transNumber}), result({$result})"); $query = "SELECT fd_mrclist_bkordernumber AS orderId, DATE_FORMAT(fd_mrclist_date, '%Y%m%d') AS orderTime FROM tb_mobilerechargelist \n\t\t\t\tWHERE fd_mrclist_bkntno = '{$transNumber}'"; $logger->debug("正在银联支付完成后,检查订单状态({$now}) : query({$query})"); $db = new DB_test(); $dataInDB = $db->get_all($query); if (!is_array($dataInDB) || count($dataInDB) != 1) { $logger->error("完成银联支付完成后,检查订单状态({$now}) : 数据({$query})有误(" . print_r($dataInDB, true) . ")"); ErrorReponse::reponError(array('retcode' => '200', 'retmsg' => '账单信息异常')); } $orderId = $dataInDB[0]['orderId']; $orderTime = $dataInDB[0]['orderTime']; $logger->debug("正在银联支付完成后,检查订单状态({$now}) : orderId({$orderId}), orderTime({$orderTime})"); if ($orderId == "" || $orderTime == "") { $logger->error("完成银联支付完成后,检查订单状态({$now}) : 订单号异常 orderId({$orderId}), orderTime({$orderTime})"); ErrorReponse::reponError(array('retcode' => '200', 'retmsg' => '订单号异常')); } $payResult = BankPayInfoV3::GetTransStatus($orderId, $orderTime); $logger->debug("正在银联支付完成后,检查订单状态({$now}) : payResult(" . $payResult . ")"); $payResult = md5("" . (string) $payResult . ""); if ($payResult == "cace2a1f74fa974808c185f17ef557de") { // bankReturnInfo为00 $retcode = 0; $arr_message = array("result" => "success", "message" => "支付成功,正在为您充值中!"); } else { $arr_message = array("result" => "fail", "message" => "支付失败,如有疑问,请联系客服!"); } MobileRecharge::UpmpPayFeedback($payResult, $orderId); $arr_msg['msgbody']['result'] = $arr_message['result']; $arr_msg['msgbody']['message'] = $arr_message['message']; $logger->info("完成银联支付完成后,检查订单状态({$now}) : msgbody" . print_r($arr_msg['msgbody'], true)); $returnvalue = array("msgbody" => $arr_msg['msgbody']); $returnval = TfbxmlResponse::ResponsetoApp($retcode, $returnvalue); return $returnval; }
public function completeOrder() { $retcode = "200"; $arr_message = array("result" => "fail", "message" => "操作出现异常,请稍后再试!"); $logger = Logger::getLogger('utility'); $logger->debug("start submitOrder"); $authorid = trim($this->arr_channelinfo['authorid']); $arr_body = $this->arr_body; $orderid = trim($arr_body['orderid']); $bkntno = trim($arr_body['bkntno']); $hasReceiveMoney = false; $db = new DB_test(); $query = "SELECT *, DATE_FORMAT(fd_submit_time,'%Y%m%d') as orderTime FROM tb_utility_order WHERE fd_author_id = {$authorid} AND fd_order_id = {$orderid}"; $orderInDB = $db->get_all($query); if ($orderInDB != 0 && count($orderInDB) > 0) { $orderNumber = $orderInDB[0]["fd_bkordernumber"]; $orderTime = $orderInDB[0]["orderTime"]; $arr_returninfo = BankPayInfoV2::bankorderquery($authorid, '', $orderNumber, $orderTime); if (md5($arr_returninfo) == "cace2a1f74fa974808c185f17ef557de") { $retcode = 0; $arr_message = array("result" => "success", "message" => "付款已收到,正在为您充值中!"); $hasReceiveMoney = true; } else { $arr_message = array("result" => "fail", "message" => $arr_returninfo); } } if ($hasReceiveMoney) { // interface info $usernumber = "7000035"; $sign = "ae4544eaa21f4575997c12332581e662"; $inordernumber = "IWEC" . $usernumber . date("YmdHis") . "6543"; $outordernumber = $orderid; $proId = $orderInDB[0]["fd_pro_id"]; $account = $orderInDB[0]["fd_account_id"]; $paymoney = $orderInDB[0]["fd_total_bill"]; $starttime = date("Y-m-d H:i:s"); $timeout = 30; $url = "http://lifeapi.salerwise.com/IWEC/IRechargeList_WEC"; $yearmonth = ""; $recordkey = $usernumber . $inordernumber . $outordernumber . $proId . $account . $paymoney . $yearmonth . $starttime . $timeout . $sign; $recordkey = md5($recordkey); $recordkey = substr($recordkey, 0, 16); $recordkey = strtoupper($recordkey); $data = array('usernumber' => $usernumber, 'inordernumber' => $inordernumber, 'outordernumber' => $outordernumber, 'proId' => $proId, 'account' => $account, 'paymoney' => $paymoney, 'starttime' => $starttime, 'timeout' => $timeout, 'recordkey' => $recordkey, 'yearmonth' => $yearmonth); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $file_contents = curl_exec($ch); curl_close($ch); $result = false; if ($file_contents != "") { $file_contents = str_replace("GB2312", "UTF-8", $file_contents); $xml = simplexml_load_string($file_contents); foreach ($xml->children() as $child) { if ($child->getName() == "result" && (string) $child == "success") { $result = true; } } } $this->customerProfit($orderInDB[0]); if ($result) { $query = "UPDATE tb_utility_order SET fd_order_state = 3, fd_complete_time = NOW() WHERE fd_author_id = {$authorid} AND fd_order_id = {$orderid}"; $db->query($query); $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; }