作者 lihan
1 个管道 的构建 通过 耗费 0 秒

赠送优惠券

... ... @@ -165,18 +165,14 @@ class OrderController extends HomeBaseController
'total_fee' => $final_price
];
$this->success('微信支付', url('user/Center/orderDetail', ['oid' => $oid]), $this->wxPay($info));
}
//支付宝支付
} //支付宝支付
elseif ($data['payment'] == 2) {
}
//余额支付
} //余额支付
elseif ($data['payment'] == 0) {
$model = new OrderModel;
if ($model->orderCallBack($oid)) {
echo json_encode(['msg' => '下单成功', 'code' => 20000, 'url'=>url('user/Center/orderDetail', ['oid' => $oid])]);
echo json_encode(['msg' => '下单成功', 'code' => 20000, 'url' => url('user/Center/orderDetail', ['oid' => $oid])]);
exit();
} else {
echo json_encode(['msg' => '下单失败', 'code' => 40000]);
... ... @@ -236,7 +232,7 @@ class OrderController extends HomeBaseController
if ($info['order_type'] == 1) {
Db::name('order_log')->where(['oid' => $oid])->update(['order_amount' => $order_amount]);
}
echo json_encode(['msg' => '支付成功', 'code' => 20000, 'url'=>url('user/Center/orderDetail', ['oid' => $oid])]);
echo json_encode(['msg' => '支付成功', 'code' => 20000, 'url' => url('user/Center/orderDetail', ['oid' => $oid])]);
exit();
} else {
echo json_encode(['msg' => '支付失败', 'code' => 40000]);
... ... @@ -330,7 +326,7 @@ class OrderController extends HomeBaseController
exit();
}
//判断用户余额能否支持余额支付
if($payment == 0) {
if ($payment == 0) {
if (Db::name('user')->where(['id' => session('user.id')])->value('balance') < $finalPrice) {
echo json_encode(['msg' => '您的余额不足,请选择其他支付方式', 'code' => 40000]);
exit();
... ... @@ -341,11 +337,12 @@ class OrderController extends HomeBaseController
//微信支付
private function wxPay($info)
{
$pay = new \Payment($info['attach'], $info['openid'], $info['body'], $info['total_fee']);
$pay = new \Payment($info['attach'], $info['openid'], $info['body'], $info['total_fee'] * 100);
return $pay->pay();
}
public function notify() {
public function notify()
{
$pay = new \Payment();
$pay->handleNotify();
}
... ...