public function orderPayrqStatus()
 {
     $db = new DB_test();
     $arr_header = $this->arr_header;
     $arr_body = $this->arr_body;
     $arr_channelinfo = $this->arr_channelinfo;
     $bkntno = trim($arr_body['bkntno']);
     //交易流水号
     //$paycardid = trim(GetPayCalcuInfo::readpaycardid($arr_body['paycardid'])); //刷卡器设备号
     $authorid = trim($arr_channelinfo['authorid']);
     //authorid
     $result = $arr_body['result'];
     $nowdate = date("Y-m-d H:i:s");
     //手机卡充值业务
     $query = "select fd_orderlist_bkordernumber as bkordernumber,fd_orderlist_authorid as authorid ,\n                  fd_orderlist_date as orderdate ,DATE_FORMAT(fd_orderlist_date,'%Y%m%d') as orderTime\n                  from tb_orderglist\n                  where 1  and  fd_orderlist_bkntno = '{$bkntno}' and fd_orderlist_authorid = '{$authorid}'  limit 1";
     $arr_val = $db->get_one($query);
     $orderNumber = $arr_val['bkordernumber'];
     $orderTime = $arr_val['orderTime'];
     $arr_returninfo = BankPayInfo::bankorderquery($authorid, '', $orderNumber, $orderTime);
     $arr_returninfo = $this->Publiccls->xml_to_array($arr_returninfo);
     if ($result == 'success') {
         $retcode = 0;
         //反馈状态 0 成功 200 自定义错误
         $arr_message = array("result" => "success", "message" => "订单已支付完成");
     } else {
         $retcode = 0;
         //反馈状态 0 成功 200 自定义错误
         $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;
 }
 public function orderPayReq()
 {
     $db = new DB_test();
     $arr_header = $this->arr_header;
     $arr_body = $this->arr_body;
     $arr_channelinfo = $this->arr_channelinfo;
     $orderid = g2u(trim($arr_body['orderid']));
     $orderno = g2u(trim($arr_body['orderno']));
     $paymoney = trim($arr_body['paymoney'] + 0);
     $fucardno = g2u(trim($arr_body['bankcardno']));
     $bankname = g2u(trim($arr_body['bankname']));
     $authorid = g2u(trim($arr_channelinfo['authorid']));
     //$paycardid = u2g(trim(GetPayCalcuInfo::readpaycardid($arr_body['paycardid']))); //银行类型
     $arr_message = array("result" => "success", "message" => "成功获取订单交易流水号!");
     $arr_msg['msgbody']['result'] = $arr_message['result'];
     $arr_msg['msgbody']['message'] = $arr_message['message'];
     $bkmoney = $paymoney;
     $arr_bkinfo = BankPayInfo::bankpayorder($authorid, $paycardid, $paymoney, $fucardno);
     $bkntno = trim($arr_bkinfo['bkntno']);
     $arr_feeinfo['bkordernumber'] = $bkorderNumber = $arr_bkinfo['bkorderNumber'];
     $arr_feeinfo['sdcrid'] = $sdcrid = trim($arr_bkinfo['sdcrid']);
     $sdcrpayfee = substr($arr_bkinfo['sdcrpayfee'], 0, -1);
     //银联收取明盛浮动费率
     $arr_feeinfo['sdcrpayfeemoney'] = $sdcrpayfeemoney = $bkmoney * $sdcrpayfee / 100 > $arr_bkinfo['minsdcrpayfee'] ? $bkmoney * $sdcrpayfee / 100 : $arr_bkinfo['minsdcrpayfee'];
     $paytype = 'order';
     $arr_msg['msgbody']['bkntno'] = $bkntno;
     $ccgno = makeorderno("orderpayglist", "oplist", "opg");
     $query = "insert into tb_orderpayglist(\n\t\t\t\t\t\t\t\t\tfd_oplist_no\t\t\t,fd_oplist_paycardid\t\t,fd_oplist_authorid\t,\n\t\t\t\t\t\t            fd_oplist_paydate\t\t,fd_oplist_orderid   \t\t,fd_oplist_fucardno\t,\n\t\t\t\t\t\t            fd_oplist_bkntno\t\t,fd_oplist_payrq           ,fd_oplist_paytype     ,\n\t\t\t\t\t\t            fd_oplist_current\t\t,fd_oplist_paymoney\t\t   ,fd_oplist_payfee\t\t,\n\t\t\t\t\t\t            fd_oplist_money\t\t,fd_oplist_orderno             ,fd_oplist_shopid ,\n\t\t\t\t\t\t            fd_oplist_fucardbank\t\t,fd_oplist_fucardmobile,\n\t\t\t\t\t\t            fd_oplist_fucardman    ,fd_oplist_feebankid       ,fd_oplist_state ," . "fd_oplist_bkorderNumber,fd_oplist_sdcrid\t\t,fd_oplist_sdcrpayfeemoney \t\n\t\t\t\t\t\t            )values\n\t\t\t\t\t\t\t\t   ('{$ccgno}'\t\t,'{$paycardid}'\t,'{$authorid}'\t\t,\n\t\t\t\t\t\t\t\t   '{$paydate}'\t\t,'{$orderid}'\t\t,'{$fucardno}'\t\t,\n\t\t\t\t\t\t\t\t   '{$bkntno}'\t\t,'01'\t\t\t,'{$paytype}'\t\t\t,\n\t\t\t\t\t\t\t\t   '{$current}'\t\t,'{$paymoney}'\t,'{$payfee}'\t\t\t,\n\t\t\t\t\t\t\t\t   '{$paymoney}'\t\t,'{$orderno}'\t\t,'{$shopid}'\t\t\t,\n\t\t\t\t\t\t\t\t   '{$fucardbank}'\t,'{$fucardmobile}',\n\t\t\t\t\t\t\t\t   '{$fucardman}'\t\t,'{$feebankid}'\t,'0'," . "'{$bkorderNumber}' ,'{$sdcrid}' \t\t, '{$sdcrpayfeemoney}')";
     $db->query($query);
     $returnvalue = array("msgbody" => $arr_msg['msgbody']);
     $retcode = "0";
     //反馈状态 0 成功 200 自定义错误
     $returnval = TfbxmlResponse::ResponsetoApp($retcode, $returnvalue);
     return $returnval;
 }
 public function checkRechaMoneyStatus()
 {
     $db = new DB_test();
     $arr_header = $this->arr_header;
     $arr_body = $this->arr_body;
     $arr_channelinfo = $this->arr_channelinfo;
     $bkntno = trim($arr_body['bkntno']);
     //交易流水号
     //$paycardid = trim(GetPayCalcuInfo::readpaycardid($arr_body['paycardid'])); //刷卡器设备号
     $authorid = trim($arr_channelinfo['authorid']);
     //authorid
     $result = $arr_body['result'];
     $nowdate = date("Y-m-d H:i:s");
     //手机卡充值业务
     $query = "select fd_mrclist_bkordernumber as bkordernumber,fd_mrclist_authorid as authorid ,\n                  fd_mrclist_date as orderdate ,DATE_FORMAT(fd_mrclist_date,'%Y%m%d') as orderTime,\n                  fd_mrclist_qq as qq\n                  from tb_qqrechargelist\n                  where 1  and  fd_mrclist_bkntno = '{$bkntno}' and fd_mrclist_authorid = '{$authorid}'  limit 1";
     $arr_val = $db->get_one($query);
     $orderNumber = $arr_val['bkordernumber'];
     $orderTime = $arr_val['orderTime'];
     $arr_returninfo = BankPayInfo::bankorderquery($authorid, '', $orderNumber, $orderTime);
     $arr_returninfo = $this->Publiccls->xml_to_array($arr_returninfo);
     //  print_r($arr_returninfo);
     // exit;
     if (!is_array($arr_returninfo)) {
         $arr_message = array("result" => "failure", "message" => "请等待,正在为您充值中!");
         $retcode = "200";
         //反馈状态 0 成功 200 自定义错误
     } else {
         $of_retcode = $arr_returninfo['orderinfo']['retcode'];
         //欧飞接口1为成功 跟我们自己的成功 0
         if ($of_retcode == 1) {
             $retcode = 0;
             //反馈状态 0 成功 200 自定义错误
             $arr_message = array("result" => "success", "message" => $arr_returninfo['orderinfo']['err_msg']);
         } else {
             $retcode = $of_retcode;
             //反馈状态 0 成功 200 自定义错误
             $arr_message = array("result" => "failure", "message" => $arr_returninfo['orderinfo']['err_msg']);
         }
     }
     $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 createOrder()
 {
     $retcode = "200";
     $arr_message = array("result" => "fail", "message" => "操作出现异常,请稍后再试!");
     $authorid = trim($this->arr_channelinfo['authorid']);
     $arr_body = $this->arr_body;
     $gameId = trim($arr_body['gameId']);
     $gameName = trim($arr_body['gameName']);
     $gameName = auto_charset($gameName, 'utf-8', 'gbk');
     $area = trim($arr_body['area']);
     $area = auto_charset($area, 'utf-8', 'gbk');
     $server = trim($arr_body['server']);
     $server = auto_charset($server, 'utf-8', 'gbk');
     $price = trim($arr_body['price']);
     $cost = trim($arr_body['cost']);
     $quantity = trim($arr_body['quantity']);
     $userCount = trim($arr_body['userCount']);
     $paycardid = trim($arr_body['paycardid']);
     $rechabkcardno = trim($arr_body['rechabkcardno']);
     if ($authorid == "" || $gameId == "" || $gameName == "" || $price == "" || $cost == "" || $quantity == "" || $userCount == "" || $rechabkcardno == "") {
         $arr_message = array("result" => "fail", "message" => "输入信息不完整");
     } else {
         $arr_bkinfo = BankPayInfo::bankpayorder($authorid, $paycardid, $price, $rechabkcardno);
         $bkntno = trim($arr_bkinfo['bkntno']);
         $bkorderNumber = trim($arr_bkinfo['bkorderNumber']);
         $sdcrid = trim($arr_bkinfo['sdcrid']);
         $arr_paycard = GetPayCalcuInfo::readpaycardid($paycardid, $authorid);
         $paycardid = $arr_paycard['paycardid'];
         $cusid = trim($arr_paycard['cusid']);
         $paycardkey = trim($arr_paycard['paycardkey']);
         $payfee = $price - $cost - $price * 0.008;
         $datadetailArray['fd_grclist_payfee'] = $payfee;
         $datadetailArray['fd_grclist_cusid'] = $cusid;
         $datadetailArray['fd_grclist_paycardid'] = $paycardid;
         $datadetailArray['fd_grclist_authorid'] = $authorid;
         $datadetailArray['fd_grclist_paydate'] = date("Ymd");
         $datadetailArray['fd_grclist_bkntno'] = $bkntno;
         $datadetailArray['fd_grclist_bkordernumber'] = $bkorderNumber;
         $datadetailArray['fd_grclist_sdcrid'] = $sdcrid;
         $datadetailArray['fd_grclist_rechamoney'] = $price;
         $datadetailArray['fd_grclist_bkmoney'] = $price;
         $datadetailArray['fd_grclist_paymoney'] = $price;
         $datadetailArray['fd_grclist_gamecardid'] = $gameId;
         $datadetailArray['fd_grclist_gamename'] = $gameName;
         $datadetailArray['fd_grclist_gamecardnum'] = $quantity;
         $datadetailArray['fd_grclist_gameuserid'] = $userCount;
         $datadetailArray['fd_grclist_gamearea'] = $area;
         $datadetailArray['fd_grclist_gamesrv'] = $server;
         $datadetailArray['fd_grclist_bankcardno'] = $rechabkcardno;
         $datadetailArray['fd_grclist_state'] = 0;
         $datadetailArray['fd_grclist_datetime'] = date("Y-m-d H:i:s");
         $db = new DB_test();
         $db->insert("tb_gamerechargelist", $datadetailArray);
         $arr_message = array("result" => "success", "message" => "订单建立成功");
         $retcode = "0";
         $arr_msg['msgbody']['bkntno'] = $bkntno;
         $arr_msg['msgbody']['totalPrice'] = $price;
     }
     $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 couponSale()
 {
     $db = new DB_test();
     $arr_header = $this->arr_header;
     $arr_body = $this->arr_body;
     $arr_channelinfo = $this->arr_channelinfo;
     $authorid = $arr_channelinfo['authorid'];
     $couponid = trim($arr_body['couponid']);
     $paymoney = trim($arr_body['couponmoney']);
     //$paycardid = trim(GetPayCalcuInfo::readpaycardid($arr_body['paycardid']));
     $arr_paycard = GetPayCalcuInfo::readpaycardid($arr_body['paycardid'], $authorid);
     //刷卡器设备号
     $paycardid = $arr_paycard['paycardid'];
     //刷卡器id
     $cusid = trim($arr_paycard['cusid']);
     //代理商
     $paycardkey = trim($arr_paycard['paycardkey']);
     //刷卡器key
     $fucardno = trim($arr_body['creditcardno']);
     $fubank = trim(u2g($arr_body['creditbank']));
     $fucardman = trim(u2g($arr_body['creditcardman']));
     $fucardphone = trim(u2g($arr_body['creditcardphone']));
     $paytype = 'coupon';
     $req_appenv = trim($arr_header['req_appenv']);
     // echo "fdf";
     $checkbankinfo = $this->checkshoubankinfo($authorid, $req_appenv);
     //检测我的银行卡信息有没填写
     $arr_feeinfo = GetPayCalcuInfo::readPayFee($authorid, "", $paymoney, "", 5);
     //获取手续费信息返回array
     if (is_array($arr_feeinfo)) {
         $feemoney = $arr_feeinfo['feemoney'];
     }
     $allmoney = round($paymoney + $feemoney, 2);
     $arr_arrive = GetPayCalcuInfo::readarrive($arr_feeinfo['arriveid']);
     $paydate = date("Y-m-d H:i:s");
     $arrivedate = GetPayCalcuInfo::getfeedate($paydate, $arr_feeinfo['addday']);
     $payfeedirct = $arr_feeinfo['defeedirct'];
     if ($arr_feeinfo['defeedirct'] == 's') {
         $bkmoney = $paymoney;
     } else {
         $bkmoney = $allmoney;
     }
     $arr_feeinfo['arrivedate'] = $arrivedate;
     $arr_feeinfo['paydate'] = $paydate;
     $arr_feeinfo['bkmoney'] = $bkmoney;
     $arr_feeinfo['payfeedirct'] = $payfeedirct;
     $payfee = $feemoney;
     $arr_bkinfo = BankPayInfo::bankpayorder($authorid, $paycardid, $paymoney, $fucardno);
     $arr_authorinfo = AuToken::getauthorusername($authorid);
     $arr_feeinfo['shoucardno'] = $shoucardno = $arr_authorinfo['shoucardno'];
     $arr_feeinfo['shoucardmobile'] = $shoucardmobile = $arr_authorinfo['shoucardmobile'];
     $arr_feeinfo['shoucardbank'] = $shoucardbank = $arr_authorinfo['shoucardbank'];
     $arr_feeinfo['shoucardman'] = $shoucardman = $arr_authorinfo['shoucardman'];
     $bkntno = trim($arr_bkinfo['bkntno']);
     $arr_feeinfo['bkordernumber'] = $bkordernumber = $arr_bkinfo['bkorderNumber'];
     $arr_feeinfo['bkmoney'] = $bkmoney = $paymoney;
     $arr_feeinfo['sdcrid'] = $sdcrid = trim($arr_bkinfo['sdcrid']);
     $sdcrpayfee = substr($arr_bkinfo['sdcrpayfee'], 0, -1);
     //银联收取明盛浮动费率
     $arr_feeinfo['sdcrpayfeemoney'] = $sdcrpayfeemoney = $bkmoney * $sdcrpayfee / 100 > $arr_bkinfo['minsdcrpayfee'] ? $bkmoney * $sdcrpayfee / 100 : $arr_bkinfo['minsdcrpayfee'];
     $ccgno = makeorderno("couponsale", "couponsale", "cps");
     $query = "insert into tb_couponsale\n\t\t\t\t\t(fd_couponsale_no\t,\tfd_couponsale_bkntno\t,\tfd_couponsale_couponno\t,\n\t\t\t\t\tfd_couponsale_paycardid,fd_couponsale_authorid  ,\tfd_couponsale_money,\n\t\t\t\t\tfd_couponsale_rebuy,\tfd_couponsale_state,\t\tfd_couponsale_datetime,\n\t\t            fd_couponsale_couponid,\tfd_couponsale_payrq,\t\tfd_couponsale_creditcardno,\n\t\t            fd_couponsale_creditcardbank,fd_couponsale_creditcardman,fd_couponsale_creditcardphone," . "fd_couponsale_bkordernumber,fd_couponsale_sdcrid,   fd_couponsale_sdcrpayfeemoney," . "fd_couponsale_paymoney , fd_couponsale_payfee   ,   fd_couponsale_bkmoney  ," . "fd_couponsale_shoucardno,fd_couponsale_shoucardman,fd_couponsale_shoucardbank," . "fd_couponsale_shoucardmobile\n\t\t            )values\n\t\t\t\t\t('{$ccgno}'\t\t\t,\t'{$bkntno}'\t\t\t\t,\t'{$bkorderNumber}',\n\t\t\t\t\t'{$paycardid}'\t\t,\t'{$authorid}'\t\t\t\t,\t'{$paymoney}',\n\t\t\t\t\t'0'\t\t\t\t\t,\t'0'\t\t\t\t\t\t,\t now()\t\t ,\n\t\t\t\t\t'{$couponid}'\t\t\t,\t'01'  \t\t\t\t\t,    '{$fucardno}',\n\t\t\t\t\t'{$fubank}'           ,   '{$fucardman}'            ,   '{$fucardphone}' , " . "'{$bkordernumber}'   ,   '{$sdcrid}'               ,   '{$sdcrpayfeemoney}'," . "'{$paymoney}'        ,   '{$payfee}'               ,   '{$bkmoney}'        ," . "'{$shoucardno}'      ,   '{$shoucardman}'          ,   '{$shoucardbank}'    ," . "'{$shoucardmobile}'    ) ";
     $db->query($query);
     $listid = $db->insert_id();
     $method = 'in';
     $method = u2g($method);
     $gettrue = AgentPayglist::insertPayglist($this->reqxmlcontext, $bkntno, $listid, $ccgno, $paytype, $method, $arr_feeinfo);
     $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'] = trim($bkntno);
     $returnvalue = array("msgbody" => $arr_msg['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 = BankPayInfo::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.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);
     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 {
         return $arr_ofpayinfo;
     }
 }
Example #7
0
 public function insertSupTransferMoney()
 {
     $db = new DB_test();
     $arr_header = $this->arr_header;
     $arr_body = $this->arr_body;
     $arr_channelinfo = $this->arr_channelinfo;
     $bkntno = trim($arr_body['bkntno']);
     //银行交易流水号
     $authorid = trim($arr_channelinfo['authorid']);
     $nowdate = date("Y-m-d H:i:s");
     $result = $arr_body['result'];
     $query = "select fd_tfmglist_bkordernumber as bkordernumber,fd_tfmglist_authorid as authorid ,\n                  DATE_FORMAT(fd_tfmglist_paydate,'%Y%m%d') as orderTime\n                  from tb_transfermoneyglist\n                  where 1  and  fd_tfmglist_bkntno = '{$bkntno}' and fd_tfmglist_authorid = '{$authorid}'  limit 1";
     $arr_val = $db->get_one($query);
     $orderNumber = $arr_val['bkordernumber'];
     $orderTime = $arr_val['orderTime'];
     $arr_returninfo = BankPayInfo::bankorderquery($authorid, '', $orderNumber, $orderTime);
     $arr_returninfo = $this->Publiccls->xml_to_array($arr_returninfo);
     if ($result == 'success' && $bkntno != "") {
         $query = "update  tb_transfermoneyglist set fd_tfmglist_payrq ='00' ,fd_tfmglist_paydate ='{$nowdate}' \n\t\t\t\t\t          where fd_tfmglist_bkntno = '{$bkntno}'";
         $db->query($query);
         $query = "update  tb_agentpaymoneylist set fd_agpm_payrq = '00'  where fd_agpm_bkntno = '{$bkntno}'";
         $db->query($query);
         $arr_message = array("result" => "success", "message" => "支付成功!");
         $retcode = "0";
         //反馈状态 0 成功 200 自定义错误
     } else {
         if ($result == 'cancel') {
             //			$query = "update  tb_transfermoneyglist set fd_tfmglist_payrq ='03' ,fd_tfmglist_paydate ='$nowdate'
             //					          where fd_tfmglist_bkntno = '$bkntno'";
             //			$db->query($query);
             //			$query = "update  tb_agentpaymoneylist set fd_agpm_payrq = '03'  where fd_agpm_bkntno = '$bkntno'";
             //			$db->query($query);
             $arr_message = array("result" => "success", "message" => "支付失败!");
             $retcode = "200";
             //反馈状态 0 成功 200 自定义错误
         }
     }
     $arr_msg['msgbody']['result'] = $arr_message['result'];
     $arr_msg['msgbody']['message'] = $arr_message['message'];
     $returnvalue = array("msgbody" => array('result' => $arr_message['result'], "message" => $arr_message['message'], $arr_returninfo));
     $returnval = TfbxmlResponse::ResponsetoApp($retcode, $returnvalue);
     return $returnval;
 }
Example #8
0
 public function submitOrder()
 {
     $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']);
     $paycardid = trim($arr_body['paycardid']);
     $rechabkcardno = trim($arr_body['rechabkcardno']);
     $logger->info("process submitOrder : authorid : (" . $authorid . "), orderid : (" . $orderid . "), paycardid : (" . $paycardid . "), rechabkcardno : (" . $rechabkcardno . ")");
     if ($orderid != "" && $rechabkcardno != "" && $authorid != "") {
         $query = "SELECT fd_product_price, fd_total_price FROM tb_utility_order \n\t\t\t\t\tWHERE fd_author_id = {$authorid} AND fd_order_id = {$orderid}";
         $db = new DB_test();
         $result = $db->get_all($query);
         if ($result != 0 && count($result) > 0) {
             $logger->debug("process submitOrder : executing sql (" . $query . ") to get count (" . count($result) . ")");
             $logger->info("process submitOrder : the bill is " . $result[0]["fd_total_bill"] / 100);
             $arr_bkinfo = BankPayInfo::bankpayorder($authorid, $paycardid, $result[0]["fd_total_bill"] / 100, $rechabkcardno);
             $logger->debug("process submitOrder : get data from bankpay" . print_r($arr_bkinfo, true));
             $bkntno = trim($arr_bkinfo['bkntno']);
             $bkorderNumber = trim($arr_bkinfo['bkorderNumber']);
             $arr_paycard = GetPayCalcuInfo::readpaycardid($paycardid, $authorid);
             $logger->debug("process submitOrder : get data from paycalcul" . print_r($arr_paycard, true));
             $paycardid = $arr_paycard['paycardid'];
             $cusid = trim($arr_paycard['cusid']);
             $paycardkey = trim($arr_paycard['paycardkey']);
             $query = "UPDATE tb_utility_order SET fd_order_state = 2, fd_bkordernumber = '{$bkorderNumber}', fd_union_pay_number = {$bkntno}, fd_submit_time = NOW(), fd_complete_time = NOW(), fd_utility_cusid = {$cusid} WHERE fd_author_id = {$authorid} AND fd_order_id = {$orderid}";
             $logger->debug("process submitOrder : executing sql (" . $query . ")");
             $db->query($query);
             $arr_msg['msgbody']['bkntno'] = $bkntno;
             $retcode = "0";
             $arr_message = array("result" => "success", "message" => "提交成功");
         } else {
             $logger->error("process submitOrder : can not get any date from executing sql (" . $query . ")");
             $arr_message = array("result" => "fail", "message" => "订单号异常!");
         }
     } else {
         $arr_message = array("result" => "fail", "message" => "数据不完整");
     }
     $logger->info("complete submitOrder : (" . print_r($arr_msg['msgbody'], true) . ")");
     $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;
 }