WIN-2308041133\Administrator 1 mese fa
parent
commit
1a9acadac4
1 ha cambiato i file con 2 aggiunte e 2 eliminazioni
  1. 2 2
      app/services/chat/ChatBalanceService.php

+ 2 - 2
app/services/chat/ChatBalanceService.php

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