diff --git a/Application/Sdk/Controller/GameController.class.php b/Application/Sdk/Controller/GameController.class.php index e15c6a38..0933217f 100644 --- a/Application/Sdk/Controller/GameController.class.php +++ b/Application/Sdk/Controller/GameController.class.php @@ -83,6 +83,55 @@ class GameController extends BaseController{ re_msg(200,'获取成功',$ret); } + // 1版本的api + public function get_suspend_1(){ + #获取SDK上POST方式传过来的数据 然后base64解密 然后将json字符串转化成数组 + $request = json_decode(base64_decode(file_get_contents("php://input")),true); + if($request['promote_id']!=0){ + $res=M('site_base','tab_')->field('sites_ball_logo,ball_status')->where(['promote_id'=>$request['promote_id']])->find(); + if($res){ + /* + 适配oss路径 + */ + if($res['sites_ball_logo']==0){ + $res['sites_ball_logo']=C(WAP_SUSPEND_ICON); + } + $cover1 = get_cover($res['sites_ball_logo'] ,'path'); + if(strpos($cover1, 'http')!==false){ + $cover1 = $cover1; + }else{ + $cover1 = 'http://'.$_SERVER['HTTP_HOST'].$cover1; + } + if($res['ball_status'] == '') { + $res['ball_status'] = 1; + } + $data = array( + "status"=>200, + "sites_ball_logo"=>$cover1, + "ball_status"=>$res['ball_status'], + ); + echo base64_encode(json_encode($data));die; + } + + } + + /* + 适配oss路径 + */ + $cover2 = get_cover( C(WAP_SUSPEND_ICON) ,'path'); + if(strpos($cover2, 'http')!==false){ + $cover2 = $cover2; + }else{ + $cover2 = 'http://'.$_SERVER['HTTP_HOST'].$cover2; + } + + $data = array( + "status"=>200, + "sites_ball_logo"=>$cover2, + "ball_status"=>C(WAP_SUSPEND_SHWO_STATUS)==2?0:1, + ); + echo base64_encode(json_encode($data));die; + } /** * 获取渠道悬浮球图 * @param int $game_id 游戏ID @@ -91,6 +140,11 @@ class GameController extends BaseController{ */ public function get_suspend(){ $data = json_decode(base64_decode(file_get_contents("php://input")), true); + + if (!isset($data['api_ver']) || $data['api_ver'] != 2) { + $this->get_suspend_1(); + return ; + } if (I('debug') == 1) { $data['user_id'] = 1; $data['sdk_version'] = 1;