头条支付

feat/task1-c-wallet
devil_gong 2019-10-29 15:28:25 +08:00
parent c23dd058e6
commit 0eb0a4df98
3 changed files with 10 additions and 7 deletions

View File

@ -57,22 +57,21 @@ class ToutiaoService
'merchant_id' => $merchant_id, 'merchant_id' => $merchant_id,
'app_id' => $app_id, 'app_id' => $app_id,
'sign_type' => 'MD5', 'sign_type' => 'MD5',
'timestamp' => (string) time(), 'timestamp' => time(),
'version' => '2.0', 'version' => '2.0',
'trade_type' => 'H5', 'trade_type' => 'H5',
'product_code' => 'pay', 'product_code' => 'pay',
'payment_type' => 'direct', 'payment_type' => 'direct',
'outorderno' => $order['order_no'], 'outorderno' => $order['order_no'],
'uid' => md5($params['user']['id']), 'uid' => md5($params['user']['id']),
'total_amount' => (string) $order['total_price']*100, 'total_amount' => $order['total_price']*100,
'currency' => 'CNY', 'currency' => 'CNY',
'subject' => '订单支付', 'subject' => '订单支付',
'body' => $order['order_no'], 'body' => $order['order_no'],
'trade_time' => (string) $order['add_time'], 'trade_time' => $order['add_time'],
'valid_time' => (string) MyC('common_order_close_limit_time', 30, true)*60, 'valid_time' => intval(MyC('common_order_close_limit_time', 30, true))*60,
'notify_url' => __MY_URL__, 'notify_url' => __MY_URL__,
]; ];
$order_info['sign'] = (new \base\Toutiao())->PaySignCreated($order_info, $secret);
// 支付方式 // 支付方式
$service = 1; $service = 1;
@ -92,6 +91,9 @@ class ToutiaoService
break; break;
} }
// 签名
$order_info['sign'] = (new \base\Toutiao())->PaySignCreated($order_info, $secret);
// 返回数据 // 返回数据
$result = [ $result = [
'order_info' => $order_info, 'order_info' => $order_info,

View File

@ -68,7 +68,7 @@ class Toutiao
$sign = ''; $sign = '';
foreach($data AS $key=>$val) foreach($data AS $key=>$val)
{ {
if($key != 'sign' && $key != 'risk_info' && $val != '' && $val != null) if($key != 'sign' && $key != 'risk_info' && $val != '')
{ {
$sign .= "$key=$val&"; $sign .= "$key=$val&";
} }

View File

@ -237,7 +237,8 @@ Page({
console.log(res.data.data.order_info) console.log(res.data.data.order_info)
tt.pay({ tt.pay({
orderInfo: res.data.data.order_info, orderInfo: res.data.data.order_info,
service: res.data.data.service, //service: res.data.data.service,
service: 1,
_debug: 1, _debug: 1,
getOrderStatus(res) { getOrderStatus(res) {
let { out_order_no } = res; let { out_order_no } = res;