diff --git a/Application/Admin/Controller/SdkMenuController.class.php b/Application/Admin/Controller/SdkMenuController.class.php new file mode 100644 index 00000000..fc50f758 --- /dev/null +++ b/Application/Admin/Controller/SdkMenuController.class.php @@ -0,0 +1,124 @@ +where(['name' => 'sdk_menu'])->find(); + $config = json_decode($sdkMenus['config'],true); + foreach($config as $k => $v) + { + $config[$k]['icon'] = is_https()?'https://':'http://' . $_SERVER['SERVER_NAME'] . $v['icon']; + } + $this->assign('list',$config); + $this->meta_title = 'SDk用户菜单'; + $this->display('lists'); + } + + public function add() + { + $sdkMenus = M('tool','tab_')->where(['name' => 'sdk_menu'])->find(); + $config = json_decode($sdkMenus['config'],true); + if(!empty($config)) + { + $config1 = $config; + $id = array_pop($config1); + $id = $id['id'] + 1; + }else + { + $config = []; + $id = 1; + } + + if(IS_POST) + { + $post = I('post.'); + $post['id'] = $id; + array_push($config,$post); + $sdkMenus['config'] = json_encode($config); + M('tool','tab_')->where(['name' => 'sdk_menu'])->data($sdkMenus)->save(); + $this->success('新增成功', U('lists')); + } + + $data['sort'] = $id; + $this->meta_title = 'SDk用户菜单'; + $this->assign('type','add'); + $this->assign('data',$data); + $this->display('add'); + } + + public function edit($id) + { + $sdkMenus = M('tool','tab_')->where(['name' => 'sdk_menu'])->find(); + $config = json_decode($sdkMenus['config'],true); + if(IS_POST) + { + foreach($config as $k => $v) + { + if($v['id'] == $id) + { + $post = I('post.'); + foreach($post as $key => $val) + { + if($key == 'icon') + { + $config[$k][$key] = strstr($val,'/Upload'); + }else + { + $config[$k][$key] = $val; + } + } + break; + } + } + $sdkMenus['config'] = json_encode($config); + M('tool','tab_')->where(['name' => 'sdk_menu'])->data($sdkMenus)->save(); + $this->success('修改成功', U('lists')); + } + $data = []; + foreach($config as $k => $v) + { + if($v['id'] == $id) + { + $v['icon'] = is_https()?'https://':'http://' . $_SERVER['SERVER_NAME'] . $v['icon']; + $data = $v; + break; + } + } + if(empty($data)) + { + $this->error('菜单不存在','lists'); + } + $this->meta_title = 'SDk用户菜单'; + $this->assign('type','edit'); + $this->assign('data',$data); + $this->display('add'); + } + + + public function del($id) + { + if(!is_array($id)) + { + $data[] = $id; + }else + { + $data = $id; + } + $sdkMenus = M('tool','tab_')->where(['name' => 'sdk_menu'])->find(); + $config = json_decode($sdkMenus['config'],true); + foreach($config as $k => $v) + { + if(in_array($v['id'], $data)) + { + unset($config[$k]); + } + } + $sdkMenus['config'] = json_encode($config); + M('tool','tab_')->where(['name' => 'sdk_menu'])->data($sdkMenus)->save(); + $this->success('删除成功', U('lists')); + } + +} \ No newline at end of file diff --git a/Application/Admin/View/SdkMenu/add.html b/Application/Admin/View/SdkMenu/add.html new file mode 100644 index 00000000..ff1b8e67 --- /dev/null +++ b/Application/Admin/View/SdkMenu/add.html @@ -0,0 +1,141 @@ + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
菜单名称 + +
菜单标题 + +
菜单链接 + +
url类型 + + + +
跳转目标 + +
排序 + +
菜单图标 + + + +
+ +
+ +
+
+
+
+ 菜单图标 +
+ + + + + + +
+ + + 返回 + +
+ +
+ +
+ + + diff --git a/Application/Admin/View/SdkMenu/lists.html b/Application/Admin/View/SdkMenu/lists.html new file mode 100644 index 00000000..171be190 --- /dev/null +++ b/Application/Admin/View/SdkMenu/lists.html @@ -0,0 +1,167 @@ + + + + + + + +
+
+ 新增 + 删 除 +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + ID菜单名称菜单标题菜单图标菜单链接url类型跳转目标排序操作
{$channel.id}{$channel.name}{$channel.title}{$channel.url}{$channel.type}{$channel.action} +
+ {$channel.sort} +
+
+ 编辑 + 删除 +
aOh! 暂时还没有内容!
+
+
+ {$_page|default=''} +
+ + + + +
+ + + + + + \ No newline at end of file diff --git a/Application/Sdk/Common/function.php b/Application/Sdk/Common/function.php index dcc79890..56800cf4 100644 --- a/Application/Sdk/Common/function.php +++ b/Application/Sdk/Common/function.php @@ -226,28 +226,13 @@ function get_game_param($game_id,$field="",$type=''){ function getChinaChar($num) { - // $string = ''; - // for ($i=0; $i<$num; $i++) { - // // 使用chr()函数拼接双字节汉字,前一个chr()为高位字节,后一个为低位字节 - // $a = chr(mt_rand(0xB0,0xD0)).chr(mt_rand(0xA1, 0xF0)); - // // 转码 - // $string .= iconv('GB2312', 'UTF-8', $a); - // } - // return $string; $char = file_get_contents(APP_PATH.'Sdk/SecretKey/Data/chinaChar.txt'); $str = ''; $length = strlen($char); for($i = 0;$i < $num;$i++) { $rand = rand(0,$length); - for(;$rand >= 0;$rand--) - { - if($rand == 0 || $rand %3 ==0) - { - break; - } - } - $str = $str . substr($char,$rand,3); + $str .= substr($char,$rand*3,3); } return $str; } diff --git a/Application/Sdk/Controller/GameController.class.php b/Application/Sdk/Controller/GameController.class.php index 417d6b40..5e689245 100644 --- a/Application/Sdk/Controller/GameController.class.php +++ b/Application/Sdk/Controller/GameController.class.php @@ -1,7 +1,7 @@ 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; - } - - } + + $base = M('site_base','tab_')->field('sites_ball_logo,ball_status')->where(['promote_id'=>$request['promote_id']])->find(); - /* - 适配oss路径 - */ - $cover2 = get_cover( C(WAP_SUSPEND_ICON) ,'path'); - if(strpos($cover2, 'http')!==false){ - $cover2 = $cover2; - }else{ - $cover2 = 'http://'.$_SERVER['HTTP_HOST'].$cover2; + $sdkMenus = M('tool','tab_')->where(['name' => 'sdk_menu'])->find(); + $menus = json_decode($sdkMenus['config'],true); + foreach($menus as $k => $v) + { + $menus[$k]['icon'] = is_https()?'https://':'http://' . $_SERVER['SERVER_NAME'] . $v['icon']; } + array_multisort(array_column($menus,'sort'),SORT_ASC,$menus); - $data = array( - "status"=>200, - "sites_ball_logo"=>$cover2, - "ball_status"=>C(WAP_SUSPEND_SHWO_STATUS)==2?0:1, - ); + $data = [ + 'code' => 200, + 'msg' => '获取成功', + 'data' => [ + 'sites_ball_logo' => $base['sites_ball_logo'], + 'ball_status' => $base['ball_status'], + 'menus' => $menus, + ] + ]; echo base64_encode(json_encode($data));die; } //获取游戏域名