isEmpty() || $coach['money'] < $order['order_amount']) { throw new \Exception('余额不足'); } //扣除余额 Coach::update([ 'money' => ['dec', $order['order_amount']] ], ['id' => $coach['id']]); //余额流水 CoachAccountLogLogic::add( $coach->id, CoachAccountLogEnum::DEPOSIT, CoachAccountLogEnum::RECHARGE_INC_DEPOSIT, 1, $order['order_amount'], $order['sn'], ); return [ 'pay_way' => PayEnum::BALANCE_PAY ]; } catch (\Exception $e) { $this->setError($e->getMessage()); return false; } } }