Ver Fonte

答对一题得N票,有个基数

lizhen_gitee há 2 dias atrás
pai
commit
33d8a36e41
1 ficheiros alterados com 3 adições e 65 exclusões
  1. 3 65
      app/Controller/Api/v1/PlayerController.php

+ 3 - 65
app/Controller/Api/v1/PlayerController.php

@@ -57,8 +57,9 @@ class PlayerController extends AbstractController
         $user_id = $user['id'];
         //今天,投了几票
         $today_record   = RedisUtil::getInstance(RedisKeyEnum::VOTE_RECORD.date('Y-m-d').':'.$user_id)->get();
-        //今天,用户答对的次数,也就是答题获得的票数
+        //今天,用户答对的次数
         $question_vote  = RedisUtil::getInstance(RedisKeyEnum::EAXM_RIGHT.date('Y-m-d').':'.$user_id)->get();
+        $question_vote  = intval(bcmul($question_vote,site('question_right_getvotenum'),0));//乘以基数,也就是答题获得的票数
         //今天,用户答题的次数
         $today_question = RedisUtil::getInstance(RedisKeyEnum::EAXM_TIMES.date('Y-m-d').':'.$user_id)->get();
         //今天,免费的的票
@@ -66,7 +67,7 @@ class PlayerController extends AbstractController
         //今天,免费的答题次数
         $exam_times = site('exam_times_user_eday');
 
-        //免费票 + 答对数 - 已投票次数 < vote
+        //免费票 + 答对数 - 已投票次数 < vote
         $times = $gift_votes + $question_vote - $today_record;
         if($times < 0){$times = 0;}
 
@@ -97,11 +98,6 @@ class PlayerController extends AbstractController
         //日志
 
 
-
-        //免费票 + 答对次数 - 已投票次数
-        $times = $gift_votes + $question_vote - $today_record;
-        if($times < 0){$times = 0;}
-
         //
         $msg = '投票成功,您今日剩余投票次数: '.$times.'次';
 
@@ -114,64 +110,6 @@ class PlayerController extends AbstractController
         return AppResult::success($msg,$result);
     }
 
-    //投票检查
-    private function record_check($user_id,$vote){
-        $result = array(
-            'status'=>true,
-            'code'=>1,
-            'msg'=>'',
-            'uservote' => 0,
-        );
-
-
-        //今天,投了几票
-        $today_record = RedisUtil::getInstance(RedisKeyEnum::VOTE_RECORD.date('Y-m-d').':'.$user_id)->get();
-        //今天,免费的的票
-        $gift_votes = site('gift_votes_user_eday');
-        //今天,免费的答题次数
-        $exam_times = site('exam_times_user_eday');
-
-        //投票次数   >=  所有的来源
-        if($today_record >= $gift_votes + $exam_times){
-            $result['status'] = false;
-            $result['code'] = 0;
-            $result['msg'] = '投票失败,您今日剩余0票,明天再来吧';
-            $result['uservote'] = 0;
-            return $result;
-        }
-
-        //今天,用户答对的次数,也就是答题获得的票数
-        $question_vote  = RedisUtil::getInstance(RedisKeyEnum::EAXM_RIGHT.date('Y-m-d').':'.$user_id)->get();
-
-        //投票次数  >= 免费票 + 答对次数
-        $times = $gift_votes + $question_vote - $today_record;
-        if($times < 0){$times = 0;}
-        if($times < $vote){
-            $result['status'] = false;
-            $result['code'] = 0;
-            $result['msg'] = '投票失败,您今日剩余: '.$times.'票';
-            $result['uservote'] = 0;
-
-            //今天,用户答题的次数
-            $today_question = RedisUtil::getInstance(RedisKeyEnum::EAXM_TIMES.date('Y-m-d').':'.$user_id)->get();
-
-            //还有答题机会
-            if($exam_times > $today_question){
-                $result['status'] = false;
-                $result['code'] = 2;
-                $result['msg'] = '投票失败,您今日剩余: '.$times.'票,可通过答题增加票数';
-                $result['uservote'] = 0;
-            }
-
-            return $result;
-        }
-
-        //剩余票数
-        $result['uservote'] = $times;
-
-
-        return $result;
-    }