From 9152a3ef59abd0dfb2756a1eede45128de1f19cd Mon Sep 17 00:00:00 2001 From: sunke <18850253506@163.com> Date: Tue, 14 Jan 2020 14:06:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E9=85=8D=E7=BD=AE=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Controller/GameController.class.php | 76 +++++++ Application/Admin/View/Game/edit.html | 202 ++++++++++++++++++ Data/update.sql | 13 ++ 3 files changed, 291 insertions(+) diff --git a/Application/Admin/Controller/GameController.class.php b/Application/Admin/Controller/GameController.class.php index c7fbef940..19a97ebcf 100644 --- a/Application/Admin/Controller/GameController.class.php +++ b/Application/Admin/Controller/GameController.class.php @@ -17,6 +17,8 @@ use BaiduBce\Services\Bos\CannedAcl; use BaiduBce\Services\Bos\BosOptions; use BaiduBce\Auth\SignOptions; use BaiduBce\Log\LogFactory; +use Admin\Model\AuthRuleModel; +use Admin\Model\AuthGroupModel; /** * 后台首页控制器 @@ -290,6 +292,17 @@ class GameController extends ThinkController public function edit($id = null) { if (IS_POST) { + if(!empty($_REQUEST['promote_data'])) { + $promote_data = json_decode($_REQUEST['promote_data'],TRUE); + $game_appid = $_REQUEST['game_appid']; + $gameId = M('game','tab_')->where(['game_appid' => $game_appid])->getField('id'); + $gameInfo = M('game','tab_')->field('game_name,game_status')->where(['id'=>$gameId])->select(); + $dataList = array(); + foreach($promote_data as $key => $promoteInfo) { + $dataList[] = ['promote_id' => intval($promoteInfo['value']),'game_id' => intval($gameId),'status'=>$gameInfo[0]['game_status'],'create_time'=>time()]; + } + M('sociaty_games','tab_')->addAll($dataList); + } if ($_POST['game_score'] <0 || $_POST['game_score'] > 5) { $this->error('游戏评分只能为0-5之间的数字!'); exit; @@ -413,6 +426,11 @@ class GameController extends ThinkController $this->m_title = '游戏列表'; $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Game/lists', 'status' => 1])->find()); $this->assign('game_ratio',$game_ratio); + $auth_group = M('AuthGroup')->where( array('status'=>array('egt','0'),'module'=>'admin','type'=>AuthGroupModel::TYPE_ADMIN) ) + ->getfield('id,id,title,rules'); + $empower_type = M('AuthGroup')->field('data_empower_type')->where(array('id'=>1))->find(); + $this->assign('data_empower_type', $empower_type['data_empower_type']); + $this->assign('auth_group', $auth_group); $this->display(); } } @@ -889,4 +907,62 @@ class GameController extends ThinkController //M('cp_game_ratio', 'tab_')->where("id=".$_POST['data_id'])->data(array("is_del"=>"1","update_time"=>time()))->save(); echo(json_encode(array("result"=>"1","desc"=>"删除成功"))); } + + + public function uploadExcel1() { + Vendor("PHPExcel.PHPExcel"); + if(@is_uploaded_file($_FILES['file']['tmp_name'])){ + $upfile = $_FILES["file"]; + $name = $upfile["name"]; + $type = $upfile["type"]; + $size = $upfile["size"]; + $tmp_name = $upfile["tmp_name"]; + $savePath = $_SERVER['DOCUMENT_ROOT'].__ROOT__.'/Uploads/Excel/'; + move_uploaded_file($tmp_name,$savePath.$name); + $file_name = $savePath.$name; + $error=$upfile["error"];//上传后系统返回的值 + // print($file_name); + $extension = strtolower( pathinfo($file_name, PATHINFO_EXTENSION) ); + if($extension == 'xlsx') { + $objReader = \PHPExcel_IOFactory::createReader('excel2007'); + }else { + $objReader = \PHPExcel_IOFactory::createReader('Excel5');//创建读取实例 + } + $objPHPExcel = $objReader->load($file_name,$encode='utf-8');//加载文件 + $sheet = $objPHPExcel->getSheet(0); + $highestRow = $sheet->getHighestRow(); + $highestColumn = $sheet->getHighestColumn(); + $dataList = []; + for($i=2;$i<=$highestRow;$i++) + { + $promote_id = $objPHPExcel->getActiveSheet()->getCell("B".$i)->getValue(); + $promoteInfo = M('promote','tab_')->field('account')->where(['id' => $promote_id ])->find(); + + if(empty($promoteInfo)) { + break; + } + $game_id = $objPHPExcel->getActiveSheet()->getCell("C".$i)->getValue(); + $gameInfo = M('game','tab_')->field('game_name,game_status')->where(['id'=>$game_id])->select(); + if(empty($gameInfo)) { + break; + } + $time = time(); + $dataList[] = ['promote_id'=>$promote_id,'game_id'=>$game_id,'status'=>$gameInfo[0]['game_status'],'create_time'=>$time]; + } + M('sociaty_games','tab_')->addAll($dataList); + $this->ajaxReturn(json_encode($dataList)); + + } + } + + function getRootPromote() { + $promoteData = M('promote','tab_')->field('id as value,account as title')->where(array('level'=>1,'chain'=>'/'))->select(); + $data_president = M('AuthGroup')->field('data_president')->where(array('id'=>1))->find(); + + $promoteData = array_merge([0=>['value'=>'-1','title'=>'官方渠道']],$promoteData); + + $returnData = array('data_president'=>$data_president['data_president'],'list'=>$promoteData); + $this->ajaxReturn(json_encode($returnData)); + } + } diff --git a/Application/Admin/View/Game/edit.html b/Application/Admin/View/Game/edit.html index cd02fe912..56c0b7f48 100644 --- a/Application/Admin/View/Game/edit.html +++ b/Application/Admin/View/Game/edit.html @@ -44,6 +44,7 @@
  • 参数配置
  • H5分享页面
  • 用户等级设置
  • +
  • 推广配置
  • 编辑游戏【{$data.relation_game_name}】

    说明:查看和编辑游戏的基础信息、下载设置、参数信息等。

    @@ -939,7 +940,57 @@ + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    推广限制 + 全部会长可申请 + 部分会长可申请 +
    +
    +
    + + + +
    @@ -968,7 +1019,152 @@ + + + + diff --git a/Data/update.sql b/Data/update.sql index df2614a60..cc96f7fdf 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -1073,3 +1073,16 @@ CREATE TABLE `sys_document_pop_rules` ( `operater_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '操作者ID', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; + + +--会长设置推广配置-- + +CREATE TABLE `tab_sociaty_games` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `promote_id` int(11) NOT NULL COMMENT '会长ID', + `game_id` int(11) NOT NULL COMMENT '游戏ID', + `status` tinyint(1) NOT null DEFAULT '0' COMMENT '状态 0 禁用 1 启用', + `create_time` int(10) NOT NULL DEFAULT '0' COMMENT '创建时间', + `update_time` int(10) NOT NULL DEFAULT '0' COMMENT '更新时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT '工会授权游戏'; \ No newline at end of file