lizhen_gitee 2 일 전
부모
커밋
bc96a88fec
2개의 변경된 파일8개의 추가작업 그리고 4개의 파일을 삭제
  1. 5 1
      app/Controller/Api/v1/PlayerController.php
  2. 3 3
      app/Controller/Api/v1/QuestionController.php

+ 5 - 1
app/Controller/Api/v1/PlayerController.php

@@ -66,7 +66,7 @@ class PlayerController extends AbstractController
         $gift_votes = site('gift_votes_user_eday');
         //今天,免费的答题次数
         $exam_times = site('exam_times_user_eday');
-dd($gift_votes,$question_vote,$today_record);return;
+
         //免费票 + 答对票数 - 已投票次数 < vote
         $times = $gift_votes + $question_vote - $today_record;
         if($times < 0){$times = 0;}
@@ -98,6 +98,10 @@ dd($gift_votes,$question_vote,$today_record);return;
         //日志
 
 
+        //免费票 + 答对次数 - 已投票次数
+        $times = $gift_votes + $question_vote - $today_record;  //重新计算一次,是因为$today_record 自增了
+        if($times < 0){$times = 0;}
+
         //
         $msg = '投票成功,您今日剩余投票次数: '.$times.'次';
 

+ 3 - 3
app/Controller/Api/v1/QuestionController.php

@@ -159,14 +159,14 @@ class QuestionController extends AbstractController
         }
 
         //答题日志
-        $right_score = intval(bcmul((string)$is_right_number,site('question_right_getscore'),0));//乘以基数,也就是答题获得的分数
+        $right_score = intval(bcmul((string)$is_right_number,(string)site('question_right_getscore'),0));//乘以基数,也就是答题获得的分数
         $this->service->questionPush(['log_data' => $log_data, 'is_right_number' => $right_score, 'bind_jigou_id' => $user['bind_jigou_id']], 0);
         //给机构加分
 
 
         //返回正确了几道题,剩余答题次数
-        $right_vote    = intval(bcmul((string)$is_right_number,site('question_right_getvotenum'),0));//乘以基数,也就是答题获得的票数
-        $question_vote = intval(bcmul((string)$exam_times_user_eday,site('question_right_getvotenum'),0));//乘以基数,也就是答题获得的票数
+        $right_vote    = intval(bcmul((string)$is_right_number,(string)site('question_right_getvotenum'),0));//乘以基数,也就是答题获得的票数
+        $question_vote = intval(bcmul((string)$exam_times_user_eday,(string)site('question_right_getvotenum'),0));//乘以基数,也就是答题获得的票数
         $result = [
             'remark' => '答对'.$is_right_number.'题,获得'.$right_vote.'次投票次数,答题最多可获得'.$question_vote.'次投票机会',
             'submit_number'=> count($user_questions),