40 lines
1.1 KiB
PHP
40 lines
1.1 KiB
PHP
![]() |
<?php
|
||
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
||
|
|
||
|
class Wxpay_model extends CI_Model {
|
||
|
|
||
|
public function __construct()
|
||
|
{
|
||
|
parent::__construct();
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
支付
|
||
|
*/
|
||
|
function wx_pay($total, $attach)
|
||
|
{
|
||
|
ini_set('date.timezone','Asia/Shanghai');
|
||
|
|
||
|
require 'D:\www\Wxpay\lib\WxPay.Api.php';
|
||
|
require 'D:\www\Wxpay\example\WxPay.NativePay.php';
|
||
|
//require_once 'log.php';
|
||
|
|
||
|
$notify = new NativePay();
|
||
|
$input = new WxPayUnifiedOrder();
|
||
|
$input->SetBody("广告位");//商品描述
|
||
|
$input->SetAttach($attach);//附加数据
|
||
|
$input->SetOut_trade_no(WxPayConfig::MCHID.date("YmdHis"));//商户订单号
|
||
|
$input->SetTotal_fee($total);//总金额
|
||
|
$input->SetTime_start(date("YmdHis"));//交易起始时间
|
||
|
$input->SetTime_expire(date("YmdHis", time() + 600));//交易结束时间
|
||
|
//$input->SetGoods_tag("test标记");//商品标记
|
||
|
$input->SetNotify_url("http://erp.itxxoo.com/Wxpay/notify");//通知地址
|
||
|
$input->SetTrade_type("NATIVE");//交易类型
|
||
|
//$input->SetProduct_id("123456789");//商品ID
|
||
|
$result = $notify->GetPayUrl($input);
|
||
|
$url2 = $result["code_url"];
|
||
|
return $url2;
|
||
|
}
|
||
|
|
||
|
}
|