82 lines
1.4 KiB
PHP
Executable File
82 lines
1.4 KiB
PHP
Executable File
<?php
|
|
|
|
namespace crmeb\services\payTool;
|
|
|
|
class Balance extends PayTool
|
|
{
|
|
|
|
public $order;
|
|
|
|
public function __construct()
|
|
{
|
|
}
|
|
|
|
/**
|
|
* 发起支付
|
|
* @param $order
|
|
* @return bool
|
|
* @throws \Exception
|
|
*/
|
|
public function pay($order)
|
|
{
|
|
$user = request()->userInfo();
|
|
if (!systemConfig('yue_pay_status')) {
|
|
throw new \Exception('未开启余额支付');
|
|
}
|
|
if ($user['now_money'] < $order['pay_price']) {
|
|
throw new \Exception('余额不足,请更换支付方式');
|
|
}
|
|
$user->now_money = bcsub($user->now_money, $order['pay_price'], 2);
|
|
if (!$user->save()) {
|
|
throw new \Exception('用户余额扣减失败', 500);
|
|
}
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* 查询
|
|
* @param $order
|
|
* @return string
|
|
* @throws \Exception
|
|
*/
|
|
public function query($order)
|
|
{
|
|
}
|
|
|
|
/**
|
|
* 退款
|
|
* @param $order
|
|
* @return string
|
|
* @throws \Exception
|
|
*/
|
|
public function refund($order)
|
|
{
|
|
}
|
|
|
|
/**
|
|
* 发起请求
|
|
* @param $body
|
|
* @return string
|
|
* @throws \Exception
|
|
*/
|
|
public function request($body)
|
|
{
|
|
}
|
|
|
|
public function success()
|
|
{
|
|
}
|
|
|
|
public function callback($request = null)
|
|
{
|
|
}
|
|
|
|
public function refundQuery($refundOrder)
|
|
{
|
|
}
|
|
|
|
public function transfer($withdraw)
|
|
{
|
|
}
|
|
|
|
} |