allen 3 年 前
コミット
2008f0af52
3 ファイル変更43 行追加68 行削除
  1. 39 67
      app/index/controller/Index.php
  2. 1 1
      app/index/view/video/index.html
  3. 3 0
      initGameCount.sql

+ 39 - 67
app/index/controller/Index.php

@@ -172,45 +172,45 @@ class Index extends Controller
             return $this->response(5002, '活动末开始');
         }
 
-//        if (empty(Safe::$body)) {
-//            return $this->response(5003, '参数有误');
-//        }
-//
-//        if (!isset(Safe::$body['duration']) || Safe::$body['duration'] < 1 || Safe::$body['duration'] > 1000) {
-//            return $this->response(5003, '时长参数有误');
-//        }
-//
-//        if (!isset(Safe::$body['number']) || Safe::$body['number'] < 0 || Safe::$body['number'] > 1000) {
-//            return $this->response(5003, '时长参数有误');
-//        }
-
-//        $duration = Safe::$body['duration'];
-//        $number = Safe::$body['number'];
-//        $duration = Request::post("duration");
-//        $number = Request::post("number");
-//
-//        $date = date('Y-m-d');
-//
-//        $userInfo = Db::table('awards_user_info')->where('uid', Safe::$user['uid'])->find();
-//        if (empty($userInfo)) {
-//            return $this->response(403, '没有登录');
-//        }
-//
-//        $count = Db::table('awards_user_task_log')->where('uid', Safe::$user['uid'])->count('id');
-//        if ($count >= $userInfo['count']) {
-//            return $this->response(5002, '没有参与次数');
-//        }
-//
-//        $log = [
-//            'uid' => Safe::$user['uid'],
-//            'date' => $date,
-//            'duration' => $duration,
-//            'number' => $number,
-//            'create_at' => time()
-//        ];
-//        if (0 == Db::table('awards_user_task_log')->insert($log)) {
-//            return $this->response(5001, '系统错误,请稍后再试~');
-//        }
+        if (empty(Safe::$body)) {
+            return $this->response(5003, '参数有误');
+        }
+
+        if (!isset(Safe::$body['duration']) || Safe::$body['duration'] < 1 || Safe::$body['duration'] > 1000) {
+            return $this->response(5003, '时长参数有误');
+        }
+
+        if (!isset(Safe::$body['number']) || Safe::$body['number'] < 0 || Safe::$body['number'] > 1000) {
+            return $this->response(5003, '时长参数有误');
+        }
+
+        $duration = Safe::$body['duration'];
+        $number = Safe::$body['number'];
+        $duration = Request::post("duration");
+        $number = Request::post("number");
+
+        $date = date('Y-m-d');
+
+        $userInfo = Db::table('awards_user_info')->where('uid', Safe::$user['uid'])->find();
+        if (empty($userInfo)) {
+            return $this->response(403, '没有登录');
+        }
+
+        $count = Db::table('awards_user_task_log')->where('uid', Safe::$user['uid'])->count('id');
+        if ($count >= $userInfo['count']) {
+            return $this->response(5002, '没有参与次数');
+        }
+
+        $log = [
+            'uid' => Safe::$user['uid'],
+            'date' => $date,
+            'duration' => $duration,
+            'number' => $number,
+            'create_at' => time()
+        ];
+        if (0 == Db::table('awards_user_task_log')->insert($log)) {
+            return $this->response(5001, '系统错误,请稍后再试~');
+        }
 
         return $this->successResponse(null, '提交成功');
     }
@@ -333,17 +333,8 @@ class Index extends Controller
             return $this->response(6001, '游戏不存在');
         }
 
-        if((time() - $game['begin_at']) > 130 || (time() - $game['begin_at']) < 13) {
-            return $this->response(6003, '游戏参数有误');
-        }
-
         $endAt = time();
 
-        $duration = $endAt - $game['begin_at'];
-        if($duration < 14) {
-            return $this->response(6001, '游戏有误');
-        }
-
         Db::table('awards_user_game')->where('game_id', '=', $gameId)->update([
             'end_at' => $endAt,
             'state' => 2,
@@ -355,21 +346,6 @@ class Index extends Controller
             return $this->response(5002, '没有参与次数');
         }
 
-        $number = Db::table('awards_user_game_log')
-            ->where('uid', '=', Safe::$user['uid'])
-            ->where('game_id', '=', $gameId)
-            ->count('id');
-
-        $date = date('Y-m-d');
-        $log = [
-            'uid' => Safe::$user['uid'],
-            'date' => $date,
-            'duration' => $duration,
-            'number' => $number,
-            'create_at' => time()
-        ];
-        Db::table('awards_user_task_log')->insert($log);
-
         return $this->successResponse(null, '提交成功');
     }
 
@@ -410,10 +386,6 @@ class Index extends Controller
             return $this->response(6001, '游戏不存在');
         }
 
-        if((time() - $game['begin_at']) > 120) {
-            return $this->response(6003, '游戏已结束');
-        }
-
         $log = Db::table('awards_user_game_log')
             ->where('uid', '=', Safe::$user['uid'])
             ->where('game_id', '=', $gameId)

+ 1 - 1
app/index/view/video/index.html

@@ -339,7 +339,7 @@
                 // 已分享
                 $('#shareBtn').hide();
             }
-        }else if(playCount == 2){
+        }else if(playCount == 4){
             $('#sendWeiboBtn').hide();
             $('#tipDIV').show();
             $('#tipImg').attr('src' , 'img/tip02.jpg');

+ 3 - 0
initGameCount.sql

@@ -0,0 +1,3 @@
+
+UPDATE `awards_user_info` SET `count` = `count` + 2;
+