|
| xqd
@@ -38,13 +38,12 @@ class VoteController extends Controller
|
|
|
* 投票分组显示
|
|
|
* */
|
|
|
public function group(Request $request) {
|
|
|
-// $we_user = session('wechat.oauth_user'); // 微信授权用户信息
|
|
|
$activity_info = ActivityInfo::first();
|
|
|
-// if(Cache::get($we_user->getId()) == null) {
|
|
|
-// Cache::put($we_user->getId(), '1', 60*24); // 将openid存入cache
|
|
|
-// $activity_info->count_views = $activity_info->count_views + 1;
|
|
|
-// $activity_info->save();
|
|
|
-// }
|
|
|
+ if(Cache::get($request->ip()) == null) {
|
|
|
+ Cache::put($request->ip(), '1', 60*12); // 将openid存入cache
|
|
|
+ $activity_info->count_views = $activity_info->count_views + 1;
|
|
|
+ $activity_info->save();
|
|
|
+ }
|
|
|
|
|
|
$keywords = $request->keywords;
|
|
|
$group_id = $request->group_id;
|
|
| xqd
@@ -99,17 +98,19 @@ class VoteController extends Controller
|
|
|
public function process(Request $request, $player_id) {
|
|
|
$we_user = session('wechat.oauth_user'); // 拿到授权用户资料
|
|
|
$user = $this->wechat->user->get($we_user->getId());
|
|
|
+
|
|
|
+ // 获取group_id
|
|
|
+ $player = Player::select('group_id')->find($player_id);
|
|
|
+ // 获取投票ip地址
|
|
|
+ $vote_ip = $request->ip();
|
|
|
if(!$user){
|
|
|
return redirect()->route('vote.group', ['group_id' => $player->group_id])->with('status', '2');
|
|
|
}
|
|
|
+
|
|
|
// 根据openid, 获取今日投票总和
|
|
|
$today_count = Vote::where('openid', $user->openid)->where('created_at', 'like', '%'.date('Y-m-d', time()).'%')->count();
|
|
|
// 结束时间 和 开始时间
|
|
|
$time_obj = ActivityInfo::select('end_time', 'start_time')->first();
|
|
|
- // 获取投票ip地址
|
|
|
- $vote_ip = $request->ip();
|
|
|
- // 获取group_id
|
|
|
- $player = Player::select('group_id')->find($player_id);
|
|
|
// 根据openid, 获取今日分组投票总和
|
|
|
$group_count = Vote::where('openid', $user->openid)->where('group_id', $player->group_id)->where('created_at', 'like', '%'.date('Y-m-d', time()).'%')->count();
|
|
|
// 根据ip, 获取今日投票总和
|