38 lines
1.4 KiB
PHP
38 lines
1.4 KiB
PHP
<?php
|
|
require_once EXTEND_PATH ."/php_sdk_v3.0.10/example/WxPay.JsApiPay.php";
|
|
require_once EXTEND_PATH ."/php_sdk_v3.0.10/lib/WxPay.Data.php";
|
|
require_once EXTEND_PATH .'/php_sdk_v3.0.10/example//WxPay.Config.php';
|
|
|
|
class Wxpay2
|
|
{
|
|
public function wxpay($data,$wxid){
|
|
$tools = new \JsApiPay();
|
|
$input = new \WxPayUnifiedOrder();
|
|
$input->SetBody($data['title']);
|
|
$input->SetOut_trade_no($data['ordersn']);
|
|
$input->SetTotal_fee($data['fee']*100);
|
|
$input->SetTime_start(date("YmdHis",$data['create_time']));
|
|
$input->SetTime_expire(date("YmdHis", $data['create_time'] + 3600));
|
|
$input->SetNotify_url($data['notify_url']);
|
|
$input->SetTrade_type("JSAPI");
|
|
$input->SetOpenid($data['openid']);
|
|
|
|
$config = new \WxPayConfig();
|
|
// $config->GetAppId($appid);
|
|
// $config->GetMerchantId('1612051549');
|
|
// $config->GetKey('ggigi4646gsg46d46g48g6d464g8fd74');
|
|
// $config->GetAppSecret('$appsecret');
|
|
|
|
// $config->appid = $appid;
|
|
// $config->mchid = '1612051549';
|
|
// $config->key = 'ggigi4646gsg46d46g48g6d464g8fd74';
|
|
// $config->secret = $appsecret;
|
|
|
|
$config->wxid = $wxid;
|
|
$order = \WxPayApi::unifiedOrder($config, $input);
|
|
|
|
$jsApiParameters = $tools->GetJsApiParameters($order);
|
|
// dump($jsApiParameters);die;
|
|
return $jsApiParameters;
|
|
}
|
|
} |