分销支付
This commit is contained in:
parent
454f6fb008
commit
2fc8ff51fb
@ -143,7 +143,8 @@ class Pay extends Api
|
||||
}else{
|
||||
$client = 1;
|
||||
}
|
||||
$result = PayLogic::distributionPay($user_id,$post, $client);
|
||||
$result = PayLogic::distributionPay($user_id,$post,$client);
|
||||
// $result = PayLogic::abc($user_id,$post);
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@ -658,6 +658,28 @@ class PayLogic extends Logic
|
||||
}
|
||||
return JsonServer::success('微信支付发起成功', $res, 1);
|
||||
}
|
||||
public static function abc($user_id,$post){
|
||||
$publicKey = "
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwRUsPpbQPhBWrxFhG00k9VBgnHc7dCZyTQYIZ0efDEZOPHtDfbldfBDlfZglvfUsVuxea4NffzkbCm9pakoQilSy7hioiF8sxhUYxpwFIbx15KaQsjpeCtu5yOr3bKb5qZNzf+QtL70EDPfdVdZ5mBlO7CMa01W7CtqkxBlc4iSfVeavFK7rzOJpTAoamHdcdjtffYlNAsg2q3I1SDIUkiasVCo+BtNgzLY+7y1mSt9SbXO5nCMBT9DQVqsccBHu4SYS6kExISfLDjfeAldgtNtMuuyESiyp53EEk/Xe8JzrrjnHloHB63H47TxElsApAEmz0dabJyMBqT8Ow/m5OQIDAQAB
|
||||
-----END PUBLIC KEY-----";
|
||||
|
||||
$user_id = 979;
|
||||
$data['agetId'] = "FWH000015822";
|
||||
$data['custId'] = "FWH000015822";
|
||||
$data['orderNo'] = "dlh".time().$user_id;
|
||||
$data['txamt'] = 1;
|
||||
$data['openid'] = $post['openid'];
|
||||
$data['payWay'] = 1;
|
||||
$data['ip'] = $_SERVER['REMOTE_ADDR'];
|
||||
$data['timeStamp'] = date("Y-m-d H:i:s");
|
||||
$data['version'] = "1.0.0";
|
||||
sort($data);
|
||||
$d =http_build_query($data);
|
||||
$sha256 = hash('sha256', $d);
|
||||
openssl_public_encrypt($d,$msg,$publicKey);
|
||||
$msgd = base64_encode($msg);
|
||||
}
|
||||
//
|
||||
public static function distributionPay($user_id,$post,$client){
|
||||
$out_trade_no = createSn('user', 'id');
|
||||
|
||||
@ -105,7 +105,18 @@ class PayNotifyLogic
|
||||
return $order_log_data;
|
||||
}
|
||||
|
||||
|
||||
private static function distribution($order_sn, $extra = [])
|
||||
{
|
||||
$orders = Db::name("distribution_pay")->where("order_sn",$order_sn)->find();
|
||||
if (isset($extra['transaction_id'])) {
|
||||
$data['transaction_id'] = $extra['transaction_id'];
|
||||
}
|
||||
if($orders['transaction_id']!=null){
|
||||
$data['pay_time'] = date("Y-m-d H:i:s");
|
||||
$data['pay_status'] = 1;
|
||||
Db::name("distribution_pay")->where("order_sn",$order_sn)->update($data);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @notes 父订单回调
|
||||
* @param $order_sn
|
||||
|
||||
@ -219,7 +219,7 @@ class WeChatPayServer
|
||||
'total_fee' => $post['money'] * 100, // 单位:分
|
||||
'notify_url' => $notify_url,
|
||||
'openid' => $auth['openid'] ?? '',
|
||||
'attach' => 'trade'
|
||||
'attach' => 'distribution'
|
||||
];
|
||||
$attributes['out_trade_no'] = $out_trade_no. $attributes['trade_type'] . $client;
|
||||
$result = $app->order->unify($attributes);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user