悬浮球接口

master
tpingzhang 5 years ago
parent 8a14ecfe17
commit a59ec0c8fc

@ -237,13 +237,18 @@ function getChinaChar($num)
return $str;
}
function re_msg($code=200,$msg,$data)
/**
* 公共返回方法
* @param number $code 200成功 非200失败
* @param string $msg 错误提示
* @param unknown $data 业务数据
*/
function re_msg($code=200,$msg='',$data=[])
{
$ret['code'] = $code;
$ret['msg'] = $msg;
$ret['data'] = $data;
echo base64_encode(json_encode($ret));
die();
exit();
}

@ -40,31 +40,48 @@ class GameController extends BaseController{
* 小纯洁
*/
public function get_suspend(){
$data = json_decode(base64_decode(file_get_contents("php://input"),true));
$data['user_id'] = 1;
$data = json_decode(base64_decode(file_get_contents("php://input")), true);
//$data['user_id'] = 1;
//$data['sdk_version'] = 1; // 1android 2 ios
if(empty($data['user_id'])) {
re_msg(1004, 'fail', '用户不存在');
}
$user_token = M('user','tab_')->where(['id' => $data['user_id']])->getField('user_token');
$userToken = M('user','tab_')->where(['id' => $data['user_id']])->getField('user_token');
if (!$user_token) {
if (!$userToken) {
re_msg(1004, 'fail', '数据有误');
}
$sdkMenus = M('tool','tab_')->where(['name' => 'sdk_menu'])->find();
$menus = json_decode($sdkMenus['config'],true);
$menus_item = $menus;
foreach($menus as $k => $v)
{
$menus[$k]['icon'] = is_https()?'https://':'http://' . $_SERVER['SERVER_NAME'] . $v['icon'];
$menus[$k]['url'] = $v['url'] . '/user_token/' . $user_token;
if ($menus[$k]['type'] == 1)
foreach($menus as $k => $v) {
$menus[$k]['icon'] = C('ADMIN_DOMAIN') . $v['icon'];
$menus[$k]['url'] = $v['url'] . '/user_token/' . $userToken;
if ($menus[$k]['type'] == 1) // 原生
$menus[$k]['ios_url'] = "?action=".$menus[$k]['name'];
else
$menus[$k]['ios_url'] = $menus[$k]['url']."?action=push";
else { // H5
if ($data['sdk_version'] == 2 && $v['name'] == 'suppersign')
$menus[$k]['ios_url'] = $menus[$k]['url']."?action=push";
else
unset($menus[$k]);
}
}
$personalMenu = M('tool','tab_')->where(['name' => 'personal_menu'])->getField('config');
$personalMenu = json_decode($personalMenu, true);
foreach($personalMenu as &$v) {
$v['icon'] = C('ADMIN_DOMAIN') . $v['icon'];
$v['url'] = $v['url'] . '/user_token/' . $userToken;
if ($v['type'] == 1) // 1 H5页面
$v['ios_url'] = "?action=".$v['name'];
else {
if ($data['sdk_version'] == 2 && $v['name'] == 'suppersign')
$v['ios_url'] = $v['url']."?action=push";
}
}
array_multisort(array_column($menus,'sort'),SORT_ASC,$menus);
array_multisort(array_column($personalMenu,'sort'),SORT_ASC,$personalMenu);
$ball_status = M('config','sys_')->where(['name' => 'WAP_SUSPEND_SHWO_STATUS'])->getField('value');
$sites_ball_logo = M('config','sys_')->where(['name' => 'WAP_SUSPEND_ICON'])->getField('value');
@ -72,17 +89,18 @@ class GameController extends BaseController{
if(strpos($sites_ball_logo, 'http')!==false){
$sites_ball_logo = $sites_ball_logo;
}else{
$sites_ball_logo = 'http://'.$_SERVER['HTTP_HOST'].$sites_ball_logo;
$sites_ball_logo = C('ADMIN_DOMAIN').$sites_ball_logo;
}
$data = [
$ret = [
'sites_ball_logo' => $sites_ball_logo,
'ball_status' => $ball_status,
'menus' => $menus,
'menus_item' => $menus_item,
'mine_features' => $personalMenu,
];
// pp($data);
re_msg(200,'获取成功',$data);
if (I('debug') == 1)
pp(($ret));
re_msg(200, '获取成功', $ret);
}
//获取游戏域名
//yyh 2018 10 23

Loading…
Cancel
Save