diff --git a/Application/Admin/Model/UserModel.class.php b/Application/Admin/Model/UserModel.class.php index fa1e937b..8bbb0232 100644 --- a/Application/Admin/Model/UserModel.class.php +++ b/Application/Admin/Model/UserModel.class.php @@ -1098,7 +1098,7 @@ class UserModel extends Model{ $data["last_device_number"] = $user['device_number']; $data["token"] = $this->generateToken($uid,$account,$password); - $userToken = $this->generateToken($uid,$account,$password); + $userToken = $this->generateToken($uid,$account,$password).uniqid().rand(1000, 9999); $relationGameId = M('game', 'tab_')->where([ 'id' => $game_id ])->getField('relation_game_id'); @@ -1117,8 +1117,18 @@ class UserModel extends Model{ 'create_time' => time(), 'update_time' => time() ]); + + M('user_token', 'tab_')->where([ + 'user_id' => $uid, + 'relation_game_id' => $relationGameId + ])->save([ + 'user_token' => $userToken, + 'login_cnt' => $userTokens['login_cnt'] + 1, + 'update_time' => time() + ]); } else { M('user_token', 'tab_')->where([ + 'user_id' => $uid, 'game_id|relation_game_id' => $relationGameId ])->save([ 'user_token' => $userToken, diff --git a/Application/Sdk/Controller/GameGiftPageController.class.php b/Application/Sdk/Controller/GameGiftPageController.class.php index adb442f0..1ef5df28 100644 --- a/Application/Sdk/Controller/GameGiftPageController.class.php +++ b/Application/Sdk/Controller/GameGiftPageController.class.php @@ -11,7 +11,7 @@ class GameGiftPageController extends Controller{ { // if (I("request.api_ver") == 2) { $user = BaseController::webH5Vetify(); - $this->userid = $user['userId']; + $this->userId = $user['userId']; $this->userToken = $user['userToken']; // } } @@ -149,6 +149,7 @@ class GameGiftPageController extends Controller{ $game_id = $post['game_id']; $game_name = $post['game_name']; $gift = M('giftbag','tab_'); + $user_token = $this->userToken; $novice = $gift->where(["id" => $gift_id])->field("id,giftbag_name,novice")->find(); if(empty($novice['novice'])){ echo "该礼包已被领完";die();