input('code'); $game_id = $this->input('gameid'); if(empty($code) || empty($game_id)){ $this->jsonResult('', 0, '非法请求,缺少必要参数!'); } try{ $dyResult = (new DyGameOpen($game_id, 'game_id'))->getAccessToken($code); if($dyResult['code'] != 100){ $this->jsonResult([], 0, $dyResult['msg']); } }catch (\Exception $e){ $this->jsonResult([], 0, "error: ".$e->getMessage()); } $this->jsonResult($dyResult['data'], 1, 'success'); } // 抖音 查询绑定意愿 public function getDyAuthInfoOpen(){ $open_id = $this->input['open_id']; $game_id = $this->input('gameid'); if(empty($open_id) || empty($game_id)){ $this->jsonResult('', 0, '非法请求,缺少必要参数!'); } try{ $result = (new DyGameOpen($game_id, 'game_id'))->getAuthInfoOpen($open_id); if($result['code'] != 100){ $this->jsonResult([], 0, $result['msg']); } }catch (\Exception $e){ $this->jsonResult([], 0, "error: ".$e->getMessage()); } $this->jsonResult($result['data'], 1, 'success'); } // 抖音 游戏内授权后回调抖音游戏 public function getJumpAuthCallback(){ $is_agree = $this->input['is_agree']; $scheme = $this->input['scheme']; $username = $this->input['username']; $game_id = $this->input('game_id'); if(empty($is_agree) || empty($scheme) || empty($username) || empty($game_id)){ $this->jsonResult([], 0, '非法请求,缺少必要参数!'); } try{ $result = (new DyGameOpen($game_id, 'game_id'))->getJumpAuthCallback($is_agree, $username, $scheme); if($result['code'] != 100){ $this->jsonResult([], 0, $result['msg']); } }catch (\Exception $e){ $this->jsonResult([], 0, "error: ".$e->getMessage()); } $this->jsonResult($result['data'], 1, 'success'); } }