diff --git a/Application/Sdk/Controller/BaseController.class.php b/Application/Sdk/Controller/BaseController.class.php index 8fd7bc40..0391b23b 100644 --- a/Application/Sdk/Controller/BaseController.class.php +++ b/Application/Sdk/Controller/BaseController.class.php @@ -34,6 +34,7 @@ class BaseController extends RestController{ $a = ACTION_NAME; $data = json_decode ( base64_decode ( file_get_contents ( "php://input" ) ), true ); + if (isset($data['api_ver']) && $data['api_ver'] == 2) { if (!(in_array($c, $this->noNeedGame) || in_array($a, $this->noNeedGame) || in_array($c.".".$a, $this->noNeedGame))) { // 解决在游戏中未退出的用户 user_token 不存在问题 $userToken = M('user', 'tab_')->where(['id' => $data['user_id']])->getField('user_token'); @@ -95,6 +96,56 @@ class BaseController extends RestController{ } } + } else { // 旧版 + + + C(api('Config/lists')); + + if( + !preg_match("/apple_alipay_pay/",GetCurUrl()) + &&!preg_match("/apple_weixin_pay/",GetCurUrl()) + &&!preg_match("/get_alipay_zmxy_return/",GetCurUrl()) + &&!preg_match("/apple_platform_pay/",GetCurUrl()) + &&!preg_match("/notice/",GetCurUrl()) + &&!preg_match("/apple_union_pay/",GetCurUrl()) + &&!preg_match("/test/",GetCurUrl()) + &&!preg_match("/wap_shortcut_pay/",GetCurUrl()) + &&!preg_match("/shortcut_pay/",GetCurUrl()) + &&!preg_match("/android_shortcut_pay/",GetCurUrl()) + &&!preg_match("/wap_shortcut_pay/",GetCurUrl()) + &&!preg_match("/apple_weixin_pay/",GetCurUrl()) + &&!preg_match("/Ipa365/",GetCurUrl()) + &&!preg_match("/user_login/",GetCurUrl()) + &&!preg_match("/platform_coin_deduction/",GetCurUrl()) + ){ + $data = json_decode(base64_decode(file_get_contents("php://input")),true); + + // #判断数据是否为空 + if(empty($data) || empty($data['game_id'])){ + echo base64_encode(json_encode(array("status"=>10,"return_msg"=>"操作数据或游戏ID不能为空")));exit(); + } + $md5Sign = $data['md5_sign']; + unset($data['md5_sign']); + + #获取游戏key + $game_data = M("game","tab_")->alias("g")->field("s.*") + ->where(['g.apply_status'=>1,'g.id'=>$data['game_id']]) + ->join("left join tab_game_set s on s.game_id = g.id") + ->find(); + if(empty($game_data)){ + $this->set_message(0,"fail","游戏不存在或未通过审核"); + } + + if (isset($data['openid'])) // 小程序支付增加参数 + unset($data['openid']); + $md5_sign = $this->encrypt_md5($data,$game_data["access_key"]);//mengchuang DZQkkiz!@#9527 + if($md5Sign !== $md5_sign){ + $this->set_message(0,"fail","验签失败"); + } + + } + + } }