Example #1
0
 /**
  * 删除应用
  */
 public function gdeleteAction()
 {
     $m = new Psys_ResModel();
     if (isset($_GET['page'])) {
         $page = reqnum('page', 1);
     } else {
         $page = 1;
     }
     if (isset($_GET['id'])) {
         if (is_array($_GET['id'])) {
             $id = reqarray('id', array());
             foreach ($id as $v) {
                 $where = array('id' => $v);
                 $data = $m->GetOneGame($where);
                 //-------------物理文件删除开始
                 //物理文件删除判断
                 if ($data['appcol'] == 1) {
                     $pathType = GAME_PATH;
                 } else {
                     $pathType = APP_PATH;
                 }
                 $path = $pathType . '/' . $data['appid'];
                 if (is_dir($path)) {
                     deldir($path);
                 }
                 //----------------------------------物理文件删除结束
                 $affectedNum = $m->DelOneGame($where);
                 // 删除等于当前等于APPID的PPT
                 $w = array('appid' => $data['appid']);
                 $m->DelOneGamePPT($w);
                 // start 写操作日志
                 $log = array('logtype' => 71, 'guid' => $_SESSION['Cur_X_User']['id'], 'ctime' => time(), 'cip' => real_ip());
                 $log['logdetail'] = $_SESSION['Cur_X_User']['username'] . "于" . date("Y-m-d H:i:s") . "[删除]游戏" . $data['appname'];
                 // $m=new Psys_SyslogModel();
                 // $m->admin_syslog($log);
                 $m->admin_syslog($log);
                 // end 日志
             }
             header("Location:/res/glist?page={$page}");
         } elseif (is_numeric($_GET['id'])) {
             $id = reqnum('id', '0');
             $where = array('id' => $id);
             $data = $m->GetOneGame($where);
             //--------------------------------物理文件删除开始
             //物理文件删除判断
             if ($data['appcol'] == 1) {
                 $pathType = GAME_PATH;
             } else {
                 $pathType = APP_PATH;
             }
             $pathAppid = $data['appid'];
             //$list = $m->GetList(array('appid'=>$data['appid']),'','','','*','rhi_apps');
             $path = $pathType . '/' . $data['appid'];
             if (is_dir($path)) {
                 deldir($path);
             }
             //---------------------------------物理文件删除结束
             $m->DelOneGame($where);
             // 删除等于当前等于APPID的PPT
             $w = array('appid' => $data['appid']);
             $m->DelOneGamePPT($w);
             // start 写操作日志
             $log = array('logtype' => 71, 'guid' => $_SESSION['Cur_X_User']['id'], 'ctime' => time(), 'cip' => real_ip());
             $log['logdetail'] = $_SESSION['Cur_X_User']['username'] . "于" . date("Y-m-d H:i:s") . "[删除]游戏" . $data['appname'];
             $m->admin_syslog($log);
             // end 日志
             header("Location:/res/glist?page={$page}");
         } else {
             echo "<script>alert('为选择数据,id为空。');</script>";
             header('HTTP/1.1 204 no content');
         }
     } else {
         echo "<script>alert('为选择数据,id为空。');</script>";
         header('HTTP/1.1 204 no content');
     }
 }