예제 #1
0
 public function Queryorder($transaction_id)
 {
     $input = new WxPayOrderQuery();
     $input->SetTransaction_id($transaction_id);
     $result = WxPayApi::orderQuery($input);
     //		Log::DEBUG("query:" . json_encode($result));
     ilog(iLOG_INFO, 'Queryorder:' . json_encode($result), __LINE__);
     if (array_key_exists("return_code", $result) && array_key_exists("result_code", $result) && $result["return_code"] == "SUCCESS" && $result["result_code"] == "SUCCESS") {
         $user_trade_no = $result['out_trade_no'];
         $transaction_id = $result['transaction_id'];
         $info1 = 'wxapp/interface/appnotify.php,operator success,session == trade_no,ordernum:' . $user_trade_no . ',wxno:' . $transaction_id;
         ilog(iLOG_INFO, $info1, __LINE__);
         $body_arr['order_no'] = $user_trade_no;
         $body_arr['pay_result'] = 2;
         //支付成功
         $body_arr['alipay_no'] = $transaction_id;
         //微信流水号
         $body_arr['channel'] = 'wxapp';
         //
         $ret = exec_procedure($body_arr, 'p_order_pay_result');
         if ($ret['status'] == 0 || $ret['status'] == 1040) {
             //成功,返回success
             return true;
         } else {
             //返回错误码,非success
             $info = 'wxapp/interface/appnotify.php,p_order_pay_result failed';
             ilog(iLOG_INFO, $info, __LINE__);
             return false;
         }
     }
     $info = 'wxapp/interface/appnotify.php,operator failed';
     ilog(iLOG_INFO, $info, __LINE__);
     //验证失败
     return false;
 }
예제 #2
0
/**
 * 设置用户权限
 * @param key
 * @param value
 */
function setUserSession_auth()
{
    $body_arr = array("code" => getUserSession_role());
    $arr = exec_procedure($body_arr, 'p_getauth_byrole');
    if (!empty($_SESSION)) {
        $_SESSION["auth"] = $arr;
        return TRUE;
    }
    return FALSE;
}
예제 #3
0
function sms_general($body_arr)
{
    $resp_arr = exec_procedure($body_arr, 'p_general_code');
    extract($resp_arr);
    if ($status != 0) {
        die_err_code_ret($resp_arr, __LINE__);
    }
    extract($body_arr);
    $code = $data[0]['code'];
    ilog(iLOG_INFO, "contact--->" . $contact, __LINE__);
    $content = '【' . _MESSAGESUBJECT_ . '】,您的验证码为:' . $code . ',有效期为:' . $deadminutes . '分钟!';
    //sendmsg_zx($contact, $content);
    return $resp_arr;
}
예제 #4
0
function bind_check($body_arr)
{
    $resp_arr = exec_procedure($body_arr, 'p_check_code');
    extract($resp_arr);
    if ($status != 0) {
        die_err_code($status, __LINE__);
    }
    $resp_bind_arr = exec_procedure($body_arr, 'p_bind');
    if ($body_arr['type'] == 1) {
        //避免登录浏览器与邮箱打开超链接的浏览器不同
        setSessonUserData('userid', $body_arr['userid']);
    }
    return $resp_bind_arr;
}
예제 #5
0
function update_order()
{
    //print_r($_GET);exit;
    /*		Array ( [buyer_email] => 13401042940 [buyer_id] => 2088702563886771 [exterface] => create_direct_pay_by_user 
    		[is_success] => T [notify_id] => RqPnCoPT3K9%2Fvwbh3InTvPfuq5BXCf%2F4bocQfLOKmSJa421I10ROCa9eXsKlZ7PGogPL 
    		[notify_time] => 2015-03-18 16:09:22 [notify_type] => trade_status_sync [out_trade_no] => 1000003451426666131 
    		[payment_type] => 1 [seller_email] => allstarway@126.com [seller_id] => 2088011992057121 [subject] => 订单12 
    		[total_fee] => 0.01 [trade_no] => 2015031800001000770046538594 [trade_status] => TRADE_SUCCESS 
    		[sign] => 00d8217c3e8fa7eb2f7265f343efda98 [sign_type] => MD5 ) */
    extract($_GET);
    $resp_arr = exec_procedure($_GET, 'p_update_order');
    if ($resp_arr['status'] != 0) {
        die_err_code($resp_arr['status'], __LINE__);
    }
    if ($trade_status == 'TRADE_FINISHED' || $trade_status == 'TRADE_SUCCESS') {
        //成功处理
    } else {
        //订单失败处理
    }
}
예제 #6
0
     //logResult("这里写入想要调试的代码变量值,或其他运行的结果记录");
     //——请根据您的业务逻辑来编写程序(以上代码仅作参考)——
     $usertrade_noarr = explode('-', $user_trade_no);
     $realuser_trade_no = $usertrade_noarr[0];
     //用户订单号
     if ($realuser_trade_no) {
         $info1 = 'alipaybank/notify_url.php,operator success,session == trade_no,ordernum:' . $user_trade_no . ',alipayno:' . $trade_no;
         ilog(iLOG_INFO, $info1, __LINE__);
         $body_arr['order_no'] = $realuser_trade_no;
         $body_arr['pay_result'] = 2;
         //
         $body_arr['alipay_no'] = $trade_no;
         //支付宝流水号
         $body_arr['channel'] = 'alipaybank';
         //
         $ret1 = exec_procedure($body_arr, 'p_order_pay_result');
         if ($ret['status'] == 0 || $ret1['status'] == 1040) {
             //get方式
             //            file_get_contents($alipay_config['root_url'] . '/index.php/Home/Trademark/cmpdf?ordernum=' . $realuser_trade_no
             //                    . '&type=' . $realuser_trade_type . '&jump=0');
             echo "success";
             //请不要修改或删除
         } else {
             //
             echo $ret['status'];
         }
     } else {
         $info2 = 'alipaybank/notify_url.php,operator failed,session != trade_no,ordernum:' . $user_trade_no . ',alipayno:' . $trade_no;
         echo '订单号有误,如果支付成功,请联系客服!';
     }
 }
예제 #7
0
function activeuser_check($body_arr)
{
    $resp_arr = exec_procedure($body_arr, 'p_check_code');
    return $resp_arr;
}
예제 #8
0
function wxqueryorderdata($body)
{
    //    $data['pay_no'] = isset($body['out_data']['pay_no'])?$body['out_data']['pay_no']:'';
    //    if(!$data['pay_no']){
    //        $ret1['status'] = 1041;
    //        $ret1['desc'] = '等待支付';
    //        return $ret1;
    //    }
    $queryOrderInput = new WxPayOrderQuery();
    $queryOrderInput->SetOut_trade_no($body['order_no']);
    $ret = WxPayApi::orderQuery($queryOrderInput);
    //数据已经解析为了数组格式
    $retexec = array();
    if ($ret['return_code'] == 'SUCCESS') {
        //查询成功
        $resp['wx_app_id'] = $ret['appid'];
        $resp['wx_partner_id'] = $ret['mch_id'];
        if ($ret['result_code'] == 'SUCCESS') {
            //
            switch ($ret['trade_state']) {
                case 'SUCCESS':
                    //支付成功
                    $body['pay_result'] = 2;
                    $body['pay_time'] = $ret['time_end'];
                    $retexec = exec_procedure($body, 'p_order_update_result');
                    $retexec['order_state'] = 2;
                    break;
                case 'REFUND':
                    //转入退款
                //转入退款
                case 'NOTPAY':
                    //未支付
                //未支付
                case 'CLOSED':
                    //已关闭
                //已关闭
                case 'REVOKED':
                    //已撤销
                //已撤销
                case 'USERPAYING':
                    //用户支付中
                //用户支付中
                case 'PAYERROR':
                    //支付失败
                    $retexec = exec_procedure($body, 'p_order_query_result');
                    $retexec['out_state'] = isset($retexec['out_data']['out_state']) ? $retexec['out_data']['out_state'] : 0;
                    break;
            }
        }
        return $retexec;
    } else {
        $ret['status'] = 1045;
        return $ret;
    }
}
예제 #9
0
function get_pwd_check($body_arr)
{
    $resp_arr = exec_procedure($body_arr, 'p_check_code');
    return $resp_arr;
}
예제 #10
0
//"http://商户网关地址/create_direct_pay_by_user-PHP-UTF-8/notify_url.php";
//需http://格式的完整路径,不能加?id=123这类自定义参数
//页面跳转同步通知页面路径
$return_url = $alipay_config["alipay_return_url"];
//"http://商户网关地址/create_direct_pay_by_user-PHP-UTF-8/return_url.php";
//需http://格式的完整路径,不能加?id=123这类自定义参数,不能写成http://localhost/
$body_arr['order_no'] = getSessonUserData('order_no');
if (empty($body_arr['order_no'])) {
    $body_arr['order_no'] = $_GET['order_no'];
    if (empty($body_arr['order_no'])) {
        $data['status'] = 1037;
        print_r(json_encode($data));
        exit;
    }
}
$ret = exec_procedure($body_arr, 'p_order_fee_calc');
$ret['order_no'] = $body_arr['order_no'];
if ($ret['status'] != 0) {
    print_r(json_encode($ret));
    exit;
    //             header("Location:".$url);
}
//如果实际支付的价格为0,则不用跳转到支付页面,直接调用存储,使得订单有效
//       if($ret['realcost']==0){
//            $ret = $vip->userconfirmorder();//确认订单,使得用户具备相应vip属性,如果
//             header("location:../../view/personal/portrait.html");
//            exit;
//       }
$randnum = rand(1000, 9999);
//产生一个4位随机数
$subject = $ret['order_no'];
예제 #11
0
function base_fun($body_arr)
{
    global $_INTERFACE;
    //声明配置文件
    global $_NOCHECKLOGIN;
    $inter_num = arr_key_value("inter_num", $body_arr);
    //获取接口号
    $resp_arr = array();
    if (!arr_key_value_login($inter_num, $_NOCHECKLOGIN)) {
        //检测登录状态
        $body_arr['userid'] = getSessonUserData('userid');
        if (!$body_arr['userid']) {
            //方便测试,这里先注释
            $resp_arr['status'] = 1035;
            $resp_arr['desc'] = err_info($resp_arr['status']);
            return $resp_arr;
        }
    }
    switch ($inter_num) {
        case "0001":
            //web
        //web
        case "0046":
            //app
            require_once dirname(__FILE__) . "/pay/index.php";
            $resp_arr = generate_order($body_arr);
            break;
        case "0005":
            #绑定提交
            require_once dirname(__FILE__) . "/bind/code/bind.php";
            $resp_arr = bind_general($body_arr);
            break;
        case "0006":
            #绑定校验
            require_once dirname(__FILE__) . "/bind/code/bind.php";
            $resp_arr = bind_check($body_arr);
            break;
        case "0007":
            #密码找回提交
            require_once dirname(__FILE__) . "/getpwd/code/getpwd.php";
            $resp_arr = get_pwd_general($body_arr);
            break;
        case "0008":
            #密码找回校验
            require_once dirname(__FILE__) . "/getpwd/code/getpwd.php";
            $resp_arr = get_pwd_check($body_arr);
            break;
        case "0027":
            #发送验证码
            require_once dirname(__FILE__) . "/sms/code/sendsms.php";
            $resp_arr = sms_general($body_arr);
            break;
        case "0028":
            //图片验证码校验
            require_once dirname(__FILE__) . "/verifycode/verifyCode.php";
            $resp_arr = verify_code($body_arr);
            break;
        case "0029":
            //发送邮件
            require_once dirname(__FILE__) . "/mail/sendmail.php";
            $resp_arr = sendemail($body_arr);
            break;
        case "0030":
            // 文件上传
            require_once dirname(__FILE__) . "/fileupload/code/fileuploadservice.php";
            $resp_arr = serviceHandle($body_arr);
            // 该方法需要根据业务需求进行修改
            break;
        case "0032":
            //html2pdf
            require_once dirname(__FILE__) . "/html2pdf/html2pdf.class.php";
            $html2pdf = new html2pdf();
            $dest = dirname(dirname(__FILE__)) . $body_arr['dest'];
            $d_filename = $body_arr['d_filename'];
            $sourcehtmlfile = $body_arr['sourcehtmlfile'];
            $resp_arr = $html2pdf->createpdf($dest, $d_filename, $sourcehtmlfile);
            //
            break;
        case "0036":
            // 获取服务器时间
            require_once dirname(__FILE__) . "/systime/getsystime.php";
            $resp_arr = getsystime();
            // 该方法需要根据业务需求进行修改
            break;
        case "0037":
            //发送注册激活邮件activeuser
            require_once dirname(__FILE__) . "/activeuser/code/activeuser.php";
            $resp_arr = activeuser_general($body_arr);
            break;
        case "0038":
            //验证 注册激活邮件activeuser
            require_once dirname(__FILE__) . "/activeuser/code/activeuser.php";
            $resp_arr = activeuser_check($body_arr);
            break;
        case "0039":
            //登出
            require_once dirname(__FILE__) . "/libcode/session.php";
            $resp_arr = clearsessionjump($body_arr);
            break;
        case "0040":
            //生成图片,保存在服务器
            require_once dirname(__FILE__) . "/createpic/createpic.php";
            $resp_arr = createpicserver($body_arr);
            break;
        case "0043":
            //跳转到支付渠道,网页版支付
            require_once dirname(__FILE__) . "/pay/index.php";
            $resp_arr = jump_paychannel($body_arr);
            break;
        case "0044":
            //返回支付信息,移动端app支付
            require_once dirname(__FILE__) . "/pay/index.php";
            $resp_arr = echo_paychannel($body_arr);
            break;
        case "0045":
            //查询订单,移动端app
            require_once dirname(__FILE__) . "/pay/index.php";
            $resp_arr = queryorderstatus($body_arr);
            break;
        case "0050":
            //购物车模块
            require_once dirname(__FILE__) . "/shopping/index.php";
            $resp_arr = dealCartFlow($body_arr);
            break;
        case "0051":
            //会员、积分模块
            break;
        default:
            $procedure = arr_key_value($inter_num, $_INTERFACE);
            //根据接口号获取存储名
            //执行存储过程
            $resp_arr = exec_procedure($body_arr, $procedure);
            break;
    }
    if ($inter_num == "0026" && $resp_arr['status'] == 0) {
        //登录成功,记录userid到session中
        $ret = setSessonUserData('userid', $resp_arr['out_data']['userid']);
        if ($body_arr['rememberpwd']) {
            //记住密码
            rememberpwd($body_arr['account'], $body_arr['passwd'], $body_arr['second']);
        }
    }
    return $resp_arr;
}