input('gameid'); $channel_id = $this->input('member_channel_id'); // 渠道ID(当前账户所属渠道) $result = [ 'status' => 2, // 状态:1=开启, 2=关闭 'ai_url' => "", // AI助手URL ]; if(empty($game_id) || empty($channel_id)){ $this->jsonResult($result, 0, '当前游戏或渠道的AI助手未开启!'); } $ai_status = Db::table('cy_gameinfo')->where('game_id', $game_id)->value('ai_status'); if($ai_status == 3){ $this->jsonResult($result, 1, '当前游戏的助手未开启!'); } else if($ai_status == 2){ $aiChannelInfo = Db::table('cy_game_ai_channel')->where(['game_id' => $game_id, 'channel_id' => $channel_id])->count(); if($aiChannelInfo <= 0){ $this->jsonResult($result, 1, '当前渠道的助手未开启!'); } } $assistantUrl = Db::table('cy_setting')->where(['name' => 'ai_assistant_url'])->value('value'); if($assistantUrl && $assistantUrl !== 0){ $result['ai_url'] = $assistantUrl; } $result['status'] = 1; $this->jsonResult($result, 1, '助手开启!'); } }