public function index() { $email = strim($GLOBALS['request']['email']); //用户名或邮箱 $pwd = strim($GLOBALS['request']['pwd']); //密码 //检查用户,用户密码 $user = user_check($email, $pwd); $user_id = intval($user['id']); $root = array(); if ($user_id > 0) { $order_id = intval($GLOBALS['request']['order_id']); $credit = doubleval($_REQUEST['credit']); $payment_id = intval($_REQUEST['payment']); $memo = strim($_REQUEST['memo']); $root['user_login_status'] = 1; $root['show_pay_btn'] = 0; //0:不显示,支付按钮; 1:显示支付按钮 $order = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_order where user_id = {$user_id} and id = " . $order_id); if (empty($order)) { // $root['order_status'] = 1; $root['pay_info'] = '订单不存在.'; $root['show_pay_btn'] = 0; output($root); } if ($order['order_status'] == 2) { $root['order_status'] = 1; $root['pay_code'] = ''; $root['order_id'] = $order_id; $root['order_sn'] = $order['order_sn']; $root['response_code'] = 1; $root['pay_info'] = '订单已支付成功.'; $root['show_pay_btn'] = 0; output($root); } if ($payment_id == 0) { $payment_id = intval($order['payment_id']); } $deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id= " . $order['deal_id']); if ($credit > 0) { $sql = $GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set credit_pay = credit_pay + " . $credit . " where id = " . $order_id); require_once APP_ROOT_PATH . "system/libs/user.php"; modify_account(array("money" => "-" . $credit), intval($user_id), "支持" . $deal_info['name'] . "项目支付"); } $result = pay_order($order_id); if ($order['credit_pay'] = $order['total_price']) { $root['response_code'] = 1; $root['info'] = "余额全部支付"; } if ($order['credit_pay'] < $order['total_price'] && $order['credit_pay'] > 0) { $root['response_code'] = 2; $root['info'] = "余额部分支付"; } if ($order['credit_pay'] = 0) { $root['response_code'] = 3; $root['info'] = "余额未支付"; } if ($result['status'] == 0) { $payment_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment where id=" . $payment_id); $pay_code = strtolower($payment_info['class_name']); /*online_pay 支付方式:1:在线支付;0:线下支付;2:手机wap;3:手机sdk */ $online_pay = intval($payment_info['online_pay']); $root['online_pay'] = $online_pay; if ($online_pay != 2) { $root['response_code'] = 0; $root['pay_info'] = '手机版本不支付,无法在手机上支付.' . $pay_code; $root['show_pay_btn'] = 0; output($root); } if ($online_pay = 2) { $money = $result['money']; $payment_notice['create_time'] = NOW_TIME; $payment_notice['user_id'] = intval($GLOBALS['user_info']['id']); $payment_notice['payment_id'] = $payment_id; $payment_notice['money'] = $money; // $payment_notice['bank_id'] = strim($_REQUEST['bank_id']); $payment_notice['order_id'] = $order_id; $payment_notice['memo'] = $memo; $payment_notice['deal_id'] = $deal_info['id']; $payment_notice['deal_item_id'] = $order['deal_item_id']; $payment_notice['deal_name'] = $deal_info['name']; do { $payment_notice['notice_sn'] = to_date(NOW_TIME, "Ymd") . rand(100, 999); $GLOBALS['db']->autoExecute(DB_PREFIX . "payment_notice", $payment_notice, "INSERT", "", "SILENT"); $notice_id = $GLOBALS['db']->insert_id(); } while ($notice_id == 0); } //创建了支付单号,通过支付接口创建支付数据 require_once APP_ROOT_PATH . "system/payment/" . $payment_info['class_name'] . "_payment.php"; $payment_class = $payment_info['class_name'] . "_payment"; $payment_object = new $payment_class(); $pay = $payment_object->get_payment_code($notice_id); $root['is_wap'] = intval($pay['is_wap']); $root['pay_money_format'] = $pay['total_fee_format']; $root['pay_money'] = $pay['total_fee']; $root['pay_info'] = $pay['body']; $root['pay_wap'] = $pay['notify_url']; if ($root['pay_money'] > 0) { $root['show_pay_btn'] = 1; } } output($root); } else { $root['response_code'] = 0; $root['user_login_status'] = 0; $root['show_err'] = "未登录"; output($root); } }
public function go_pay() { if (!$GLOBALS['user_info']) { app_redirect(url("user#login")); } $id = intval($_REQUEST['id']); $consignee_id = intval($_REQUEST['consignee_id']); $credit = doubleval($_REQUEST['credit']); $memo = strim($_REQUEST['memo']); $payment_id = intval($_REQUEST['payment']); $deal_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_item where id = " . $id); if (!$deal_item) { app_redirect(url("index")); } elseif ($deal_item['support_count'] >= $deal_item['limit_user'] && $deal_item['limit_user'] != 0) { app_redirect(url("deal#show", array("id" => $deal_item['deal_id']))); } $deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where is_delete = 0 and is_effect = 1 and id = " . $deal_item['deal_id']); if (!$deal_info) { app_redirect(url("index")); } elseif ($deal_info['begin_time'] > NOW_TIME || $deal_info['end_time'] < NOW_TIME && $deal_info['end_time'] != 0) { app_redirect(url("deal#show", array("id" => $deal_item['deal_id']))); } if (intval($consignee_id) == 0 && $deal_item['is_delivery'] == 1) { showErr("请选择配送方式", 0, get_gopreview()); } $order_info['deal_id'] = $deal_info['id']; $order_info['deal_item_id'] = $deal_item['id']; $order_info['user_id'] = intval($GLOBALS['user_info']['id']); $order_info['user_name'] = $GLOBALS['user_info']['user_name']; $order_info['total_price'] = $deal_item['price'] + $deal_item['delivery_fee']; $order_info['delivery_fee'] = $deal_item['delivery_fee']; $order_info['deal_price'] = $deal_item['price']; $order_info['support_memo'] = $memo; $order_info['payment_id'] = $payment_id; $order_info['bank_id'] = strim($_REQUEST['bank_id']); $max_credit = $order_info['total_price'] < $GLOBALS['user_info']['money'] ? $order_info['total_price'] : $GLOBALS['user_info']['money']; $credit = $credit > $max_credit ? $max_credit : $credit; $order_info['credit_pay'] = $credit; $order_info['online_pay'] = 0; $order_info['deal_name'] = $deal_info['name']; $order_info['order_status'] = 0; $order_info['create_time'] = NOW_TIME; if ($consignee_id > 0) { $consignee_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_consignee where id = " . $consignee_id . " and user_id = " . intval($GLOBALS['user_info']['id'])); if (!$consignee_info && $deal_item['is_delivery'] == 1) { showErr("请选择配送方式", 0, get_gopreview()); } $order_info['consignee'] = $consignee_info['consignee']; $order_info['zip'] = $consignee_info['zip']; $order_info['address'] = $consignee_info['address']; $order_info['province'] = $consignee_info['province']; $order_info['city'] = $consignee_info['city']; $order_info['mobile'] = $consignee_info['mobile']; } $order_info['is_success'] = $deal_info['is_success']; $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_order", $order_info); $order_id = $GLOBALS['db']->insert_id(); if ($order_id > 0) { if ($order_info['credit_pay'] > 0) { require_once APP_ROOT_PATH . "system/libs/user.php"; modify_account(array("money" => "-" . $order_info['credit_pay']), intval($GLOBALS['user_info']['id']), "支持" . $deal_info['name'] . "项目支付"); } $result = pay_order($order_id); if ($result['status'] == 0) { $money = $result['money']; $payment_notice['create_time'] = NOW_TIME; $payment_notice['user_id'] = intval($GLOBALS['user_info']['id']); $payment_notice['payment_id'] = $payment_id; $payment_notice['money'] = $money; $payment_notice['bank_id'] = strim($_REQUEST['bank_id']); $payment_notice['order_id'] = $order_id; $payment_notice['memo'] = $memo; $payment_notice['deal_id'] = $deal_info['id']; $payment_notice['deal_item_id'] = $deal_item['id']; $payment_notice['deal_name'] = $deal_info['name']; do { $payment_notice['notice_sn'] = to_date(NOW_TIME, "Ymd") . rand(100, 999); $GLOBALS['db']->autoExecute(DB_PREFIX . "payment_notice", $payment_notice, "INSERT", "", "SILENT"); $notice_id = $GLOBALS['db']->insert_id(); } while ($notice_id == 0); app_redirect(url("cart#jump", array("id" => $notice_id))); } elseif ($result['status'] == 1 || $result['status'] == 2) { app_redirect(url("account#credit")); } else { app_redirect(url("account")); } } else { showErr("下单失败", 0, get_gopreview()); } }
public function go_order_pay() { if (!$GLOBALS['user_info']) { app_redirect(url("user#login")); } $id = intval($_REQUEST['order_id']); $order_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_order where id = " . $id . " and user_id = " . intval($GLOBALS['user_info']['id']) . " and order_status = 0"); if (!$order_info) { showErr("项目支持已支付", 0, get_gopreview()); } else { $credit = doubleval($_REQUEST['credit']); $payment_id = intval($_REQUEST['payment']); if ($credit > 0) { $max_pay = $order_info['total_price'] - $order_info['credit_pay']; $max_credit = $max_pay < $GLOBALS['user_info']['money'] ? $max_pay : $GLOBALS['user_info']['money']; $credit = $credit > $max_credit ? $max_credit : $credit; if ($credit > 0) { $GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set credit_pay = credit_pay + " . $credit . " where id = " . $order_info['id']); //追加使用余额支付 require_once APP_ROOT_PATH . "system/libs/user.php"; modify_account(array("money" => "-" . $credit), intval($GLOBALS['user_info']['id']), "支持" . $order_info['deal_name'] . "项目支付"); } } $result = pay_order($order_info['id']); if ($result['status'] == 0) { $money = $result['money']; $payment_notice['create_time'] = NOW_TIME; $payment_notice['user_id'] = intval($GLOBALS['user_info']['id']); $payment_notice['payment_id'] = $payment_id; $payment_notice['money'] = $money; $payment_notice['bank_id'] = strim($_REQUEST['bank_id']); $payment_notice['order_id'] = $order_info['id']; $payment_notice['memo'] = $order_info['support_memo']; $payment_notice['deal_id'] = $order_info['deal_id']; $payment_notice['deal_item_id'] = $order_info['deal_item_id']; $payment_notice['deal_name'] = $order_info['deal_name']; do { $payment_notice['notice_sn'] = to_date(NOW_TIME, "Ymd") . rand(100, 999); $GLOBALS['db']->autoExecute(DB_PREFIX . "payment_notice", $payment_notice, "INSERT", "", "SILENT"); $notice_id = $GLOBALS['db']->insert_id(); } while ($notice_id == 0); app_redirect(url("cart#jump", array("id" => $notice_id))); } else { app_redirect(url("account#view_order", array("id" => $order_info['id']))); } } }
public function go_pay() { if (!$GLOBALS['user_info']) { app_redirect(url_wap("user#login")); } $id = intval($_REQUEST['id']); $paypassword = strim($_REQUEST['paypassword']); if ($paypassword == '') { showErr("请输入支付密码", 0); } if (md5($paypassword) != $GLOBALS['user_info']['paypassword']) { showErr("支付密码错误", 0); } $consignee_id = intval($_REQUEST['consignee_id']); $credit = floatval($_REQUEST['credit']); $pay_score = intval($_REQUEST['pay_score']); if ($pay_score > 0) { $score_array = score_to_money($pay_score); $pay_score_money = $score_array['score_money']; $pay_score = $score_array['score']; } else { $pay_score = 0; $pay_score_money = 0; } $is_tg = intval($_REQUEST['is_tg']); if ($is_tg) { if (!$GLOBALS['is_user_tg']) { $jump_url = get_domain() . APP_ROOT . "/wap/index.php?ctl=collocation&act=CreateNewAcct&user_type=0&user_id=" . $GLOBALS['user_info']['id']; //$jump_url = get_domain().url_wap("collocation#CreateNewAcct",array('user_type'=>0,'user_id'=>$GLOBALS['user_info']['id'])); showErr("您未绑定第三方接口无法支付,点击确定后跳转到绑定页面", 0, $jump_url); } } $memo = strim($_REQUEST['memo']); $payment_id = intval($_REQUEST['payment']); $deal_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_item where id = " . $id); if (!$deal_item) { app_redirect(url_wap("index")); } elseif ($deal_item['support_count'] >= $deal_item['limit_user'] && $deal_item['limit_user'] != 0) { app_redirect(url_wap("deal#show", array("id" => $deal_item['deal_id']))); } $deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where is_delete = 0 and is_effect = 1 and id = " . $deal_item['deal_id']); if (!$deal_info) { app_redirect(url_wap("index")); } elseif ($deal_info['begin_time'] > NOW_TIME || $deal_info['end_time'] < NOW_TIME && $deal_info['end_time'] != 0) { app_redirect(url_wap("deal#show", array("id" => $deal_item['deal_id']))); } if (intval($consignee_id) == 0 && $deal_item['is_delivery'] == 1) { showErr("请选择配送方式", 0, get_gopreview_wap()); } //无私奉献 if ($deal_item['type'] == 1) { $pay_money = floatval($_REQUEST['pay_money']); if ($pay_money <= 0) { showErr("您输入的金额错误", 0, url_wap("deal#show", array("id" => $deal_item['deal_id']))); } $deal_item['price'] = $pay_money; $order_info['type'] = 2; } else { $order_info['type'] = $deal_info['type']; } $order_info['deal_id'] = $deal_info['id']; $order_info['deal_item_id'] = $deal_item['id']; $order_info['user_id'] = intval($GLOBALS['user_info']['id']); $order_info['user_name'] = $GLOBALS['user_info']['user_name']; $order_info['total_price'] = $deal_item['price'] + $deal_item['delivery_fee']; $order_info['delivery_fee'] = $deal_item['delivery_fee']; $order_info['deal_price'] = $deal_item['price']; $order_info['support_memo'] = $memo; $order_info['payment_id'] = $payment_id; $order_info['bank_id'] = strim($_REQUEST['bank_id']); if ($deal_item['is_share'] == 1) { $order_info['share_fee'] = $deal_item['share_fee']; $order_info['share_status'] = 0; } else { $order_info['share_fee'] = 0; } /* $max_credit= $order_info['total_price']<$GLOBALS['user_info']['money']?$order_info['total_price']:$GLOBALS['user_info']['money']; $credit = $credit>$max_credit?$max_credit:$credit; */ if (!$is_tg) { $credit_score_money = $pay_score_money + $credit; if ($credit > $GLOBALS['user_info']['money']) { showErr("余额最多只能用" . format_price($GLOBALS['user_info']['money']), 0); } if ($pay_score > $GLOBALS['user_info']['score']) { showErr("积分最多只能用" . $GLOBALS['user_info']['score']); } if ($credit_score_money > $order_info['total_price']) { showErr("支付超出"); } if (intval(($order_info['total_price'] - $credit_score_money) * 100) > 0 && $payment_id == 0) { showErr("请选择支付方式"); } } if ($credit > 0 && $GLOBALS['user_info']['money'] >= $credit) { $order_info['credit_pay'] = $credit; } if ($pay_score > 0 && $GLOBALS['user_info']['score'] >= $pay_score) { $order_info['score'] = $pay_score; $order_info['score_money'] = $pay_score_money; } // $order_info['credit_pay'] = $credit; $order_info['online_pay'] = 0; $order_info['deal_name'] = $deal_info['name']; $order_info['order_status'] = 0; $order_info['create_time'] = NOW_TIME; if ($consignee_id > 0) { $consignee_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_consignee where id = " . $consignee_id . " and user_id = " . intval($GLOBALS['user_info']['id'])); if (!$consignee_info && $deal_item['is_delivery'] == 1) { showErr("请选择配送方式", 0, get_gopreview_wap()); } $order_info['consignee'] = $consignee_info['consignee']; $order_info['zip'] = $consignee_info['zip']; $order_info['address'] = $consignee_info['address']; $order_info['province'] = $consignee_info['province']; $order_info['city'] = $consignee_info['city']; $order_info['mobile'] = $consignee_info['mobile']; } $order_info['is_success'] = $deal_info['is_success']; $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_order", $order_info); $order_id = $GLOBALS['db']->insert_id(); if ($order_id > 0) { // if($order_info['credit_pay']>0) // { // require_once APP_ROOT_PATH."system/libs/user.php"; // modify_account(array("money"=>"-".$order_info['credit_pay']),intval($GLOBALS['user_info']['id']),"支持".$order_info['deal_name']."项目支付"); // } $result = pay_order($order_id); if ($result['status'] == 0) { if ($is_tg) { $sign = md5(md5($paypassword) . $order_id); $url = get_domain() . APP_ROOT . "/wap/index.php?ctl=collocation&act=RegisterCreditor&order_id=" . $order_id . "&sign=" . $sign; //showSuccess("",0,$url); app_redirect($url); } else { $money = $result['money']; $payment_notice['create_time'] = NOW_TIME; $payment_notice['user_id'] = intval($GLOBALS['user_info']['id']); $payment_notice['payment_id'] = $order_info['payment_id']; $payment_notice['money'] = $money; $payment_notice['order_id'] = $order_id; $payment_notice['memo'] = $order_info['memo']; $payment_notice['deal_id'] = $order_info['deal_id']; $payment_notice['deal_item_id'] = $order_info['deal_item_id']; $payment_notice['deal_name'] = $order_info['deal_name']; do { $payment_notice['notice_sn'] = to_date(NOW_TIME, "Ymdhi") . rand(10000, 99999); $GLOBALS['db']->autoExecute(DB_PREFIX . "payment_notice", $payment_notice, "INSERT", "", "SILENT"); $notice_id = $GLOBALS['db']->insert_id(); } while ($notice_id == 0); app_redirect(url_wap("cart#jump", array("id" => $notice_id))); } } elseif ($result['status'] == 1) { $data['pay_status'] = 0; $data['pay_info'] = '订单过期.'; $data['show_pay_btn'] = 0; $GLOBALS['tmpl']->assign('data', $data); $GLOBALS['tmpl']->display('pay_order_index.html'); } elseif ($result['status'] == 2) { $data['pay_status'] = 0; $data['pay_info'] = '订单无库存.'; $data['show_pay_btn'] = 0; $GLOBALS['tmpl']->assign('data', $data); $GLOBALS['tmpl']->display('pay_order_index.html'); } else { $data['pay_status'] = 1; $data['pay_info'] = '订单支付成功.'; $data['show_pay_btn'] = 0; $GLOBALS['tmpl']->assign('data', $data); $GLOBALS['tmpl']->display('pay_order_index.html'); } //app_redirect(url_wap("cart#pay_order",array("order_id"=>$order_id))); } else { showErr("下单失败", 0, get_gopreview_wap()); } }
public function go_order_pay() { if (!$GLOBALS['user_info']) { app_redirect(url("user#login")); } $id = intval($_REQUEST['order_id']); $order_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_order where id = " . $id . " and user_id = " . intval($GLOBALS['user_info']['id']) . " and order_status = 0"); $paypassword = strim($_REQUEST['paypassword']); if ($paypassword == '') { showErr("请输入支付密码", 0); } if (md5($paypassword) != $GLOBALS['user_info']['paypassword']) { showErr("支付密码错误", 0); } $is_tg = intval($_REQUEST['is_tg']); if ($is_tg) { if (!$GLOBALS['is_user_tg']) { $jump_url = APP_ROOT . "/index.php?ctl=collocation&act=CreateNewAcct&user_type=0&user_id=" . $GLOBALS['user_info']['id']; showErr("您未绑定第三方接口无法支付,点击确定后跳转到绑定页面", 0, $jump_url); } elseif ($order_info) { $sign = md5(md5($paypassword) . $order_info['id']); $url = APP_ROOT . "/index.php?ctl=collocation&act=RegisterCreditor&order_id=" . $order_info['id'] . "&sign=" . $sign; //showSuccess("",0,$url); app_redirect($url); } } if (!$order_info) { showErr("项目支持已支付", 0, get_gopreview()); } else { $credit = doubleval($_REQUEST['credit']); $payment_id = intval($_REQUEST['payment']); $pay_score = intval($_REQUEST['pay_score']); $score_trade_number = intval(app_conf("SCORE_TRADE_NUMBER")) > 0 ? intval(app_conf("SCORE_TRADE_NUMBER")) : 0; $pay_score_money = intval($pay_score / $score_trade_number * 100) / 100; /*余额支付金额先不扣,只写入订单 if($credit>0) { $max_pay = $order_info['total_price'] - $order_info['credit_pay']; $max_credit= $max_pay<$GLOBALS['user_info']['money']?$max_pay:$GLOBALS['user_info']['money']; if($max_credit<0){ $max_credit=0; } $credit = $credit>$max_credit?$max_credit:$credit; if($credit>0) { require_once APP_ROOT_PATH."system/libs/user.php"; $re=modify_account(array("money"=>"-".$credit),intval($GLOBALS['user_info']['id']),"支持".$order_info['deal_name']."项目支付"); if($re){ $GLOBALS['db']->query("update ".DB_PREFIX."deal_order set credit_pay = credit_pay + ".$credit." where id = ".$order_info['id']);//追加使用余额支付 } } } */ if (!$is_tg) { if ($credit > $GLOBALS['user_info']['money']) { showErr("余额最多只能用" . format_price($GLOBALS['user_info']['money']), 0); } if ($pay_score > $GLOBALS['user_info']['score']) { showErr("积分最多只能用" . $GLOBALS['user_info']['score']); } if ($pay_score_money + $credit > $order_info['total_price']) { showErr("支付超出"); } } if ($credit > 0) { $order_data['credit_pay'] = $credit; } else { $order_data['credit_pay'] = 0; } if ($pay_score > 0) { $order_data['score'] = $pay_score; $order_data['score_money'] = $pay_score_money; } else { $order_data['score'] = 0; $order_data['score_money'] = 0; } $GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set credit_pay = " . $order_data['credit_pay'] . ",score=" . $order_data['score'] . ",score_money=" . $order_data['score_money'] . " where id = " . intval($order_info['id']) . " "); $result = pay_order($order_info['id']); if ($result['status'] == 0) { $money = $result['money']; $payment_notice['create_time'] = NOW_TIME; $payment_notice['user_id'] = intval($GLOBALS['user_info']['id']); $payment_notice['payment_id'] = $payment_id; $payment_notice['money'] = $money; $payment_notice['bank_id'] = strim($_REQUEST['bank_id']); $payment_notice['order_id'] = $order_info['id']; $payment_notice['memo'] = $order_info['support_memo']; $payment_notice['deal_id'] = $order_info['deal_id']; $payment_notice['deal_item_id'] = $order_info['deal_item_id']; $payment_notice['deal_name'] = $order_info['deal_name']; do { $payment_notice['notice_sn'] = to_date(NOW_TIME, "Ymd") . rand(100, 999); $GLOBALS['db']->autoExecute(DB_PREFIX . "payment_notice", $payment_notice, "INSERT", "", "SILENT"); $notice_id = $GLOBALS['db']->insert_id(); } while ($notice_id == 0); app_redirect(url("cart#jump", array("id" => $notice_id))); } else { app_redirect(url("account#view_order", array("id" => $order_info['id']))); } } }
function payment_paid($notice_sn, $outer_sn) { $payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where notice_sn = '" . $notice_sn . "'"); if ($payment_notice) { if ($payment_notice['order_id'] == 0) { //充值单 $GLOBALS['db']->query("update " . DB_PREFIX . "payment_notice set pay_time = '" . get_gmtime() . "',is_paid = 1,outer_notice_sn = '" . $outer_sn . "' where id = " . $payment_notice['id'] . " and is_paid = 0"); if ($GLOBALS['db']->affected_rows() > 0) { $GLOBALS['db']->query("update " . DB_PREFIX . "payment set total_amount = total_amount + " . $payment_notice['money'] . " where id = " . $payment_notice['payment_id']); $payment_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment where id = " . $payment_notice['payment_id']); require_once APP_ROOT_PATH . "system/libs/user.php"; require_once APP_ROOT_PATH . "system/payment/" . $payment_info['class_name'] . "_payment.php"; $log_info = "通过" . $payment_info['name'] . $payment_lang[$payment_notice['bank_id']] . "充值,单号" . $outer_sn; modify_account(array("money" => $payment_notice['money']), $payment_notice['user_id'], $log_info, array('money_type' => 17)); } //get_mortgate(); return array("info" => "恭喜您,成功" . $log_info, "jump" => url("account")); //已充值 } else { $GLOBALS['db']->query("update " . DB_PREFIX . "payment_notice set pay_time = '" . get_gmtime() . "',is_paid = 1,outer_notice_sn = '" . $outer_sn . "' where id = " . $payment_notice['id'] . " and is_paid = 0"); if ($GLOBALS['db']->affected_rows() > 0) { $GLOBALS['db']->query("update " . DB_PREFIX . "payment set total_amount = total_amount + " . $payment_notice['money'] . " where id = " . $payment_notice['payment_id']); $order_id = $payment_notice['order_id']; $order_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_order where id = " . $order_id); if ($order_info) { $payment_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment where id = " . $payment_notice['payment_id']); require_once APP_ROOT_PATH . "system/libs/user.php"; if ($payment_info['class_name']) { require_once APP_ROOT_PATH . "system/payment/" . $payment_info['class_name'] . "_payment.php"; } if ($GLOBALS['payment_lang'][$payment_notice['bank_id']]) { $log_info = "通过" . $payment_info['name'] . $GLOBALS['payment_lang'][$payment_notice['bank_id']] . "支付,单号" . $outer_sn . ",订单已支付过,转存入会员帐户"; } else { $log_info = "通过" . $payment_info['name'] . "支付,单号" . $outer_sn . ",订单已支付过,转存入会员帐户"; } $re = modify_account(array("money" => $payment_notice['money']), $payment_notice['user_id'], $log_info, array('money_type' => 17, 'deal_id' => $order_info['deal_id'], 'order_id' => $order_info['id'])); if ($order_info['order_status'] > 0) { //已支付 return array("info" => $log_info, "jump" => url("account#credit")); } else { //开始支付订单 $GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set online_pay = " . $payment_notice['money'] . " where id = " . $order_info['id']); $result = pay_order($order_info['id']); if ($result['status'] == 1) { return array("info" => "<a href='" . url("deal#show", array("id" => $order_info['deal_id'])) . "'>" . $order_info['deal_name'] . "</a>已过期,金额已退回帐户", "jump" => url("account#credit")); } if ($result['status'] == 2) { return array("info" => "<a href='" . url("deal#show", array("id" => $order_info['deal_id'])) . "'>" . $order_info['deal_name'] . "</a>限额已满,金额已退回帐户", "jump" => url("account#credit")); } if ($result['status'] == 3) { return array("info" => "<a href='" . url("deal#show", array("id" => $order_info['deal_id'])) . "'>" . $order_info['deal_name'] . "</a>支付成功", "jump" => url("account")); } if ($result['status'] == 0) { return array("info" => "<a href='" . url("deal#show", array("id" => $order_info['deal_id'])) . "'>" . $order_info['deal_name'] . "</a>订单被篡改,支付失败", "jump" => url("account")); } } } else { $payment_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment where id = " . $payment_notice['payment_id']); require_once APP_ROOT_PATH . "system/libs/user.php"; require_once APP_ROOT_PATH . "system/payment/" . $payment_info['class_name'] . "_payment.php"; $log_info = "通过" . $payment_info['name'] . $payment_lang[$payment_notice['bank_id']] . "支付,单号" . $outer_sn . ",支付的订单已失效,转存入会员帐户"; modify_account(array("money" => $payment_notice['money']), $payment_notice['user_id'], $log_info, array('money_type' => 19)); return array("info" => $log_info, "jump" => url("account#credit")); } } else { $order_id = $payment_notice['order_id']; $order_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_order where id = " . $order_id); if ($order_info) { if ($order_info['order_status'] > 0) { //已支付 if ($order_info['order_status'] == 1) { return array("info" => "<a href='" . url("deal#show", array("id" => $order_info['deal_id'])) . "'>" . $order_info['deal_name'] . "</a>已过期,金额已退回帐户", "jump" => url("account#credit")); } if ($order_info['order_status'] == 2) { return array("info" => "<a href='" . url("deal#show", array("id" => $order_info['deal_id'])) . "'>" . $order_info['deal_name'] . "</a>限额已满,金额已退回帐户", "jump" => url("account#credit")); } if ($order_info['order_status'] == 3) { return array("info" => "<a href='" . url("deal#show", array("id" => $order_info['deal_id'])) . "'>" . $order_info['deal_name'] . "</a>支付成功", "jump" => url("account")); } if ($order_info['order_status'] == 0) { return array("info" => "<a href='" . url("deal#show", array("id" => $order_info['deal_id'])) . "'>" . $order_info['deal_name'] . "</a>订单被篡改,支付失败", "jump" => url("account")); } } else { //开始支付订单 $GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set online_pay = " . $payment_notice['money'] . " where id = " . $order_info['id']); $result = pay_order($order_info['id']); if ($result['status'] == 1) { return array("info" => "<a href='" . url("deal#show", array("id" => $order_info['deal_id'])) . "'>" . $order_info['deal_name'] . "</a>已过期,金额已退回帐户", "jump" => url("account#credit")); } if ($result['status'] == 2) { return array("info" => "<a href='" . url("deal#show", array("id" => $order_info['deal_id'])) . "'>" . $order_info['deal_name'] . "</a>限额已满,金额已退回帐户", "jump" => url("account#credit")); } if ($result['status'] == 3) { return array("info" => "<a href='" . url("deal#show", array("id" => $order_info['deal_id'])) . "'>" . $order_info['deal_name'] . "</a>支付成功", "jump" => url("account")); } if ($result['status'] == 0) { return array("info" => "<a href='" . url("deal#show", array("id" => $order_info['deal_id'])) . "'>" . $order_info['deal_name'] . "</a>订单被篡改,支付失败", "jump" => url("account")); } } } else { $payment_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment where id = " . $payment_notice['payment_id']); require_once APP_ROOT_PATH . "system/payment/" . $payment_info['class_name'] . "_payment.php"; $log_info = "通过" . $payment_info['name'] . $payment_lang[$payment_notice['bank_id']] . "支付,单号" . $outer_sn . ",支付的订单已失效,转存入会员帐户"; return array("info" => $log_info, "jump" => url("account#credit")); } } } } else { return array("info" => "无效的支付单号,请联系管理员", "jump" => url("index")); } }
public function go_order_pay() { $id = intval($_REQUEST['order_id']); $order_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_order where id = " . $id . " and user_id = " . intval($GLOBALS['user_info']['id']) . " and order_status = 0"); if (!$order_info) { showErr("项目支持已支付", 0, get_gopreview_wap()); } else { $credit = doubleval($_REQUEST['credit']); $payment_id = intval($_REQUEST['payment_id']); if ($credit > 0) { $max_pay = $order_info['total_price'] - $order_info['credit_pay']; $max_credit = $max_pay < $GLOBALS['user_info']['money'] ? $max_pay : $GLOBALS['user_info']['money']; $credit = $credit > $max_credit ? $max_credit : $credit; if ($credit > 0) { $GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set credit_pay = credit_pay + " . $credit . " where id = " . $order_info['id']); //追加使用余额支付 require_once APP_ROOT_PATH . "system/libs/user.php"; modify_account(array("money" => "-" . $credit), intval($GLOBALS['user_info']['id']), "支持" . $order_info['deal_name'] . "项目支付"); } } $result = pay_order($order_info['id']); //print_r($order_info); if ($result['status'] == 0) { $money = $result['money']; $payment_notice['create_time'] = NOW_TIME; $payment_notice['user_id'] = intval($GLOBALS['user_info']['id']); $payment_notice['payment_id'] = $payment_id; $payment_notice['money'] = $money; $payment_notice['bank_id'] = strim($_REQUEST['bank_id']); $payment_notice['order_id'] = $order_info['id']; $payment_notice['memo'] = $order_info['support_memo']; $payment_notice['deal_id'] = $order_info['deal_id']; $payment_notice['deal_item_id'] = $order_info['deal_item_id']; $payment_notice['deal_name'] = $order_info['deal_name']; //积分商城项目增加积分方和积分兑换率 if ($order_info['is_ap'] == "1") { $payment_notice['partner_id'] = $order_info['ap_partner_id']; $payment_notice['ap_ratio'] = $order_info['ap_ratio']; } do { $payment_notice['notice_sn'] = to_date(NOW_TIME, "Ymd") . rand(100, 999); $GLOBALS['db']->autoExecute(DB_PREFIX . "payment_notice", $payment_notice, "INSERT", "", "SILENT"); $notice_id = $GLOBALS['db']->insert_id(); } while ($notice_id == 0); if ((int) $order_info['is_ap'] !== 0) { //调用积分支付方法类 require_once APP_ROOT_PATH . "system/payment/Appay_payment.php"; $o = new Appay_payment(); $res = $o->user_pay($notice_id); $data = array(); $data['deal_id'] = $order_info['deal_id']; $data['deal_item_id'] = $order_info['deal_item_id']; $data['order_id'] = $id; switch ($res) { case 1: $GLOBALS['tmpl']->assign('data', $data); $GLOBALS['tmpl']->display('pay_sucess.html'); break; case -1: $data['pay_info'] = '积分不足.'; // $GLOBALS['tmpl']->assign('msg','积分不足'); $GLOBALS['tmpl']->assign('data', $data); $GLOBALS['tmpl']->display('pay_error.html'); break; case 0: $data['pay_info'] = '订单为空.'; $GLOBALS['tmpl']->assign('data', $data); // $GLOBALS['tmpl']->assign('msg','订单为空'); $GLOBALS['tmpl']->display('pay_error.html'); break; } } else { app_redirect(url_wap("cart#jump", array("id" => $notice_id))); } } else { app_redirect(url_wap("account#view_order", array("id" => $order_info['id']))); } } }
public function go_pay_() { if (!$GLOBALS['user_info']) { app_redirect(url("user#login")); } $id = intval($_REQUEST['id']); $pay_money = floatval($_REQUEST['pay_money']); $paypassword = strim($_REQUEST['paypassword']); if ($paypassword == '') { showErr("请输入支付密码", 0); } if (md5($paypassword) != $GLOBALS['user_info']['paypassword']) { showErr("支付密码错误", 0); } $credit = floatval($_REQUEST['credit']); $pay_score = intval($_REQUEST['pay_score']); if ($pay_score > 0) { $score_array = score_to_money($pay_score); $pay_score_money = $score_array['score_money']; $pay_score = $score_array['score']; } else { $pay_score_money = 0; } $is_tg = intval($_REQUEST['is_tg']); if ($is_tg) { if (!$GLOBALS['is_user_tg']) { $jump_url = APP_ROOT . "/index.php?ctl=collocation&act=CreateNewAcct&user_type=0&user_id=" . $GLOBALS['user_info']['id']; showErr("您未绑定第三方接口无法支付,点击确定后跳转到绑定页面", 0, $jump_url); } } $payment_id = intval($_REQUEST['payment']); $deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where is_delete = 0 and is_effect = 1 and id = " . $id); if (!$deal_info) { app_redirect(url("index")); } elseif ($deal_info['begin_time'] > NOW_TIME || $deal_info['end_time'] < NOW_TIME && $deal_info['end_time'] != 0) { app_redirect(url("deal#show", array("id" => $deal_item['deal_id']))); } /*$buy_right_number = 0; if($deal_info['type']==3||$deal_info['type']==4){//企业众筹和币创投 $rights = $GLOBALS['db']->getAll("select * from ".DB_PREFIX."user_right where deal_id = ".$deal_info["id"]." and user_id = ".intval($GLOBALS['user_info']['id']).""); if(count($rights)>0){ foreach ($rights as $k=>$v){ $buy_right_number += $v["right_amount"] + $v["frozen_right_amount"]; } } }*/ $buy_right_number = get_zc_right_number($deal_info["id"], intval($GLOBALS['user_info']['id'])); $zc_amount = $pay_money / $deal_info["price_per_right"]; if ($deal_info["zc_amount_limit"] > 0 && $zc_amount + $buy_right_number > $deal_info["zc_amount_limit"]) { showErr("对不起,您众筹数字权益份额已经超过上限!", 0, url("deal#show", array("id" => $deal_info["id"]))); } $zc_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_order where deal_id = " . $deal_info["id"] . " and user_id = " . $GLOBALS['user_info']['id']); if ($deal_info["zc_count_limit"] != 0 and $zc_count >= $deal_info["zc_count_limit"]) { showErr("对不起,您参与次数超过上限,已经无法继续参与本项目!", 0, url("deal#show", array("id" => $deal_info["id"]))); } $order_info['type'] = 0; //普通众筹 $order_info['is_tg'] = $is_tg; $order_info['deal_id'] = $deal_info['id']; $order_info['deal_item_id'] = 0; $order_info['user_id'] = intval($GLOBALS['user_info']['id']); $order_info['user_name'] = $GLOBALS['user_info']['user_name']; $order_info['total_price'] = floatval($_REQUEST['pay_money']); $order_info['delivery_fee'] = 0; $order_info['deal_price'] = floatval($_REQUEST['pay_money']); //$order_info['support_memo'] = $memo; $order_info['payment_id'] = $payment_id; $order_info['bank_id'] = strim($_REQUEST['bank_id']); $order_info['share_fee'] = 0; if (!$is_tg) { $credit_score_money = $pay_score_money + $credit; if ($credit > $GLOBALS['user_info']['money']) { showErr("余额最多只能用" . format_price($GLOBALS['user_info']['money']), 0); } if ($pay_score > $GLOBALS['user_info']['score']) { showErr("积分最多只能用" . $GLOBALS['user_info']['score']); } if ($credit_score_money > $order_info['total_price']) { showErr("支付超出"); } if (intval(($order_info['total_price'] - $credit_score_money) * 100) > 0 && $payment_id == 0) { showErr("请选择支付方式"); } } if ($credit > 0) { $order_info['credit_pay'] = $credit; } if ($pay_score > 0) { $order_info['score'] = $pay_score; $order_info['score_money'] = $pay_score_money; } $order_info['online_pay'] = 0; $order_info['deal_name'] = $deal_info['name']; $order_info['order_status'] = 0; $order_info['create_time'] = NOW_TIME; $order_info['is_success'] = $deal_info['is_success']; $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_order", $order_info); $order_id = $GLOBALS['db']->insert_id(); if ($order_id > 0) { if ($is_tg) { $sign = md5(md5($paypassword) . $order_id); $url = APP_ROOT . "/index.php?ctl=collocation&act=RegisterCreditor&order_id=" . $order_id . "&sign=" . $sign; //showSuccess("",0,$url); app_redirect($url); } $result = pay_order($order_id); if ($result['status'] == 0) { $money = $result['money']; $payment_notice['create_time'] = NOW_TIME; $payment_notice['user_id'] = intval($GLOBALS['user_info']['id']); $payment_notice['payment_id'] = $payment_id; $payment_notice['money'] = $money; $payment_notice['bank_id'] = strim($_REQUEST['bank_id']); $payment_notice['order_id'] = $order_id; $payment_notice['memo'] = $memo; $payment_notice['deal_id'] = $deal_info['id']; $payment_notice['deal_item_id'] = 0; $payment_notice['deal_name'] = $deal_info['name']; do { $payment_notice['notice_sn'] = to_date(NOW_TIME, "Ymdhi") . rand(10000, 99999); $GLOBALS['db']->autoExecute(DB_PREFIX . "payment_notice", $payment_notice, "INSERT", "", "SILENT"); $notice_id = $GLOBALS['db']->insert_id(); } while ($notice_id == 0); app_redirect(url("cart#jump", array("id" => $notice_id))); } elseif ($result['status'] == 1 || $result['status'] == 2) { app_redirect(url("account#credit")); } elseif ($result['status'] == 5) { showErr("很遗憾,订单支付失败"); } else { app_redirect(url("account")); } } else { showErr("下单失败", 0, get_gopreview()); } }
public function go_pay() { if (es_session::get("confirm") == $_REQUEST['t']) { app_redirect(url_wap("index")); //支付过期时跳转回首页 // echo '网页过期'; exit; } if (!$GLOBALS['user_info']) { app_redirect(url_wap("user#login")); } $isap = $_REQUEST['isap']; $id = intval($_REQUEST['id']); $is_address = intval($_REQUEST['is_address']); $consignee_id = intval($_REQUEST['consignee_id']); if ($is_address == 1) { if (empty($consignee_id)) { $consignee = strim($_REQUEST['consignee']); $province = strim($_REQUEST['province']); $city = strim($_REQUEST['city']); $address = strim($_REQUEST['address']); $zip = strim($_REQUEST['zip']); $mobile = strim($_REQUEST['mobile']); $data = array(); $data['consignee'] = $consignee; $data['province'] = $province; $data['city'] = $city; $data['address'] = $address; $data['zip'] = $zip; $data['mobile'] = $mobile; $data['user_id'] = intval($GLOBALS['user_info']['id']); $GLOBALS['db']->autoExecute(DB_PREFIX . "user_consignee", $data); $consignee_id = $GLOBALS['db']->insert_id(); } } $credit = doubleval($_REQUEST['credit']); $memo = strim($_REQUEST['memo']); $payment_id = intval($_REQUEST['payment_id']); $deal_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_item where id = " . $id); if (!$deal_item) { app_redirect(url_wap("index")); } elseif ($deal_item['support_count'] >= $deal_item['limit_user'] && $deal_item['limit_user'] != 0) { app_redirect(url_wap("deal#show", array("id" => $deal_item['deal_id']))); } $deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where is_delete = 0 and is_effect = 1 and id = " . $deal_item['deal_id']); if (!$deal_info) { app_redirect(url_wap("index")); } elseif ($deal_info['begin_time'] > NOW_TIME || $deal_info['end_time'] < NOW_TIME && $deal_info['end_time'] != 0) { app_redirect(url_wap("deal#show", array("id" => $deal_item['deal_id']))); } if (intval($consignee_id) == 0 && $deal_item['is_delivery'] == 1) { showErr("请选择配送方式", 0, get_gopreview_wap()); } $order_info['deal_id'] = $deal_info['id']; $order_info['deal_item_id'] = $deal_item['id']; $order_info['user_id'] = intval($GLOBALS['user_info']['id']); $order_info['user_name'] = $GLOBALS['user_info']['user_name']; $order_info['total_price'] = $deal_item['price'] + $deal_item['delivery_fee']; $order_info['delivery_fee'] = $deal_item['delivery_fee']; $order_info['deal_price'] = $deal_item['price']; $order_info['support_memo'] = $memo; $order_info['payment_id'] = $payment_id; $order_info['bank_id'] = strim($_REQUEST['bank_id']); //积分商城项目增加积分方和积分兑换率 if ($isap == "1") { $order_info['is_ap'] = $isap; $order_info['ap_partner_id'] = 2; $order_info['ap_ratio'] = $deal_item['ap_ratio']; } $max_credit = $order_info['total_price'] < $GLOBALS['user_info']['money'] ? $order_info['total_price'] : $GLOBALS['user_info']['money']; $credit = $credit > $max_credit ? $max_credit : $credit; $order_info['credit_pay'] = $credit; $order_info['online_pay'] = 0; $order_info['deal_name'] = $deal_info['name']; $order_info['order_status'] = 0; $order_info['create_time'] = NOW_TIME; if ($consignee_id > 0) { $consignee_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_consignee where id = " . $consignee_id . " and user_id = " . intval($GLOBALS['user_info']['id'])); if (!$consignee_info && $deal_item['is_delivery'] == 1) { showErr("请选择配送方式", 0, get_gopreview_wap()); } $order_info['consignee'] = $consignee_info['consignee']; $order_info['zip'] = $consignee_info['zip']; $order_info['address'] = $consignee_info['address']; $order_info['province'] = $consignee_info['province']; $order_info['city'] = $consignee_info['city']; $order_info['mobile'] = $consignee_info['mobile']; } $order_info['is_success'] = $deal_info['is_success']; $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_order", $order_info); $order_id = $GLOBALS['db']->insert_id(); if ($order_id > 0) { if ($order_info['credit_pay'] > 0) { require_once APP_ROOT_PATH . "system/libs/user.php"; modify_account(array("money" => "-" . $order_info['credit_pay']), intval($GLOBALS['user_info']['id']), "支持" . $order_info['deal_name'] . "项目支付"); } $result = pay_order($order_id); if ($result['status'] == 0) { $money = $result['money']; $payment_notice['create_time'] = NOW_TIME; $payment_notice['user_id'] = intval($GLOBALS['user_info']['id']); $payment_notice['payment_id'] = $order_info['payment_id']; $payment_notice['money'] = $money; $payment_notice['order_id'] = $order_id; $payment_notice['memo'] = $order_info['memo']; $payment_notice['deal_id'] = $order_info['deal_id']; $payment_notice['deal_item_id'] = $order_info['deal_item_id']; $payment_notice['deal_name'] = $order_info['deal_name']; //积分商城项目增加积分方和积分兑换率 if ($isap == "1") { $payment_notice['partner_id'] = $order_info['ap_partner_id']; $payment_notice['ap_ratio'] = $order_info['ap_ratio']; } do { $payment_notice['notice_sn'] = to_date(NOW_TIME, "Ymd") . rand(100, 999); $GLOBALS['db']->autoExecute(DB_PREFIX . "payment_notice", $payment_notice, "INSERT", "", "SILENT"); $notice_id = $GLOBALS['db']->insert_id(); } while ($notice_id == 0); /*if($isap=="1"){ app_redirect(url("cart#ap_jump",array("notice_id"=>$notice_id,"order_id"=>$order_id))); }*/ if ($isap == "1") { //调用积分支付方法类 require_once APP_ROOT_PATH . "system/payment/Appay_payment.php"; $o = new Appay_payment(); $res = $o->user_pay($notice_id); $data = array(); $data['deal_id'] = $order_info['deal_id']; $data['deal_item_id'] = $order_info['deal_item_id']; $data['order_id'] = $order_id; // $_COOKIE["confirm"] = false; es_session::set("confirm", $_REQUEST['t']); switch ($res) { case 1: $GLOBALS['tmpl']->assign('data', $data); $GLOBALS['tmpl']->display('pay_sucess.html'); break; case -1: $data['pay_info'] = '积分不足.'; // $GLOBALS['tmpl']->assign('msg','积分不足'); $GLOBALS['tmpl']->assign('data', $data); $GLOBALS['tmpl']->display('pay_error.html'); break; case 0: $data['pay_info'] = '订单为空.'; $GLOBALS['tmpl']->assign('data', $data); // $GLOBALS['tmpl']->assign('msg','订单为空'); $GLOBALS['tmpl']->display('pay_error.html'); break; } exit; } // echo $payment_id; if ($_REQUEST['isqr'] !== '1') { app_redirect(url("cart#jump", array("id" => $notice_id))); } else { app_redirect(url("cart#jump_wxzf", array("id" => $notice_id))); } } elseif ($result['status'] == 1) { $data['pay_status'] = 0; $data['pay_info'] = '订单过期.'; $data['show_pay_btn'] = 0; $GLOBALS['tmpl']->assign('data', $data); $GLOBALS['tmpl']->display('pay_order_index.html'); } elseif ($result['status'] == 2) { $data['pay_status'] = 0; $data['pay_info'] = '订单无库存.'; $data['show_pay_btn'] = 0; $GLOBALS['tmpl']->assign('data', $data); $GLOBALS['tmpl']->display('pay_order_index.html'); } else { $data['pay_status'] = 1; $data['pay_info'] = '订单支付成功.'; $data['show_pay_btn'] = 0; $GLOBALS['tmpl']->assign('data', $data); $GLOBALS['tmpl']->display('pay_order_index.html'); } //app_redirect(url_wap("cart#pay_order",array("order_id"=>$order_id))); } else { showErr("下单失败", 0, get_gopreview_wap()); } }
public function incharge() { $id = intval($_REQUEST['id']); $order_info = M("DealOrder")->getById($id); if ($order_info) { if ($order_info['order_status'] == 0) { $result = pay_order($order_info['id']); $money = $result['money']; $payment_notice['create_time'] = get_gmtime(); $payment_notice['user_id'] = $order_info['user_id']; $payment_notice['payment_id'] = 0; $payment_notice['money'] = $money; $payment_notice['bank_id'] = ""; $payment_notice['order_id'] = $order_info['id']; $payment_notice['memo'] = "管理员收款"; $payment_notice['deal_id'] = $order_info['deal_id']; $payment_notice['deal_item_id'] = $order_info['deal_item_id']; $payment_notice['deal_name'] = $order_info['deal_name']; do { $payment_notice['notice_sn'] = to_date(get_gmtime(), "Ymd") . rand(100, 999); $GLOBALS['db']->autoExecute(DB_PREFIX . "payment_notice", $payment_notice, "INSERT", "", "SILENT"); $notice_id = $GLOBALS['db']->insert_id(); } while ($notice_id == 0); require_once APP_ROOT_PATH . "system/libs/cart.php"; $rs = payment_paid($payment_notice['notice_sn'], ""); $this->error("收款完成"); } else { $this->error("已经付过款"); } } else { $this->error("没有该项目的支持"); } }
function RegisterCreditorCallBack($str3Req) { $requestNo = $str3Req["requestNo"]; $where = " requestNo = '" . $requestNo . "'"; $sql = "update " . DB_PREFIX . "yeepay_cp_transaction set is_callback = 1 where is_callback = 0 and " . $where; $GLOBALS['db']->query($sql); //操作成功 if ($GLOBALS['db']->affected_rows()) { $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_cp_transaction", $str3Req, 'UPDATE', $where); if ($str3Req['code'] == '1') { $ipsdata = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "yeepay_cp_transaction where " . $where); $order = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_order where id = " . (int) $ipsdata['tenderOrderNo']); $GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set online_pay=" . $ipsdata['paymentAmount'] . ",is_tg = 1 where order_status=0 and id=" . $ipsdata['tenderOrderNo']); deal_order_progress($order['deal_id'], $order['user_id'], $order['type']); $log_info = "通过第三方接口易宝支付,单号" . $ipsdata['tenderOrderNo'] . ",支付金额" . $ipsdata['paymentAmount']; $deal_type = $GLOBALS['db']->getOne("select type from " . DB_PREFIX . "deal where id = " . $order['deal_id']); if ($deal_type == 0) { save_log_common('-' . $ipsdata['paymentAmount'], $GLOBALS['user_info']['id'], $log_info, array('type' => 5, 'deal_id' => $order['deal_id'])); } if ($deal_type == 1) { save_log_common('-' . $ipsdata['paymentAmount'], $GLOBALS['user_info']['id'], $log_info, array('type' => 6, 'deal_id' => $order['deal_id'])); } pay_order($ipsdata['tenderOrderNo']); } } else { return 1; } }