pay debug

This commit is contained in:
devil_gong 2019-01-08 14:22:41 +08:00
parent 68a74805f3
commit ffd6708058

View File

@ -211,6 +211,13 @@ class WeixinMini
*/ */
private function GetPayParams($params = []) private function GetPayParams($params = [])
{ {
$trade_type = empty($params['trade_type']) ? $this->GetTradeType() : $params['trade_type'];
if(empty($trade_type))
{
return DataReturn('支付类型不匹配', -1);
}
// appid
$appid = (APPLICATION_CLIENT_TYPE == 'weixin') ? $this->config['mini_appid'] : $this->config['appid']; $appid = (APPLICATION_CLIENT_TYPE == 'weixin') ? $this->config['mini_appid'] : $this->config['appid'];
$data = [ $data = [
'appid' => $appid, 'appid' => $appid,
@ -222,7 +229,7 @@ class WeixinMini
'out_trade_no' => $params['order_no'].GetNumberCode(6), 'out_trade_no' => $params['order_no'].GetNumberCode(6),
'spbill_create_ip' => GetClientIP(), 'spbill_create_ip' => GetClientIP(),
'total_fee' => intval($params['total_price']*100), 'total_fee' => intval($params['total_price']*100),
'trade_type' => empty($params['trade_type']) ? $this->GetTradeType() : $params['trade_type'], 'trade_type' => $trade_type,
'attach' => empty($params['attach']) ? $params['site_name'].'-'.$params['name'] : $params['attach'], 'attach' => empty($params['attach']) ? $params['site_name'].'-'.$params['name'] : $params['attach'],
'sign_type' => 'MD5', 'sign_type' => 'MD5',
]; ];
@ -254,12 +261,12 @@ class WeixinMini
} }
// 微信中打开 // 微信中打开
$user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''; // $user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
if(!empty($user_agent) && strpos($user_agent, 'MicroMessenger') !== false) // if(!empty($user_agent) && strpos($user_agent, 'MicroMessenger') !== false)
{ // {
$type_all['pc'] = $type_all['weixin']; // $type_all['pc'] = $type_all['weixin'];
$type_all['h5'] = $type_all['weixin']; // $type_all['h5'] = $type_all['weixin'];
} // }
return isset($type_all[APPLICATION_CLIENT_TYPE]) ? $type_all[APPLICATION_CLIENT_TYPE] : ''; return isset($type_all[APPLICATION_CLIENT_TYPE]) ? $type_all[APPLICATION_CLIENT_TYPE] : '';
} }