From 9d08427fe1b24122a687594262e3ca105a5da4c4 Mon Sep 17 00:00:00 2001 From: tpingzhang <635929049@qq.com> Date: Thu, 7 Nov 2019 17:27:37 +0800 Subject: [PATCH] =?UTF-8?q?get=5Fsuspend=5F1=20=E6=82=AC=E6=B5=AE=E7=90=83?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=20=E5=85=BC=E5=AE=B9=E4=B8=8A=E4=B8=AA?= =?UTF-8?q?=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sdk/Controller/GameController.class.php | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) 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;