作者 何书鹏
1 个管道 的构建 通过 耗费 7 秒

过滤0元支付情况

... ... @@ -234,18 +234,21 @@ class Index extends Api
'description' => $post['description'],
'date' => $post['date']
]);
// 发起微信支付
$Wechat = new Wechat;
$openid = Db::name('third')->where('user_id',$this->auth->id)->value('openid');
$notify_url = $this->request->root(true) . '/api/notify/notifyAppointment';
if(!$payment = $Wechat->wxPay($appointment['order_sn'], $openid, $pay_fee, $notify_url)){
$this->error($Wechat->getError());
if($pay_fee <= 0){
$payment = [];
(new Notify())->notifyAppointmentZero([
'out_trade_no' => $appointment['order_sn'],
'transaction_id' => ''
]);
}else{
// 发起微信支付
$Wechat = new Wechat;
$openid = Db::name('third')->where('user_id',$this->auth->id)->value('openid');
$notify_url = $this->request->root(true) . '/api/notify/notifyAppointment';
if(!$payment = $Wechat->wxPay($appointment['order_sn'], $openid, $pay_fee, $notify_url)){
$this->error($Wechat->getError());
}
}
// $payment = [];
// (new Notify())->notifyAppointmentZero([
// 'out_trade_no' => $appointment['order_sn'],
// 'transaction_id' => ''
// ]);
$this->success('成功',[
'payment' => $payment,
'appointment_id' => $appointment['id']
... ...