|
@@ -99,13 +99,13 @@ class ChatBalanceService
|
|
|
$price = (int)$order->price;
|
|
$price = (int)$order->price;
|
|
|
|
|
|
|
|
// 检查用户积分是否足够
|
|
// 检查用户积分是否足够
|
|
|
- $userScore = UserScoreDetail::getUserScore($userId);
|
|
|
|
|
|
|
+ $userScore = (float)(new User)->where('uid', $userId)->value('score');
|
|
|
if ($userScore < $price) {
|
|
if ($userScore < $price) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 扣除积分
|
|
// 扣除积分
|
|
|
- $scoreResult = UserScoreDetail::scoreChange($userId, -$price, '购买聊天次数', $order->id);
|
|
|
|
|
|
|
+ $scoreResult = (new UserScoreDetail)->payScore($userId, $price, 'outcome_score', $order->order_no, [], '购买聊天次数', '购买聊天次数消费' . $price . '积分');
|
|
|
if (!$scoreResult) {
|
|
if (!$scoreResult) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|