本文整理汇总了PHP中format_price函数的典型用法代码示例。如果您正苦于以下问题:PHP format_price函数的具体用法?PHP format_price怎么用?PHP format_price使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了format_price函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$root = array();
$email = strim($GLOBALS['request']['email']);
//用户名或邮箱
$pwd = strim($GLOBALS['request']['pwd']);
//密码
$id = intval($GLOBALS['request']['id']);
//$user_id = intval($GLOBALS['user_info']['id']);
//检查用户,用户密码
$user = user_check($email, $pwd);
$user_id = intval($user['id']);
if ($user_id > 0) {
require APP_ROOT_PATH . 'app/Lib/deal.php';
$root['user_login_status'] = 1;
$root['response_code'] = 1;
//充值已支付
$root['incharge_count'] = $GLOBALS['db']->getOne("SELECT sum(money) FROM " . DB_PREFIX . "payment_notice where is_paid = 1 and user_id = " . $user_id . " ");
$root['incharge_count'] = format_price($root['incharge_count']);
//提现成功
$root['carry_money'] = $GLOBALS['db']->getOne("SELECT sum(money) FROM " . DB_PREFIX . "user_carry where status = 1 and user_id = " . $user_id . " ");
$root['carry_money'] = format_price($root['carry_money']);
//已付管理费
$root['true_repay_manage_money'] = $GLOBALS['db']->getOne("SELECT sum(true_repay_manage_money) FROM " . DB_PREFIX . "deal_load_repay where has_repay = 1 and user_id = " . $user_id . " ");
$root['true_repay_manage_money'] = format_price($root['true_repay_manage_money']);
$user_statistics = sys_user_status($user_id);
$root['user_statistics'] = $user_statistics;
} else {
$root['response_code'] = 0;
$root['show_err'] = "未登录";
$root['user_login_status'] = 0;
}
$root['program_title'] = "理财统计";
output($root);
}
示例2: export_csv
public function export_csv($page = 1)
{
set_time_limit(0);
$limit = ($page - 1) * intval(app_conf("BATCH_PAGE_SIZE")) . "," . intval(app_conf("BATCH_PAGE_SIZE"));
$map['ecv_type_id'] = intval($_REQUEST['ecv_type_id']);
$list = M(MODULE_NAME)->where($map)->limit($limit)->findAll();
if ($list) {
register_shutdown_function(array(&$this, 'export_csv'), $page + 1);
$ecv_value = array('sn' => '""', 'password' => '""', 'money' => '""', 'use_limit' => '""', 'begin_time' => '""', 'end_time' => '""');
if ($page == 1) {
$content = iconv("utf-8", "gbk", "序列号,密码,面额,使用数量,生效时间,过期时间");
$content = $content . "\n";
}
foreach ($list as $k => $v) {
$ecv_value['sn'] = '"' . iconv('utf-8', 'gbk', $v['sn']) . '"';
$ecv_value['password'] = '"' . iconv('utf-8', 'gbk', $v['password']) . '"';
$ecv_value['money'] = '"' . iconv('utf-8', 'gbk', format_price($v['money'])) . '"';
$ecv_value['use_limit'] = '"' . iconv('utf-8', 'gbk', $v['use_limit']) . '"';
$ecv_value['begin_time'] = '"' . iconv('utf-8', 'gbk', to_date($v['begin_time'])) . '"';
$ecv_value['end_time'] = '"' . iconv('utf-8', 'gbk', to_date($v['end_time'])) . '"';
$content .= implode(",", $ecv_value) . "\n";
}
header("Content-Disposition: attachment; filename=voucher_list.csv");
echo $content;
} else {
if ($page == 1) {
$this->error(L("NO_RESULT"));
}
}
}
示例3: index
public function index()
{
$root = array();
$email = strim($GLOBALS['request']['email']);
//用户名或邮箱
$pwd = strim($GLOBALS['request']['pwd']);
//密码
$id = intval($GLOBALS['request']['id']);
//检查用户,用户密码
$user = user_check($email, $pwd);
$user_id = intval($user['id']);
if ($user_id > 0) {
$root['user_login_status'] = 1;
$root['response_code'] = 1;
$root['is_faved'] = $GLOBALS['db']->getOne("SELECT count(*) FROM " . DB_PREFIX . "deal_collect WHERE deal_id = " . $id . " AND user_id=" . $user_id);
$root['user_money'] = $user['money'];
$root['user_money_format'] = format_price($user['money']);
//用户金额
} else {
$root['response_code'] = 0;
$root['show_err'] = "未登录";
$root['user_login_status'] = 0;
}
output($root);
}
示例4: tuijian_goods
function tuijian_goods($list = 8)
{
$w = "(g.is_best='1' OR g.is_new='1' OR g.is_hot='1' OR g.is_promote='1')";
$sql = "SELECT g.goods_id,g.goods_sn,g.goods_bianhao,g.goods_name,g.market_price,g.shop_price,g.promote_price,g.goods_thumb,g.goods_img,g.promote_price, g.promote_start_date, g.promote_end_date,g.is_promote,g.sale_count,b.brand_name FROM `{$this->App->prefix()}goods` AS g LEFT JOIN `{$this->App->prefix()}brand` AS b ON g.brand_id=b.brand_id WHERE g.is_on_sale='1' AND g.is_alone_sale='1' AND {$w} ORDER BY RAND() DESC LIMIT {$list}";
$rt = $this->App->find($sql);
$rts = array();
if (!empty($rt)) {
foreach ($rt as $k => $row) {
$rts[$k] = $row;
$rts[$k]['goods_thumb'] = SITE_URL . $row['goods_thumb'];
$rts[$k]['goods_img'] = SITE_URL . $row['goods_img'];
$rts[$k]['url'] = get_url($row['goods_name'], $row['goods_id'], SITE_URL . 'product.php?id=' . $row['goods_id'], 'goods', array('product', 'index', $row['goods_id']));
if ($row['is_promote'] == '1') {
//促销 价格
if ($row['promote_start_date'] < mktime() && $row['promote_end_date'] > mktime()) {
$row['promote_price'] = format_price($row['promote_price']);
} else {
$row['promote_price'] = "0.00";
}
} else {
$row['promote_price'] = "0.00";
}
$rts[$k]['promote_price'] = $row['promote_price'];
}
unset($rt);
}
return $rts;
}
示例5: get_payment_code
public function get_payment_code($payment_notice_id)
{
$payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id);
$money = round($payment_notice['money'], 2);
$code .= "<br /><div style='text-align:center' class='red'>" . $GLOBALS['lang']['PAY_TOTAL_PRICE'] . ":" . format_price($money) . "</div>";
return $code;
}
示例6: index
public function index()
{
// 检查用户,用户密码
$user = $GLOBALS['user_info'];
$user_id = intval($user['id']);
$root = array();
$root['return'] = 1;
if ($user_id > 0) {
$root['user_login_status'] = 1;
$root['user_name'] = $user['user_name'];
$root['user_money'] = $user['money'];
$root['user_money_format'] = format_price($user['money']);
// 用户金额
$root['user_score'] = $user['score'];
// 用户积分
$coupon_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_coupon where user_id = " . $user_id . " and is_delete = 0 and is_valid = 1 ");
$root['coupon_count'] = $coupon_count;
$youhui_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "youhui_log as yl left join " . DB_PREFIX . "youhui as yh on yh.id = yl.youhui_id where yl.user_id={$user_id} ");
$root['youhui_count'] = $youhui_count;
$not_pay_order_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_order where user_id = " . $user_id . " and type = 0 and is_delete = 0 and pay_status <> 2");
$root['not_pay_order_count'] = $not_pay_order_count;
output($root);
} else {
$root['user_login_status'] = 0;
}
output($root);
}
示例7: get_payment_code
public function get_payment_code($payment_notice_id)
{
$payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id);
$money = round($payment_notice['money'], 2);
$payment_info = $GLOBALS['db']->getRow("select id,config,logo from " . DB_PREFIX . "payment where id=" . intval($payment_notice['payment_id']));
$payment_info['config'] = unserialize($payment_info['config']);
$subject = $payment_notice['deal_name'] == "" ? "充值" . format_price($payment_notice['money']) : $payment_notice['deal_name'];
$data_return_url = get_domain() . APP_ROOT . '/index.php?ctl=payment&act=response&class_name=AlipayBank';
$data_notify_url = get_domain() . APP_ROOT . '/index.php?ctl=payment&act=notify&class_name=AlipayBank';
$service = 'create_direct_pay_by_user';
/* 银行类型 */
$bank_type = $payment_notice['bank_id'];
$parameter = array('service' => $service, 'partner' => $payment_info['config']['alipay_partner'], '_input_charset' => 'utf-8', 'notify_url' => $data_notify_url, 'return_url' => $data_return_url, 'subject' => $subject, 'out_trade_no' => $payment_notice['notice_sn'], 'price' => $money, 'quantity' => 1, 'payment_type' => 1, 'logistics_type' => 'EXPRESS', 'logistics_fee' => 0, 'logistics_payment' => 'BUYER_PAY_AFTER_RECEIVE', 'extend_param' => 'isv^fanwe11', 'seller_email' => $payment_info['config']['alipay_account'], 'defaultbank' => $bank_type, 'payment' => 'bankPay');
ksort($parameter);
reset($parameter);
$param = '';
$sign = '';
foreach ($parameter as $key => $val) {
$param .= "{$key}=" . urlencode($val) . "&";
$sign .= "{$key}={$val}&";
}
$param = substr($param, 0, -1);
$sign = substr($sign, 0, -1) . $payment_info['config']['alipay_key'];
$sign_md5 = md5($sign);
$payLinks = '<form action="https://www.alipay.com/cooperate/gateway.do?' . $param . '&sign=' . $sign_md5 . '&sign_type=MD5" id="jumplink" method="post">正在连接支付接口...</form>';
$payLinks .= '<script type="text/javascript">document.getElementById("jumplink").submit();</script>';
return $payLinks;
}
示例8: get_payment_code
public function get_payment_code($payment_notice_id)
{
$payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id);
$order = $GLOBALS['db']->getRow("select order_sn,bank_id from " . DB_PREFIX . "deal_order where id = " . $payment_notice['order_id']);
$payment_info = $GLOBALS['db']->getRow("select id,config,logo from " . DB_PREFIX . "payment where id=" . intval($payment_notice['payment_id']));
$payment_info['config'] = unserialize($payment_info['config']);
//订单号
$BillNo = $order['order_sn'];
// 总金额
$Amount = round($payment_notice['money'], 2);
$ReturnURL = SITE_DOMAIN . APP_ROOT . '/95epay_response.php';
//后台通知
$NotifyURL = SITE_DOMAIN . APP_ROOT . '/95epay_notify.php';
//支付方式
$PayType = "CSPAY";
$PaymentType = $order['bank_id'];
$MerRemark = $payment_notice_id;
/* 数字签名 */
$MerNo = $payment_info['config']['merno'];
$MD5key = $payment_info['config']['md5key'];
$MD5info = $this->getSignature($MerNo, $BillNo, $Amount, $ReturnURL, $MD5key);
/*交易参数*/
$parameter = array('MerNo' => $MerNo, 'Amount' => $Amount, 'BillNo' => $BillNo, 'ReturnURL' => $ReturnURL, 'NotifyURL' => $NotifyURL, 'MD5info' => $MD5info, 'SubMerNo' => '', 'PayType' => $PayType, 'PaymentType' => $PaymentType, 'MerRemark' => $MerRemark, 'products' => '');
$def_url = '<form style="text-align:center;" action="https://www.95epay.cn/sslpayment" target="_blank" style="margin:0px;padding:0px" method="post" >';
foreach ($parameter as $key => $val) {
$def_url .= "<input type='hidden' name='{$key}' value='{$val}' />";
}
$def_url .= "<input type='submit' class='paybutton' value='前往双乾支付' />";
$def_url .= "</form>";
$def_url .= "<br /><div style='text-align:center' class='red'>" . $GLOBALS['lang']['PAY_TOTAL_PRICE'] . ":" . format_price($Amount) . "</div>";
return $def_url;
}
示例9: index
public function index()
{
$city_name = strim($GLOBALS['request']['city_name']);
//城市名称
$root = array();
$user_data = $GLOBALS['user_info'];
//logUtils::log_obj($user_data);
$user_id = intval($user_data['id']);
if ($user_id == 0) {
$root['user_login_status'] = 0;
$root['info'] = "请先登陆";
$root['page_title'] = "登陆";
} else {
$root['user_login_status'] = 1;
$root['info'] = "用户中心";
$root['page_title'] = "用户中心";
$root['uid'] = $user_data['id'];
$root['user_name'] = $user_data['user_name'];
$root['user_email'] = $user_data['email'];
$root['user_money'] = $user_data['money'];
$root['user_money_format'] = format_price($user_data['money']);
//用户金额
$root['user_avatar'] = get_abs_img_root(get_muser_avatar($user_data['id'], "big"));
}
$root['mana_page_title'] = '经理中心';
$root['user'] = $user_data;
$root['city_name'] = $city_name;
output($root);
}
示例10: get_payment_code
public function get_payment_code($payment_notice_id)
{
define('REAL_APP_ROOT', str_replace('/mapi', "", APP_ROOT));
$payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id);
$order_sn = $payment_notice['notice_sn'];
$money = round($payment_notice['money'], 2);
$payment_info = $GLOBALS['db']->getRow("select id,config,logo from " . DB_PREFIX . "payment where id=" . intval($payment_notice['payment_id']));
$payment_info['config'] = unserialize($payment_info['config']);
$sql = "select name " . "from " . DB_PREFIX . "deal " . "where id =" . intval($payment_notice['deal_id']);
$title_name = $GLOBALS['db']->getOne($sql);
$subject = $order_sn;
//$data_return_url = get_domain().APP_ROOT.'/../shop.php?ctl=payment&act=response&class_name=Walipay';
//$notify_url = get_domain().APP_ROOT.'/../shop.php?ctl=payment&act=notify&class_name=Walipay';
$notify_url = get_domain() . REAL_APP_ROOT . "/alipay_web/alipayapi.php?order_id=" . intval($payment_notice['order_id']) . "&out_trade_no=" . $order_sn;
//."&out_trade_no={$data.walipay.out_trade_no}";
$pay = array();
$pay['subject'] = $title_name;
$pay['body'] = $subject;
$pay['total_fee'] = $money;
$pay['total_fee_format'] = format_price($money);
$pay['out_trade_no'] = $payment_notice['notice_sn'];
$pay['notify_url'] = $notify_url;
$pay['partner'] = $payment_info['config']['alipay_partner'];
//合作商户ID
$pay['seller'] = $payment_info['config']['alipay_account'];
//账户ID
$pay['key'] = $payment_info['config']['alipay_key'];
//支付宝(RSA)公钥
$pay['is_wap'] = 1;
$pay['pay_code'] = 'walipay';
//,支付宝;mtenpay,财付通;mcod,货到付款
return $pay;
}
示例11: get_payment_code
public function get_payment_code($payment_notice_id)
{
$payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id);
$money = round($payment_notice['money'], 2);
$payment_info = $GLOBALS['db']->getRow("select id,config,logo from " . DB_PREFIX . "payment where id=" . intval($payment_notice['payment_id']));
$payment_info['config'] = unserialize($payment_info['config']);
$sql = "select name " . "from " . DB_PREFIX . "deal_order_item " . "where order_id =" . intval($payment_notice['order_id']);
$title_name = $GLOBALS['db']->getOne($sql);
$subject = msubstr($title_name, 0, 40);
$data_return_url = SITE_DOMAIN . APP_ROOT . '/index.php.php?ctl=payment&act=response&class_name=Wtenpay';
$notify_url = SITE_DOMAIN . APP_ROOT . '/index.php?ctl=payment&act=notify&class_name=Wtenpay';
$pay = array();
$pay['subject'] = $subject;
$pay['body'] = $title_name;
$pay['total_fee'] = $money;
$pay['total_fee_format'] = format_price($money);
$pay['out_trade_no'] = $payment_notice['notice_sn'];
$pay['notify_url'] = $notify_url;
$pay['partner'] = $payment_info['config']['tenpay_partner'];
//合作商户ID
$pay['key'] = $payment_info['config']['tenpay_key'];
//支付宝(RSA)公钥
$pay['pay_code'] = 'wtenpay';
//,支付宝;mtenpay,财付通;mcod,货到付款
return $pay;
}
示例12: get_supplier_info
function get_supplier_info($id)
{
$supplier_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier where is_effect = 1 and id=" . $id);
if ($supplier_info) {
$main_location = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location where supplier_id = " . $supplier_info['id'] . " and is_main = 1");
$supplier_info['tel'] = $main_location['tel'];
$supplier_info['address'] = $main_location['address'];
$supplier_info['contact'] = $main_location['contact'];
$supplier_info['brief'] = $main_location['brief'];
$supplier_info['deal_count'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal where supplier_id = " . $supplier_info['id'] . " and is_effect = 1 and is_delete = 0 and buy_type <> 1 and time_status > 0");
$max_price = $GLOBALS['db']->getOne("select max(current_price) from " . DB_PREFIX . "deal where supplier_id = " . $supplier_info['id'] . " and is_effect = 1 and is_delete = 0 and buy_type <> 1");
$min_price = $GLOBALS['db']->getOne("select min(current_price) from " . DB_PREFIX . "deal where supplier_id = " . $supplier_info['id'] . " and is_effect = 1 and is_delete = 0 and buy_type <> 1");
if ($max_price == $min_price) {
$supplier_info['deal_price'] = format_price($max_price);
} else {
$supplier_info['deal_price'] = format_price($min_price) . " - " . format_price($max_price);
}
$supplier_info['comment_count'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "message where rel_table='supplier' and rel_id = " . $supplier_info['id']);
$supplier_info['comment1_count'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "message where rel_table='supplier' and rel_id = " . $supplier_info['id'] . " and point = 1");
//差
$supplier_info['comment2_count'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "message where rel_table='supplier' and rel_id = " . $supplier_info['id'] . " and point = 2");
//中
$supplier_info['comment3_count'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "message where rel_table='supplier' and rel_id = " . $supplier_info['id'] . " and point = 3");
//好
$supplier_info['location_list'] = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "supplier_location where supplier_id = " . $supplier_info['id']);
}
return $supplier_info;
}
示例13: index
public function index()
{
$root = array();
$email = strim($GLOBALS['request']['email']);
//用户名或邮箱
$pwd = strim($GLOBALS['request']['pwd']);
//密码
//检查用户,用户密码
$user = user_check($email, $pwd);
$user_id = intval($user['id']);
$root['user_id'] = $user_id;
if ($user_id > 0) {
require APP_ROOT_PATH . 'app/Lib/uc_func.php';
$root['user_login_status'] = 1;
$root['response_code'] = 1;
$bank_list = $GLOBALS['db']->getAll("SELECT u.id, u.bankcard,u.real_name, b.name as bank_name, b.id as bank_id FROM " . DB_PREFIX . "user_bank u left join " . DB_PREFIX . "bank b on b.id = u.bank_id where u.user_id=" . $user_id . " ORDER BY u.id ASC");
foreach ($bank_list as $k => $v) {
$bank_list[$k]['bankcode'] = str_replace(" ", "", $v['bankcard']);
$bank_list[$k]['img'] = str_replace("/mapi", "", SITE_DOMAIN . APP_ROOT . '/public/bank/' . $v['bank_id'] . '.jpg');
}
$root['item'] = $bank_list;
//手续费
$fee_config = load_auto_cache("user_carry_config");
$json_fee = array();
foreach ($fee_config as $k => $v) {
$json_fee[] = $v;
$fee_config[$k]['fee_format'] = format_price($v['fee']);
}
$root['fee_config'] = $fee_config;
//$root['json_fee'] = json_encode($json_fee);
$root['open_ips'] = intval(app_conf("OPEN_IPS"));
$root['ips_acct_no'] = $user['ips_acct_no'];
$root['idno'] = $user['idno'];
//身份证号
$root['real_name'] = $user['real_name'];
//第三方托管标
if (!empty($user['ips_acct_no']) && intval(app_conf("OPEN_IPS")) > 0) {
$result = GetIpsUserMoney($user_id, 0);
$root['ips_money'] = $result['pBalance'];
//提现 http://p2p.fanwe.net/index.php?ctl=collocation&act=DoDwTrade&user_type=0&from=app&user_id=44&pTrdAmt=10
$app_url = APP_ROOT . "/index.php?ctl=collocation&act=DoDwTrade&user_type=0&pTrdAmt=parm_amt&user_id=" . $user_id . "&from=" . $GLOBALS['request']['from'];
$root['dw_url'] = str_replace("/mapi", "", SITE_DOMAIN . $app_url);
} else {
//申请
$app_url = APP_ROOT . "/index.php?ctl=collocation&act=CreateNewAcct&user_type=0&user_id=" . $user_id . "&from=" . $GLOBALS['request']['from'];
$root['acct_url'] = str_replace("/mapi", "", SITE_DOMAIN . $app_url);
$root['ips_money'] = 0;
}
$root['ips_money_format'] = format_price($root['ips_money']);
//预留 提现金额
$root['ips_money_fee'] = 0;
//预留 提现费用
} else {
$root['response_code'] = 0;
$root['show_err'] = "未登录";
$root['user_login_status'] = 0;
}
$root['program_title'] = "提现";
output($root);
}
示例14: get_payment_code
public function get_payment_code($payment_notice_id)
{
$payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id);
$order_sn = $GLOBALS['db']->getOne("select order_sn from " . DB_PREFIX . "deal_order where id = " . $payment_notice['order_id']);
$money = round($payment_notice['money'], 2);
$payment_info = $GLOBALS['db']->getRow("select id,config,logo from " . DB_PREFIX . "payment where id=" . intval($payment_notice['payment_id']));
$payment_info['config'] = unserialize($payment_info['config']);
$data_return_url = SITE_DOMAIN . APP_ROOT . '/index.php?ctl=payment&act=response&class_name=AlipayBank';
$data_notify_url = SITE_DOMAIN . APP_ROOT . '/index.php?ctl=payment&act=notify&class_name=AlipayBank';
$service = 'create_direct_pay_by_user';
/* 银行类型 */
$bank_type = $GLOBALS['db']->getOne("select bank_id from " . DB_PREFIX . "deal_order where id = " . $payment_notice['order_id']);
$parameter = array('service' => $service, 'partner' => $payment_info['config']['alipay_partner'], '_input_charset' => 'utf-8', 'notify_url' => $data_notify_url, 'return_url' => $data_return_url, 'subject' => $order_sn, 'out_trade_no' => $payment_notice['notice_sn'], 'price' => $money, 'quantity' => 1, 'payment_type' => 1, 'logistics_type' => 'EXPRESS', 'logistics_fee' => 0, 'logistics_payment' => 'BUYER_PAY_AFTER_RECEIVE', 'seller_email' => $payment_info['config']['alipay_account'], 'defaultbank' => $bank_type, 'payment' => 'bankPay');
ksort($parameter);
reset($parameter);
$param = '';
$sign = '';
foreach ($parameter as $key => $val) {
$param .= "{$key}=" . urlencode($val) . "&";
$sign .= "{$key}={$val}&";
}
$param = substr($param, 0, -1);
$sign = substr($sign, 0, -1) . $payment_info['config']['alipay_key'];
$sign_md5 = md5($sign);
$payLinks = '<form action="https://mapi.alipay.com/gateway.do?' . $param . '&sign=' . $sign_md5 . '&sign_type=MD5" target="_blank" method="post" ><button type="submit" class="ui-button paybutton" rel="blue">前往支付宝在线支付</button></form>';
$code = '<div style="text-align:center">' . $payLinks . '</div>';
$code .= "<br /><div style='text-align:center' class='red'>" . $GLOBALS['lang']['PAY_TOTAL_PRICE'] . ":" . format_price($money) . "</div>";
return $code;
}
示例15: get_payment_code
public function get_payment_code($payment_notice_id)
{
$payment_notice = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "payment_notice where id = " . $payment_notice_id);
$order_sn = $GLOBALS['db']->getOne("select order_sn from " . DB_PREFIX . "deal_order where id = " . $payment_notice['order_id']);
$money = round($payment_notice['money'], 2);
$payment_info = $GLOBALS['db']->getRow("select id,config,logo from " . DB_PREFIX . "payment where id=" . intval($payment_notice['payment_id']));
$payment_info['config'] = unserialize($payment_info['config']);
$data_return_url = get_domain() . APP_ROOT . '/index.php?ctl=payment&act=response&class_name=AlipayBank';
$data_notify_url = get_domain() . APP_ROOT . '/index.php?ctl=payment&act=notify&class_name=AlipayBank';
$service = 'create_direct_pay_by_user';
/* 银行类型 */
$bank_type = $GLOBALS['db']->getOne("select bank_id from " . DB_PREFIX . "deal_order where id = " . $payment_notice['order_id']);
$parameter = array('service' => $service, 'partner' => $payment_info['config']['alipay_partner'], '_input_charset' => 'utf-8', 'notify_url' => $data_notify_url, 'return_url' => $data_return_url, 'subject' => $order_sn, 'out_trade_no' => $payment_notice['notice_sn'], 'price' => $money, 'quantity' => 1, 'payment_type' => 1, 'logistics_type' => 'EXPRESS', 'logistics_fee' => 0, 'logistics_payment' => 'BUYER_PAY_AFTER_RECEIVE', 'seller_email' => $payment_info['config']['alipay_account'], 'defaultbank' => $bank_type, 'payment' => 'bankPay');
ksort($parameter);
reset($parameter);
$param = '';
$sign = '';
foreach ($parameter as $key => $val) {
$param .= "{$key}=" . urlencode($val) . "&";
$sign .= "{$key}={$val}&";
}
$param = substr($param, 0, -1);
$sign = substr($sign, 0, -1) . $payment_info['config']['alipay_key'];
$sign_md5 = md5($sign);
$payLinks = '<a href="https://www.alipay.com/cooperate/gateway.do?' . $param . '&sign=' . $sign_md5 . '&sign_type=MD5" target="_blank"><span class="paybutton" name="buy">' . sprintf($this->payment_lang['GO_TO_PAY'], $this->get_name($bank_type)) . '</span></a>';
if (!empty($payment_info['logo'])) {
$payLinks = '<a href="https://www.alipay.com/cooperate/gateway.do?' . $param . '&sign=' . $sign_md5 . '&sign_type=MD5" target="_blank" class="payLink"><img src=' . APP_ROOT . $payment_info['logo'] . ' style="border:solid 1px #ccc;" /></a><div class="blank"></div>' . $payLinks;
}
$code = '<div style="text-align:center">' . $payLinks . '</div>';
$code .= "<br /><div style='text-align:center' class='red'>" . $GLOBALS['lang']['PAY_TOTAL_PRICE'] . ":" . format_price($money) . "</div>";
return $code;
}