コード例 #1
0
 function apiAutoken($xml)
 {
     global $req_token;
     // 授权码
     global $au_token;
     // 动态码
     global $req_version;
     // 版本号
     global $req_bkenv;
     // 银联环境
     global $req_time;
     global $api_name;
     global $api_name_func;
     global $authorid;
     global $arr_limitauthorid;
     $Publiccls = new PublicClass();
     //初始化类实例
     $arr_xml = $Publiccls->xml_to_array($xml);
     $api_name = $arr_xml['operation_request']['msgheader']['channelinfo']['api_name'];
     $api_name_func = $arr_xml['operation_request']['msgheader']['channelinfo']['api_name_func'];
     $req_token = $arr_xml['operation_request']['msgheader']['req_token'];
     $req_time = $arr_xml['operation_request']['msgheader']['req_time'];
     $au_token = $arr_xml['operation_request']['msgheader']['au_token'];
     $req_version = $arr_xml['operation_request']['msgheader']['req_version'];
     $req_bkenv = $arr_xml['operation_request']['msgheader']['req_bkenv'];
     $req_appenv = $arr_xml['operation_request']['msgheader']['req_appenv'];
     //1:安卓_phone 2:安卓_pad 3:iphone  4:ipad
     $req_appevn = $arr_xml['operation_request']['msgheader']['req_appevn'];
     //1:安卓_phone 2:安卓_pad 3:iphone  4:ipad
     $authorid = $arr_xml['operation_request']['msgheader']['channelinfo']['authorid'];
     $req_time = $arr_xml['operation_request']['msgheader']['req_time'];
     //$authorid = $arr_xml['operation_request']['msgheader']['channelinfo']['authorid'];
     // 需要开通-cai
     if (!in_array($authorid, $arr_limitauthorid)) {
         //return true;
     }
     $desreqtoken = $this->DesDecryptStr($req_token);
     //授权码解密
     $reqtokenss = $this->checkauthorexists($desreqtoken, $authorid);
     //授权码验证 授权码登录验证- 功能权限验证
     if ($api_name != 'ApiAuthorInfo' && $api_name != 'ApiAuthorReg' && $api_name != 'ApiAppInfo' && $api_name != 'ApiAuthorInfoV2' && $api_name != 'ApiSafeGuard') {
         $app_env = $this->getappnav($req_version, $req_appenv, $req_appevn);
     }
     if ($api_name != 'ApiAuthorInfo' && $api_name != 'ApiAuthorReg' && $api_name != 'ApiAppInfo' && $api_name != 'ApiAuthorInfoV2' && $api_name != 'ApiSafeGuard') {
         //$app_env = $this->getappnav($req_version,$req_appenv,$req_appevn);
         $checktokel = $this->AuToken->checkAuToken($au_token, $api_name_func);
     }
     $arr_checkloginMod = AuToken::checkLoginMod($api_name, $api_name_func);
     //检验登录接口还是非登录接口
     switch ($arr_checkloginMod['result']) {
         case 'success':
             //需要登录验证
             if (!$arr_checkloginMod['ischeck']) {
                 return true;
             }
             //注册用户直接返回true的功能
             if ($arr_checkloginMod['ischeck'] == '1') {
                 $desreqtoken = $this->DesDecryptStr($req_token);
                 //授权码解密
                 $reqtoken = $this->AuToken->checkReqToken($desreqtoken, $au_token, $api_name, $api_name_func, $authorid);
                 //授权码验证 授权码登录验证- 功能权限验证
                 return true;
             }
             break;
         default:
             //没找到相应的模块直接出错反馈
             $Error = array('result' => 'failure', 'retcode' => '404', 'retmsg' => '客户端调用错误');
             $returnvalue = $this->ErrorReponse->reponError($Error);
             break;
     }
 }
コード例 #2
0
 public function readOrderList()
 {
     $db = new DB_test();
     $arr_header = $this->arr_header;
     $arr_body = $this->arr_body;
     $arr_channelinfo = $this->arr_channelinfo;
     $msgdisplay = g2u(trim($arr_body['msgdisplay']));
     $appversion = g2u(trim($arr_body['appversion']));
     $orderno = g2u(trim($arr_body['orderno']));
     $orderstate = g2u(trim($arr_body['orderstate']));
     // nopay/pay/all
     $querycondi = g2u(trim($arr_body['querywhere']));
     // 近一个月使用符号:@  一个月前:#
     $msgstart = g2u(trim($arr_body['msgstart']));
     $authorid = g2u(trim($arr_channelinfo['authorid']));
     $arr_authorinfo = AuToken::getauthorusername($authorid);
     $ordermemid = $arr_authorinfo['memid'];
     if (!$ordermemid) {
         $arr_message = array("result" => "failure", "message" => "还未开通商家,没有订单信息!");
         $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;
         exit;
     }
     $today = date('Y-m-d');
     $premonthday = date('Y-m-d', strtotime("{$today} -1 month -0 day"));
     // $querywhere     = g2u(trim($arr_body['querywhere']));
     switch ($orderstate) {
         case "nopay":
             $querywhere = " and  fd_order_memeberid = '{$ordermemid}' and  fd_order_state = 6  and fd_order_no like '%{$orderno}%'";
             break;
         case "pay":
             $querywhere = " and  fd_order_memeberid = '{$ordermemid}'  and fd_order_state = 7 and  fd_order_no like '%{$orderno}%' ";
             break;
         case "all":
             $querywhere = " and fd_order_memeberid = '{$ordermemid}' and (fd_order_state = 7 or fd_order_state = 6 )  and fd_order_no like '%{$orderno}%' ";
             break;
         default:
             $querywhere = " and fd_order_memeberid = '{$ordermemid}' and (fd_order_state = 7 or fd_order_state = 6 )  and fd_order_no like '%{$orderno}%'";
             break;
     }
     switch ($querycondi) {
         case "@":
             //近一个月
             $querywhere .= " and fd_order_date>'{$premonthday}'";
             break;
         case "#":
             //一个月前:#
             $querywhere .= " and fd_order_date<='{$premonthday}'";
             break;
     }
     $Clsmssale = new APImssale();
     $arr_msg = $Clsmssale->getorderinfo($querywhere, $msgstart, $msgdisplay);
     $arr_msg['msgbody'] = auto_charset($arr_msg, 'gbk', 'utf-8');
     //echo var_dump($arr_msg ['msgbody']);
     $returnvalue = array("msgbody" => $arr_msg['msgbody']);
     $retcode = "0";
     //反馈状态 0 成功 200 自定义错误
     $returnval = TfbxmlResponse::ResponsetoApp($retcode, $returnvalue);
     return $returnval;
 }
コード例 #3
0
ファイル: getapi.php プロジェクト: Xiaoyuyexi/client-server
require "../class/tfbslotcard.class.php";
require "../class/tfbxmlResponse.class.php";
include_once "../third_api/kuaidi.class.php";
include_once "../third_api/mssale.class.php";
$arr_limitauthorid = array('82', '102');
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 {
コード例 #4
0
 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;
 }