|
@@ -172,45 +172,45 @@ class Index extends Controller
|
|
|
return $this->response(5002, '活动末开始');
|
|
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, '提交成功');
|
|
return $this->successResponse(null, '提交成功');
|
|
|
}
|
|
}
|
|
@@ -333,17 +333,8 @@ class Index extends Controller
|
|
|
return $this->response(6001, '游戏不存在');
|
|
return $this->response(6001, '游戏不存在');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if((time() - $game['begin_at']) > 130 || (time() - $game['begin_at']) < 13) {
|
|
|
|
|
- return $this->response(6003, '游戏参数有误');
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
$endAt = time();
|
|
$endAt = time();
|
|
|
|
|
|
|
|
- $duration = $endAt - $game['begin_at'];
|
|
|
|
|
- if($duration < 14) {
|
|
|
|
|
- return $this->response(6001, '游戏有误');
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
Db::table('awards_user_game')->where('game_id', '=', $gameId)->update([
|
|
Db::table('awards_user_game')->where('game_id', '=', $gameId)->update([
|
|
|
'end_at' => $endAt,
|
|
'end_at' => $endAt,
|
|
|
'state' => 2,
|
|
'state' => 2,
|
|
@@ -355,21 +346,6 @@ class Index extends Controller
|
|
|
return $this->response(5002, '没有参与次数');
|
|
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, '提交成功');
|
|
return $this->successResponse(null, '提交成功');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -410,10 +386,6 @@ class Index extends Controller
|
|
|
return $this->response(6001, '游戏不存在');
|
|
return $this->response(6001, '游戏不存在');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if((time() - $game['begin_at']) > 120) {
|
|
|
|
|
- return $this->response(6003, '游戏已结束');
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
$log = Db::table('awards_user_game_log')
|
|
$log = Db::table('awards_user_game_log')
|
|
|
->where('uid', '=', Safe::$user['uid'])
|
|
->where('uid', '=', Safe::$user['uid'])
|
|
|
->where('game_id', '=', $gameId)
|
|
->where('game_id', '=', $gameId)
|