public function index() { $root = array(); $email = strim($GLOBALS['request']['email']); //用户名或邮箱 $pwd = strim($GLOBALS['request']['pwd']); //密码 $payment_id = intval($GLOBALS['request']['payment_id']); $money = floatval($GLOBALS['request']['money']); $bank_id = addslashes(htmlspecialchars(trim($GLOBALS['request']['bank_id']))); $memo = addslashes(htmlspecialchars(trim($GLOBALS['request']['memo']))); if ($payment_id == 0) { $root['response_code'] = 0; $root['show_err'] = '支付方式不能为空'; output($root); } //检查用户,用户密码 $user = user_check($email, $pwd); $user_id = intval($user['id']); if ($user_id > 0) { $root['response_code'] = 1; $root['user_login_status'] = 1; require APP_ROOT_PATH . 'app/Lib/uc_func.php'; $status = getInchargeDone($payment_id, $money, $bank_id, $memo); if ($status['status'] == 0) { $root['response_code'] = 0; $root['show_err'] = $status['show_err']; } else { $root['pay_status'] = $status['pay_status']; $root['order_id'] = $status['order_id']; $root['payment_notice_id'] = $status['payment_notice_id']; $payment_info = $status['payment_info']; $payment_notice_id = $status['payment_notice_id']; //创建了支付单号,通过支付接口创建支付数据 if ($payment_info['class_name'] == 'Otherpay') { $root['pay_code'] == 'otherpay'; $root['pay_type'] = 2; $root['show_err'] = "信息已经提交,请等待管理员审核"; } else { 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($payment_notice_id); $root['pay_code'] = $pay['pay_code']; if ($pay['pay_code'] == 'walipay' || $pay['pay_code'] == 'yjwap' || $pay['is_wap'] == 1) { $root['pay_type'] = 1; $root['pay_wap'] = $pay['notify_url']; } //$root['response_code'] = 0; //$root['show_err'] = $pay['user_ua'].';ip:'.$pay['user_ip']; } } } else { $root['response_code'] = 0; $root['show_err'] = "未登录"; $root['user_login_status'] = 0; } output($root); }
public function incharge_done() { /* $payment_id = intval($_REQUEST['payment']); $money = floatval($_REQUEST['money']); $bank_id = addslashes(htmlspecialchars(trim($_REQUEST['bank_id']))); $memo = addslashes(htmlspecialchars(trim($_REQUEST['memo']))); if($money<=0) { showErr($GLOBALS['lang']['PLEASE_INPUT_CORRECT_INCHARGE']); } $payment_info = $GLOBALS['db']->getRow("select * from ".DB_PREFIX."payment where id = ".$payment_id); if(!$payment_info) { showErr($GLOBALS['lang']['PLEASE_SELECT_PAYMENT']); } //开始生成订单 $now = TIME_UTC; $order['type'] = 1; //充值单 $order['user_id'] = $GLOBALS['user_info']['id']; $order['create_time'] = $now; if($payment_info['fee_type'] == 0) $order['total_price'] = $money + $payment_info['fee_amount']; else $order['total_price'] = $money + $payment_info['fee_amount']*$money; $order['deal_total_price'] = $money; $order['pay_amount'] = 0; $order['pay_status'] = 0; $order['delivery_status'] = 5; $order['order_status'] = 0; $order['payment_id'] = $payment_id; if($payment_info['fee_type'] == 0) $order['payment_fee'] = $payment_info['fee_amount']; else $order['payment_fee'] = $payment_info['fee_amount']*$money; $order['bank_id'] = $bank_id; $order['memo'] = $bank_id; if($payment_info['class_name']=='Otherpay' && $order['memo']!=""){ $payment_info['config'] = unserialize($payment_info['config']); $order['memo'] = "银行流水单号:".$order['memo']; $order['memo'] .= "<br>开户行:".$payment_info['config']['pay_bank'][$order['bank_id']]; $order['memo'] .= "<br>充值银行:".$payment_info['config']['pay_name'][$order['bank_id']]; $order['memo'] .= "<br>帐号:".$payment_info['config']['pay_account'][$order['bank_id']]; $order['memo'] .= "<br>用户:".$payment_info['config']['pay_account_name'][$order['bank_id']]; } do { $order['order_sn'] = to_date(TIME_UTC,"Ymdhis").rand(100,999); $GLOBALS['db']->autoExecute(DB_PREFIX."deal_order",$order,'INSERT','','SILENT'); $order_id = intval($GLOBALS['db']->insert_id()); }while($order_id==0); require_once APP_ROOT_PATH."system/libs/cart.php"; $payment_notice_id = make_payment_notice($order['total_price'],$order_id,$payment_info['id'],$order['memo']); //创建支付接口的付款单 */ $payment_id = intval($_REQUEST['payment']); $money = floatval($_REQUEST['money']); $bank_id = addslashes(htmlspecialchars(trim($_REQUEST['bank_id']))); $memo = addslashes(htmlspecialchars(trim($_REQUEST['memo']))); $pingzheng = replace_public(trim($_REQUEST['pingzheng'])); $status = getInchargeDone($payment_id, $money, $bank_id, $memo, $pingzheng); if ($status['status'] == 0) { showErr($status['show_err']); } else { if ($status['pay_status']) { app_redirect(url("index", "payment#incharge_done", array("id" => $status['order_id']))); //充值支付成功 } else { app_redirect(url("index", "payment#pay", array("id" => $status['payment_notice_id']))); } } }